]>
Commit | Line | Data |
---|---|---|
c722a9e4 AB |
1 | # -*- Mode: makefile -*- |
2 | # | |
3 | # TCG tests (per-target rules) | |
4 | # | |
e50a6121 | 5 | # This Makefile fragment is included from the per-target |
c722a9e4 AB |
6 | # Makefile.target so will be invoked for each linux-user program we |
7 | # build. We have two options for compiling, either using a configured | |
8 | # guest compiler or calling one of our docker images to do it for us. | |
9 | # | |
10 | ||
11 | # The per ARCH makefile, if it exists, holds extra information about | |
12 | # useful docker images or alternative compiler flags. | |
13 | ||
14 | -include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include | |
15 | -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include | |
16 | ||
17 | GUEST_BUILD= | |
18 | TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile | |
19 | # Support installed Cross Compilers | |
20 | ||
21 | ifdef CROSS_CC_GUEST | |
22 | ||
23 | .PHONY: cross-build-guest-tests | |
24 | cross-build-guest-tests: | |
25 | $(call quiet-command, \ | |
26 | (mkdir -p tests && cd tests && \ | |
27 | $(MAKE) -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \ | |
28 | BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \ | |
29 | EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \ | |
30 | "BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)") | |
31 | ||
32 | GUEST_BUILD=cross-build-guest-tests | |
33 | ||
34 | endif | |
35 | ||
36 | # Support building with Docker | |
37 | ||
38 | ifeq ($(HAVE_USER_DOCKER)$(GUEST_BUILD),y) | |
39 | ifneq ($(DOCKER_IMAGE),) | |
40 | ||
41 | # We also need the Docker make rules to depend on | |
42 | include $(SRC_PATH)/tests/docker/Makefile.include | |
43 | ||
44 | DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \ | |
45 | --cc $(DOCKER_CROSS_COMPILER) \ | |
46 | -i qemu:$(DOCKER_IMAGE) \ | |
47 | -s $(SRC_PATH) -- " | |
48 | DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE) | |
49 | ||
50 | .PHONY: docker-build-guest-tests | |
51 | docker-build-guest-tests: $(DOCKER_PREREQ) | |
52 | $(call quiet-command, \ | |
53 | (mkdir -p tests && cd tests && \ | |
54 | $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \ | |
55 | BUILD_STATIC=y \ | |
56 | EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \ | |
57 | "BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)") | |
58 | ||
59 | GUEST_BUILD=docker-build-guest-tests | |
60 | ||
61 | endif | |
62 | endif | |
63 | ||
64 | # Final targets | |
65 | .PHONY: guest-tests | |
66 | ||
67 | ifneq ($(GUEST_BUILD),) | |
68 | guest-tests: $(GUEST_BUILD) | |
69 | ||
bd15e6e0 | 70 | run-guest-tests: guest-tests qemu-$(subst y,system-,$(CONFIG_SOFTMMU))$(TARGET_NAME) |
c722a9e4 AB |
71 | $(call quiet-command, \ |
72 | (cd tests && $(MAKE) -f $(TCG_MAKE) SPEED=$(SPEED) run), \ | |
73 | "RUN", "tests for $(TARGET_NAME)") | |
74 | ||
75 | else | |
76 | guest-tests: | |
77 | $(call quiet-command, /bin/true, "BUILD", \ | |
78 | "$(TARGET_NAME) guest-tests SKIPPED") | |
79 | ||
80 | run-guest-tests: | |
81 | $(call quiet-command, /bin/true, "RUN", \ | |
82 | "tests for $(TARGET_NAME) SKIPPED") | |
83 | endif | |
84 | ||
85 | # It doesn't matter if these don't exits | |
86 | .PHONY: clean-guest-tests | |
87 | clean-guest-tests: | |
88 | rm -rf tests || echo "no $(TARGET_NAME) tests to remove" |