1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

Merge pull request #4691 from keszybz/test-suite-fixes

Test suite fixes
This commit is contained in:
Evgeny Vereshchagin 2016-11-20 19:38:58 +03:00 committed by GitHub
commit 270f419316
4 changed files with 17 additions and 5 deletions

View File

@ -675,7 +675,7 @@ int getenv_for_pid(pid_t pid, const char *field, char **_value) {
}
line[i] = 0;
if (memcmp(line, field, l) == 0 && line[l] == '=') {
if (strneq(line, field, l) && line[l] == '=') {
value = strdup(line + l + 1);
if (!value)
return -ENOMEM;

View File

@ -28,9 +28,11 @@ int main(int argc, char *argv[]) {
r = get_user_creds(&name, &uid, NULL, NULL, NULL);
if (r < 0) {
log_error_errno(r, "Failed to resolve \"%s\": %m", name);
return EXIT_FAILURE;
log_full_errno(r == -ESRCH ? LOG_NOTICE : LOG_ERR,
r, "Failed to resolve \"%s\": %m", name);
return r == -ESRCH ? EXIT_TEST_SKIP : EXIT_FAILURE;
}
return clean_ipc_by_uid(uid) < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
r = clean_ipc_by_uid(uid);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}

View File

@ -193,7 +193,14 @@ static void test_get_process_cmdline_harder(void) {
fd = mkostemp(path, O_CLOEXEC);
assert_se(fd >= 0);
assert_se(mount(path, "/proc/self/cmdline", "bind", MS_BIND, NULL) >= 0);
if (mount(path, "/proc/self/cmdline", "bind", MS_BIND, NULL) < 0) {
/* This happens under selinux… Abort the test in this case. */
log_warning_errno(errno, "mount(..., \"/proc/self/cmdline\", \"bind\", ...) failed: %m");
assert(errno == EACCES);
return;
}
assert_se(unlink(path) >= 0);
assert_se(prctl(PR_SET_NAME, "testa") >= 0);

View File

@ -40,6 +40,9 @@ function find_qemu_bin() {
# i386 version of QEMU
[ "$QEMU_BIN" ] || QEMU_BIN=$(which -a qemu 2>/dev/null | grep '^/' -m1)
;;
ppc64*)
[ "$QEMU_BIN" ] || QEMU_BIN=$(which -a qemu-system-$ARCH 2>/dev/null | grep '^/' -m1)
;;
esac
if [ ! -e "$QEMU_BIN" ]; then