1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

test-architecture: add more tests

This commit is contained in:
Yu Watanabe 2017-11-28 18:14:55 +09:00
parent f30788ee23
commit ade0eb2190

View File

@ -25,6 +25,14 @@
int main(int argc, char *argv[]) {
int a, v;
const char *p;
assert_se(architecture_from_string("") < 0);
assert_se(architecture_from_string(NULL) < 0);
assert_se(architecture_from_string("hoge") < 0);
assert_se(architecture_to_string(-1) == NULL);
assert_se(architecture_from_string(architecture_to_string(0)) == 0);
assert_se(architecture_from_string(architecture_to_string(1)) == 1);
v = detect_virtualization();
if (IN_SET(v, -EPERM, -EACCES))
@ -40,12 +48,18 @@ int main(int argc, char *argv[]) {
a = uname_architecture();
assert_se(a >= 0);
log_info("uname architecture=%s", architecture_to_string(a));
p = architecture_to_string(a);
assert_se(p);
log_info("uname architecture=%s", p);
assert_se(architecture_from_string(p) == a);
a = native_architecture();
assert_se(a >= 0);
log_info("native architecture=%s", architecture_to_string(a));
p = architecture_to_string(a);
assert_se(p);
log_info("native architecture=%s", p);
assert_se(architecture_from_string(p) == a);
log_info("primary library architecture=" LIB_ARCH_TUPLE);