[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC 7/7] tests: Move i386 tcg tests to check-tcg
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH RFC 7/7] tests: Move i386 tcg tests to check-tcg |
Date: |
Fri, 8 Sep 2017 17:17:00 +0800 |
Only enable the tests if i386-linux-user is a specified target in
configure, and build the test programs with "docker.py cc" command.
Also change the "diff -u" to "cmp -s" because we have really huge output
to compare.
Signed-off-by: Fam Zheng <address@hidden>
---
tests/tcg/Makefile | 60 -------------------------------------
tests/tcg/Makefile.include | 74 +++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 73 insertions(+), 61 deletions(-)
diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile
index 89e3342f3d..4a2b069304 100644
--- a/tests/tcg/Makefile
+++ b/tests/tcg/Makefile
@@ -17,15 +17,6 @@ LDFLAGS=
# runcom maps page 0, so it requires root privileges
# also, pi_10.com runs indefinitely
-I386_TESTS=hello-i386 \
- linux-test \
- testthread \
- sha1-i386 \
- test-i386 \
- test-i386-fprem \
- test-mmap \
- # runcom
-
# native i386 compilers sometimes are not biarch. assume cross-compilers are
ifneq ($(ARCH),i386)
I386_TESTS+=run-test-x86_64
@@ -46,35 +37,11 @@ test: all
run-%: %
-$(QEMU) ./$*
-run-hello-i386: hello-i386
-run-linux-test: linux-test
-run-testthread: testthread
-run-sha1-i386: sha1-i386
-
-run-test-i386: test-i386
- ./test-i386 > test-i386.ref
- -$(QEMU) test-i386 > test-i386.out
- @if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
-
-run-test-i386-fprem: test-i386-fprem
- ./test-i386-fprem > test-i386-fprem.ref
- -$(QEMU) test-i386-fprem > test-i386-fprem.out
- @if diff -u test-i386-fprem.ref test-i386-fprem.out ; then echo "Auto
Test OK"; fi
-
run-test-x86_64: test-x86_64
./test-x86_64 > test-x86_64.ref
-$(QEMU_X86_64) test-x86_64 > test-x86_64.out
@if diff -u test-x86_64.ref test-x86_64.out ; then echo "Auto Test OK";
fi
-run-test-mmap: test-mmap
- -$(QEMU) ./test-mmap
- -$(QEMU) -p 8192 ./test-mmap 8192
- -$(QEMU) -p 16384 ./test-mmap 16384
- -$(QEMU) -p 32768 ./test-mmap 32768
-
-run-runcom: runcom
- -$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com
-
run-test_path: test_path
./test_path
@@ -84,37 +51,10 @@ test_path: test_path.o
test_path.o: test_path.c
-hello-i386: hello-i386.c
- $(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
- strip $@
-
-testthread: testthread.c
- $(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
-
-# i386/x86_64 emulation test (test various opcodes) */
-test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
- test-i386.h test-i386-shift.h test-i386-muldiv.h
- $(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ \
- $(<D)/test-i386.c $(<D)/test-i386-code16.S
$(<D)/test-i386-vm86.S -lm
-
-test-i386-fprem: test-i386-fprem.c
- $(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $^
-
test-x86_64: test-i386.c \
test-i386.h test-i386-shift.h test-i386-muldiv.h
$(CC_X86_64) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@
$(<D)/test-i386.c -lm
-# generic Linux and CPU test
-linux-test: linux-test.c
- $(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
-
-# vm86 test
-runcom: runcom.c
- $(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
-
-test-mmap: test-mmap.c
- $(CC_I386) -m32 $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $<
-
# speed test
sha1-i386: sha1.c
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
diff --git a/tests/tcg/Makefile.include b/tests/tcg/Makefile.include
index e5fea1c8c5..64f1a4a003 100644
--- a/tests/tcg/Makefile.include
+++ b/tests/tcg/Makefile.include
@@ -1,3 +1,75 @@
-check-tcg:
+TCG_I386_TESTS := \
+ hello-i386 \
+ linux-test \
+ testthread \
+ sha1-i386 \
+ test-i386 \
+ test-i386-fprem \
+ test-mmap \
+ # runcom
+
+$(addprefix tests/tcg/, $(TCG_I386_TESTS)): DOCKER_IMAGE := fedora-i386-cross
+$(addprefix tests/tcg/, $(TCG_I386_TESTS)): CFLAGS := -m32
-I/usr/lib/glib-2.0/include/ -I/usr/include/glib-2.0 -Wall -O2 -g
-fno-strict-aliasing $(QEMU_INCLUDES)
+$(addprefix tests/tcg/, $(TCG_I386_TESTS)): QEMU_CFLAGS :=
+$(addprefix tests/tcg/, $(TCG_I386_TESTS)): LDFLAGS :=
+$(addprefix tests/tcg/, $(TCG_I386_TESTS)): QEMU_LDFLAGS :=
+
+check-tcg-i386: $(addprefix tcg-run-,$(TCG_I386_TESTS))
+$(addprefix tcg-run-,$(TCG_I386_TESTS)): QEMU := i386-linux-user/qemu-i386
+$(addprefix tcg-run-,$(TCG_I386_TESTS)): i386-linux-user/qemu-i386
+
+TCG_SIMPLE_TESTS := \
+ hello-i386 \
+ linux-test \
+ testthread \
+ sha1-i386
+
+$(foreach t,$(TCG_SIMPLE_TESTS), \
+ $(eval tcg-run-$t: tcg-runsimple-$t))
+
+tcg-runsimple-%: tests/tcg/%$(EXESUF)
+ -$(QEMU) $<
+
+TCG_CMP_TESTS := \
+ test-i386 \
+ test-i386-fprem
+
+$(foreach t,$(TCG_CMP_TESTS), \
+ $(eval tcg-run-$t: tcg-runcmp-$t))
+
+tcg-runcmp-%: tests/tcg/%$(EXESUF)
+ $< > $<.ref
+ -$(QEMU) $< > $<.out
+ @if cmp -s $<.ref $<.out ; then echo "Auto Test OK"; fi
+
+tcg-run-test-mmap: tests/tcg/test-mmap
+ -$(QEMU) $<
+ -$(QEMU) -p 8192 $< 8192
+ -$(QEMU) -p 16384 $< 16384
+ -$(QEMU) -p 32768 $< 32768
+
+tcg-run-runcom: tests/tcg/runcom
+ -$(QEMU) $< $(SRC_PATH)/tests/tcg/pi_10.com
+
+TCG_TESTS = $(if $(filter i386-linux-user, $(TARGET_LIST)), $(TCG_I386_TESTS))
+
+$(addprefix tests/tcg/, $(TCG_TESTS)): CXX :=
+$(addprefix tests/tcg/, $(TCG_TESTS)): CC := \
+ $(SRC_PATH)/tests/docker/docker.py cc -i qemu:$(DOCKER_IMAGE) -s
$(SRC_PATH) --
+
+tests/tcg/hello-i386: LDFLAGS := -nostdlib
+
+tests/tcg/sha1-i386: tests/tcg/sha1.o
+ $(call LINK, $^)
+
+tests/tcg/test-i386: $(addprefix $(SRC_PATH)/tests/tcg/, \
+ test-i386.c test-i386-code16.S test-i386-vm86.S \
+ test-i386.h test-i386-shift.h test-i386-muldiv.h)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
+ $(<D)/test-i386.c $(<D)/test-i386-code16.S
$(<D)/test-i386-vm86.S -lm
+
+.PHONY: check-tcg $(patsubst %,run-%,$(TCG_TESTS))
+
+check-tcg: $(addprefix tcg-run-, $(TCG_TESTS))
$(MAKE) -C tests/tcg test
--
2.13.5
- [Qemu-devel] [PATCH RFC 0/7] Proof of concept to power up "make test" with docker, Fam Zheng, 2017/09/08
- [Qemu-devel] [PATCH RFC 1/7] Makefile: Rename TARGET_DIRS to TARGET_LIST, Fam Zheng, 2017/09/08
- [Qemu-devel] [PATCH RFC 2/7] docker: Add "cc" subcommand, Fam Zheng, 2017/09/08
- [Qemu-devel] [PATCH RFC 3/7] docker: Add fedora-i386-cross image, Fam Zheng, 2017/09/08
- [Qemu-devel] [PATCH RFC 4/7] tests: Build fix for hello-i386, Fam Zheng, 2017/09/08
- [Qemu-devel] [PATCH RFC 5/7] tests: Build fix for linux-test, Fam Zheng, 2017/09/08
- [Qemu-devel] [PATCH RFC 6/7] buildsys: Add "check-tcg" target, Fam Zheng, 2017/09/08
- [Qemu-devel] [PATCH RFC 7/7] tests: Move i386 tcg tests to check-tcg,
Fam Zheng <=
- Re: [Qemu-devel] [PATCH RFC 0/7] Proof of concept to power up "make test" with docker, no-reply, 2017/09/08