Statistics
| Branch: | Revision:

root / tests / tcg / Makefile @ 29b358f9

History | View | Annotate | Download (3.9 kB)

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