]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/test/test-architecture.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / test / test-architecture.c
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
099524d7
LP
2/***
3 This file is part of systemd.
4
5 Copyright 2014 Kay Sievers
6
7 systemd is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 2.1 of the License, or
10 (at your option) any later version.
11
12 systemd is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with systemd; If not, see <http://www.gnu.org/licenses/>.
19***/
20
099524d7 21#include "architecture.h"
099524d7 22#include "log.h"
cf0fbc49
TA
23#include "util.h"
24#include "virt.h"
099524d7
LP
25
26int main(int argc, char *argv[]) {
592fd144 27 int a, v;
099524d7 28
75f86906 29 v = detect_virtualization();
4c701096 30 if (IN_SET(v, -EPERM, -EACCES))
099524d7
LP
31 return EXIT_TEST_SKIP;
32
33 assert_se(v >= 0);
34
35 log_info("virtualization=%s id=%s",
75f86906
LP
36 VIRTUALIZATION_IS_CONTAINER(v) ? "container" :
37 VIRTUALIZATION_IS_VM(v) ? "vm" : "n/a",
38 virtualization_to_string(v));
099524d7
LP
39
40 a = uname_architecture();
41 assert_se(a >= 0);
42
43 log_info("uname architecture=%s", architecture_to_string(a));
44
45 a = native_architecture();
46 assert_se(a >= 0);
47
48 log_info("native architecture=%s", architecture_to_string(a));
c3a07d94
LP
49
50 log_info("primary library architecture=" LIB_ARCH_TUPLE);
51
099524d7
LP
52 return 0;
53}