summaryrefslogtreecommitdiff
path: root/src/test/test-selinux.c
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-03-09 18:21:42 +0100
committerMartin Pitt <martin.pitt@ubuntu.com>2016-03-09 18:21:42 +0100
commitbd7e03af007c4e857ed0370eba9e903d6b561937 (patch)
tree23b7f66162ff1a45d29c5a03fe74c381ffec0ef3 /src/test/test-selinux.c
parent280d397ab313b647fbd824d1cb58eb8323c74501 (diff)
parent58015d7815bce405c7c0ac082d8c2f407ec07eeb (diff)
Merge pull request #2755 from keszybz/more-tests
Enable more tests by default, and even more with `--enable-tests=unsafe`
Diffstat (limited to 'src/test/test-selinux.c')
-rw-r--r--src/test/test-selinux.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/test/test-selinux.c b/src/test/test-selinux.c
index c2152269f8..7545ad3764 100644
--- a/src/test/test-selinux.c
+++ b/src/test/test-selinux.c
@@ -23,7 +23,9 @@
#include "fd-util.h"
#include "log.h"
#include "selinux-util.h"
+#include "string-util.h"
#include "time-util.h"
+#include "util.h"
static void test_testing(void) {
bool b;
@@ -31,18 +33,18 @@ static void test_testing(void) {
log_info("============ %s ==========", __func__);
b = mac_selinux_use();
- log_info("mac_selinux_use → %d", b);
+ log_info("mac_selinux_use → %s", yes_no(b));
b = mac_selinux_have();
- log_info("mac_selinux_have → %d", b);
+ log_info("mac_selinux_have → %s", yes_no(b));
mac_selinux_retest();
b = mac_selinux_use();
- log_info("mac_selinux_use → %d", b);
+ log_info("mac_selinux_use → %s", yes_no(b));
b = mac_selinux_have();
- log_info("mac_selinux_have → %d", b);
+ log_info("mac_selinux_have → %s", yes_no(b));
}
static void test_loading(void) {
@@ -76,16 +78,19 @@ static void test_misc(const char* fname) {
log_info("============ %s ==========", __func__);
r = mac_selinux_get_our_label(&label);
- log_info_errno(r, "mac_selinux_get_our_label → %d (%m), \"%s\"", r, label);
+ log_info_errno(r, "mac_selinux_get_our_label → %d (%m), \"%s\"",
+ r, strnull(label));
r = mac_selinux_get_create_label_from_exe(fname, &label2);
- log_info_errno(r, "mac_selinux_create_label_from_exe → %d (%m), \"%s\"", r, label2);
+ log_info_errno(r, "mac_selinux_create_label_from_exe → %d (%m), \"%s\"",
+ r, strnull(label2));
fd = socket(AF_INET, SOCK_DGRAM, 0);
assert_se(fd >= 0);
r = mac_selinux_get_child_mls_label(fd, fname, label2, &label3);
- log_info_errno(r, "mac_selinux_get_child_mls_label → %d (%m), \"%s\"", r, label3);
+ log_info_errno(r, "mac_selinux_get_child_mls_label → %d (%m), \"%s\"",
+ r, strnull(label3));
}
static void test_create_file_prepare(const char* fname) {