Skip to content

Commit 531d43c

Browse files
authored
Merge pull request #10 from cjolowicz/ci-allow-running-specific-tests
Allow running specific tests
2 parents 3adac4f + 13ca277 commit 531d43c

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ check:
1010

1111
test-heroku-16:
1212
@echo "Running tests in docker (heroku-16)..."
13-
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
13+
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run $(TESTS);'
1414
@echo ""
1515

1616
test-heroku-18:
1717
@echo "Running tests in docker (heroku-18)..."
18-
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-18" heroku/heroku:18-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
18+
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-18" heroku/heroku:18-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run $(TESTS);'
1919
@echo ""
2020

2121
buildenv-heroku-16:

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ make test-heroku-18
8383
make test-heroku-16
8484
```
8585

86+
You can also specify which tests to run:
87+
88+
```
89+
make test TESTS="testPython3_7 testGitEgg"
90+
```
91+
8692
The tests are run via the vendored
8793
[shunit2](https://github.com/kward/shunit2)
8894
test framework.

test/run

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,17 @@ assertFile() {
315315
assertEquals "$1" "$(cat ${compile_dir}/$2)"
316316
}
317317

318+
# If tests are passed as command-line arguments, only run those tests.
319+
if [ $# -gt 0 ]; then
320+
shunit_funcs_="$*"
321+
set --
322+
323+
suite() {
324+
for shunit_func_ in ${shunit_funcs_}; do
325+
suite_addTest ${shunit_func_}
326+
done
327+
unset shunit_func_
328+
}
329+
fi
330+
318331
source $(pwd)/test/shunit2

0 commit comments

Comments
 (0)