1 -include ..
/config-host.mak
2 -include $(SRC_PATH
)/rules.mak
4 $(call set-vpath
, $(SRC_PATH
)/tests
)
6 QEMU
=..
/i386-linux-user
/qemu-i386
7 QEMU_X86_64
=..
/x86_64-linux-user
/qemu-x86_64
8 CC_X86_64
=$(CC_I386
) -m64
10 CFLAGS
=-Wall
-O2
-g
-fno-strict-aliasing
-I..
14 # TODO: automatically detect ARM and MIPS compilers, and run those too
16 # runcom maps page 0, so it requires root privileges
17 # also, pi_10.com runs indefinitely
19 I386_TESTS
=hello-i386 \
27 # native i386 compilers sometimes are not biarch. assume cross-compilers are
29 I386_TESTS
+=run-test-x86_64
33 ifneq ($(call find-in-path
, $(CC_I386
)),)
34 TESTS
+= $(I386_TESTS
)
37 all: $(patsubst %,run-
%,$(TESTS
))
41 .PHONY
: $(patsubst %,run-
%,$(TESTS
))
46 run-hello-i386
: hello-i386
47 run-linux-test
: linux-test
48 run-testthread
: testthread
49 run-sha1-i386
: sha1-i386
51 run-test-i386
: test-i386
52 .
/test-i386
> test-i386.ref
53 -$(QEMU
) test-i386
> test-i386.out
54 @if diff
-u test-i386.ref test-i386.out
; then echo
"Auto Test OK"; fi
56 run-test-x86_64
: test-x86_64
57 .
/test-x86_64
> test-x86_64.ref
58 -$(QEMU_X86_64
) test-x86_64
> test-x86_64.out
59 @if diff
-u test-x86_64.ref test-x86_64.out
; then echo
"Auto Test OK"; fi
61 run-test-mmap
: test-mmap
63 -$(QEMU
) -p
8192 .
/test-mmap
8192
64 -$(QEMU
) -p
16384 .
/test-mmap
16384
65 -$(QEMU
) -p
32768 .
/test-mmap
32768
68 -$(QEMU
) .
/runcom
$(SRC_PATH
)/tests
/pi_10.com
70 run-test_path
: test_path
73 # rules to compile tests
75 test_path
: test_path.o
76 test_path.o
: test_path.c
78 hello-i386
: hello-i386.c
79 $(CC_I386
) -nostdlib
$(CFLAGS
) -static
$(LDFLAGS
) -o
$@
$<
82 testthread
: testthread.c
83 $(CC_I386
) $(CFLAGS
) $(LDFLAGS
) -o
$@
$< -lpthread
85 # i386/x86_64 emulation test (test various opcodes) */
86 test-i386
: test-i386.c test-i386-code16.S test-i386-vm86.S \
87 test-i386.h test-i386-shift.h test-i386-muldiv.h
88 $(CC_I386
) $(CFLAGS
) $(LDFLAGS
) -o
$@ \
89 $(<D
)/test-i386.c
$(<D
)/test-i386-code16.S
$(<D
)/test-i386-vm86.S
-lm
91 test-x86_64
: test-i386.c \
92 test-i386.h test-i386-shift.h test-i386-muldiv.h
93 $(CC_X86_64
) $(CFLAGS
) $(LDFLAGS
) -o
$@
$(<D
)/test-i386.c
-lm
95 # generic Linux and CPU test
96 linux-test
: linux-test.c
97 $(CC_I386
) $(CFLAGS
) $(LDFLAGS
) -o
$@
$< -lm
101 $(CC_I386
) $(CFLAGS
) $(LDFLAGS
) -o
$@
$<
103 test-mmap
: test-mmap.c
104 $(CC_I386
) -m32
$(CFLAGS
) -Wall
-O2
$(LDFLAGS
) -o
$@
$<
108 $(CC_I386
) $(CFLAGS
) $(LDFLAGS
) -o
$@
$<
111 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o
$@
$<
113 speed
: sha1 sha1-i386
115 time
$(QEMU
) .
/sha1-i386
118 # NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu
119 qruncom
: qruncom.c ..
/ioport-user.c ..
/i386-user
/libqemu.a
120 $(CC
) $(CFLAGS
) -fomit-frame-pointer
$(LDFLAGS
) -I..
/target-i386
-I..
-I..
/i386-user
-I..
/fpu \
121 -o
$@
$(filter %.c
, $^
) -L..
/i386-user
-lqemu
-lm
124 hello-arm
: hello-arm.o
125 arm-linux-ld
-o
$@
$<
127 hello-arm.o
: hello-arm.c
128 arm-linux-gcc
-Wall
-g
-O2
-c
-o
$@
$<
130 test-arm-iwmmxt
: test-arm-iwmmxt.s
131 cpp < $< | arm-linux-gnu-gcc
-Wall
-static
-march
=iwmmxt
-mabi
=aapcs
-x assembler
- -o
$@
134 hello-mips
: hello-mips.c
135 mips-linux-gnu-gcc
-nostdlib
-static
-mno-abicalls
-fno-PIC
-mabi
=32 -Wall
-Wextra
-g
-O2
-o
$@
$<
137 hello-mipsel
: hello-mips.c
138 mipsel-linux-gnu-gcc
-nostdlib
-static
-mno-abicalls
-fno-PIC
-mabi
=32 -Wall
-Wextra
-g
-O2
-o
$@
$<
140 # testsuite for the CRIS port.
142 $(MAKE
) -C cris
check
145 rm -f
*~
*.o test-i386.out test-i386.ref \
146 test-x86_64.log test-x86_64.ref qruncom
$(TESTS
)