diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-02-26 18:39:20 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-03-04 21:45:45 -0500 |
commit | c1ab81916286747a1b466716188f05ae373dff6e (patch) | |
tree | 731d36182d9037635816cacf0424989908d5260c | |
parent | 134953c99c7441c4fa2d8000face10608f8832ec (diff) |
Enable test-ipcrm, test-hostname in unsafe tests
-rw-r--r-- | Makefile.am | 12 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/test/test-ipcrm.c | 11 |
3 files changed, 21 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index c6f6bc5d37..e2d5328c1b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -131,8 +131,12 @@ TEST_EXTENSIONS = .py PY_LOG_COMPILER = $(PYTHON) DISABLE_HARD_ERRORS = yes if ENABLE_TESTS -noinst_PROGRAMS = $(manual_tests) $(tests) +noinst_PROGRAMS = $(manual_tests) $(tests) $(unsafe_tests) TESTS = $(tests) +if ENABLE_UNSAFE_TESTS +TESTS += \ + $(unsafe_tests) +endif else noinst_PROGRAMS = TESTS = @@ -1387,15 +1391,17 @@ EXTRA_DIST += \ manual_tests += \ test-ns \ - test-hostname \ test-cgroup \ test-install \ - test-ipcrm \ test-btrfs \ test-acd \ test-ipv4ll-manual \ test-ask-password-api +unsafe_tests = \ + test-hostname \ + test-ipcrm + if HAVE_LIBIPTC manual_tests += \ test-firewall-util diff --git a/configure.ac b/configure.ac index e55d1a02a6..79340bcca9 100644 --- a/configure.ac +++ b/configure.ac @@ -1487,9 +1487,10 @@ AS_IF([test x"$cross_compiling" = "xyes"], [], [ ]) AC_ARG_ENABLE(tests, - [AC_HELP_STRING([--disable-tests], [disable tests])], + [AC_HELP_STRING([--disable-tests], [disable tests, or enable extra tests with =unsafe])], enable_tests=$enableval, enable_tests=yes) -AM_CONDITIONAL(ENABLE_TESTS, [test x$enable_tests = xyes]) +AM_CONDITIONAL(ENABLE_TESTS, [test x$enable_tests = xyes -o x$enable_tests = xunsafe]) +AM_CONDITIONAL(ENABLE_UNSAFE_TESTS, [test x$enable_tests = xunsafe]) AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug@<:@=LIST@:>@], [enable extra debugging (hashmap,mmap-cache)])], @@ -1611,6 +1612,7 @@ AC_MSG_RESULT([ ldconfig support: ${enable_ldconfig} hibernate support: ${enable_hibernate} extra debugging: ${enable_debug} + tests: ${enable_tests} prefix: ${prefix} rootprefix: ${with_rootprefix} diff --git a/src/test/test-ipcrm.c b/src/test/test-ipcrm.c index 2464d32458..47b1c4443d 100644 --- a/src/test/test-ipcrm.c +++ b/src/test/test-ipcrm.c @@ -23,9 +23,14 @@ int main(int argc, char *argv[]) { uid_t uid; - - assert_se(argc == 2); - assert_se(parse_uid(argv[1], &uid) >= 0); + int r; + const char* name = argv[1] ?: "nfsnobody"; + + r = get_user_creds(&name, &uid, NULL, NULL, NULL); + if (r < 0) { + log_error("Failed to resolve \"nobody\": %m"); + return EXIT_FAILURE; + } return clean_ipc(uid) < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } |