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
1 changed files with 12 additions and 2 deletions

View File

@ -4,12 +4,17 @@ CONTAINER_OPTS := --security-opt $(shell grep -q selinux /sys/kernel/security/ls
CONTAINER_CONFIG_DIR := testing/containers/ceph CONTAINER_CONFIG_DIR := testing/containers/ceph
VOLUME_FLAGS := VOLUME_FLAGS :=
CEPH_VERSION := nautilus CEPH_VERSION := nautilus
RESULTS_DIR :=
SELINUX := $(shell getenforce 2>/dev/null) SELINUX := $(shell getenforce 2>/dev/null)
ifeq ($(SELINUX),Enforcing) ifeq ($(SELINUX),Enforcing)
VOLUME_FLAGS = :z VOLUME_FLAGS = :z
endif endif
ifdef RESULTS_DIR
RESULTS_VOLUME := -v $(RESULTS_DIR):/results$(VOLUME_FLAGS)
endif
build: build:
go build -v -tags $(CEPH_VERSION) $(shell go list ./... | grep -v /contrib) go build -v -tags $(CEPH_VERSION) $(shell go list ./... | grep -v /contrib)
fmt: fmt:
@ -19,8 +24,13 @@ test:
.PHONY: test-docker test-container .PHONY: test-docker test-container
test-docker: test-container test-docker: test-container
test-container: check-ceph-version .build-docker 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) $(DOCKER_CI_IMAGE) $(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 .PHONY: ci-image
ci-image: .build-docker ci-image: .build-docker