Statistics
| Branch: | Revision:

root / tests / Makefile @ d0ecd2aa

History | View | Annotate | Download (2.3 kB)

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