Skip to contentSkip to conversation

fstests: -I <n> CLI option and some random fixes

PATCH In review Ritesh Harjani 2 participants 6 messages Feb 11, 2021 – Mar 7, 2021

lore
Share & tools
lore
#0 lore raw

cover fstests: -I <n> CLI option and some random fixes

Patch-1: is a v2 with comments addressed from Eryu. Patch-{2,3}: are random fixes found during testing.

Ritesh Harjani (3):
check: add CLI option to repeat and stop tests in case of failure common/rc: Add _require_get_hugepagesize and fix
_require_label_get_max
generic/{413/605}: Add _require_get_hugepagesize check

 check             | 8 ++++++++
 common/rc         | 8 +++++++-
 tests/generic/413 | 1 +
 tests/generic/605 | 1 +
 4 files changed, 17 insertions(+), 1 deletion(-)

--

#1 lore raw

PATCH v2 1/3 check: add CLI option to repeat and stop tests in case of failure

Currently with -i <n> option the test can run for many iterations, but in case if we want to stop the iteration in case of a failure, it is much easier to have such an option which could check the failed status and stop the test from further proceeding.

This patch adds such an option (-I <n>) thereby extending the -i <n> option functionality.

---
 check | 8 ++++++++
 1 file changed, 8 insertions(+)
check +8 -0
index c6ad1d6c0733..6760d066955d 100755
@@ -27,6 +27,7 @@ brief_test_summary=false
 do_report=false
 DUMP_OUTPUT=false
 iterations=1
+istop=false
 
 # This is a global variable used to pass test failure text to reporting gunk
 _err_msg=""
@@ -68,6 +69,7 @@ check options
     -T			output timestamps
     -r			randomize test order
     -i <n>		iterate the test list <n> times
+    -I <n>		iterate the test list <n> times, but stops iterating further in case of any test failure
     -d			dump test output to stdout
     -b			brief test summary
     -R fmt[,fmt]	generate report in formats specified. Supported format: [xunit]
@@ -300,6 +302,7 @@ while [ $# -gt 0 ]; do
 	-n)	showme=true ;;
         -r)	randomize=true ;;
 	-i)	iterations=$2; shift ;;
+	-I) 	iterations=$2; istop=true; shift ;;
 	-T)	timestamp=true ;;
 	-d)	DUMP_OUTPUT=true ;;
 	-b)	brief_test_summary=true;;
@@ -926,6 +929,11 @@ function run_section()
 for ((iters = 0; iters < $iterations; iters++)) do
 	for section in $HOST_OPTIONS_SECTIONS; do
 		run_section $section
+		if [ "$sum_bad" != 0 ] && [ "$istop" = true ]; then
+			interrupt=false
+			status=`expr $sum_bad != 0`
+			exit
+		fi
 	done
 done
 

--

#2 lore raw

PATCH 2/3 common/rc: Add _require_get_hugepagesize and fix _require_label_get_max

In reply to Ritesh Harjani

_notrun executed from a subshell $(cmd) won't exit it's parent. Hence _require_*** functions shouldn't have below statements.

	dummy=$(_label_get_max)

Also add a function _require_get_hugepagesize(), since it seems the intention of _get_hugepagesize() is to also '_notrun' when the hugepagesize is not a valid number.

---
 common/rc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
common/rc +7 -1
index 649b1cfd884a..1831714198af 100644
@@ -175,6 +175,12 @@ _get_hugepagesize()
 	echo $((hugepgsz * 1024))
 }
 
+_require_get_hugepagesize()
+{
+	# Just a dummy for _notrun if hugepagesize is not supported
+	_get_hugepagesize
+}
+
 _mount()
 {
     $MOUNT_PROG `_mount_ops_filter $*`
@@ -4250,7 +4256,7 @@ _label_get_max()
 _require_label_get_max()
 {
 	# Just call _label_get_max which will notrun if appropriate
-	dummy=$(_label_get_max)
+	_label_get_max
 }
 
 _dmsetup_remove()

--

#3 lore raw

Re: [PATCH 2/3] common/rc: Add _require_get_hugepagesize and fix _require_label_get_max

Quoted 17 lines · Ritesh Harjani

_notrun executed from a subshell $(cmd) won't exit it's parent. Hence _require_*** functions shouldn't have below statements.

	dummy=$(_label_get_max)

Also add a function _require_get_hugepagesize(), since it seems the intention of _get_hugepagesize() is to also '_notrun' when the hugepagesize is not a valid number.

---
 common/rc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
common/rc +0 -0
index 649b1cfd884a..1831714198af 100644

common/rc _get_hugepagesize() · line 183

Quoted 9 lines
common/rc +6 -0
@@ -175,6 +175,12 @@ _get_hugepagesize()
 	echo $((hugepgsz * 1024))
 }
 
+_require_get_hugepagesize()
+{
+	# Just a dummy for _notrun if hugepagesize is not supported
+	_get_hugepagesize
+}
+

I think this hunk should be moved to patch 3.

Otherwise patch looks fine to me. And I applied patch 1 for next update, thanks!

Eryu

Quoted 13 lines
common/rc +1 -2
 _mount()
 {
     $MOUNT_PROG `_mount_ops_filter $*`
@@ -4250,7 +4256,7 @@ _label_get_max()
 _require_label_get_max()
 {
 	# Just call _label_get_max which will notrun if appropriate
-	dummy=$(_label_get_max)
+	_label_get_max
 }
 
 _dmsetup_remove()
--
#4 lore raw

PATCH 3/3 generic/{413/605}: Add _require_get_hugepagesize check

In reply to Ritesh Harjani

This adds _require_get_hugepagesize() check at the beginning, which seems like was the intention earlier behind function _get_hugepagesize().

---
 tests/generic/413 | 1 +
 tests/generic/605 | 1 +
 2 files changed, 2 insertions(+)
tests/generic/413 +1 -0
index 503c7c999d4f..7db8d756abc7 100755
@@ -34,6 +34,7 @@ _require_scratch_dax_mountopt "dax"
 _require_test_program "feature"
 _require_test_program "t_mmap_dio"
 _require_xfs_io_command "falloc"
+_require_get_hugepagesize
 
 prep_files()
 {
tests/generic/605 +1 -0
index 1e2d71882dd0..7620e148e4b3 100755
@@ -34,6 +34,7 @@ _require_test_program "feature"
 _require_test_program "t_mmap_dio"
 _require_dax_iflag
 _require_xfs_io_command "falloc"
+_require_get_hugepagesize
 
 SRC_DIR=$SCRATCH_MNT/src
 SRC_FILE=$SRC_DIR/tf_s

--
Ritesh Harjani (signature)

#5 lore raw
In reply to Ritesh Harjani
Quoted 9 lines · Ritesh Harjani

Patch-1: is a v2 with comments addressed from Eryu. Patch-{2,3}: are random fixes found during testing.

Ritesh Harjani (3):
check: add CLI option to repeat and stop tests in case of failure common/rc: Add _require_get_hugepagesize and fix
_require_label_get_max
generic/{413/605}: Add _require_get_hugepagesize check

Quoted 6 lines
  check             | 8 ++++++++
  common/rc         | 8 +++++++-
  tests/generic/413 | 1 +
  tests/generic/605 | 1 +
  4 files changed, 17 insertions(+), 1 deletion(-)

Ping.

-ritesh