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