• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 13f1ce96046fba15d93a90733b791312284fbb62 Mon Sep 17 00:00:00 2001
2From: Andreas Dilger <adilger@whamcloud.com>
3Date: Mon, 28 Feb 2022 21:17:06 -0700
4Subject: [PATCH] tests: fix ACL-printing tests
5
6Fix the ACL-printing tests to be more flexible for different systems.
7If the MKFS_DIR is on tmpfs, it will not list "system.posix_acl*"
8xattrs, so they will not be copied.  Create this on a real filesystem
9or skip the test if that doesn't work.
10
11Filter out the security.selinux xattr if it is printed, since this
12depends on the selinux configuration of the host system.  However,
13this also spills xattrs for "acl_dir/file" into an external xattr
14block, and causes it to fail due to different block allocations.
15Increase the filesystem inode size so that the allocation is the same
16regardless of whether selinux is enabled or not.
17
18Fixes: 67e6ae0a35 ("mke2fs: fix a importing a directory with an ACL")
19Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
20Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
21Reviewed-by: Li Dongyang <dongyangli@ddn.com>
22Signed-off-by: Theodore Ts'o <tytso@mit.edu>
23---
24 tests/filter.sed           |  1 +
25 tests/m_rootdir_acl/expect | 18 +++++++++---------
26 tests/m_rootdir_acl/script | 13 +++++++++----
27 3 files changed, 19 insertions(+), 13 deletions(-)
28
29diff --git a/tests/filter.sed b/tests/filter.sed
30index 796186e..5fd68f3 100644
31--- a/tests/filter.sed
32+++ b/tests/filter.sed
33@@ -20,6 +20,7 @@ s/\\015//g
34 /^Maximum mount count:/d
35 /^Next check after:/d
36 /^Suggestion:/d
37+/security.selinux/d
38 /Reserved blocks uid:/s/ (user .*)//
39 /Reserved blocks gid:/s/ (group .*)//
40 /whichever comes first/d
41diff --git a/tests/m_rootdir_acl/expect b/tests/m_rootdir_acl/expect
42index babd802..57f03e5 100644
43--- a/tests/m_rootdir_acl/expect
44+++ b/tests/m_rootdir_acl/expect
45@@ -10,8 +10,8 @@ Filesystem OS type:       Linux
46 Inode count:              1024
47 Block count:              16384
48 Reserved block count:     819
49-Overhead clusters:        1543
50-Free blocks:              14788
51+Overhead clusters:        1799
52+Free blocks:              14533
53 Free inodes:              1003
54 First block:              1
55 Block size:               1024
56@@ -21,14 +21,14 @@ Reserved GDT blocks:      127
57 Blocks per group:         8192
58 Fragments per group:      8192
59 Inodes per group:         512
60-Inode blocks per group:   128
61+Inode blocks per group:   256
62 Flex block group size:    16
63 Mount count:              0
64 Check interval:           15552000 (6 months)
65 Reserved blocks uid:      0
66 Reserved blocks gid:      0
67 First inode:              11
68-Inode size:	          256
69+Inode size:	          512
70 Required extra isize:     32
71 Desired extra isize:      32
72 Journal inode:            8
73@@ -49,16 +49,16 @@ Group 0: (Blocks 1-8192)
74   Reserved GDT blocks at 3-129
75   Block bitmap at 130 (+129)
76   Inode bitmap at 132 (+131)
77-  Inode table at 134-261 (+133)
78-  7750 free blocks, 491 free inodes, 5 directories, 491 unused inodes
79-  Free blocks: 443-8192
80+  Inode table at 134-389 (+133)
81+  7495 free blocks, 491 free inodes, 5 directories, 491 unused inodes
82+  Free blocks: 698-8192
83   Free inodes: 22-512
84 Group 1: (Blocks 8193-16383) [INODE_UNINIT]
85   Backup superblock at 8193, Group descriptors at 8194-8194
86   Reserved GDT blocks at 8195-8321
87   Block bitmap at 131 (bg #0 + 130)
88   Inode bitmap at 133 (bg #0 + 132)
89-  Inode table at 262-389 (bg #0 + 261)
90+  Inode table at 390-645 (bg #0 + 389)
91   7038 free blocks, 512 free inodes, 0 directories, 512 unused inodes
92   Free blocks: 9346-16383
93   Free inodes: 513-1024
94@@ -116,4 +116,4 @@ Pass 2: Checking directory structure
95 Pass 3: Checking directory connectivity
96 Pass 4: Checking reference counts
97 Pass 5: Checking group summary information
98-test.img: 21/1024 files (0.0% non-contiguous), 1596/16384 blocks
99+test.img: 21/1024 files (0.0% non-contiguous), 1851/16384 blocks
100diff --git a/tests/m_rootdir_acl/script b/tests/m_rootdir_acl/script
101index e81c82c..a00e4c4 100644
102--- a/tests/m_rootdir_acl/script
103+++ b/tests/m_rootdir_acl/script
104@@ -16,12 +16,10 @@ if [ "$os" = "GNU" ]; then
105 	return 0
106 fi
107
108-MKFS_DIR=$TMPFILE.dir
109+MKFS_DIR=$(mktemp -d ./$test_name-XXXXXX.tmp)
110 OUT=$test_name.log
111 EXP=$test_dir/expect
112
113-rm -rf $MKFS_DIR
114-mkdir -p $MKFS_DIR
115 touch $MKFS_DIR/emptyfile
116 dd if=/dev/zero bs=1024 count=32 2> /dev/null | tr '\0' 'a' > $MKFS_DIR/bigfile
117 echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1024 2> /dev/null
118@@ -60,7 +58,14 @@ mask::r-x
119 other::r-x
120 EOF
121
122-$MKE2FS -q -F -o Linux -T ext4 -O metadata_csum,inline_data,64bit -E lazy_itable_init=1 -b 1024 -d $MKFS_DIR $TMPFILE 16384 > $OUT 2>&1
123+if ! getfattr -d -m - $MKFS_DIR/acl_dir | grep -q posix_acl; then
124+	echo "$test_name: $test_description: skipped (no posix_acl xattrs)"
125+	rm -rf $MKFS_DIR
126+	return 0
127+fi
128+
129+# use 512-byte inodes so with/out security.selinux xattr doesn't fail
130+$MKE2FS -q -F -o Linux -T ext4 -I 512 -O metadata_csum,inline_data,64bit -E lazy_itable_init=1 -b 1024 -d $MKFS_DIR $TMPFILE 16384 > $OUT 2>&1
131
132 $DUMPE2FS $TMPFILE >> $OUT 2>&1
133 cat > $TMPFILE.cmd << ENDL
134--
1351.8.3.1
136
137