diff mbox series

[kvm-unit-tests,3/4] run_tests/mkstandalone: add arch_cmd hook

Message ID 20200818130424.20522-4-mhartmay@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Add Protected VM support | expand

Commit Message

Marc Hartmayer Aug. 18, 2020, 1:04 p.m. UTC
This allows us, for example, to auto generate a new test case based on
an existing test case.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 scripts/common.bash | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Andrew Jones Aug. 18, 2020, 2:32 p.m. UTC | #1
On Tue, Aug 18, 2020 at 03:04:23PM +0200, Marc Hartmayer wrote:
> This allows us, for example, to auto generate a new test case based on
> an existing test case.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  scripts/common.bash | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/common.bash b/scripts/common.bash
> index c7acdf14a835..a6044b7c6c35 100644
> --- a/scripts/common.bash
> +++ b/scripts/common.bash
> @@ -19,7 +19,7 @@ function for_each_unittest()
>  	while read -r -u $fd line; do
>  		if [[ "$line" =~ ^\[(.*)\]$ ]]; then
>  			if [ -n "${testname}" ]; then
> -				"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
> +				$(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
>  			fi
>  			testname=${BASH_REMATCH[1]}
>  			smp=1
> @@ -49,11 +49,16 @@ function for_each_unittest()
>  		fi
>  	done
>  	if [ -n "${testname}" ]; then
> -		"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
> +		$(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
>  	fi
>  	exec {fd}<&-
>  }
>  
> +function arch_cmd()
> +{
> +	[ "${ARCH_CMD}" ] && echo "${ARCH_CMD}"
> +}
> +
>  # The current file has to be the only file sourcing the arch helper
>  # file
>  ARCH_FUNC=scripts/${ARCH}/func.bash
> -- 
> 2.25.4
>

Reviewed-by: Andrew Jones <drjones@redhat.com>
Cornelia Huck Aug. 19, 2020, 10:23 a.m. UTC | #2
On Tue, 18 Aug 2020 15:04:23 +0200
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> This allows us, for example, to auto generate a new test case based on
> an existing test case.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  scripts/common.bash | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
David Hildenbrand Aug. 19, 2020, 10:39 a.m. UTC | #3
On 18.08.20 15:04, Marc Hartmayer wrote:
> This allows us, for example, to auto generate a new test case based on
> an existing test case.

An example would have been nice :)

> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  scripts/common.bash | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/common.bash b/scripts/common.bash
> index c7acdf14a835..a6044b7c6c35 100644
> --- a/scripts/common.bash
> +++ b/scripts/common.bash
> @@ -19,7 +19,7 @@ function for_each_unittest()
>  	while read -r -u $fd line; do
>  		if [[ "$line" =~ ^\[(.*)\]$ ]]; then
>  			if [ -n "${testname}" ]; then
> -				"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
> +				$(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
>  			fi
>  			testname=${BASH_REMATCH[1]}
>  			smp=1
> @@ -49,11 +49,16 @@ function for_each_unittest()
>  		fi
>  	done
>  	if [ -n "${testname}" ]; then
> -		"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
> +		$(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
>  	fi
>  	exec {fd}<&-
>  }
>  
> +function arch_cmd()
> +{
> +	[ "${ARCH_CMD}" ] && echo "${ARCH_CMD}"
> +}
> +
>  # The current file has to be the only file sourcing the arch helper
>  # file
>  ARCH_FUNC=scripts/${ARCH}/func.bash
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/scripts/common.bash b/scripts/common.bash
index c7acdf14a835..a6044b7c6c35 100644
--- a/scripts/common.bash
+++ b/scripts/common.bash
@@ -19,7 +19,7 @@  function for_each_unittest()
 	while read -r -u $fd line; do
 		if [[ "$line" =~ ^\[(.*)\]$ ]]; then
 			if [ -n "${testname}" ]; then
-				"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+				$(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
 			fi
 			testname=${BASH_REMATCH[1]}
 			smp=1
@@ -49,11 +49,16 @@  function for_each_unittest()
 		fi
 	done
 	if [ -n "${testname}" ]; then
-		"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+		$(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
 	fi
 	exec {fd}<&-
 }
 
+function arch_cmd()
+{
+	[ "${ARCH_CMD}" ] && echo "${ARCH_CMD}"
+}
+
 # The current file has to be the only file sourcing the arch helper
 # file
 ARCH_FUNC=scripts/${ARCH}/func.bash