xref: /openbmc/qemu/tests/docker/Makefile.include (revision cf9b6d21)
1324027c2SFam Zheng# Makefile for Docker tests
2324027c2SFam Zheng
36147c249SAlex Bennée.PHONY: docker docker-help docker-test docker-clean docker-image docker-qemu-src
4324027c2SFam Zheng
5660f7930SPaolo BonziniNULL :=
6660f7930SPaolo BonziniSPACE := $(NULL) #
7660f7930SPaolo BonziniCOMMA := ,
8660f7930SPaolo Bonzini
906746324SAlex BennéeHOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m))
1006746324SAlex Bennée
11324027c2SFam ZhengDOCKER_SUFFIX := .docker
12324027c2SFam ZhengDOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
13272e551bSPhilippe Mathieu-Daudé# we don't run tests on intermediate images (used as base by another image)
14ddd5ed83SAlex BennéeDOCKER_PARTIAL_IMAGES := debian10 debian11 debian-bootstrap empty
15ef8f3283SJohn SnowDOCKER_IMAGES := $(sort $(notdir $(basename $(wildcard $(DOCKER_FILES_DIR)/*.docker))))
16324027c2SFam ZhengDOCKER_TARGETS := $(patsubst %,docker-image-%,$(DOCKER_IMAGES))
17324027c2SFam Zheng# Use a global constant ccache directory to speed up repetitive builds
18324027c2SFam ZhengDOCKER_CCACHE_DIR := $$HOME/.cache/qemu-docker-ccache
1934019198SAlex Bennéeifeq ($(HOST_ARCH),x86_64)
2034019198SAlex BennéeDOCKER_DEFAULT_REGISTRY := registry.gitlab.com/qemu-project/qemu
2134019198SAlex Bennéeendif
2234019198SAlex BennéeDOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY))
23324027c2SFam Zheng
24324027c2SFam ZhengDOCKER_TESTS := $(notdir $(shell \
25324027c2SFam Zheng	find $(SRC_PATH)/tests/docker/ -name 'test-*' -type f))
26324027c2SFam Zheng
2705af039dSMarc-André LureauENGINE := auto
2805af039dSMarc-André Lureau
2905af039dSMarc-André LureauDOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py --engine $(ENGINE)
30e27cae26SAlex Bennée
31324027c2SFam ZhengTESTS ?= %
32324027c2SFam ZhengIMAGES ?= %
33324027c2SFam Zheng
34324027c2SFam ZhengCUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
35bc739b8eSPaolo BonziniDOCKER_SRC_COPY := $(BUILD_DIR)/docker-src.$(CUR_TIME)
36324027c2SFam Zheng
37b28ef6b9SPhilippe Mathieu-Daudé.DELETE_ON_ERROR: $(DOCKER_SRC_COPY)
38324027c2SFam Zheng$(DOCKER_SRC_COPY):
39324027c2SFam Zheng	@mkdir $@
4073fb4f1dSFam Zheng	$(if $(SRC_ARCHIVE), \
4173fb4f1dSFam Zheng		$(call quiet-command, cp "$(SRC_ARCHIVE)" $@/qemu.tar, \
4273fb4f1dSFam Zheng			"CP", "$@/qemu.tar"), \
43bc739b8eSPaolo Bonzini		$(call quiet-command, cd $(SRC_PATH) && scripts/archive-source.sh $@/qemu.tar, \
4473fb4f1dSFam Zheng			"GEN", "$@/qemu.tar"))
45324027c2SFam Zheng	$(call quiet-command, cp $(SRC_PATH)/tests/docker/run $@/run, \
460bdb12c7SPeter Maydell		"COPY","RUNNER")
47324027c2SFam Zheng
48324027c2SFam Zhengdocker-qemu-src: $(DOCKER_SRC_COPY)
49324027c2SFam Zheng
50324027c2SFam Zhengdocker-image: ${DOCKER_TARGETS}
51324027c2SFam Zheng
52cff54773SAlex Bennée# General rule for building docker images. If we are a sub-make
53cff54773SAlex Bennée# invoked with SKIP_DOCKER_BUILD we still check the image is up to date
54cff54773SAlex Bennée# though
55cff54773SAlex Bennéeifdef SKIP_DOCKER_BUILD
56cff54773SAlex Bennéedocker-image-%: $(DOCKER_FILES_DIR)/%.docker
57cff54773SAlex Bennée	$(call quiet-command, \
58767b6bd2SAlex Bennée		$(DOCKER_SCRIPT) check --quiet qemu/$* $<, \
59cff54773SAlex Bennée		"CHECK", "$*")
60cff54773SAlex Bennéeelse
61324027c2SFam Zhengdocker-image-%: $(DOCKER_FILES_DIR)/%.docker
62324027c2SFam Zheng	$(call quiet-command,\
63767b6bd2SAlex Bennée		$(DOCKER_SCRIPT) build -t qemu/$* -f $< \
64e6f1306bSAlex Bennée		$(if $V,,--quiet) \
65e6f1306bSAlex Bennée		$(if $(NOCACHE),--no-cache, \
66e6f1306bSAlex Bennée			$(if $(DOCKER_REGISTRY),--registry $(DOCKER_REGISTRY))) \
67414a8ce5SAlex Bennée		$(if $(NOUSER),,--add-current-user) \
684c84f662SPhilippe Mathieu-Daudé		$(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\
69b7c851b2SAlex Bennée		$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
700bdb12c7SPeter Maydell		"BUILD","$*")
71dc338fdbSAlex Bennée
72dc338fdbSAlex Bennée# Special rule for debootstraped binfmt linux-user images
73dc338fdbSAlex Bennéedocker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
74dc338fdbSAlex Bennée	$(if $(EXECUTABLE),,\
75dc338fdbSAlex Bennée		$(error EXECUTABLE not set, debootstrap of debian-$* would fail))
76dc338fdbSAlex Bennée	$(if $(DEB_ARCH),,\
77dc338fdbSAlex Bennée		$(error DEB_ARCH not set, debootstrap of debian-$* would fail))
78dc338fdbSAlex Bennée	$(if $(DEB_TYPE),,\
79dc338fdbSAlex Bennée		$(error DEB_TYPE not set, debootstrap of debian-$* would fail))
8027963460SAlex Bennée	$(if $(wildcard $(EXECUTABLE)),						\
81dc338fdbSAlex Bennée		$(call quiet-command,						\
82dc338fdbSAlex Bennée			DEB_ARCH=$(DEB_ARCH)					\
83dc338fdbSAlex Bennée			DEB_TYPE=$(DEB_TYPE) 					\
844d26c7feSAlex Bennée			$(if $(DEB_URL),DEB_URL=$(DEB_URL),)			\
85182ec060SAlex Bennée			$(DOCKER_SCRIPT) build -t qemu/debian-$* -f $< 		\
86dc338fdbSAlex Bennée			$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) 		\
87dc338fdbSAlex Bennée			$(if $(NOUSER),,--add-current-user) 			\
88dc338fdbSAlex Bennée			$(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))	\
89dc338fdbSAlex Bennée			$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)), \
9019c9a18fSAlex Bennée			"BUILD","binfmt debian-$* (debootstrapped)"),		\
9119c9a18fSAlex Bennée		$(call quiet-command,						\
92767b6bd2SAlex Bennée			$(DOCKER_SCRIPT) check --quiet qemu/debian-$* $< || 	\
93d19f5fc0SAlex Bennée			{ echo "You will need to build $(EXECUTABLE)"; exit 1;},\
9419c9a18fSAlex Bennée			"CHECK", "debian-$* exists"))
95dc338fdbSAlex Bennée
96ddd5ed83SAlex Bennée# These are test targets
97ddd5ed83SAlex BennéeUSER_TCG_TARGETS=$(patsubst %-linux-user,qemu-%,$(filter %-linux-user,$(TARGET_DIRS)))
98ddd5ed83SAlex BennéeEXEC_COPY_TESTS=$(patsubst %,docker-exec-copy-test-%, $(USER_TCG_TARGETS))
99ddd5ed83SAlex Bennée
100ddd5ed83SAlex Bennée$(EXEC_COPY_TESTS): docker-exec-copy-test-%: $(DOCKER_FILES_DIR)/empty.docker
101ddd5ed83SAlex Bennée	$(call quiet-command,							\
102ddd5ed83SAlex Bennée		$(DOCKER_SCRIPT) build -t qemu/exec-copy-test-$* -f $< 		\
103ddd5ed83SAlex Bennée			$(if $V,,--quiet) --no-cache 				\
104ddd5ed83SAlex Bennée			--include-executable=$*					\
105ddd5ed83SAlex Bennée			--skip-binfmt,						\
106ddd5ed83SAlex Bennée			"TEST","copy $* to container")
107ddd5ed83SAlex Bennée	$(call quiet-command,							\
108ddd5ed83SAlex Bennée		$(DOCKER_SCRIPT) run qemu/exec-copy-test-$* 			\
109ddd5ed83SAlex Bennée			/$* -version > tests/docker-exec-copy-test-$*.out,	\
110ddd5ed83SAlex Bennée			"TEST","check $* works in container")
111ddd5ed83SAlex Bennée
112ddd5ed83SAlex Bennéedocker-exec-copy-test: $(EXEC_COPY_TESTS)
113ddd5ed83SAlex Bennée
114cff54773SAlex Bennéeendif
115324027c2SFam Zheng
1169d5e546aSPhilippe Mathieu-Daudé# Enforce dependencies for composite images
11706746324SAlex Bennéeifeq ($(HOST_ARCH),x86_64)
118698a71edSAlex Bennéedocker-image-debian-amd64: docker-image-debian10
119ec22b726SAlex BennéeDOCKER_PARTIAL_IMAGES += debian-amd64-cross
120ec22b726SAlex Bennéeelse
121ec22b726SAlex Bennéedocker-image-debian-amd64-cross: docker-image-debian10
122ec22b726SAlex BennéeDOCKER_PARTIAL_IMAGES += debian-amd64
123ec22b726SAlex Bennéeendif
124409c1c9cSAlex Bennée
125e5389e44SAlex Bennée# For non-x86 hosts not all cross-compilers have been packaged
12606746324SAlex Bennéeifneq ($(HOST_ARCH),x86_64)
127e5389e44SAlex BennéeDOCKER_PARTIAL_IMAGES += debian-mips-cross debian-mipsel-cross debian-mips64el-cross
128e5389e44SAlex BennéeDOCKER_PARTIAL_IMAGES += debian-ppc64el-cross
129e5389e44SAlex BennéeDOCKER_PARTIAL_IMAGES += debian-s390x-cross
130d79f5c8bSDaniel P. BerrangéDOCKER_PARTIAL_IMAGES += fedora
131e5389e44SAlex Bennéeendif
132e5389e44SAlex Bennée
133e3386c27SAlex Bennéedocker-image-debian-alpha-cross: docker-image-debian10
13418b6be43SAlex Bennéedocker-image-debian-arm64-cross: docker-image-debian10
135698a71edSAlex Bennéedocker-image-debian-armel-cross: docker-image-debian10
136698a71edSAlex Bennéedocker-image-debian-armhf-cross: docker-image-debian10
137c268700bSAlex Bennéedocker-image-debian-hppa-cross: docker-image-debian10
13820f8b1a2SAlex Bennéedocker-image-debian-m68k-cross: docker-image-debian10
139698a71edSAlex Bennéedocker-image-debian-mips-cross: docker-image-debian10
1404575a701SAlex Bennéedocker-image-debian-mips64-cross: docker-image-debian10
141698a71edSAlex Bennéedocker-image-debian-mips64el-cross: docker-image-debian10
142698a71edSAlex Bennéedocker-image-debian-mipsel-cross: docker-image-debian10
143698a71edSAlex Bennéedocker-image-debian-ppc64el-cross: docker-image-debian10
144c6e8f512SAlex Bennéedocker-image-debian-riscv64-cross: docker-image-debian10
145698a71edSAlex Bennéedocker-image-debian-s390x-cross: docker-image-debian10
146923984c5SAlex Bennéedocker-image-debian-sh4-cross: docker-image-debian10
14778d1d696SAlex Bennéedocker-image-debian-sparc64-cross: docker-image-debian10
14818b6be43SAlex Bennée
149afbdf0a4SAlessandro Di Federico#
150afbdf0a4SAlessandro Di Federico# The build rule for hexagon-cross is special in so far for most of
151afbdf0a4SAlessandro Di Federico# the time we don't want to build it. While dockers caching does avoid
152afbdf0a4SAlessandro Di Federico# this most of the time sometimes we want to force the issue.
153afbdf0a4SAlessandro Di Federico#
154afbdf0a4SAlessandro Di Federicodocker-image-debian-hexagon-cross: $(DOCKER_FILES_DIR)/debian-hexagon-cross.docker
155afbdf0a4SAlessandro Di Federico	$(if $(NOCACHE), 								\
156afbdf0a4SAlessandro Di Federico		$(call quiet-command,							\
157afbdf0a4SAlessandro Di Federico			$(DOCKER_SCRIPT) build -t qemu/debian-hexagon-cross -f $< 	\
158afbdf0a4SAlessandro Di Federico			$(if $V,,--quiet) --no-cache 					\
159afbdf0a4SAlessandro Di Federico			--registry $(DOCKER_REGISTRY) --extra-files			\
160afbdf0a4SAlessandro Di Federico			$(DOCKER_FILES_DIR)/debian-hexagon-cross.docker.d/build-toolchain.sh, \
161afbdf0a4SAlessandro Di Federico			"BUILD", "debian-hexagon-cross"),				\
162afbdf0a4SAlessandro Di Federico		$(call quiet-command,							\
163afbdf0a4SAlessandro Di Federico			$(DOCKER_SCRIPT) fetch $(if $V,,--quiet)			\
164afbdf0a4SAlessandro Di Federico				qemu/debian-hexagon-cross $(DOCKER_REGISTRY),		\
165afbdf0a4SAlessandro Di Federico			"FETCH", "debian-hexagon-cross")				\
166afbdf0a4SAlessandro Di Federico		$(call quiet-command,							\
167afbdf0a4SAlessandro Di Federico			$(DOCKER_SCRIPT) update $(if $V,,--quiet) 			\
168afbdf0a4SAlessandro Di Federico				qemu/debian-hexagon-cross --add-current-user,		\
169afbdf0a4SAlessandro Di Federico			"PREPARE", "debian-hexagon-cross"))
170afbdf0a4SAlessandro Di Federico
17136dc5fedSPhilippe Mathieu-Daudé# Specialist build images, sometimes very limited tools
172cf63177eSThomas Huthdocker-image-debian-tricore-cross: docker-image-debian10
17327ebeda0SAlex Bennéedocker-image-debian-all-test-cross: docker-image-debian10
174c729a99dSAlex Bennéedocker-image-debian-arm64-test-cross: docker-image-debian11
175*cf9b6d21SMatheus Ferstdocker-image-debian-powerpc-test-cross: docker-image-debian11
17636dc5fedSPhilippe Mathieu-Daudé
17777b08f73SAlex Bennée# These images may be good enough for building tests but not for test builds
178ac276a4bSAlex BennéeDOCKER_PARTIAL_IMAGES += debian-alpha-cross
179c729a99dSAlex BennéeDOCKER_PARTIAL_IMAGES += debian-arm64-test-cross
180*cf9b6d21SMatheus FerstDOCKER_PARTIAL_IMAGES += debian-powerpc-test-cross
181ac276a4bSAlex BennéeDOCKER_PARTIAL_IMAGES += debian-hppa-cross
182ac276a4bSAlex BennéeDOCKER_PARTIAL_IMAGES += debian-m68k-cross debian-mips64-cross
183ac276a4bSAlex BennéeDOCKER_PARTIAL_IMAGES += debian-riscv64-cross
184ac276a4bSAlex BennéeDOCKER_PARTIAL_IMAGES += debian-sh4-cross debian-sparc64-cross
185ac276a4bSAlex BennéeDOCKER_PARTIAL_IMAGES += debian-tricore-cross
186ac276a4bSAlex BennéeDOCKER_PARTIAL_IMAGES += debian-xtensa-cross
187ac276a4bSAlex BennéeDOCKER_PARTIAL_IMAGES += fedora-i386-cross fedora-cris-cross
18877b08f73SAlex Bennée
18919c9a18fSAlex Bennée# Rules for building linux-user powered images
19019c9a18fSAlex Bennée#
19119c9a18fSAlex Bennée# These are slower than using native cross compiler setups but can
19219c9a18fSAlex Bennée# work around issues with poorly working multi-arch systems and broken
19319c9a18fSAlex Bennée# packages.
19419c9a18fSAlex Bennée
195324027c2SFam Zheng# Expand all the pre-requistes for each docker image and test combination
196ef8f3283SJohn Snow$(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES)), \
197d79f5c8bSDaniel P. Berrangé	$(foreach t,$(DOCKER_TESTS), \
198324027c2SFam Zheng		$(eval .PHONY: docker-$t@$i) \
199324027c2SFam Zheng		$(eval docker-$t@$i: docker-image-$i docker-run-$t@$i) \
200324027c2SFam Zheng	) \
201324027c2SFam Zheng	$(foreach t,$(DOCKER_TESTS), \
202ff1a3902SAlex Bennée		$(eval docker-all-tests: docker-$t@$i) \
203ff1a3902SAlex Bennée		$(eval docker-$t: docker-$t@$i) \
204324027c2SFam Zheng	) \
205324027c2SFam Zheng)
206324027c2SFam Zheng
207324027c2SFam Zhengdocker:
20805af039dSMarc-André Lureau	@echo 'Build QEMU and run tests inside Docker or Podman containers'
209324027c2SFam Zheng	@echo
210324027c2SFam Zheng	@echo 'Available targets:'
211324027c2SFam Zheng	@echo
212324027c2SFam Zheng	@echo '    docker:              Print this help.'
213ff1a3902SAlex Bennée	@echo '    docker-all-tests:    Run all image/test combinations.'
21487db9018SWainer dos Santos Moschetta	@echo '    docker-TEST:         Run "TEST" on all image combinations.'
215324027c2SFam Zheng	@echo '    docker-clean:        Kill and remove residual docker testing containers.'
216324027c2SFam Zheng	@echo '    docker-TEST@IMAGE:   Run "TEST" in container "IMAGE".'
217324027c2SFam Zheng	@echo '                         Note: "TEST" is one of the listed test name,'
218324027c2SFam Zheng	@echo '                         or a script name under $$QEMU_SRC/tests/docker/;'
21987db9018SWainer dos Santos Moschetta	@echo '                         "IMAGE" is one of the listed container name.'
220324027c2SFam Zheng	@echo '    docker-image:        Build all images.'
221324027c2SFam Zheng	@echo '    docker-image-IMAGE:  Build image "IMAGE".'
22287db9018SWainer dos Santos Moschetta	@echo '    docker-run:          For manually running a "TEST" with "IMAGE".'
223324027c2SFam Zheng	@echo
224324027c2SFam Zheng	@echo 'Available container images:'
225324027c2SFam Zheng	@echo '    $(DOCKER_IMAGES)'
22619c9a18fSAlex Bennéeifneq ($(DOCKER_USER_IMAGES),)
22719c9a18fSAlex Bennée	@echo
22819c9a18fSAlex Bennée	@echo 'Available linux-user images (docker-binfmt-image-debian-%):'
22919c9a18fSAlex Bennée	@echo '    $(DOCKER_USER_IMAGES)'
23019c9a18fSAlex Bennéeendif
231324027c2SFam Zheng	@echo
232324027c2SFam Zheng	@echo 'Available tests:'
233324027c2SFam Zheng	@echo '    $(DOCKER_TESTS)'
234324027c2SFam Zheng	@echo
235324027c2SFam Zheng	@echo 'Special variables:'
236324027c2SFam Zheng	@echo '    TARGET_LIST=a,b,c    Override target list in builds.'
23735e0f959SFam Zheng	@echo '    EXTRA_CONFIGURE_OPTS="..."'
23835e0f959SFam Zheng	@echo '                         Extra configure options.'
239324027c2SFam Zheng	@echo '    IMAGES="a b c ..":   Filters which images to build or run.'
240324027c2SFam Zheng	@echo '    TESTS="x y z .."     Filters which tests to run (for docker-test).'
241324027c2SFam Zheng	@echo '    J=[0..9]*            Overrides the -jN parameter for make commands'
242324027c2SFam Zheng	@echo '                         (default is 1)'
243324027c2SFam Zheng	@echo '    DEBUG=1              Stop and drop to shell in the created container'
244324027c2SFam Zheng	@echo '                         before running the command.'
2458a2390a4SDaniel P. Berrange	@echo '    NETWORK=1            Enable virtual network interface with default backend.'
2466423795eSPhilippe Mathieu-Daudé	@echo '    NETWORK=$$BACKEND     Enable virtual network interface with $$BACKEND.'
247dc23bbc3SPhilippe Mathieu-Daudé	@echo '    NOUSER=1             Define to disable adding current user to containers passwd.'
248324027c2SFam Zheng	@echo '    NOCACHE=1            Ignore cache when build images.'
249b7c851b2SAlex Bennée	@echo '    EXECUTABLE=<path>    Include executable in image.'
2504c84f662SPhilippe Mathieu-Daudé	@echo '    EXTRA_FILES="<path> [... <path>]"'
2514c84f662SPhilippe Mathieu-Daudé	@echo '                         Include extra files in image.'
25205af039dSMarc-André Lureau	@echo '    ENGINE=auto/docker/podman'
25305af039dSMarc-André Lureau	@echo '                         Specify which container engine to run.'
254e6f1306bSAlex Bennée	@echo '    REGISTRY=url         Cache builds from registry (default:$(DOCKER_REGISTRY))'
255324027c2SFam Zheng
2566147c249SAlex Bennéedocker-help: docker
2576147c249SAlex Bennée
258e86c9a64SAlex Bennée# This rule if for directly running against an arbitrary docker target.
259e86c9a64SAlex Bennée# It is called by the expanded docker targets (e.g. make
260e86c9a64SAlex Bennée# docker-test-foo@bar) which will do additional verification.
261e86c9a64SAlex Bennée#
262e86c9a64SAlex Bennée# For example: make docker-run TEST="test-quick" IMAGE="debian:arm64" EXECUTABLE=./aarch64-linux-user/qemu-aarch64
263e86c9a64SAlex Bennée#
264e86c9a64SAlex Bennéedocker-run: docker-qemu-src
265324027c2SFam Zheng	@mkdir -p "$(DOCKER_CCACHE_DIR)"
266e86c9a64SAlex Bennée	@if test -z "$(IMAGE)" || test -z "$(TEST)"; \
267e86c9a64SAlex Bennée		then echo "Invalid target $(IMAGE)/$(TEST)"; exit 1; \
268324027c2SFam Zheng	fi
269e86c9a64SAlex Bennée	$(if $(EXECUTABLE),						\
270324027c2SFam Zheng		$(call quiet-command,					\
271e27cae26SAlex Bennée			$(DOCKER_SCRIPT) update 			\
2728d628d07SAlex Bennée			$(IMAGE) --executable $(EXECUTABLE),		\
273e86c9a64SAlex Bennée			"  COPYING $(EXECUTABLE) to $(IMAGE)"))
274e86c9a64SAlex Bennée	$(call quiet-command,						\
275e27cae26SAlex Bennée		$(DOCKER_SCRIPT) run 					\
2762461d80eSMarc-André Lureau			$(if $(NOUSER),,--run-as-current-user) 		\
27744707491SFam Zheng			--security-opt seccomp=unconfined		\
2784b2c6bc5SFam Zheng			$(if $(DEBUG),-ti,)				\
2798a2390a4SDaniel P. Berrange			$(if $(NETWORK),$(if $(subst $(NETWORK),,1),--net=$(NETWORK)),--net=none) \
2805609c512SAlex Bennée			-e TARGET_LIST=$(subst $(SPACE),$(COMMA),$(TARGET_LIST))	\
281e86c9a64SAlex Bennée			-e EXTRA_CONFIGURE_OPTS="$(EXTRA_CONFIGURE_OPTS)" \
282e86c9a64SAlex Bennée			-e V=$V -e J=$J -e DEBUG=$(DEBUG)		\
283e86c9a64SAlex Bennée			-e SHOW_ENV=$(SHOW_ENV) 			\
28436ac78e6SFam Zheng			$(if $(NOUSER),,				\
285324027c2SFam Zheng				-e CCACHE_DIR=/var/tmp/ccache 		\
286324027c2SFam Zheng				-v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z \
28736ac78e6SFam Zheng			)						\
28836ac78e6SFam Zheng			-v $$(readlink -e $(DOCKER_SRC_COPY)):/var/tmp/qemu:z$(COMMA)ro \
289e86c9a64SAlex Bennée			$(IMAGE) 					\
290c8158513SFam Zheng			/var/tmp/qemu/run 				\
291e86c9a64SAlex Bennée			$(TEST), "  RUN $(TEST) in ${IMAGE}")
29208c3f6d5SPeter Xu	$(call quiet-command, rm -r $(DOCKER_SRC_COPY), \
29308c3f6d5SPeter Xu		"  CLEANUP $(DOCKER_SRC_COPY)")
294e86c9a64SAlex Bennée
295e86c9a64SAlex Bennée# Run targets:
296e86c9a64SAlex Bennée#
297e86c9a64SAlex Bennée# Of the form docker-TEST-FOO@IMAGE-BAR which will then be expanded into a call to "make docker-run"
298e86c9a64SAlex Bennéedocker-run-%: CMD = $(shell echo '$@' | sed -e 's/docker-run-\([^@]*\)@\(.*\)/\1/')
299e86c9a64SAlex Bennéedocker-run-%: IMAGE = $(shell echo '$@' | sed -e 's/docker-run-\([^@]*\)@\(.*\)/\2/')
300e86c9a64SAlex Bennéedocker-run-%:
301767b6bd2SAlex Bennée	@$(MAKE) docker-run TEST=$(CMD) IMAGE=qemu/$(IMAGE)
302324027c2SFam Zheng
303324027c2SFam Zhengdocker-clean:
304e27cae26SAlex Bennée	$(call quiet-command, $(DOCKER_SCRIPT) clean)
305