selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selinux-testsuite: fix the cgroups_label test
@ 2019-08-26 15:11 Paul Moore
  2019-08-26 15:19 ` Paul Moore
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Moore @ 2019-08-26 15:11 UTC (permalink / raw)
  To: selinux

From: Paul Moore <paul@paul-moore.com>

We can't rely on /sys/fs/cgroups/unified anymore, use our own directory.

Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 tests/cgroupfs_label/test |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tests/cgroupfs_label/test b/tests/cgroupfs_label/test
index 127e802..385b953 100755
--- a/tests/cgroupfs_label/test
+++ b/tests/cgroupfs_label/test
@@ -5,24 +5,23 @@ BEGIN { plan tests => 2 }
 
 my $ret;
 
+my $dir = "/sys/fs/cgroup/selinuxtest";
+
 # Create a new cgroupfs directory and relabel it.
-mkdir("/sys/fs/cgroup/unified/test");
-system("chcon -R -t test_cgroup_t /sys/fs/cgroup/unified/test");
+mkdir("$dir");
+system("chcon -R -t test_cgroup_t $dir");
 
 # Create a subdirectory in it.
-mkdir("/sys/fs/cgroup/unified/test/subdir");
+mkdir("$dir/subdir");
 
-$ret =
-  system("test `secon -tf /sys/fs/cgroup/unified/test/subdir` = test_cgroup_t");
+$ret = system("secon -tf $dir/subdir | grep -q '^test_cgroup_t\$'");
 ok( $ret, 0 );    # Did the subdirectory inherit the parent's label?
 
-$ret = system(
-"test `secon -tf /sys/fs/cgroup/unified/test/subdir/cgroup.type` = test_cgroup_t"
-);
+$ret = system("secon -tf $dir/subdir/cgroup.type | grep -q '^test_cgroup_t\$'");
 ok( $ret, 0 );    # Did also files in the subdirectory inherit the label?
 
 # Cleanup.
-rmdir("/sys/fs/cgroup/unified/test/subdir");
-rmdir("/sys/fs/cgroup/unified/test");
+rmdir("$dir/subdir");
+rmdir("$dir");
 
 exit;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-26 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-26 15:11 [PATCH] selinux-testsuite: fix the cgroups_label test Paul Moore
2019-08-26 15:19 ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).