From d8f955d69226a8be45c013199d0cac89bd1d8fc5 Mon Sep 17 00:00:00 2001 From: Levak Borok Date: Tue, 11 Jun 2024 14:31:41 +0200 Subject: [PATCH 1/2] Run tests in parallel or only some with a filter `make check JOBS=4` will spawn 4 workers and spread the tests among them. `make check FILTER=try` will only run tests that contain `try` in their name. --- .gitignore | 1 + README.markdown | 3 ++- tests/all_tests.sh | 15 ++++++--------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 6237dda..9bb0f98 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ *.kdev4 /.kdev4 __pycache__ +tests-out \ No newline at end of file diff --git a/README.markdown b/README.markdown index 787435c..f1faa0f 100644 --- a/README.markdown +++ b/README.markdown @@ -26,7 +26,8 @@ https://github.com/zrax/pycdc * Build the generated project or makefile * For projects (e.g. MSVC), open the generated project file and build it * For makefiles, just run `make` - * To run tests (on \*nix or MSYS), run `make check` + * To run tests (on \*nix or MSYS), run `make check JOBS=4` (optional + `FILTER=xxxx` to run only certain tests) ## Usage **To run pycdas**, the PYC Disassembler: diff --git a/tests/all_tests.sh b/tests/all_tests.sh index 2e3dd6c..fac9772 100755 --- a/tests/all_tests.sh +++ b/tests/all_tests.sh @@ -1,13 +1,10 @@ #!/bin/bash +set -e srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)" +jobs=${JOBS:-4} +filter=${FILTER:-""} -test_status=0 -test_files=( "$srcdir"/tests/tokenized/*.txt ) -for tf in "${test_files[@]}"; do - test_name="$(basename "$tf")" - test_name="${test_name%.txt}" - "$srcdir"/tests/decompyle_test.sh $test_name tests || test_status=1 -done - -exit $test_status +find "${srcdir}/tests/tokenized" -type f -name '*.txt' -a -name "*${filter}*" -print0 | \ + xargs -0 -I '{}' -P $jobs \ + bash -c 'o=$('"$srcdir"'/tests/decompyle_test.sh "$(basename -s .txt "{}")" tests-out) r=$?; echo "$o"; exit $r' From 462fc46424444397877f69f1e0a800160e8ab237 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sun, 23 Jun 2024 11:46:12 -0700 Subject: [PATCH 2/2] Add JOBS parameter to GH workflows (currently default, but not guaranteed) ... and fix missing newline at EOF --- .github/workflows/linux-ci.yml | 4 ++-- .github/workflows/msvc-ci.yml | 1 + .gitignore | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index b2598ed..102d8a8 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -13,8 +13,8 @@ jobs: run: | mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Debug .. - make -j2 + make -j4 - name: Test run: | cd build - make check + make check JOBS=4 diff --git a/.github/workflows/msvc-ci.yml b/.github/workflows/msvc-ci.yml index 20ac5e6..8adb503 100644 --- a/.github/workflows/msvc-ci.yml +++ b/.github/workflows/msvc-ci.yml @@ -26,6 +26,7 @@ jobs: bash.exe ..\..\tests\all_tests.sh env: PYTHON_EXE: python.exe + JOBS: 4 - name: Upload artifact uses: actions/upload-artifact@v3 diff --git a/.gitignore b/.gitignore index 9bb0f98..7cfe02d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ *.kdev4 /.kdev4 __pycache__ -tests-out \ No newline at end of file +tests-out