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