@@ -4,6 +4,7 @@ SBINDIR ?= $(PREFIX)/sbin
POLDEV ?= $(PREFIX)/share/selinux/devel
INCLUDEDIR ?= $(PREFIX)/include
SELINUXFS ?= /sys/fs/selinux
+FILESYSTEMS ?= ext4 xfs jfs vfat
export CFLAGS+=-g -O0 -Wall -D_GNU_SOURCE
@@ -17,6 +18,9 @@ MOD_POL_VERS := $(shell $(CHECKMODULE) -V |cut -f 2 -d '-')
MAX_KERNEL_POLICY := $(shell cat $(SELINUXFS)/policyvers)
POL_TYPE := $(shell ./pol_detect $(SELINUXFS))
+# Filter out unavailable filesystems
+FILESYSTEMS := $(foreach fs,$(FILESYSTEMS),$(shell modprobe $(fs) && echo $(fs)))
+
SUBDIRS:= domain_trans entrypoint execshare exectrace execute_no_trans \
fdreceive inherit link mkdir msg open ptrace readlink relabel rename \
rxdir sem setattr setnice shm sigkill stat sysctl task_create \
@@ -111,7 +115,7 @@ SUBDIRS += lockdown
endif
ifeq ($(shell grep -q filesystem $(POLDEV)/include/support/all_perms.spt && echo true),true)
-SUBDIRS += filesystem
+SUBDIRS += $(addprefix filesystem/,$(FILESYSTEMS))
ifeq ($(shell grep -q all_filesystem_perms.*watch $(POLDEV)/include/support/all_perms.spt && echo true),true)
export CFLAGS += -DHAVE_FS_WATCH_PERM
endif
@@ -119,7 +123,7 @@ endif
ifeq ($(shell grep -q filesystem $(POLDEV)/include/support/all_perms.spt && echo true),true)
ifneq ($(shell ./kvercmp $$(uname -r) 5.2),-1)
-SUBDIRS += fs_filesystem
+SUBDIRS += $(addprefix fs_filesystem/,$(FILESYSTEMS))
endif
endif
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
@@ -2,15 +2,22 @@
use Test::More;
# Load common subroutines.
-use File::Basename qw(dirname);
+use File::Basename qw(dirname basename);
use Cwd qw(abs_path);
-use lib dirname( abs_path $0);
+
+BEGIN {
+ $basedir = dirname($0);
+ $basedir = `cd $basedir && pwd`;
+ chomp($basedir);
+}
+use lib $basedir;
use Filesystem
qw(check_config udisks2_stop udisks2_restart get_loop_dev attach_dev make_fs mk_mntpoint_1 mk_mntpoint_2 cleanup cleanup1 reaper nfs_gen_opts);
BEGIN {
- $basedir = $0;
- $basedir =~ s|(.*)/[^/]*|$1|;
+ # extract fs_type
+ $test_name = basename($basedir);
+ $fs_type = $test_name ne "filesystem" ? $test_name : " ";
# Options: -v Verbose, -e enable udisks(8) daemon, -f filesystem type
$v = " ";
@@ -20,8 +27,7 @@ BEGIN {
$nfs_enabled = 0;
$vfat_enabled = 0;
- $i = 0;
- $fs_type = " ";
+ $i = 0;
foreach $arg (@ARGV) {
if ( $arg eq "-v" ) {
$v = $arg;
@@ -131,15 +137,7 @@ print "Testing filesystem fs_type: $fs_type\n";
# mount(2) MS_BIND | MS_PRIVATE requires an absolute path to a private mount
# point before MS_MOVE
-$cwd = `pwd 2>/dev/null`;
-chomp($cwd);
-$private_path = "$cwd";
-if ( $basedir eq "." ) {
- $private_path = "$cwd/mntpoint";
-}
-else {
- $private_path = "$cwd/$basedir/mntpoint";
-}
+$private_path = abs_path($basedir) . "/mntpoint";
# Keep a list of devices used for removal at end of test.
$device_count = 0;
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
@@ -2,18 +2,25 @@
use Test::More;
# Load common subroutines.
-use File::Basename qw(dirname);
+use File::Basename qw(dirname basename);
use Cwd qw(abs_path);
-use lib dirname( abs_path $0) . '/../filesystem';
-use Filesystem
- qw(check_config udisks2_stop udisks2_restart get_loop_dev attach_dev make_fs mk_mntpoint_1 mk_mntpoint_2 cleanup cleanup1 reaper nfs_gen_opts);
BEGIN {
- $basedir = $0;
- $basedir =~ s|(.*)/[^/]*|$1|;
+ $basedir = dirname($0);
+ $basedir = `cd $basedir && pwd`;
+ chomp($basedir);
# Some code in tests/filesystem is reused
- $filesystem_dir = "$basedir/../filesystem";
+ $filesystem_dir = abs_path($basedir) . "/../filesystem";
+}
+use lib $filesystem_dir;
+use Filesystem
+ qw(check_config udisks2_stop udisks2_restart get_loop_dev attach_dev make_fs mk_mntpoint_1 mk_mntpoint_2 cleanup cleanup1 reaper nfs_gen_opts);
+
+BEGIN {
+ # extract fs_type
+ $test_name = basename($basedir);
+ $fs_type = $test_name ne "fs_filesystem" ? $test_name : " ";
# Options: -v = Verbose, -e enable udisks(8) daemon, -f filesystem type
$v = " ";
@@ -23,8 +30,7 @@ BEGIN {
$nfs_enabled = 0;
$vfat_enabled = 0;
- $i = 0;
- $fs_type = " ";
+ $i = 0;
foreach $arg (@ARGV) {
if ( $arg eq "-v" ) {
$v = $arg;
@@ -133,15 +139,7 @@ BEGIN {
print "Testing filesystem fs_type: $fs_type\n";
# Generate an absolute path to a private mount
-$cwd = `pwd 2>/dev/null`;
-chomp($cwd);
-$private_path = "$cwd";
-if ( $basedir eq "." ) {
- $private_path = "$cwd/mntpoint";
-}
-else {
- $private_path = "$cwd/$basedir/mntpoint";
-}
+$private_path = abs_path($basedir) . "/mntpoint";
# Keep a list of devices used for removal at end of test.
$device_count = 0;
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
new file mode 120000
@@ -0,0 +1 @@
+.
\ No newline at end of file
Run [fs_]filesystem tests always for all common filesystems (xfs, ext4, jfs, vfat). Use symlinks to achieve this without changing much code while still allowing to run the test script directly (optionally specifying the filesystem type). Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> --- tests/Makefile | 8 ++++++-- tests/filesystem/ext4 | 1 + tests/filesystem/jfs | 1 + tests/filesystem/test | 28 +++++++++++++--------------- tests/filesystem/vfat | 1 + tests/filesystem/xfs | 1 + tests/fs_filesystem/ext4 | 1 + tests/fs_filesystem/jfs | 1 + tests/fs_filesystem/test | 34 ++++++++++++++++------------------ tests/fs_filesystem/vfat | 1 + tests/fs_filesystem/xfs | 1 + 11 files changed, 43 insertions(+), 35 deletions(-) create mode 120000 tests/filesystem/ext4 create mode 120000 tests/filesystem/jfs create mode 120000 tests/filesystem/vfat create mode 120000 tests/filesystem/xfs create mode 120000 tests/fs_filesystem/ext4 create mode 120000 tests/fs_filesystem/jfs create mode 120000 tests/fs_filesystem/vfat create mode 120000 tests/fs_filesystem/xfs