ci: Provide consistent results location in LAVA
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Thu, 4 Nov 2021 18:49:05 +0000 (20:49 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 22 Mar 2022 17:01:09 +0000 (17:01 +0000)
There is an out-of-sync approach regarding the location of the results
folder: some scripts refer to it via $CI_PROJECT_DIR/results, while
others just assume it is located in the current working directory.

Usually $PWD points to $CI_PROJECT_DIR, but in some cases this is not
the case, hence let's ensure the 'results' folder can always be found
in the current working directory.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15208>

.gitlab-ci/common/init-stage2.sh

index b9eb8b5..baf3fc3 100755 (executable)
@@ -91,11 +91,12 @@ if [ -n "$HWCI_START_XORG" ]; then
   export DISPLAY=:0
 fi
 
-RESULT=fail
-if sh $HWCI_TEST_SCRIPT; then
-  RESULT=pass
-  rm -rf results/trace/$PIGLIT_REPLAY_DEVICE_NAME
-fi
+sh "$HWCI_TEST_SCRIPT" && RESULT=pass || RESULT=fail
+
+# Let's make sure the results are always stored in current working directory
+mv -f ${CI_PROJECT_DIR}/results ./ 2>/dev/null || true
+
+[ "${RESULT}" = "fail" ] || rm -rf results/trace/$PIGLIT_REPLAY_DEVICE_NAME
 
 # upload artifacts
 MINIO=$(cat /proc/cmdline | tr ' ' '\n' | grep minio_results | cut -d '=' -f 2 || true)