ci: rework vkd3d-proton runner and fix detecting failures
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 16 May 2023 11:37:41 +0000 (13:37 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 19 May 2023 07:52:25 +0000 (07:52 +0000)
The script returned 0 (aka succcess) for assertions or segmentation
faults. Found this after introducing a regression that caused a
segfault in vkd3d with vk-cts-image but not with Mesa CI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23057>

.gitlab-ci/vkd3d-proton/run.sh
src/amd/ci/gitlab-ci.yml

index 8ef00f7..e508a80 100755 (executable)
@@ -14,7 +14,7 @@ RESULTS=$(realpath -s "$PWD"/results)
 # Modifiying here directly LD_LIBRARY_PATH may cause problems when
 # using a command wrapper. Hence, we will just set it when running the
 # command.
-export __LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$INSTALL/lib/:/vkd3d-proton-tests/x64/"
+export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$INSTALL/lib/:/vkd3d-proton-tests/x64/"
 
 
 # Sanity check to ensure that our environment is sufficient to make our tests
@@ -44,12 +44,8 @@ quiet() {
     set -x
 }
 
-SANITY_MESA_VERSION_CMD="vulkaninfo | tee /tmp/version.txt | grep \"Mesa $MESA_VERSION\(\s\|$\)\""
-
-RUN_CMD="export LD_LIBRARY_PATH=$__LD_LIBRARY_PATH; $SANITY_MESA_VERSION_CMD"
-
 set +e
-eval $RUN_CMD
+vulkaninfo | tee /tmp/version.txt | grep \"Mesa $MESA_VERSION\(\s\|$\)\"
 
 if [ $? -ne 0 ]; then
     printf "%s\n" "Found $(cat /tmp/version.txt), expected $MESA_VERSION"
@@ -62,31 +58,37 @@ else
     mkdir "$RESULTS"
 fi
 
-VKD3D_PROTON_TESTSUITE_CMD="/vkd3d-proton-tests/x64/bin/d3d12 >$RESULTS/vkd3d-proton.log"
-
 quiet printf "%s\n" "Running vkd3d-proton testsuite..."
-RUN_CMD="export LD_LIBRARY_PATH=$__LD_LIBRARY_PATH; $VKD3D_PROTON_TESTSUITE_CMD"
 
 set +e
-eval $RUN_CMD
-
-VKD3D_PROTON_RESULTS="${VKD3D_PROTON_RESULTS:-vkd3d-proton-results}"
-RESULTSFILE="$RESULTS/$VKD3D_PROTON_RESULTS.txt"
-mkdir -p .gitlab-ci/vkd3d-proton
-grep "Test failed" "$RESULTS"/vkd3d-proton.log > "$RESULTSFILE"
+/vkd3d-proton-tests/x64/bin/d3d12 > $RESULTS/vkd3d-proton.log
+
+if [ $? != 0 ]; then
+    quiet print_red printf "%s\n" "Failed, see vkd3d-proton.log!"
+
+    # Collect all the failures
+    VKD3D_PROTON_RESULTS="${VKD3D_PROTON_RESULTS:-vkd3d-proton-results}"
+    RESULTSFILE="$RESULTS/$VKD3D_PROTON_RESULTS.txt"
+    mkdir -p .gitlab-ci/vkd3d-proton
+    grep "Test failed" "$RESULTS"/vkd3d-proton.log > "$RESULTSFILE"
+
+    # Gather the list expected failures
+    if [ -f "$INSTALL/$VKD3D_PROTON_RESULTS.txt" ]; then
+        cp "$INSTALL/$VKD3D_PROTON_RESULTS.txt" \
+           ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline"
+    else
+        touch ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline"
+    fi
+
+    # Make sure that the failures found in this run match the current expectation
+    if ! diff -q ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" "$RESULTSFILE"; then
+        quiet print_red printf "%s\n" "Changes found, see vkd3d-proton.log!"
+        quiet diff --color=always -u ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" "$RESULTSFILE"
+    fi
 
-if [ -f "$INSTALL/$VKD3D_PROTON_RESULTS.txt" ]; then
-    cp "$INSTALL/$VKD3D_PROTON_RESULTS.txt" \
-       ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline"
-else
-    touch ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline"
+    exit 1
 fi
 
-if diff -q ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" "$RESULTSFILE"; then
-    echo "SUCCESS: No changes found!"
-    exit 0
-fi
+printf "%s\n" "vkd3d-proton execution: SUCCESS"
 
-quiet print_red printf "%s\n" "Changes found, see vkd3d-proton.log!"
-quiet diff --color=always -u ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" "$RESULTSFILE"
-exit 1
+exit 0
index 0676ed7..0c84e70 100644 (file)
@@ -430,7 +430,7 @@ radv-fossils:
   extends:
     - .b2c-test-radv-vk
   variables:
-    B2C_JOB_SUCCESS_REGEX: 'SUCCESS: No changes found!\r$'
+    B2C_JOB_SUCCESS_REGEX: 'vkd3d-proton execution: SUCCESS\r$'
     HWCI_TEST_SCRIPT: ./install/vkd3d-proton/run.sh
 
 .vkd3d-kabini-valve: