scripts/tests/testversions: enable concurrent installation for each

version

The test-versions test currently takes 1h 40min to run each time. By
running each installation concurrently, hopefully, it will reduce the execution
time for the whole test.

Change-Id: I680c7d9945e982894b11825c9075c167f754e087
This commit is contained in:
Yingrong Zhao 2020-11-13 13:38:58 -05:00 committed by Stefan Benten
parent 3fc76f4ffe
commit 13555f3983

View File

@ -165,9 +165,22 @@ fi
echo "Setting up environments for versions" ${unique_versions}
# create a result file for each child process' exit code
exit_statuses_dir=${TMP}/exit_statuses
mkdir ${exit_statuses_dir}
write_exit_status(){
# we need to capture the exit status first so it won't be overwritten
local exit_status=$?
local version=$1
echo $exit_status > ${exit_statuses_dir}/${version} # write exit code to a file named with the current installing version
echo "installation for ${version} exited"
}
# clean up git worktree
git worktree prune
for version in ${unique_versions}; do
# run in parallel
(
trap "write_exit_status ${version}" EXIT
dir=$(version_dir ${version})
bin_dir=${dir}/bin
@ -216,8 +229,14 @@ for version in ${unique_versions}; do
echo "Binary shasums:"
shasum ${bin_dir}/uplink
fi
) &
done
wait # wait for all child processes to finish
# iterate through those result files to check their exit code
# if there's any exit code that's non-zero, exit the test
grep -qvwr "0" ${exit_statuses_dir} && exit 1
# Use stage 1 satellite version as the starting state. Create a cp of that
# version folder so we don't worry about dirty states. Then copy/link/mv
# appropriate resources into that folder to ensure we have correct versions.