]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/test/test-execute.c
tests: various small fixes for strict systems
authorTopi Miettinen <toiwoton@gmail.com>
Thu, 23 Apr 2020 10:12:23 +0000 (13:12 +0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 26 Apr 2020 18:18:48 +0000 (20:18 +0200)
commit3c14dc61f7782d8eca0ff7b55e9f60fef176fe82
tree3296fc428ff2b84635404b6702250c11b2232f81
parent7b679a188ee2f643e47938e8f287347399f2e083
tests: various small fixes for strict systems

Don't assume that 4MB can be allocated from stack since there could be smaller
DefaultLimitSTACK= in force, so let's use malloc(). NUL terminate the huge
strings by hand, also ensure termination in test_lz4_decompress_partial() and
optimize the memset() for the string.

Some items in /proc and /etc may not be accessible to poor unprivileged users
due to e.g. SELinux, BOFH or both, so check for EACCES and EPERM.

/var/tmp may be a symlink to /tmp and then path_compare() will always fail, so
let's stick to /tmp like elsewhere.

/tmp may be mounted with noexec option and then trying to execute scripts from
there would fail.

Detect and warn if seccomp is already in use, which could make seccomp test
fail if the syscalls are already blocked.

Unset $TMPDIR so it will not break specifier tests where %T is assumed to be
/tmp and %V /var/tmp.
16 files changed:
src/journal/test-compress.c
src/journal/test-journal-send.c
src/test/test-capability.c
src/test/test-cgroup-setup.c
src/test/test-cgroup-util.c
src/test/test-clock.c
src/test/test-condition.c
src/test/test-copy.c
src/test/test-exec-util.c
src/test/test-execute.c
src/test/test-fileio.c
src/test/test-proc-cmdline.c
src/test/test-procfs-util.c
src/test/test-sd-hwdb.c
src/test/test-seccomp.c
src/test/test-umount.c