Statistics
| Branch: | Revision:

root / tests / tcg / Makefile @ c09015dd

History | View | Annotate | Download (3.5 kB)

1 8d5f07fa bellard
-include ../config-host.mak
2 9517a9e6 Paolo Bonzini
-include $(SRC_PATH)/rules.mak
3 076d2471 Paolo Bonzini
4 076d2471 Paolo Bonzini
$(call set-vpath, $(SRC_PATH)/tests)
5 7d13299d bellard
6 2b2e59e6 Paolo Bonzini
QEMU=../i386-linux-user/qemu-i386
7 2b2e59e6 Paolo Bonzini
QEMU_X86_64=../x86_64-linux-user/qemu-x86_64
8 2b2e59e6 Paolo Bonzini
CC_X86_64=$(CC_I386) -m64
9 2b2e59e6 Paolo Bonzini
10 f9728943 Paolo Bonzini
QEMU_INCLUDES += -I..
11 f9728943 Paolo Bonzini
CFLAGS=-Wall -O2 -g -fno-strict-aliasing
12 3b42c979 bellard
#CFLAGS+=-msse2
13 4d1135e4 bellard
LDFLAGS=
14 4d1135e4 bellard
15 2b2e59e6 Paolo Bonzini
# TODO: automatically detect ARM and MIPS compilers, and run those too
16 2b2e59e6 Paolo Bonzini
17 2b2e59e6 Paolo Bonzini
# runcom maps page 0, so it requires root privileges
18 2b2e59e6 Paolo Bonzini
# also, pi_10.com runs indefinitely
19 2b2e59e6 Paolo Bonzini
20 2b2e59e6 Paolo Bonzini
I386_TESTS=hello-i386 \
21 2b2e59e6 Paolo Bonzini
	   linux-test \
22 2b2e59e6 Paolo Bonzini
	   testthread \
23 2b2e59e6 Paolo Bonzini
	   sha1-i386 \
24 2b2e59e6 Paolo Bonzini
	   test-i386 \
25 2b2e59e6 Paolo Bonzini
	   test-mmap \
26 2b2e59e6 Paolo Bonzini
	   # runcom
27 2b2e59e6 Paolo Bonzini
28 2b2e59e6 Paolo Bonzini
# native i386 compilers sometimes are not biarch.  assume cross-compilers are
29 2b2e59e6 Paolo Bonzini
ifneq ($(ARCH),i386)
30 2b2e59e6 Paolo Bonzini
I386_TESTS+=run-test-x86_64
31 7d13299d bellard
endif
32 2b2e59e6 Paolo Bonzini
33 2b2e59e6 Paolo Bonzini
TESTS = test_path
34 2b2e59e6 Paolo Bonzini
ifneq ($(call find-in-path, $(CC_I386)),)
35 2b2e59e6 Paolo Bonzini
TESTS += $(I386_TESTS)
36 776f2227 bellard
endif
37 367e86e8 bellard
38 2b2e59e6 Paolo Bonzini
all: $(patsubst %,run-%,$(TESTS))
39 2b2e59e6 Paolo Bonzini
40 2b2e59e6 Paolo Bonzini
# rules to run tests
41 2b2e59e6 Paolo Bonzini
42 2b2e59e6 Paolo Bonzini
.PHONY: $(patsubst %,run-%,$(TESTS))
43 2b2e59e6 Paolo Bonzini
44 2b2e59e6 Paolo Bonzini
run-%: %
45 2b2e59e6 Paolo Bonzini
	-$(QEMU) ./$*
46 2b2e59e6 Paolo Bonzini
47 2b2e59e6 Paolo Bonzini
run-hello-i386: hello-i386
48 2b2e59e6 Paolo Bonzini
run-linux-test: linux-test
49 2b2e59e6 Paolo Bonzini
run-testthread: testthread
50 2b2e59e6 Paolo Bonzini
run-sha1-i386: sha1-i386
51 2b2e59e6 Paolo Bonzini
52 2b2e59e6 Paolo Bonzini
run-test-i386: test-i386
53 2b2e59e6 Paolo Bonzini
	./test-i386 > test-i386.ref
54 2b2e59e6 Paolo Bonzini
	-$(QEMU) test-i386 > test-i386.out
55 2b2e59e6 Paolo Bonzini
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
56 2b2e59e6 Paolo Bonzini
57 2b2e59e6 Paolo Bonzini
run-test-x86_64: test-x86_64
58 2b2e59e6 Paolo Bonzini
	./test-x86_64 > test-x86_64.ref
59 2b2e59e6 Paolo Bonzini
	-$(QEMU_X86_64) test-x86_64 > test-x86_64.out
60 2b2e59e6 Paolo Bonzini
	@if diff -u test-x86_64.ref test-x86_64.out ; then echo "Auto Test OK"; fi
61 2b2e59e6 Paolo Bonzini
62 2b2e59e6 Paolo Bonzini
run-test-mmap: test-mmap
63 2b2e59e6 Paolo Bonzini
	-$(QEMU) ./test-mmap
64 2b2e59e6 Paolo Bonzini
	-$(QEMU) -p 8192 ./test-mmap 8192
65 2b2e59e6 Paolo Bonzini
	-$(QEMU) -p 16384 ./test-mmap 16384
66 2b2e59e6 Paolo Bonzini
	-$(QEMU) -p 32768 ./test-mmap 32768
67 2b2e59e6 Paolo Bonzini
68 2b2e59e6 Paolo Bonzini
run-runcom: runcom
69 2b2e59e6 Paolo Bonzini
	-$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com
70 2b2e59e6 Paolo Bonzini
71 2b2e59e6 Paolo Bonzini
run-test_path: test_path
72 2b2e59e6 Paolo Bonzini
	./test_path
73 2b2e59e6 Paolo Bonzini
74 2b2e59e6 Paolo Bonzini
# rules to compile tests
75 4d1135e4 bellard
76 2b2e59e6 Paolo Bonzini
test_path: test_path.o
77 2b2e59e6 Paolo Bonzini
test_path.o: test_path.c
78 4d1135e4 bellard
79 144c345d bellard
hello-i386: hello-i386.c
80 2b2e59e6 Paolo Bonzini
	$(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
81 144c345d bellard
	strip $@
82 4d1135e4 bellard
83 1b6b029e bellard
testthread: testthread.c
84 2b2e59e6 Paolo Bonzini
	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
85 7fb9a24e bellard
86 776f2227 bellard
# i386/x86_64 emulation test (test various opcodes) */
87 5132455e bellard
test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
88 e5918247 bellard
           test-i386.h test-i386-shift.h test-i386-muldiv.h
89 2b2e59e6 Paolo Bonzini
	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ \
90 e5fd43a9 malc
              $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
91 776f2227 bellard
92 776f2227 bellard
test-x86_64: test-i386.c \
93 776f2227 bellard
           test-i386.h test-i386-shift.h test-i386-muldiv.h
94 2b2e59e6 Paolo Bonzini
	$(CC_X86_64) $(CFLAGS) $(LDFLAGS) -o $@ $(<D)/test-i386.c -lm
95 e1ffb0f1 edgar_igl
96 9d16dd55 bellard
# generic Linux and CPU test
97 9d16dd55 bellard
linux-test: linux-test.c
98 2b2e59e6 Paolo Bonzini
	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
99 2b2e59e6 Paolo Bonzini
100 2b2e59e6 Paolo Bonzini
# vm86 test
101 2b2e59e6 Paolo Bonzini
runcom: runcom.c
102 2b2e59e6 Paolo Bonzini
	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
103 2b2e59e6 Paolo Bonzini
104 2b2e59e6 Paolo Bonzini
test-mmap: test-mmap.c
105 2b2e59e6 Paolo Bonzini
	$(CC_I386) -m32 $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $<
106 9d16dd55 bellard
107 4d1135e4 bellard
# speed test
108 04369ff2 bellard
sha1-i386: sha1.c
109 2b2e59e6 Paolo Bonzini
	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
110 4d1135e4 bellard
111 04369ff2 bellard
sha1: sha1.c
112 2b2e59e6 Paolo Bonzini
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
113 04369ff2 bellard
114 04369ff2 bellard
speed: sha1 sha1-i386
115 4d1135e4 bellard
	time ./sha1
116 3ef693a0 bellard
	time $(QEMU) ./sha1-i386
117 4d1135e4 bellard
118 394411ac bellard
# arm test
119 394411ac bellard
hello-arm: hello-arm.o
120 394411ac bellard
	arm-linux-ld -o $@ $<
121 394411ac bellard
122 394411ac bellard
hello-arm.o: hello-arm.c
123 394411ac bellard
	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
124 394411ac bellard
125 18c9b560 balrog
test-arm-iwmmxt: test-arm-iwmmxt.s
126 18c9b560 balrog
	cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
127 18c9b560 balrog
128 e4630047 ths
# MIPS test
129 e4630047 ths
hello-mips: hello-mips.c
130 e4630047 ths
	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
131 e4630047 ths
132 e4630047 ths
hello-mipsel: hello-mips.c
133 e4630047 ths
	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
134 e4630047 ths
135 e7daa605 ths
# testsuite for the CRIS port.
136 e7daa605 ths
test-cris:
137 e7daa605 ths
	$(MAKE) -C cris check
138 e7daa605 ths
139 d65f0831 Michael Walle
# testsuite for the LM32 port.
140 d65f0831 Michael Walle
test-lm32:
141 d65f0831 Michael Walle
	$(MAKE) -C lm32 check
142 d65f0831 Michael Walle
143 7d13299d bellard
clean:
144 11650e36 bellard
	rm -f *~ *.o test-i386.out test-i386.ref \
145 11650e36 bellard
           test-x86_64.log test-x86_64.ref qruncom $(TESTS)