1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

Merge pull request #8765 from poettering/test-fixes

some short fixes for the tests
This commit is contained in:
Lennart Poettering 2018-04-19 16:18:46 +02:00 committed by GitHub
commit 7a9a0c05d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 11 deletions

View File

@ -34,6 +34,7 @@ BuildPackages=
gnu-efi-devel
gnutls-devel
gperf
hostname
iptables-devel
kmod-devel
libacl-devel

View File

@ -84,7 +84,7 @@ if [ ! -f "$BUILDDIR"/build.ninja ] ; then
fi
ninja -C "$BUILDDIR" all
[ "$WITH_TESTS" = 0 ] || ninja -C "$BUILDDIR" test || ( RET="$?" ; cat "$BUILDDIR"/meson-logs/testlog.txt ; exit "$RET" )
[ "$WITH_TESTS" = 0 ] || ninja -C "$BUILDDIR" test
ninja -C "$BUILDDIR" install
mkdir -p "$DESTDIR"/etc

View File

@ -775,11 +775,11 @@ int fgetpwent_sane(FILE *stream, struct passwd **pw) {
errno = 0;
p = fgetpwent(stream);
if (p == NULL && errno != ENOENT)
if (!p && errno != ENOENT)
return errno > 0 ? -errno : -EIO;
*pw = p;
return p != NULL;
return !!p;
}
int fgetspent_sane(FILE *stream, struct spwd **sp) {
@ -790,11 +790,11 @@ int fgetspent_sane(FILE *stream, struct spwd **sp) {
errno = 0;
s = fgetspent(stream);
if (s == NULL && errno != ENOENT)
if (!s && errno != ENOENT)
return errno > 0 ? -errno : -EIO;
*sp = s;
return s != NULL;
return !!s;
}
int fgetgrent_sane(FILE *stream, struct group **gr) {
@ -805,11 +805,11 @@ int fgetgrent_sane(FILE *stream, struct group **gr) {
errno = 0;
g = fgetgrent(stream);
if (g == NULL && errno != ENOENT)
if (!g && errno != ENOENT)
return errno > 0 ? -errno : -EIO;
*gr = g;
return g != NULL;
return !!g;
}
#if ENABLE_GSHADOW
@ -821,10 +821,10 @@ int fgetsgent_sane(FILE *stream, struct sgrp **sg) {
errno = 0;
s = fgetsgent(stream);
if (s == NULL && errno != ENOENT)
if (!s && errno != ENOENT)
return errno > 0 ? -errno : -EIO;
*sg = s;
return s != NULL;
return !!s;
}
#endif

View File

@ -5168,6 +5168,9 @@ void unit_export_state_files(Unit *u) {
if (!MANAGER_IS_SYSTEM(u->manager))
return;
if (u->manager->test_run_flags != 0)
return;
/* Exports a couple of unit properties to /run/systemd/units/, so that journald can quickly query this data
* from there. Ideally, journald would use IPC to query this, like everybody else, but that's hard, as long as
* the IPC system itself and PID 1 also log to the journal.

View File

@ -686,6 +686,7 @@ int main(int argc, char *argv[]) {
(void) unsetenv("USER");
(void) unsetenv("LOGNAME");
(void) unsetenv("SHELL");
/* It is needed otherwise cgroup creation fails */
if (getuid() != 0) {

View File

@ -17,7 +17,7 @@ ExecStart=test %L = /var/log
ExecStart=sh -c 'test %u = $$(id -un 0)'
ExecStart=test %U = 0
ExecStart=sh -c 'test %h = $$(getent passwd 0 | cut -d: -f 6)'
ExecStart=sh -c 'test %s = $$(getent passwd 0 | cut -d: -f 7)'
ExecStart=sh -c 'test %s = /bin/sh'
ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)'
ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')'
ExecStart=sh -c 'test %H = $$(hostname)'

View File

@ -17,7 +17,7 @@ ExecStart=test %L = /var/log
ExecStart=sh -c 'test %u = $$(id -un 0)'
ExecStart=test %U = 0
ExecStart=sh -c 'test %h = $$(getent passwd 0 | cut -d: -f 6)'
ExecStart=sh -c 'test %s = $$(getent passwd 0 | cut -d: -f 7)'
ExecStart=sh -c 'test %s = /bin/sh'
ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)'
ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')'
ExecStart=sh -c 'test %H = $$(hostname)'