Statistics
| Branch: | Revision:

root / tests / Makefile @ 7aaabde7

History | View | Annotate | Download (2.8 kB)

1 8d5f07fa bellard
-include ../config-host.mak
2 7d13299d bellard
3 7aaabde7 bellard
CFLAGS=-Wall -O2 -g -fno-strict-aliasing
4 3b42c979 bellard
#CFLAGS+=-msse2
5 4d1135e4 bellard
LDFLAGS=
6 4d1135e4 bellard
7 7d13299d bellard
ifeq ($(ARCH),i386)
8 9d16dd55 bellard
TESTS=linux-test testthread sha1-i386 test-i386 runcom
9 7d13299d bellard
endif
10 776f2227 bellard
ifeq ($(ARCH),x86_64)
11 776f2227 bellard
TESTS=test-x86_64
12 776f2227 bellard
endif
13 9d16dd55 bellard
TESTS+=sha1# test_path
14 9d16dd55 bellard
#TESTS+=test_path
15 367e86e8 bellard
16 2afbeee7 bellard
QEMU=../i386-linux-user/qemu-i386
17 4d1135e4 bellard
18 4d1135e4 bellard
all: $(TESTS)
19 4d1135e4 bellard
20 144c345d bellard
hello-i386: hello-i386.c
21 4d1135e4 bellard
	$(CC) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
22 144c345d bellard
	strip $@
23 4d1135e4 bellard
24 1b6b029e bellard
testthread: testthread.c
25 1b6b029e bellard
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
26 1b6b029e bellard
27 7fb9a24e bellard
test_path: test_path.c
28 7fb9a24e bellard
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
29 7fb9a24e bellard
	./$@ || { rm $@; exit 1; }
30 7fb9a24e bellard
31 776f2227 bellard
# i386/x86_64 emulation test (test various opcodes) */
32 5132455e bellard
test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
33 e5918247 bellard
           test-i386.h test-i386-shift.h test-i386-muldiv.h
34 776f2227 bellard
	$(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ \
35 776f2227 bellard
              test-i386.c test-i386-code16.S test-i386-vm86.S -lm
36 776f2227 bellard
37 776f2227 bellard
test-x86_64: test-i386.c \
38 776f2227 bellard
           test-i386.h test-i386-shift.h test-i386-muldiv.h
39 776f2227 bellard
	$(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ test-i386.c -lm
40 4d1135e4 bellard
41 04369ff2 bellard
ifeq ($(ARCH),i386)
42 d3032929 bellard
test: test-i386
43 4d1135e4 bellard
	./test-i386 > test-i386.ref
44 d3032929 bellard
else
45 d3032929 bellard
test:
46 04369ff2 bellard
endif
47 3ef693a0 bellard
	$(QEMU) test-i386 > test-i386.out
48 4d1135e4 bellard
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
49 b5075d29 bellard
ifeq ($(ARCH),i386)
50 b5075d29 bellard
	$(QEMU) -no-code-copy test-i386 > test-i386.out
51 b5075d29 bellard
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK (no code copy)"; fi
52 b5075d29 bellard
endif
53 4d1135e4 bellard
54 9d16dd55 bellard
# generic Linux and CPU test
55 9d16dd55 bellard
linux-test: linux-test.c
56 9d16dd55 bellard
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
57 9d16dd55 bellard
58 4d1135e4 bellard
# speed test
59 04369ff2 bellard
sha1-i386: sha1.c
60 4d1135e4 bellard
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
61 4d1135e4 bellard
62 04369ff2 bellard
sha1: sha1.c
63 04369ff2 bellard
	$(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
64 04369ff2 bellard
65 04369ff2 bellard
speed: sha1 sha1-i386
66 4d1135e4 bellard
	time ./sha1
67 3ef693a0 bellard
	time $(QEMU) ./sha1-i386
68 4d1135e4 bellard
69 c3c7c292 bellard
# vm86 test
70 c3c7c292 bellard
runcom: runcom.c
71 c3c7c292 bellard
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
72 c3c7c292 bellard
73 039d3da3 bellard
# NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu
74 039d3da3 bellard
qruncom: qruncom.c ../i386-user/libqemu.a
75 2d7a3b9d bellard
	$(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user -I../fpu \
76 039d3da3 bellard
              -o $@ $< -L../i386-user -lqemu -lm
77 039d3da3 bellard
78 394411ac bellard
# arm test
79 394411ac bellard
hello-arm: hello-arm.o
80 394411ac bellard
	arm-linux-ld -o $@ $<
81 394411ac bellard
82 394411ac bellard
hello-arm.o: hello-arm.c
83 394411ac bellard
	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
84 394411ac bellard
85 18c9b560 balrog
test-arm-iwmmxt: test-arm-iwmmxt.s
86 18c9b560 balrog
	cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
87 18c9b560 balrog
88 e4630047 ths
# MIPS test
89 e4630047 ths
hello-mips: hello-mips.c
90 e4630047 ths
	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
91 e4630047 ths
92 e4630047 ths
hello-mipsel: hello-mips.c
93 e4630047 ths
	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
94 e4630047 ths
95 546cdbd7 bellard
# XXX: find a way to compile easily a test for each arch
96 546cdbd7 bellard
test2:
97 56902eee bellard
	@for arch in i386 arm armeb sparc ppc mips mipsel; do \
98 57be54bb pbrook
           ../$${arch}-linux-user/qemu-$${arch} $${arch}/ls -l linux-test.c ; \
99 546cdbd7 bellard
        done
100 546cdbd7 bellard
101 e7daa605 ths
102 e7daa605 ths
# testsuite for the CRIS port.
103 e7daa605 ths
test-cris:
104 e7daa605 ths
	$(MAKE) -C cris check
105 e7daa605 ths
106 7d13299d bellard
clean:
107 11650e36 bellard
	rm -f *~ *.o test-i386.out test-i386.ref \
108 11650e36 bellard
           test-x86_64.log test-x86_64.ref qruncom $(TESTS)