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