[mutter] tests/kvm: Allow passing multi argument test cases



commit 22a46d4f7bc371a2289446248d2ea8ea4fdd2163
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Aug 4 16:31:58 2022 +0200

    tests/kvm: Allow passing multi argument test cases
    
    This means we can wrap the test case in another executable, or pass
    arguments to test case executables.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2561>

 src/tests/kvm/run-kvm-test.sh |  3 +--
 src/tests/kvm/virtme-run.sh   | 10 ++++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/tests/kvm/run-kvm-test.sh b/src/tests/kvm/run-kvm-test.sh
index 3f022d1479..974ff75eaf 100755
--- a/src/tests/kvm/run-kvm-test.sh
+++ b/src/tests/kvm/run-kvm-test.sh
@@ -5,7 +5,6 @@ set -e
 WRAPPER="$1"
 WRAPPER_ARGS="$2"
 TEST_RESULT="$3"
-TEST_EXECUTABLE="$4"
 
 export XDG_RUNTIME_DIR="/tmp/sub-runtime-dir-$UID"
 export GSETTINGS_SCHEMA_DIR="$PWD/build/data"
@@ -18,6 +17,6 @@ mkdir -p -m 700 $XDG_RUNTIME_DIR
 
 glib-compile-schemas $GSETTINGS_SCHEMA_DIR
 
-"$WRAPPER" $WRAPPER_ARGS "$TEST_EXECUTABLE"
+"$WRAPPER" $WRAPPER_ARGS "${@:4}"
 
 echo $? > $TEST_RESULT
diff --git a/src/tests/kvm/virtme-run.sh b/src/tests/kvm/virtme-run.sh
index 191493258b..e41d21c77e 100755
--- a/src/tests/kvm/virtme-run.sh
+++ b/src/tests/kvm/virtme-run.sh
@@ -8,7 +8,6 @@ WRAPPER="$2"
 WRAPPER_ARGS="$3"
 TEST_BUILD_DIR="$4"
 VM_ENV="$5"
-TEST_EXECUTABLE="$6"
 
 TEST_RESULT_FILE=$(mktemp -p "$TEST_BUILD_DIR" -t test-result-XXXXXX)
 echo 1 > "$TEST_RESULT_FILE"
@@ -30,12 +29,19 @@ if [[ "$(stat -c '%t:%T' -L /proc/$$/fd/0)" == "0:0" ]]; then
   rm -f $XDG_RUNTIME_DIR/fake-stdin.$$
 fi
 
+SCRIPT="\
+  env $VIRTME_ENV $DIRNAME/run-kvm-test.sh \
+  \\\"$WRAPPER\\\" \\\"$WRAPPER_ARGS\\\" \
+  \\\"$TEST_RESULT_FILE\\\" \
+  $(printf "\"%s\" " "${@:6}")\
+"
+
 virtme-run \
   --memory=256M \
   --rw \
   --pwd \
   --kimg "$IMAGE" \
-  --script-sh "sh -c \"env $VIRTME_ENV $DIRNAME/run-kvm-test.sh \\\"$WRAPPER\\\" \\\"$WRAPPER_ARGS\\\" 
\\\"$TEST_RESULT_FILE\\\" \\\"$TEST_EXECUTABLE\\\"\"" \
+  --script-sh "sh -c \"$SCRIPT\"" \
   --qemu-opts -cpu host,pdcm=off -smp 2
 
 TEST_RESULT="$(cat "$TEST_RESULT_FILE")"


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