Skip to contentSkip to conversation

Fix some tests failing for exfat FS

PATCH New Pavel Reichl 1 participant 2 messages Apr 19, 2021

lore
Share & tools
lore
#0 lore raw

v4 cover Fix some tests failing for exfat FS

Do not run test that require posix permissions and ownership.

Changes in V2 (Thank you for comments on version 1)

* Merged patch #1 and #2 (the one introducing the helper and the other actually using them)
* Fixed generic/597 by introducing _require_symlink
* Fixed generic/598 by adding _require_chmod
** changes are part of patch #1
* Introduced _format_swapon_file()

Changes in version #3 (thanks for the comments and hints!)
* reuse _require_symlinks() instead of introducing _require_symlink()
* implement _require_chown() so it actually checks if chown() is supported.
* Don't special case filtering of MKSWAP_PROG's perm. warn for exfat only.
* Rename _format_swapon_file() to _swapon_file() and also don't special case the perm. warning filtering

Changes in version #4
New implementation of _require_chmod()

Pavel Reichl (1):
common/rc: Add _require_{chown,chmod}()

 common/rc         | 38 ++++++++++++++++++++++++++++++++++++++
 tests/generic/087 |  1 +
 tests/generic/088 |  1 +
 tests/generic/125 |  1 +
 tests/generic/126 |  1 +
 tests/generic/128 |  1 +
 tests/generic/193 |  1 +
 tests/generic/314 |  1 +
 tests/generic/317 |  1 +
 tests/generic/355 |  1 +
 tests/generic/597 |  1 +
 tests/generic/598 |  1 +
 12 files changed, 49 insertions(+)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v4 1/1 common/rc: Add _require_{chown,chmod}()

Add helper functions that ensure that test is only executed on file systems that implement chown, chmod and symbolic links.

Fixed test are: generic/{87,88,125,126,128,193,314,317,355,597,598}

---
 common/rc         | 38 ++++++++++++++++++++++++++++++++++++++
 tests/generic/087 |  1 +
 tests/generic/088 |  1 +
 tests/generic/125 |  1 +
 tests/generic/126 |  1 +
 tests/generic/128 |  1 +
 tests/generic/193 |  1 +
 tests/generic/314 |  1 +
 tests/generic/317 |  1 +
 tests/generic/355 |  1 +
 tests/generic/597 |  1 +
 tests/generic/598 |  1 +
 12 files changed, 49 insertions(+)
common/rc +38 -0
index 11ff7635..9fd42254 100644
@@ -2185,6 +2185,44 @@ _require_user()
     [ "$?" == "0" ] || _notrun "$qa_user cannot execute commands."
 }
 
+# check for a chown support
+#
+_require_chown()
+{
+	rnd_uid=4242
+
+	_require_test
+
+	local file="$TEST_DIR/chown_testfile"
+	touch $file
+	chown ${rnd_uid}:${rnd_uid} $file >/dev/null 2>&1 \
+		|| _notrun "chown is not supported ${FSTYP}"
+	rm -f $file
+}
+
+
+# check for a chmod support
+# Since chmod sometimes fails silently actual functionality test is done
+#
+_require_chmod()
+{
+	_require_test
+
+	local file="$TEST_DIR/chmod_testfile"
+	touch $file
+
+	# get original file mode
+	mode=`stat --format="0%a" $file`
+	# flip the user's read bit
+	let mode^=0400
+	chmod `printf '%o' "$mode"` $file
+	# check that the chmod actually flipped the bit
+	[ `stat --format="0%a" $file` == `printf '0%o' "$mode"` ] \
+		|| _notrun "chmod is not supported ${FSTYP}"
+
+	rm -f $file
+}
+
 # check for a group on the machine, fsgqa as default
 #
 _require_group()
tests/generic/087 +1 -0
index 1f30dbf4..c3576117 100755
@@ -37,6 +37,7 @@ _cleanup()
 # real QA test starts here
 _supported_fs generic
 _require_test
+_require_chown
 
 QA_FS_PERMS=$here/src/fs_perms
 
tests/generic/088 +1 -0
index 9388a083..ad99bd7e 100755
@@ -29,6 +29,7 @@ _filter()
 # real QA test starts here
 _supported_fs generic
 _require_test
+_require_chown
 
 path=$TEST_DIR/t_access
 $here/src/t_access_root $path | tee $seqres.full | _filter
tests/generic/125 +1 -0
index e84248d3..8c8f5cd7 100755
@@ -25,6 +25,7 @@ _supported_fs generic
 _require_test
 _require_user
 _require_odirect
+_require_chmod
 
 TESTDIR=$TEST_DIR/ftrunc
 TESTFILE=$TESTDIR/ftrunc.tmp
tests/generic/126 +1 -0
index ac25d294..636ca00d 100755
@@ -27,6 +27,7 @@ _cleanup()
 # real QA test starts here
 _supported_fs generic
 _require_test
+_require_chown
 
 QA_FS_PERMS=$here/src/fs_perms
 
tests/generic/128 +1 -0
index b3e49eff..c1eae77a 100755
@@ -24,6 +24,7 @@ _supported_fs generic
 
 _require_scratch
 _require_user
+_require_chmod
 
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount "-o nosuid"
tests/generic/193 +1 -0
index 3125efdd..fd0ebbf6 100755
@@ -56,6 +56,7 @@ _supported_fs generic
 
 _require_test
 _require_user
+_require_chown
 
 test_root=$TEST_DIR/$seq.$$.root
 test_user=$TEST_DIR/$seq.$$.user
tests/generic/314 +1 -0
index 03df81ce..540f0feb 100755
@@ -29,6 +29,7 @@ _cleanup()
 _supported_fs generic
 _require_test
 _require_user
+_require_chown
 
 rm -rf $TEST_DIR/$seq-dir
 
tests/generic/317 +1 -0
index 29c37a57..289dfabe 100755
@@ -45,6 +45,7 @@ _require_scratch
 _require_user
 _require_ugid_map
 _require_userns
+_require_chown
 qa_user_id=`id -u $qa_user`
 
 _filter_output()
tests/generic/355 +1 -0
index 161dd042..74fba0f9 100755
@@ -32,6 +32,7 @@ _supported_fs generic
 _require_test
 _require_user
 _require_odirect
+_require_chown
 
 testfile=$TEST_DIR/$seq.test
 rm -f $testfile
tests/generic/597 +1 -0
index ba769d73..6602dc70 100755
@@ -43,6 +43,7 @@ _require_sysctl_variable fs.protected_hardlinks
 _require_user fsgqa2
 # Do this SECOND so that qa_user is fsgqa, and _user_do uses that account
 _require_user fsgqa
+_require_symlinks
 
 OWNER=fsgqa2
 OTHER=fsgqa
tests/generic/598 +1 -0
index 6b765275..230c3ac7 100755
@@ -43,6 +43,7 @@ _require_sysctl_variable fs.protected_fifos
 _require_user fsgqa2
 # Do this SECOND so that qa_user is fsgqa, and _user_do uses that account
 _require_user fsgqa
+_require_chmod
 
 USER1=fsgqa2
 USER2=fsgqa
Signature · 1 line
2.30.2