summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-08-05 16:36:45 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-08-05 16:38:17 +0200
commit00d27e5dd74a6c67759def1e958a71aae0650976 (patch)
tree4f070dd604614dd4f80593d66afda353d9815de1 /src/test
parent92f8e978923f962a57d744c5f358520ac06f7892 (diff)
downloadsystemd-00d27e5dd74a6c67759def1e958a71aae0650976.tar.gz
systemd-00d27e5dd74a6c67759def1e958a71aae0650976.tar.bz2
systemd-00d27e5dd74a6c67759def1e958a71aae0650976.zip
shared/exit-status: fix lookup
FLAGS_SET() is the wrong operator here, because we want to see if *any* bits are set. Add test. https://github.com/systemd/systemd/pull/12884#issuecomment-518238410
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-exit-status.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/test-exit-status.c b/src/test/test-exit-status.c
index 3bcebd06a4..a007bda5c4 100644
--- a/src/test/test-exit-status.c
+++ b/src/test/test-exit-status.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "exit-status.h"
+#include "string-util.h"
#include "tests.h"
static void test_exit_status_to_string(void) {
@@ -31,11 +32,21 @@ static void test_exit_status_from_string(void) {
assert_se(exit_status_from_string("FAILURE") == 1);
}
+static void test_exit_status_NUMA_POLICY(void) {
+ log_info("/* %s */", __func__);
+
+ assert_se(streq(exit_status_to_string(EXIT_NUMA_POLICY, EXIT_STATUS_FULL), "NUMA_POLICY"));
+ assert_se(streq(exit_status_to_string(EXIT_NUMA_POLICY, EXIT_STATUS_SYSTEMD), "NUMA_POLICY"));
+ assert_se(!exit_status_to_string(EXIT_NUMA_POLICY, EXIT_STATUS_BSD));
+ assert_se(!exit_status_to_string(EXIT_NUMA_POLICY, EXIT_STATUS_LSB));
+}
+
int main(int argc, char *argv[]) {
test_setup_logging(LOG_DEBUG);
test_exit_status_to_string();
test_exit_status_from_string();
+ test_exit_status_NUMA_POLICY();
return 0;
}