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