makefile: support getting results locally from container test

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-04-17 11:29:30 -04:00 committed by John Mulligan
parent 6072f41bd6
commit 204a7558d4

View File

@ -4,12 +4,17 @@ CONTAINER_OPTS := --security-opt $(shell grep -q selinux /sys/kernel/security/ls
CONTAINER_CONFIG_DIR := testing/containers/ceph
VOLUME_FLAGS :=
CEPH_VERSION := nautilus
RESULTS_DIR :=
SELINUX := $(shell getenforce 2>/dev/null)
ifeq ($(SELINUX),Enforcing)
VOLUME_FLAGS = :z
endif
ifdef RESULTS_DIR
RESULTS_VOLUME := -v $(RESULTS_DIR):/results$(VOLUME_FLAGS)
endif
build:
go build -v -tags $(CEPH_VERSION) $(shell go list ./... | grep -v /contrib)
fmt:
@ -19,8 +24,13 @@ test:
.PHONY: test-docker test-container
test-docker: test-container
test-container: check-ceph-version .build-docker
$(CONTAINER_CMD) run --device /dev/fuse --cap-add SYS_ADMIN $(CONTAINER_OPTS) --rm -v $(CURDIR):/go/src/github.com/ceph/go-ceph$(VOLUME_FLAGS) $(DOCKER_CI_IMAGE)
test-container: check-ceph-version .build-docker $(RESULTS_DIR)
$(CONTAINER_CMD) run --device /dev/fuse --cap-add SYS_ADMIN $(CONTAINER_OPTS) --rm -v $(CURDIR):/go/src/github.com/ceph/go-ceph$(VOLUME_FLAGS) $(RESULTS_VOLUME) $(DOCKER_CI_IMAGE)
ifdef RESULTS_DIR
$(RESULTS_DIR):
mkdir -p $(RESULTS_DIR)
endif
.PHONY: ci-image
ci-image: .build-docker