ci: Clean up setup of the job-specific env vars in baremetal testing.
authorEric Anholt <eric@anholt.net>
Mon, 4 May 2020 20:42:41 +0000 (13:42 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 18:34:38 +0000 (18:34 +0000)
Avoids copy and paste errors when adding more vars.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4896>

.gitlab-ci/bare-metal/fastboot.sh
.gitlab-ci/bare-metal/init.sh

index 5e57639c476ed799aa66a21499f55cef8af773fe..5d2d1de176cd64807cfae8b5f3d76860df9ac8c0 100755 (executable)
@@ -50,11 +50,20 @@ cp -Rp $BM_ROOTFS rootfs
 
 # Set up the init script that brings up the system.
 cp $BM/init.sh rootfs/init
-sed -i "s|DEQP_VER_REPLACE|$DEQP_VER|g" rootfs/init
-sed -i "s|DEQP_PARALLEL_REPLACE|$DEQP_PARALLEL|g" rootfs/init
-sed -i "s|DEQP_EXPECTED_RENDERER_REPLACE|$DEQP_EXPECTED_RENDERER|g" rootfs/init
-sed -i "s|CI_NODE_INDEX_REPLACE|$CI_NODE_INDEX|g" rootfs/init
-sed -i "s|CI_NODE_TOTAL_REPLACE|$CI_NODE_TOTAL|g" rootfs/init
+
+# Pass through relevant env vars from the gitlab job to the baremetal init script
+touch rootfs/set-job-env-vars.sh
+chmod +x rootfs/set-job-env-vars.sh
+for var in \
+    CI_NODE_INDEX \
+    CI_NODE_TOTAL \
+    DEQP_EXPECTED_RENDERER \
+    DEQP_PARALLEL \
+    DEQP_VER \
+    ; do
+  val=`echo ${!var} | sed 's|"||g'`
+  echo "export $var=\"${val}\"" >> rootfs/set-job-env-vars.sh
+done
 
 # Add the Mesa drivers we built, and make a consistent symlink to them.
 mkdir -p rootfs/$CI_PROJECT_DIR
index ba0168691d0fa9f946964ad23e05971bf6ff173d..edaaa9692cdac3ead66f17a55d8fb63ea150229f 100644 (file)
@@ -9,11 +9,8 @@ mkdir -p /dev/pts
 mount -t devpts devpts /dev/pts
 
 export DEQP_NO_SAVE_RESULTS=1
-export DEQP_VER=DEQP_VER_REPLACE
-export DEQP_PARALLEL=DEQP_PARALLEL_REPLACE
-export DEQP_EXPECTED_RENDERER=DEQP_EXPECTED_RENDERER_REPLACE
-export CI_NODE_INDEX=CI_NODE_INDEX_REPLACE
-export CI_NODE_TOTAL=CI_NODE_TOTAL_REPLACE
+. /set-job-env-vars.sh
+
 export DEQP_SKIPS=deqp-skips.txt
 if [ -e /install/deqp-expected-fails.txt ]; then
   export DEQP_EXPECTED_FAILS=deqp-expected-fails.txt