Skip to content

Commit 0de52fc

Browse files
Richard HainesWOnder93
authored andcommitted
selinux-testsuite: Add btrfs support for filesystem tests
This allows btrfs filesystems to be created to support the filesystem mount(2) type calls and the fs_filesystem fsmount(2) type calls. Signed-off-by: Richard Haines <[email protected]> Signed-off-by: Stephen Smalley <[email protected]> Signed-off-by: Ondrej Mosnacek <[email protected]>
1 parent 4c351fe commit 0de52fc

File tree

9 files changed

+28
-1
lines changed

9 files changed

+28
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ similar dependencies):
6161
* e2fsprogs _(used by the ext4 filesystem tests)_
6262
* jfsutils _(used by the jfs filesystem tests)_
6363
* dosfstools _(used by the vfat filesystem tests)_
64+
* btrfs-progs _(used by the btrfs filesystem tests)_
6465
* nftables _(used by inet_socket and sctp tests if ver >= 9.3 for secmark testing )_
6566
* rdma-core-devel _(to build the `ibpkey` test program)_
6667

@@ -89,6 +90,7 @@ following command (NOTE: On Fedora 32 and below you need to remove
8990
e2fsprogs \
9091
jfsutils \
9192
dosfstools \
93+
btrfs-progs \
9294
rdma-core-devel \
9395
kernel-devel-$(uname -r) \
9496
kernel-modules-$(uname -r)
@@ -136,6 +138,7 @@ command:
136138
e2fsprogs \
137139
jfsutils \
138140
dosfstools \
141+
btrfs-progs \
139142
nftables \
140143
netlabel-tools \
141144
libibverbs-dev

defconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ CONFIG_XFS_QUOTA=y
122122
CONFIG_VFAT_FS=m
123123
CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
124124

125+
126+
# Test BTRFS filesystem.
127+
# This is not required for SELinux operation itself.
128+
CONFIG_BTRFS_FS=y
129+
125130
# watch_queue for key changes.
126131
# They are not required for SELinux operation itself.
127132
CONFIG_WATCH_QUEUE=y

tests/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SBINDIR ?= $(PREFIX)/sbin
44
POLDEV ?= $(PREFIX)/share/selinux/devel
55
INCLUDEDIR ?= $(PREFIX)/include
66
SELINUXFS ?= /sys/fs/selinux
7-
FILESYSTEMS ?= ext4 xfs jfs vfat
7+
FILESYSTEMS ?= ext4 xfs jfs vfat btrfs
88

99
export CFLAGS+=-g -O0 -Wall -D_GNU_SOURCE
1010

tests/filesystem/Filesystem.pm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ sub make_fs {
126126
if ( $mk_type eq "xfs" ) {
127127
$mk_size = 300;
128128
}
129+
elsif ( $mk_type eq "btrfs" ) {
130+
$mk_size = 128;
131+
}
132+
129133
print "Create $mk_dir/fstest with dd\n";
130134
$result =
131135
system(

tests/filesystem/btrfs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.

tests/filesystem/test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ BEGIN {
8989
$test_count = 55;
9090
$quota_checks = 0;
9191
}
92+
93+
# BTRFS uses internal quotas requiring no security hooks
94+
elsif ( $fs_type eq "btrfs" ) {
95+
$test_count = 55;
96+
$quota_checks = 0;
97+
}
9298
else {
9399
$test_count = 69;
94100
}

tests/fs_filesystem/btrfs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.

tests/fs_filesystem/test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ BEGIN {
9292
$test_count = 54;
9393
$quota_checks = 0;
9494
}
95+
96+
# BTRFS uses internal quotas requiring no security hooks
97+
elsif ( $fs_type eq "btrfs" ) {
98+
$test_count = 54;
99+
$quota_checks = 0;
100+
}
95101
else {
96102
$test_count = 68;
97103
}

tmt/tests.fmf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
- e2fsprogs
119119
- jfsutils
120120
- dosfstools
121+
- btrfs-progs
121122
- rdma-core-devel
122123
- kexec-tools
123124
/main:

0 commit comments

Comments
 (0)