Statistics
| Branch: | Revision:

root / tests / Makefile @ 5439779e

History | View | Annotate | Download (2.8 kB)

1
-include ../config-host.mak
2

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

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

    
16
QEMU=../i386-linux-user/qemu-i386
17

    
18
all: $(TESTS)
19

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

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

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

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

    
37
test-x86_64: test-i386.c \
38
           test-i386.h test-i386-shift.h test-i386-muldiv.h
39
	$(CC) -m64 $(CFLAGS) $(LDFLAGS) -static -o $@ test-i386.c -lm
40

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

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

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

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

    
71
sha1: sha1.c
72
	$(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
73

    
74
speed: sha1 sha1-i386
75
	time ./sha1
76
	time $(QEMU) ./sha1-i386
77

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

    
82
# NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu
83
qruncom: qruncom.c ../i386-user/libqemu.a
84
	$(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user -I../fpu \
85
              -o $@ $< -L../i386-user -lqemu -lm
86

    
87
# arm test
88
hello-arm: hello-arm.o
89
	arm-linux-ld -o $@ $<
90

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

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

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

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

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

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