1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

Enable test-ipcrm, test-hostname in unsafe tests

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-02-26 18:39:20 -05:00
parent 134953c99c
commit c1ab819162
3 changed files with 20 additions and 7 deletions

View File

@ -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

View File

@ -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}

View File

@ -23,9 +23,14 @@
int main(int argc, char *argv[]) {
uid_t uid;
int r;
const char* name = argv[1] ?: "nfsnobody";
assert_se(argc == 2);
assert_se(parse_uid(argv[1], &uid) >= 0);
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;
}