]> git.ipfire.org Git - thirdparty/coreutils.git/commit
tests: support non-MLS enabled SELinux systems
authorNicolas Iooss <nicolas.iooss@m4x.org>
Thu, 11 Feb 2016 14:07:52 +0000 (15:07 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 18 Dec 2016 20:03:59 +0000 (20:03 +0000)
commitbe2f82f670b914e26ffcbbff0378a0452d432d1c
tree5b00c4a1b0c0547351683ec5c4d94cd2ac78a46f
parentca52f3bf3f48a1a296e70bff5fd77ff789c570f5
tests: support non-MLS enabled SELinux systems

When running "make check" on a Linux system running SELinux with a
non-MLS policy, tests/mkdir/restorecon.sh test fails with:

  chcon: invalid context: root:object_r:tmp_t:s0: Invalid argument

Indeed in such a configuration, contexts cannot have ":s0" suffix.

* init.cfg (get_selinux_type): Refactor this function to here
from various tests.  Update to work with a non-MLS policy.
(mls_enabled_): A new function to detect if MLS is enabled.
(skip_if_mcstransd_is_running_): Update to not skip when
MLS is not enabled.
* tests/mkdir/restorecon.sh: Use a valid non-MLS context when needed.
* tests/install/install-Z-selinux.sh: Likewise.
* tests/cp/cp-a-selinux.sh: Likewise.
* tests/misc/selinux.sh: Likewise.
* tests/misc/chcon.sh: Skip if non-MLS as --range used throughout.
Fixes http://bugs.gnu.org/22631
init.cfg
tests/cp/cp-a-selinux.sh
tests/install/install-Z-selinux.sh
tests/misc/chcon.sh
tests/misc/selinux.sh
tests/mkdir/restorecon.sh