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.
This commit is contained in:
Levak Borok
2024-06-11 14:31:41 +02:00
parent 513e03c883
commit d8f955d692
3 changed files with 9 additions and 10 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@
*.kdev4 *.kdev4
/.kdev4 /.kdev4
__pycache__ __pycache__
tests-out

View File

@@ -26,7 +26,8 @@ https://github.com/zrax/pycdc
* Build the generated project or makefile * Build the generated project or makefile
* For projects (e.g. MSVC), open the generated project file and build it * For projects (e.g. MSVC), open the generated project file and build it
* For makefiles, just run `make` * 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 ## Usage
**To run pycdas**, the PYC Disassembler: **To run pycdas**, the PYC Disassembler:

View File

@@ -1,13 +1,10 @@
#!/bin/bash #!/bin/bash
set -e
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)" srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
jobs=${JOBS:-4}
filter=${FILTER:-""}
test_status=0 find "${srcdir}/tests/tokenized" -type f -name '*.txt' -a -name "*${filter}*" -print0 | \
test_files=( "$srcdir"/tests/tokenized/*.txt ) xargs -0 -I '{}' -P $jobs \
for tf in "${test_files[@]}"; do bash -c 'o=$('"$srcdir"'/tests/decompyle_test.sh "$(basename -s .txt "{}")" tests-out) r=$?; echo "$o"; exit $r'
test_name="$(basename "$tf")"
test_name="${test_name%.txt}"
"$srcdir"/tests/decompyle_test.sh $test_name tests || test_status=1
done
exit $test_status