diff --git a/tests/gdb-tests/tests.sh b/tests/gdb-tests/tests.sh index e90baefae..553d2fa6a 100755 --- a/tests/gdb-tests/tests.sh +++ b/tests/gdb-tests/tests.sh @@ -3,6 +3,19 @@ set -o errexit set -o pipefail +# env_parallel will fail if there are too many environment variables, so we need +# to use `--session` or `--record-env`, and only `--record-env` is supported on +# the version of `parallel` on Ubuntu 20.04 and earlier. The directory also +# needs to be created for CI +mkdir -p ~/.parallel +. $(which env_parallel.bash) + +# Workaround for Ubuntu 20.04/18.04 CI. If no aliases are defined +# `env_parallel --record-env` will have non-zero exit code for older versions of +# `parallel`, so we define a dummy alias here +alias __dummy=foo +env_parallel --record-env + ROOT_DIR="$(readlink -f ../../)" GDB_INIT_PATH="$ROOT_DIR/gdbinit.py" COVERAGERC_PATH="$ROOT_DIR/pyproject.toml" @@ -167,9 +180,8 @@ else echo "" fi - . $(which env_parallel.bash) - - env_parallel --output-as-files --joblog $JOBLOG_PATH run_test ::: "${TESTS_LIST[@]}" | env_parallel parse_output_file {} + # The `--env _` is required when using `--record-env` + env_parallel --env _ --output-as-files --joblog $JOBLOG_PATH run_test ::: "${TESTS_LIST[@]}" | env_parallel --env _ parse_output_file {} fi end=$(date +%s)