File:  [Qemu by Fabrice Bellard] / qemu / tests / Makefile
Revision 1.1.1.10 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 18:57:14 2018 UTC (3 years, 3 months ago) by root
Branches: qemu, MAIN
CVS tags: qemu1001, qemu1000, qemu0151, HEAD
qemu 0.15.1

    1: -include ../config-host.mak
    2: -include $(SRC_PATH)/rules.mak
    3: 
    4: $(call set-vpath, $(SRC_PATH)/tests)
    5: 
    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
    9: 
   10: QEMU_INCLUDES += -I..
   11: CFLAGS=-Wall -O2 -g -fno-strict-aliasing
   12: #CFLAGS+=-msse2
   13: LDFLAGS=
   14: 
   15: # TODO: automatically detect ARM and MIPS compilers, and run those too
   16: 
   17: # runcom maps page 0, so it requires root privileges
   18: # also, pi_10.com runs indefinitely
   19: 
   20: I386_TESTS=hello-i386 \
   21: 	   linux-test \
   22: 	   testthread \
   23: 	   sha1-i386 \
   24: 	   test-i386 \
   25: 	   test-mmap \
   26: 	   # runcom
   27: 
   28: # native i386 compilers sometimes are not biarch.  assume cross-compilers are
   29: ifneq ($(ARCH),i386)
   30: I386_TESTS+=run-test-x86_64
   31: endif
   32: 
   33: TESTS = test_path
   34: ifneq ($(call find-in-path, $(CC_I386)),)
   35: TESTS += $(I386_TESTS)
   36: endif
   37: 
   38: all: $(patsubst %,run-%,$(TESTS))
   39: 
   40: # rules to run tests
   41: 
   42: .PHONY: $(patsubst %,run-%,$(TESTS))
   43: 
   44: run-%: %
   45: 	-$(QEMU) ./$*
   46: 
   47: run-hello-i386: hello-i386
   48: run-linux-test: linux-test
   49: run-testthread: testthread
   50: run-sha1-i386: sha1-i386
   51: 
   52: run-test-i386: test-i386
   53: 	./test-i386 > test-i386.ref
   54: 	-$(QEMU) test-i386 > test-i386.out
   55: 	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
   56: 
   57: run-test-x86_64: test-x86_64
   58: 	./test-x86_64 > test-x86_64.ref
   59: 	-$(QEMU_X86_64) test-x86_64 > test-x86_64.out
   60: 	@if diff -u test-x86_64.ref test-x86_64.out ; then echo "Auto Test OK"; fi
   61: 
   62: run-test-mmap: test-mmap
   63: 	-$(QEMU) ./test-mmap
   64: 	-$(QEMU) -p 8192 ./test-mmap 8192
   65: 	-$(QEMU) -p 16384 ./test-mmap 16384
   66: 	-$(QEMU) -p 32768 ./test-mmap 32768
   67: 
   68: run-runcom: runcom
   69: 	-$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com
   70: 
   71: run-test_path: test_path
   72: 	./test_path
   73: 
   74: # rules to compile tests
   75: 
   76: test_path: test_path.o
   77: test_path.o: test_path.c
   78: 
   79: hello-i386: hello-i386.c
   80: 	$(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
   81: 	strip $@
   82: 
   83: testthread: testthread.c
   84: 	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
   85: 
   86: # i386/x86_64 emulation test (test various opcodes) */
   87: test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
   88:            test-i386.h test-i386-shift.h test-i386-muldiv.h
   89: 	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ \
   90:               $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
   91: 
   92: test-x86_64: test-i386.c \
   93:            test-i386.h test-i386-shift.h test-i386-muldiv.h
   94: 	$(CC_X86_64) $(CFLAGS) $(LDFLAGS) -o $@ $(<D)/test-i386.c -lm
   95: 
   96: # generic Linux and CPU test
   97: linux-test: linux-test.c
   98: 	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
   99: 
  100: # vm86 test
  101: runcom: runcom.c
  102: 	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
  103: 
  104: test-mmap: test-mmap.c
  105: 	$(CC_I386) -m32 $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $<
  106: 
  107: # speed test
  108: sha1-i386: sha1.c
  109: 	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
  110: 
  111: sha1: sha1.c
  112: 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
  113: 
  114: speed: sha1 sha1-i386
  115: 	time ./sha1
  116: 	time $(QEMU) ./sha1-i386
  117: 
  118: # broken test
  119: # NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu
  120: qruncom: qruncom.c ../ioport-user.c ../i386-user/libqemu.a
  121: 	$(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user -I../fpu \
  122:               -o $@ $(filter %.c, $^) -L../i386-user -lqemu -lm
  123: 
  124: # arm test
  125: hello-arm: hello-arm.o
  126: 	arm-linux-ld -o $@ $<
  127: 
  128: hello-arm.o: hello-arm.c
  129: 	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
  130: 
  131: test-arm-iwmmxt: test-arm-iwmmxt.s
  132: 	cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
  133: 
  134: # MIPS test
  135: hello-mips: hello-mips.c
  136: 	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
  137: 
  138: hello-mipsel: hello-mips.c
  139: 	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
  140: 
  141: # testsuite for the CRIS port.
  142: test-cris:
  143: 	$(MAKE) -C cris check
  144: 
  145: # testsuite for the LM32 port.
  146: test-lm32:
  147: 	$(MAKE) -C lm32 check
  148: 
  149: clean:
  150: 	rm -f *~ *.o test-i386.out test-i386.ref \
  151:            test-x86_64.log test-x86_64.ref qruncom $(TESTS)

unix.superglobalmegacorp.com