Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests in parallel or only some with a filter #490

Merged
merged 2 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .github/workflows/msvc-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.kdev4
/.kdev4
__pycache__
tests-out
3 changes: 2 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 6 additions & 9 deletions tests/all_tests.sh
Original file line number Diff line number Diff line change
@@ -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'
Loading