From b836cd937ccf709548d483f0fd705ecc8df74647 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Tue, 10 May 2022 14:44:07 -0700 Subject: [PATCH] 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 Part-of: --- .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 + VSOCK_TEMP_DIR="/tmp-vsock.${THREAD}" + mkdir $VSOCK_TEMP_DIR || return 1 - 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_CID=$(((CI_JOB_ID & 0x1ffffff) | ((cid_prefix & 0x7f) << 25))) + VSOCK_CID=$(((CI_JOB_ID & 0x1ffffff) | ((${THREAD} & 0x7f) << 25))) VSOCK_STDOUT=5001 VSOCK_STDERR=5002