Skip to content

Commit a2e11ce

Browse files
committed
fix vm.sh abaility to run a single testsuite
1 parent c124029 commit a2e11ce

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tests/ci/vm.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ROOT_DIR="$(dirname -- "$(dirname -- "$(dirname -- "$(readlink -f "$0")")")")"
3636
cd "$(dirname -- "$(readlink -f "$0")")"
3737

3838
help() {
39-
printf "Usage: vm.sh [OPTIONS] ACTION
39+
printf "Usage: vm.sh [OPTIONS] ACTION [OPTARGS]
4040
4141
Manages the Test Environment (a Docker Container)
4242
@@ -45,7 +45,7 @@ Main actions:
4545
cleanup remove the container and its image
4646
enter start a shell session in the running container
4747
exec [\$command] run a single command in the running container
48-
runtests [\$suite] execute the test suite using the test container (or a single test scenario eg. tests/1ParsingBugsTest.php);
48+
runtests [\$suite] execute the test suite using the test container (or a single test scenario eg. tests/02ValueTest.php);
4949
build and start the container if required
5050
runcoverage execute the test suite and generate a code coverage report (in build/coverage);
5151
build and start the container if required
@@ -177,6 +177,11 @@ runtests() {
177177
if [ "$(docker inspect --format '{{.State.Status}}' "${CONTAINER_NAME}" 2>/dev/null)" != running ]; then
178178
start
179179
fi
180+
if [ -z "$1" ]; then
181+
TESTSUITE=tests
182+
else
183+
TESTSUITE="$*"
184+
fi
180185
test -t 1 && USE_TTY="-t"
181186
lock
182187
trap unlock INT
@@ -188,7 +193,7 @@ runtests() {
188193
--env "HTTPSIGNOREPEER=${HTTPSIGNOREPEER}" \
189194
--env "SSLVERSION=${SSLVERSION}" \
190195
--env DEBUG="${DEBUG}" \
191-
"${CONTAINER_NAME}" su "${CONTAINER_USER}" -c "./vendor/bin/phpunit -v tests"
196+
"${CONTAINER_NAME}" su "${CONTAINER_USER}" -c "./vendor/bin/phpunit -v $TESTSUITE"
192197
docker exec -i $USE_TTY \
193198
--env "HTTPSVERIFYHOST=${HTTPSVERIFYHOST}" \
194199
--env "HTTPSIGNOREPEER=${HTTPSIGNOREPEER}" \
@@ -295,7 +300,8 @@ case "${ACTION}" in
295300
;;
296301

297302
runtests)
298-
runtests
303+
shift
304+
runtests "$@"
299305
;;
300306

301307
start)

0 commit comments

Comments
 (0)