Statistics
| Branch: | Revision:

root / tests / Makefile @ 829309c7

History | View | Annotate | Download (2 kB)

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