From d08c6af337d653a9678579d95f8ec57063959d21 Mon Sep 17 00:00:00 2001 From: Gulshan Singh Date: Tue, 20 Dec 2022 13:37:51 -0800 Subject: [PATCH] Start a env_parallel session to avoid argument too long errors (#1446) Co-authored-by: Gulshan Singh Fixes https://github.com/pwndbg/pwndbg/issues/1430 --- tests/gdb-tests/tests.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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)