Statistics
| Branch: | Revision:

root / tests / Makefile @ 5f650495

History | View | Annotate | Download (2.8 kB)

1
-include ../config-host.mak
2
VPATH=$(SRC_PATH)/tests
3

    
4
CFLAGS=-Wall -O2 -g -fno-strict-aliasing
5
#CFLAGS+=-msse2
6
LDFLAGS=
7

    
8
ifeq ($(ARCH),i386)
9
TESTS=linux-test testthread sha1-i386 test-i386
10
endif
11
ifeq ($(ARCH),x86_64)
12
TESTS=test-x86_64
13
endif
14
TESTS+=sha1# test_path
15
#TESTS+=test_path
16
#TESTS+=runcom
17

    
18
QEMU=../i386-linux-user/qemu-i386
19

    
20
all: $(TESTS)
21

    
22
hello-i386: hello-i386.c
23
	$(CC) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
24
	strip $@
25

    
26
testthread: testthread.c
27
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
28

    
29
test_path: test_path.c
30
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
31
	./$@ || { rm $@; exit 1; }
32

    
33
# i386/x86_64 emulation test (test various opcodes) */
34
test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
35
           test-i386.h test-i386-shift.h test-i386-muldiv.h
36
	$(CC) -m32 $(CFLAGS) $(LDFLAGS) -static -o $@ \
37
              $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
38

    
39
test-x86_64: test-i386.c \
40
           test-i386.h test-i386-shift.h test-i386-muldiv.h
41
	$(CC) -m64 $(CFLAGS) $(LDFLAGS) -static -o $@ $(<D)/test-i386.c -lm
42

    
43
ifeq ($(ARCH),i386)
44
test: test-i386
45
	./test-i386 > test-i386.ref
46
else
47
test:
48
endif
49
	$(QEMU) test-i386 > test-i386.out
50
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
51

    
52
.PHONY: test-mmap
53
test-mmap: test-mmap.c
54
	$(CC) $(CFLAGS) -Wall -static -O2 $(LDFLAGS) -o $@ $<
55
	-./test-mmap
56
	-$(QEMU) ./test-mmap
57
	-$(QEMU) -p 8192 ./test-mmap 8192
58
	-$(QEMU) -p 16384 ./test-mmap 16384
59
	-$(QEMU) -p 32768 ./test-mmap 32768
60

    
61
# generic Linux and CPU test
62
linux-test: linux-test.c
63
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
64

    
65
# speed test
66
sha1-i386: sha1.c
67
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
68

    
69
sha1: sha1.c
70
	$(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
71

    
72
speed: sha1 sha1-i386
73
	time ./sha1
74
	time $(QEMU) ./sha1-i386
75

    
76
# vm86 test
77
runcom: runcom.c
78
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
79

    
80
# NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu
81
qruncom: qruncom.c ../ioport-user.c ../i386-user/libqemu.a
82
	$(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user -I../fpu \
83
              -o $@ $(filter %.c, $^) -L../i386-user -lqemu -lm
84

    
85
# arm test
86
hello-arm: hello-arm.o
87
	arm-linux-ld -o $@ $<
88

    
89
hello-arm.o: hello-arm.c
90
	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
91

    
92
test-arm-iwmmxt: test-arm-iwmmxt.s
93
	cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
94

    
95
# MIPS test
96
hello-mips: hello-mips.c
97
	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
98

    
99
hello-mipsel: hello-mips.c
100
	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
101

    
102
# testsuite for the CRIS port.
103
test-cris:
104
	$(MAKE) -C cris check
105

    
106
clean:
107
	rm -f *~ *.o test-i386.out test-i386.ref \
108
           test-x86_64.log test-x86_64.ref qruncom $(TESTS)