Skip to content

Commit d8f955d

Browse files
committed
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.
1 parent 513e03c commit d8f955d

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
*.kdev4
66
/.kdev4
77
__pycache__
8+
tests-out

README.markdown

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ https://github.com/zrax/pycdc
2626
* Build the generated project or makefile
2727
* For projects (e.g. MSVC), open the generated project file and build it
2828
* For makefiles, just run `make`
29-
* To run tests (on \*nix or MSYS), run `make check`
29+
* To run tests (on \*nix or MSYS), run `make check JOBS=4` (optional
30+
`FILTER=xxxx` to run only certain tests)
3031

3132
## Usage
3233
**To run pycdas**, the PYC Disassembler:

tests/all_tests.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
#!/bin/bash
2+
set -e
23

34
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
5+
jobs=${JOBS:-4}
6+
filter=${FILTER:-""}
47

5-
test_status=0
6-
test_files=( "$srcdir"/tests/tokenized/*.txt )
7-
for tf in "${test_files[@]}"; do
8-
test_name="$(basename "$tf")"
9-
test_name="${test_name%.txt}"
10-
"$srcdir"/tests/decompyle_test.sh $test_name tests || test_status=1
11-
done
12-
13-
exit $test_status
8+
find "${srcdir}/tests/tokenized" -type f -name '*.txt' -a -name "*${filter}*" -print0 | \
9+
xargs -0 -I '{}' -P $jobs \
10+
bash -c 'o=$('"$srcdir"'/tests/decompyle_test.sh "$(basename -s .txt "{}")" tests-out) r=$?; echo "$o"; exit $r'

0 commit comments

Comments
 (0)