Statistics
| Branch: | Revision:

root / tests / Makefile @ 2b2e59e6

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