]> Git Repo - qemu.git/blame - tests/tcg/Makefile
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-request...
[qemu.git] / tests / tcg / Makefile
CommitLineData
7e97017e
AB
1# -*- Mode: makefile -*-
2#
3# TCG tests
4#
5# These are complicated by the fact we want to build them for guest
6# systems. This requires knowing what guests we are building and which
7# ones we have cross-compilers for or docker images with
8# cross-compilers.
9#
10# The tests themselves should be as minimal as possible as
11# cross-compilers don't always have a large amount of libraries
12# available.
13#
14# We only include the host build system for SRC_PATH and we don't
15# bother with the common rules.mk. We expect the following:
16#
17# CC - the C compiler command
18# EXTRA_CFLAGS - any extra CFLAGS
19# BUILD_STATIC - are we building static binaries
20#
21# By default all tests are statically compiled but some host systems
22# may not package static libraries by default. If an external
23# cross-compiler can only build dynamic libraries the user might need
24# to make extra efforts to ensure ld.so can link at runtime when the
25# tests are run.
26#
27# We also accept SPEED=slow to enable slower running tests
28#
29# We also expect to be in the tests build dir for the FOO-linux-user.
30#
31
f62cb1b6 32-include ../../config-host.mak
7e97017e 33-include ../config-target.mak
076d2471 34
7e97017e 35quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
7d13299d 36
607bf9b5
AB
37# $1 = test name, $2 = cmd, $3 = desc
38run-test = $(call quiet-command, timeout $(TIMEOUT) $2 > $1.out,"TEST",$3)
39
40# $1 = test name, $2 = reference
41diff-out = $(call quiet-command, diff -u $1.out $2 | head -n 10,"DIFF","$1.out with $2")
42
43# $1 = test name, $2 = reason
44skip-test = @printf " SKIPPED %s on $(TARGET_NAME) because %s\n" $1 $2
45
7e97017e
AB
46# Tests we are building
47TESTS=
2b2e59e6 48
7e97017e
AB
49# Start with a blank slate, the build targets get to add stuff first
50CFLAGS=
51QEMU_CFLAGS=
4d1135e4
FB
52LDFLAGS=
53
7e97017e
AB
54# The QEMU for this TARGET
55QEMU=../qemu-$(TARGET_NAME)
2b2e59e6 56
7e97017e
AB
57# If TCG debugging is enabled things are a lot slower
58ifeq ($(CONFIG_DEBUG_TCG),y)
59TIMEOUT=45
60else
61TIMEOUT=15
7d13299d 62endif
2b2e59e6 63
7e97017e
AB
64# The order we include is important. We include multiarch, base arch
65# and finally arch if it's not the same as base arch.
66-include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target
67-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.target
68ifneq ($(TARGET_BASE_ARCH),$(TARGET_NAME))
69-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
776f2227 70endif
367e86e8 71
7e97017e
AB
72# Add the common build options
73CFLAGS+=-Wall -O0 -g -fno-strict-aliasing
74ifeq ($(BUILD_STATIC),y)
75LDFLAGS+=-static
76endif
394411ac 77
7e97017e
AB
78%: %.c
79 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
394411ac 80
7e97017e 81all: $(TESTS)
18c9b560 82
7e97017e
AB
83#
84# Test Runners
85#
86# By default we just run the test with the appropriate QEMU for the
87# target. More advanced tests may want to override the runner in their
88# specific make rules. Additional runners for the same binary should
89# be added to EXTRA_RUNS.
90#
e4630047 91
7e97017e
AB
92RUN_TESTS=$(patsubst %,run-%, $(TESTS))
93RUN_TESTS+=$(EXTRA_RUNS)
e4630047 94
7e97017e 95run-%: %
607bf9b5 96 $(call run-test, $<, $(QEMU) $<, "$< on $(TARGET_NAME)")
e7daa605 97
7e97017e
AB
98.PHONY: run
99run: $(RUN_TESTS)
d65f0831 100
7e97017e 101# There is no clean target, the calling make just rm's the tests build dir
This page took 0.939936 seconds and 4 git commands to generate.