diff --git a/common.mk b/common.mk index 607055cc..83863a32 100644 --- a/common.mk +++ b/common.mk @@ -34,6 +34,7 @@ endif SKIP_SQUASH ?= 1 DOCKER_BUILD_CONTEXT ?= . +TEST_SUITES ?= test/run script_env = \ SKIP_SQUASH=$(SKIP_SQUASH) \ @@ -42,7 +43,8 @@ script_env = \ CLEAN_AFTER=$(CLEAN_AFTER) \ DOCKER_BUILD_CONTEXT=$(DOCKER_BUILD_CONTEXT) \ OPENSHIFT_NAMESPACES="$(OPENSHIFT_NAMESPACES)" \ - CUSTOM_REPO="$(CUSTOM_REPO)" + CUSTOM_REPO="$(CUSTOM_REPO)" \ + TEST_SUITES="$(TEST_SUITES)" # TODO: switch to 'build: build-all' once parallel builds are relatively safe .PHONY: build build-serial build-all @@ -64,7 +66,7 @@ $(VERSIONS): % : %/root/help.1 .PHONY: test check check: test -test: script_env += TEST_MODE=true +test: script_env += TEST_MODE=local # The tests should ideally depend on $IMAGE_ID only, but see PR#19 for more info # while we need to depend on 'tag' instead of 'build'. diff --git a/test.sh b/test.sh index 2f14e39a..bb5bfb26 100755 --- a/test.sh +++ b/test.sh @@ -15,10 +15,15 @@ for dir in ${VERSIONS}; do # Kept also IMAGE_NAME as some tests might still use that. export IMAGE_NAME=$(docker inspect -f "{{.Config.Labels.name}}" $IMAGE_ID) - if [ -n "${TEST_MODE}" ]; then - VERSION=$dir test/run - fi + for test_script in ${TEST_SUITES}; do + if [ "${TEST_MODE}" == "container" ]; then + docker run --net=host -e VERSION=$dir -e IMAGE_NAME --rm -v /dev:/dev:ro -v /var/lib/docker:/var/lib/docker:ro --security-opt label=disable --cap-add SYS_ADMIN -ti -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}:/src -w /src docker.io/modularitycontainers/conu $test_script + elif [ "${TEST_MODE}" == "local" ]; then + VERSION=$dir $test_script + fi + done + # FIXME: deprecate TEST_OPENSHIFT_MODE and use TEST_SUITES instead? if [ -n "${TEST_OPENSHIFT_MODE}" ]; then if [[ -x test/run-openshift ]]; then VERSION=$dir test/run-openshift