From ab36f62d593c4597cf2cc115187bdb5a95652883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Sat, 19 Mar 2016 10:14:36 +0100 Subject: [PATCH 1/3] Add 'test-unit' and 'test-unit-local' Makefile targets Running unit tests without the integration tests is non-trivial, so add a Makefile target to help with this. --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index a0acf950..3fa942b9 100644 --- a/Makefile +++ b/Makefile @@ -54,5 +54,12 @@ shell: build-container test-integration: build-container $(DOCKER_RUN_DOCKER) hack/make.sh test-integration +test-unit: build-container + # Just call (make test unit-local) here instead of worrying about environment differences, e.g. GO15VENDOREXPERIMENT. + $(DOCKER_RUN_DOCKER) make test-unit-local + validate: build-container $(DOCKER_RUN_DOCKER) hack/make.sh validate-git-marks validate-gofmt validate-lint validate-vet + +test-unit-local: + go test $$(go list -e ./... | grep -v '^github\.com/projectatomic/skopeo/\(integration\|vendor/.*\)$$') From a4fd447146018edb5930ab59a6e882e0f57abdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 21 Mar 2016 15:34:22 +0100 Subject: [PATCH 2/3] Run unit tests in Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e133b98e..87319f0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,5 @@ notifications: script: - make validate + - make test-unit - make test-integration From b815271f168334a872ca54be451c75c8374d1dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 21 Mar 2016 15:38:50 +0100 Subject: [PATCH 3/3] Add collective test targets: - (make check): GNU coding standards-compliant primary entry point, running all available tests in the best environment (i.e. Docker container). - (make test-all-local): Local entry point, running only tests which do not require a special environment; intended for IDE integration and quick turnaround cycles. Also modifies the Travis configuration to run (make check), to prevent duplication. --- .travis.yml | 4 +--- Makefile | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 87319f0a..c5c539f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,4 @@ notifications: email: false script: - - make validate - - make test-unit - - make test-integration + - make check diff --git a/Makefile b/Makefile index 3fa942b9..60c963ce 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,8 @@ man: shell: build-container $(DOCKER_RUN_DOCKER) bash +check: validate test-unit test-integration + test-integration: build-container $(DOCKER_RUN_DOCKER) hack/make.sh test-integration @@ -61,5 +63,11 @@ test-unit: build-container validate: build-container $(DOCKER_RUN_DOCKER) hack/make.sh validate-git-marks validate-gofmt validate-lint validate-vet +# This target is only intended for development, e.g. executing it from an IDE. Use (make test) for CI or pre-release testing. +test-all-local: validate-local test-unit-local + +validate-local: + hack/make.sh validate-git-marks validate-gofmt validate-lint validate-vet + test-unit-local: go test $$(go list -e ./... | grep -v '^github\.com/projectatomic/skopeo/\(integration\|vendor/.*\)$$')