Module: Mesa
Branch: main
Commit: b836cd937ccf709548d483f0fd705ecc8df74647
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b836cd937ccf709548d483f0fd705ecc8df74647

Author: Emma Anholt <[email protected]>
Date:   Tue May 10 14:44:07 2022 -0700

ci/crosvm: Simplify the CID setup.

Now that deqp-runner tells us which thread we are, we don't need to go
probing for a spare directory to use.

Reviewed-by: Cristian Ciocaltea <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16485>

---

 .gitlab-ci/crosvm-runner.sh | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/.gitlab-ci/crosvm-runner.sh b/.gitlab-ci/crosvm-runner.sh
index 82cc37fb18e..9dbf9fef711 100755
--- a/.gitlab-ci/crosvm-runner.sh
+++ b/.gitlab-ci/crosvm-runner.sh
@@ -2,6 +2,10 @@
 
 set -e
 
+# If run outside of a deqp-runner invoction (e.g. piglit trace replay), then 
act
+# the same as the first thread in its threadpool.
+THREAD=${DEQP_RUNNER_THREAD:-0}
+
 #
 # Helper to generate CIDs for virtio-vsock based communication with processes
 # running inside crosvm guests.
@@ -26,19 +30,10 @@ set_vsock_context() {
         exit 1
     }
 
-    local dir_prefix="/tmp-vsock."
-    local cid_prefix=0
-    unset VSOCK_TEMP_DIR
-
-    while [ ${cid_prefix} -lt 128 ]; do
-        VSOCK_TEMP_DIR=${dir_prefix}${cid_prefix}
-        mkdir "${VSOCK_TEMP_DIR}" >/dev/null 2>&1 && break || unset 
VSOCK_TEMP_DIR
-        cid_prefix=$((cid_prefix + 1))
-    done
-
-    [ -n "${VSOCK_TEMP_DIR}" ] || return 1
+    VSOCK_TEMP_DIR="/tmp-vsock.${THREAD}"
+    mkdir $VSOCK_TEMP_DIR || return 1
 
-    VSOCK_CID=$(((CI_JOB_ID & 0x1ffffff) | ((cid_prefix & 0x7f) << 25)))
+    VSOCK_CID=$(((CI_JOB_ID & 0x1ffffff) | ((${THREAD} & 0x7f) << 25)))
     VSOCK_STDOUT=5001
     VSOCK_STDERR=5002
 

Reply via email to