[kvm-unit-tests RFC v2 3/4] run_tests/mkstandalone: add arch dependent function to `for_each_unittest`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This allows us, for example, to auto generate a new test case based on
an existing test case.

Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
---
 run_tests.sh            |  2 +-
 scripts/common.bash     | 13 +++++++++++++
 scripts/mkstandalone.sh |  2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/run_tests.sh b/run_tests.sh
index 24aba9cc3a98..23658392c488 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -160,7 +160,7 @@ trap "wait; exit 130" SIGINT
    # preserve stdout so that process_test_output output can write TAP to it
    exec 3>&1
    test "$tap_output" == "yes" && exec > /dev/null
-   for_each_unittest $config run_task
+   for_each_unittest $config run_task arch_cmd
 ) | postprocess_suite_output
 
 # wait until all tasks finish
diff --git a/scripts/common.bash b/scripts/common.bash
index f9c15fd304bd..62931a40b79a 100644
--- a/scripts/common.bash
+++ b/scripts/common.bash
@@ -1,8 +1,15 @@
+function arch_cmd()
+{
+	# Dummy function, can be overwritten by architecture dependent
+	# code
+	return
+}
 
 function for_each_unittest()
 {
 	local unittests="$1"
 	local cmd="$2"
+	local arch_cmd="${3-}"
 	local testname
 	local smp
 	local kernel
@@ -19,6 +26,9 @@ function for_each_unittest()
 		if [[ "$line" =~ ^\[(.*)\]$ ]]; then
 			if [ -n "${testname}" ]; then
 				"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+				if [ "${arch_cmd}" ]; then
+					"${arch_cmd}" "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+				fi
 			fi
 			testname=${BASH_REMATCH[1]}
 			smp=1
@@ -49,6 +59,9 @@ function for_each_unittest()
 	done
 	if [ -n "${testname}" ]; then
 		"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+		if [ "${arch_cmd}" ]; then
+			"${arch_cmd}" "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+		fi
 	fi
 	exec {fd}<&-
 }
diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index cefdec30cb33..3b18c0cf090b 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -128,4 +128,4 @@ fi
 
 mkdir -p tests
 
-for_each_unittest $cfg mkstandalone
+for_each_unittest $cfg mkstandalone arch_cmd
-- 
2.25.4




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux