All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests
@ 2016-08-19 17:00 Pranith Kumar
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 1/4] tests/tcg: Move i386 tests to arch specific folder Pranith Kumar
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Pranith Kumar @ 2016-08-19 17:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, rth, pbonzini, peter.maydell

Hello,

This RFC patch series cleans up the tcg tests in tests/tcg folder.

The tests have bit-rotten and were not compiling or running. I fixed
the Makefiles to make them compile though there are tests which do not
pass. I plan to fix them if you think this approach is reasonable.

The motivation is to add litmus tests to each arch and have them run
using the 'make check' target to test consistency on TCG.

There are no maintainers listed for this test folder. So I am cc'ing
people who I think might be interested.

Pranith Kumar (4):
  tests/tcg: Move i386 tests to arch specific folder
  tests/tcg: Move arm tests to arch specific folder
  tcg/tests: Move mips test to arch specific folder
  tests/tcg: Create and populate misc tests for arch independent tests

 tests/tcg/Makefile                      | 156 --------------------------------
 tests/tcg/arm/Makefile                  |  45 +++++++++
 tests/tcg/{ => arm}/hello-arm.c         |   0
 tests/tcg/{ => arm}/test-arm-iwmmxt.s   |   0
 tests/tcg/i386/Makefile                 |  88 ++++++++++++++++++
 tests/tcg/{ => i386}/hello-i386.c       |   0
 tests/tcg/{ => i386}/pi_10.com          | Bin
 tests/tcg/{ => i386}/runcom.c           |   0
 tests/tcg/{ => i386}/test-i386-code16.S |   0
 tests/tcg/{ => i386}/test-i386-fprem.c  |   0
 tests/tcg/{ => i386}/test-i386-muldiv.h |   0
 tests/tcg/{ => i386}/test-i386-shift.h  |   0
 tests/tcg/{ => i386}/test-i386-ssse3.c  |   0
 tests/tcg/{ => i386}/test-i386-vm86.S   |   0
 tests/tcg/{ => i386}/test-i386.c        |   0
 tests/tcg/{ => i386}/test-i386.h        |   0
 tests/tcg/{ => mips}/hello-mips.c       |   0
 tests/tcg/misc/Makefile                 |  75 +++++++++++++++
 tests/tcg/{ => misc}/linux-test.c       |   3 +
 tests/tcg/{ => misc}/sha1.c             |   0
 tests/tcg/{ => misc}/test-mmap.c        |   0
 tests/tcg/{ => misc}/test_path.c        |   0
 tests/tcg/{ => misc}/testthread.c       |   0
 23 files changed, 211 insertions(+), 156 deletions(-)
 delete mode 100644 tests/tcg/Makefile
 create mode 100644 tests/tcg/arm/Makefile
 rename tests/tcg/{ => arm}/hello-arm.c (100%)
 rename tests/tcg/{ => arm}/test-arm-iwmmxt.s (100%)
 create mode 100644 tests/tcg/i386/Makefile
 rename tests/tcg/{ => i386}/hello-i386.c (100%)
 rename tests/tcg/{ => i386}/pi_10.com (100%)
 rename tests/tcg/{ => i386}/runcom.c (100%)
 rename tests/tcg/{ => i386}/test-i386-code16.S (100%)
 rename tests/tcg/{ => i386}/test-i386-fprem.c (100%)
 rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%)
 rename tests/tcg/{ => i386}/test-i386-shift.h (100%)
 rename tests/tcg/{ => i386}/test-i386-ssse3.c (100%)
 rename tests/tcg/{ => i386}/test-i386-vm86.S (100%)
 rename tests/tcg/{ => i386}/test-i386.c (100%)
 rename tests/tcg/{ => i386}/test-i386.h (100%)
 rename tests/tcg/{ => mips}/hello-mips.c (100%)
 create mode 100644 tests/tcg/misc/Makefile
 rename tests/tcg/{ => misc}/linux-test.c (99%)
 rename tests/tcg/{ => misc}/sha1.c (100%)
 rename tests/tcg/{ => misc}/test-mmap.c (100%)
 rename tests/tcg/{ => misc}/test_path.c (100%)
 rename tests/tcg/{ => misc}/testthread.c (100%)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [RFC PATCH 1/4] tests/tcg: Move i386 tests to arch specific folder
  2016-08-19 17:00 [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Pranith Kumar
@ 2016-08-19 17:00 ` Pranith Kumar
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 2/4] tests/tcg: Move arm " Pranith Kumar
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Pranith Kumar @ 2016-08-19 17:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, rth, pbonzini, peter.maydell

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 tests/tcg/Makefile                      | 156 --------------------------------
 tests/tcg/i386/Makefile                 |  88 ++++++++++++++++++
 tests/tcg/{ => i386}/hello-i386.c       |   0
 tests/tcg/{ => i386}/pi_10.com          | Bin
 tests/tcg/{ => i386}/runcom.c           |   0
 tests/tcg/{ => i386}/test-i386-code16.S |   0
 tests/tcg/{ => i386}/test-i386-fprem.c  |   0
 tests/tcg/{ => i386}/test-i386-muldiv.h |   0
 tests/tcg/{ => i386}/test-i386-shift.h  |   0
 tests/tcg/{ => i386}/test-i386-ssse3.c  |   0
 tests/tcg/{ => i386}/test-i386-vm86.S   |   0
 tests/tcg/{ => i386}/test-i386.c        |   0
 tests/tcg/{ => i386}/test-i386.h        |   0
 13 files changed, 88 insertions(+), 156 deletions(-)
 delete mode 100644 tests/tcg/Makefile
 create mode 100644 tests/tcg/i386/Makefile
 rename tests/tcg/{ => i386}/hello-i386.c (100%)
 rename tests/tcg/{ => i386}/pi_10.com (100%)
 rename tests/tcg/{ => i386}/runcom.c (100%)
 rename tests/tcg/{ => i386}/test-i386-code16.S (100%)
 rename tests/tcg/{ => i386}/test-i386-fprem.c (100%)
 rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%)
 rename tests/tcg/{ => i386}/test-i386-shift.h (100%)
 rename tests/tcg/{ => i386}/test-i386-ssse3.c (100%)
 rename tests/tcg/{ => i386}/test-i386-vm86.S (100%)
 rename tests/tcg/{ => i386}/test-i386.c (100%)
 rename tests/tcg/{ => i386}/test-i386.h (100%)

diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile
deleted file mode 100644
index 89e3342..0000000
--- a/tests/tcg/Makefile
+++ /dev/null
@@ -1,156 +0,0 @@
--include ../../config-host.mak
--include $(SRC_PATH)/rules.mak
-
-$(call set-vpath, $(SRC_PATH)/tests/tcg)
-
-QEMU=../../i386-linux-user/qemu-i386
-QEMU_X86_64=../../x86_64-linux-user/qemu-x86_64
-CC_X86_64=$(CC_I386) -m64
-
-QEMU_INCLUDES += -I../..
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
-#CFLAGS+=-msse2
-LDFLAGS=
-
-# TODO: automatically detect ARM and MIPS compilers, and run those too
-
-# 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
-endif
-
-TESTS = test_path
-ifneq ($(call find-in-path, $(CC_I386)),)
-TESTS += $(I386_TESTS)
-endif
-
-all: $(patsubst %,run-%,$(TESTS))
-test: all
-
-# rules to run tests
-
-.PHONY: $(patsubst %,run-%,$(TESTS))
-
-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
-
-# rules to compile tests
-
-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 $@ $<
-
-sha1: sha1.c
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
-
-speed: sha1 sha1-i386
-	time ./sha1
-	time $(QEMU) ./sha1-i386
-
-# arm test
-hello-arm: hello-arm.o
-	arm-linux-ld -o $@ $<
-
-hello-arm.o: hello-arm.c
-	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
-
-test-arm-iwmmxt: test-arm-iwmmxt.s
-	cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
-
-# MIPS test
-hello-mips: hello-mips.c
-	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
-
-hello-mipsel: hello-mips.c
-	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
-
-# testsuite for the CRIS port.
-test-cris:
-	$(MAKE) -C cris check
-
-# testsuite for the LM32 port.
-test-lm32:
-	$(MAKE) -C lm32 check
-
-clean:
-	rm -f *~ *.o test-i386.out test-i386.ref \
-           test-x86_64.log test-x86_64.ref qruncom $(TESTS)
diff --git a/tests/tcg/i386/Makefile b/tests/tcg/i386/Makefile
new file mode 100644
index 0000000..15f77af
--- /dev/null
+++ b/tests/tcg/i386/Makefile
@@ -0,0 +1,88 @@
+BUILD_DIR=../../../build/
+SRC_PATH=../../../
+include $(BUILD_DIR)/config-host.mak
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/i386)
+
+QEMU=$(BUILD_DIR)/i386-linux-user/qemu-i386
+QEMU_X86_64=$(BUILD_DIR)/x86_64-linux-user/qemu-x86_64
+CC_X86_64=$(CC_I386) -m64
+
+QEMU_INCLUDES += -I$(BUILD_DIR)
+CFLAGS=-Wall -O2 -g -fno-strict-aliasing
+#CFLAGS+=-msse2
+LDFLAGS=
+
+# TODO: automatically detect ARM and MIPS compilers, and run those too
+
+# runcom maps page 0, so it requires root privileges
+# also, pi_10.com runs indefinitely
+
+I386_TESTS=hello-i386 \
+	   test-i386 \
+	   test-i386-fprem
+	   # runcom
+
+# native i386 compilers sometimes are not biarch.  assume cross-compilers are
+ifneq ($(ARCH),i386)
+I386_TESTS+=run-test-x86_64
+endif
+
+all: $(patsubst %,run-%,$(I386_TESTS))
+test: all
+
+# rules to run tests
+
+.PHONY: $(patsubst %,run-%,$(I386_TESTS))
+
+run-%: %
+	-$(QEMU) ./$*
+
+run-hello-i386: hello-i386
+	$(QEMU) ./hello-i386
+
+run-test-i386: test-i386
+	./test-i386 > test-i386.ref
+	-$(QEMU) test-i386 > test-i386.out
+	@if cmp -s 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_X86_64) test-i386-fprem > test-i386-fprem.out
+	@if cmp -s 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-runcom: runcom
+	-$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com
+
+# rules to compile tests
+
+hello-i386: hello-i386.c
+	$(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
+	strip $@
+
+# 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) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $^ `pkg-config --cflags --libs glib-2.0`
+
+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
+
+# vm86 test
+runcom: runcom.c
+	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $<
+
+clean:
+	rm -f *~ *.o test-i386.out test-i386.ref test-i386-fprem.out test-i386-fprem.ref \
+           test-x86_64.log test-x86_64.ref qruncom $(I386_TESTS)
diff --git a/tests/tcg/hello-i386.c b/tests/tcg/i386/hello-i386.c
similarity index 100%
rename from tests/tcg/hello-i386.c
rename to tests/tcg/i386/hello-i386.c
diff --git a/tests/tcg/pi_10.com b/tests/tcg/i386/pi_10.com
similarity index 100%
rename from tests/tcg/pi_10.com
rename to tests/tcg/i386/pi_10.com
diff --git a/tests/tcg/runcom.c b/tests/tcg/i386/runcom.c
similarity index 100%
rename from tests/tcg/runcom.c
rename to tests/tcg/i386/runcom.c
diff --git a/tests/tcg/test-i386-code16.S b/tests/tcg/i386/test-i386-code16.S
similarity index 100%
rename from tests/tcg/test-i386-code16.S
rename to tests/tcg/i386/test-i386-code16.S
diff --git a/tests/tcg/test-i386-fprem.c b/tests/tcg/i386/test-i386-fprem.c
similarity index 100%
rename from tests/tcg/test-i386-fprem.c
rename to tests/tcg/i386/test-i386-fprem.c
diff --git a/tests/tcg/test-i386-muldiv.h b/tests/tcg/i386/test-i386-muldiv.h
similarity index 100%
rename from tests/tcg/test-i386-muldiv.h
rename to tests/tcg/i386/test-i386-muldiv.h
diff --git a/tests/tcg/test-i386-shift.h b/tests/tcg/i386/test-i386-shift.h
similarity index 100%
rename from tests/tcg/test-i386-shift.h
rename to tests/tcg/i386/test-i386-shift.h
diff --git a/tests/tcg/test-i386-ssse3.c b/tests/tcg/i386/test-i386-ssse3.c
similarity index 100%
rename from tests/tcg/test-i386-ssse3.c
rename to tests/tcg/i386/test-i386-ssse3.c
diff --git a/tests/tcg/test-i386-vm86.S b/tests/tcg/i386/test-i386-vm86.S
similarity index 100%
rename from tests/tcg/test-i386-vm86.S
rename to tests/tcg/i386/test-i386-vm86.S
diff --git a/tests/tcg/test-i386.c b/tests/tcg/i386/test-i386.c
similarity index 100%
rename from tests/tcg/test-i386.c
rename to tests/tcg/i386/test-i386.c
diff --git a/tests/tcg/test-i386.h b/tests/tcg/i386/test-i386.h
similarity index 100%
rename from tests/tcg/test-i386.h
rename to tests/tcg/i386/test-i386.h
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [RFC PATCH 2/4] tests/tcg: Move arm tests to arch specific folder
  2016-08-19 17:00 [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Pranith Kumar
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 1/4] tests/tcg: Move i386 tests to arch specific folder Pranith Kumar
@ 2016-08-19 17:00 ` Pranith Kumar
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 3/4] tcg/tests: Move mips test " Pranith Kumar
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Pranith Kumar @ 2016-08-19 17:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, rth, pbonzini, peter.maydell

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 tests/tcg/arm/Makefile                | 45 +++++++++++++++++++++++++++++++++++
 tests/tcg/{ => arm}/hello-arm.c       |  0
 tests/tcg/{ => arm}/test-arm-iwmmxt.s |  0
 3 files changed, 45 insertions(+)
 create mode 100644 tests/tcg/arm/Makefile
 rename tests/tcg/{ => arm}/hello-arm.c (100%)
 rename tests/tcg/{ => arm}/test-arm-iwmmxt.s (100%)

diff --git a/tests/tcg/arm/Makefile b/tests/tcg/arm/Makefile
new file mode 100644
index 0000000..da92305
--- /dev/null
+++ b/tests/tcg/arm/Makefile
@@ -0,0 +1,45 @@
+BUILD_DIR=../../../build/
+SRC_PATH=../../../
+include $(BUILD_DIR)/config-host.mak
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/arm)
+
+QEMU=$(BUILD_DIR)/arm-linux-user/qemu-arm
+
+QEMU_INCLUDES += -I$(BUILD_DIR)
+CFLAGS=-Wall -O2 -g -fno-strict-aliasing
+LDFLAGS=
+
+# TODO: automatically detect ARM and MIPS compilers, and run those too
+
+# runcom maps page 0, so it requires root privileges
+# also, pi_10.com runs indefinitely
+
+TESTS=hello-arm arm-iwmmxt
+
+all: $(patsubst %,run-%,$(TESTS))
+test: all
+
+# rules to run tests
+
+run-%: %
+	$(QEMU) ./$*
+
+#.PHONY: $(patsubst %,run-%,$(TESTS))
+
+run-hello-arm: hello-arm
+run-arm-iwmmxt: arm-iwmmxt
+
+# arm test
+hello-arm: hello-arm.o
+	arm-linux-gnueabi-ld -o $@ $<
+
+hello-arm.o: hello-arm.c
+	arm-linux-gnueabi-gcc -Wall -g -O2 -c -o $@ $<
+
+arm-iwmmxt: test-arm-iwmmxt.s
+	cpp < $< | arm-linux-gnueabi-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
+
+clean:
+	rm -f *~ *.o $(TESTS)
diff --git a/tests/tcg/hello-arm.c b/tests/tcg/arm/hello-arm.c
similarity index 100%
rename from tests/tcg/hello-arm.c
rename to tests/tcg/arm/hello-arm.c
diff --git a/tests/tcg/test-arm-iwmmxt.s b/tests/tcg/arm/test-arm-iwmmxt.s
similarity index 100%
rename from tests/tcg/test-arm-iwmmxt.s
rename to tests/tcg/arm/test-arm-iwmmxt.s
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [RFC PATCH 3/4] tcg/tests: Move mips test to arch specific folder
  2016-08-19 17:00 [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Pranith Kumar
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 1/4] tests/tcg: Move i386 tests to arch specific folder Pranith Kumar
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 2/4] tests/tcg: Move arm " Pranith Kumar
@ 2016-08-19 17:00 ` Pranith Kumar
  2016-08-22  9:34   ` Alex Bennée
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 4/4] tests/tcg: misc tests holds arch independent tests Pranith Kumar
  2016-08-21  3:19 ` [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Richard Henderson
  4 siblings, 1 reply; 11+ messages in thread
From: Pranith Kumar @ 2016-08-19 17:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, rth, pbonzini, peter.maydell

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 tests/tcg/{ => mips}/hello-mips.c | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename tests/tcg/{ => mips}/hello-mips.c (100%)

diff --git a/tests/tcg/hello-mips.c b/tests/tcg/mips/hello-mips.c
similarity index 100%
rename from tests/tcg/hello-mips.c
rename to tests/tcg/mips/hello-mips.c
-- 
2.9.3

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [RFC PATCH 4/4] tests/tcg: misc tests holds arch independent tests
  2016-08-19 17:00 [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Pranith Kumar
                   ` (2 preceding siblings ...)
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 3/4] tcg/tests: Move mips test " Pranith Kumar
@ 2016-08-19 17:00 ` Pranith Kumar
  2016-08-21  3:19 ` [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Richard Henderson
  4 siblings, 0 replies; 11+ messages in thread
From: Pranith Kumar @ 2016-08-19 17:00 UTC (permalink / raw)
  To: qemu-devel, Veronia Bahaa, Paolo Bonzini; +Cc: alex.bennee, rth, peter.maydell

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 tests/tcg/misc/Makefile           | 75 +++++++++++++++++++++++++++++++++++++++
 tests/tcg/{ => misc}/linux-test.c |  3 ++
 tests/tcg/{ => misc}/sha1.c       |  0
 tests/tcg/{ => misc}/test-mmap.c  |  0
 tests/tcg/{ => misc}/test_path.c  |  0
 tests/tcg/{ => misc}/testthread.c |  0
 6 files changed, 78 insertions(+)
 create mode 100644 tests/tcg/misc/Makefile
 rename tests/tcg/{ => misc}/linux-test.c (99%)
 rename tests/tcg/{ => misc}/sha1.c (100%)
 rename tests/tcg/{ => misc}/test-mmap.c (100%)
 rename tests/tcg/{ => misc}/test_path.c (100%)
 rename tests/tcg/{ => misc}/testthread.c (100%)

diff --git a/tests/tcg/misc/Makefile b/tests/tcg/misc/Makefile
new file mode 100644
index 0000000..39c316b
--- /dev/null
+++ b/tests/tcg/misc/Makefile
@@ -0,0 +1,75 @@
+BUILD_DIR=../../../build/
+SRC_PATH=../../../
+include $(BUILD_DIR)/config-host.mak
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/misc)
+
+QEMU=$(BUILD_DIR)/$(ARCH)-linux-user/qemu-$(ARCH)
+
+QEMU_INCLUDES += -I$(BUILD_DIR)
+CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I$(SRC_PATH)/include -I$(BUILD_DIR)
+#CFLAGS+=-msse2
+LDFLAGS=
+
+# TODO: automatically detect ARM and MIPS compilers, and run those too
+
+# runcom maps page 0, so it requires root privileges
+# also, pi_10.com runs indefinitely
+
+TESTS=linux-test \
+      testthread \
+      sha1 \
+      test-mmap \
+      test_path
+      # runcom
+
+all: $(patsubst %,run-%,$(TESTS))
+test: all
+
+# rules to run tests
+
+run-%: %
+	-$(QEMU) ./$*
+
+run-linux-test: linux-test
+run-testthread: testthread
+run-sha1: sha1
+run-test_path: test_path
+
+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-test_path: test_path
+
+# rules to compile tests
+
+test_path: test_path.o
+	$(CC) $^ -o $@ -lglib-2.0
+
+test_path.o: test_path.c
+	$(CC) $^ -c -o $@ $(QEMU_INCLUDES) `pkg-config --cflags --libs glib-2.0`
+
+testthread: testthread.c
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
+
+# generic Linux and CPU test
+linux-test: linux-test.c
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
+
+test-mmap: test-mmap.c
+	$(CC) $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $< -static
+
+# speed test
+sha1: sha1.c
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
+
+speed: sha1
+	time ./sha1
+	time $(QEMU) ./sha1
+
+clean:
+	rm -f *~ *.o $(TESTS)
diff --git a/tests/tcg/linux-test.c b/tests/tcg/misc/linux-test.c
similarity index 99%
rename from tests/tcg/linux-test.c
rename to tests/tcg/misc/linux-test.c
index 5070d31..41ad91c 100644
--- a/tests/tcg/linux-test.c
+++ b/tests/tcg/misc/linux-test.c
@@ -39,6 +39,9 @@
 #include <dirent.h>
 #include <setjmp.h>
 #include <sys/shm.h>
+#include <stdbool.h>
+#include <sys/resource.h>
+#include "qemu/compiler.h"
 #include "qemu/cutils.h"
 
 #define TESTPATH "/tmp/linux-test.tmp"
diff --git a/tests/tcg/sha1.c b/tests/tcg/misc/sha1.c
similarity index 100%
rename from tests/tcg/sha1.c
rename to tests/tcg/misc/sha1.c
diff --git a/tests/tcg/test-mmap.c b/tests/tcg/misc/test-mmap.c
similarity index 100%
rename from tests/tcg/test-mmap.c
rename to tests/tcg/misc/test-mmap.c
diff --git a/tests/tcg/test_path.c b/tests/tcg/misc/test_path.c
similarity index 100%
rename from tests/tcg/test_path.c
rename to tests/tcg/misc/test_path.c
diff --git a/tests/tcg/testthread.c b/tests/tcg/misc/testthread.c
similarity index 100%
rename from tests/tcg/testthread.c
rename to tests/tcg/misc/testthread.c
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests
  2016-08-19 17:00 [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Pranith Kumar
                   ` (3 preceding siblings ...)
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 4/4] tests/tcg: misc tests holds arch independent tests Pranith Kumar
@ 2016-08-21  3:19 ` Richard Henderson
  2016-08-21  3:46   ` Pranith Kumar
  4 siblings, 1 reply; 11+ messages in thread
From: Richard Henderson @ 2016-08-21  3:19 UTC (permalink / raw)
  To: Pranith Kumar, qemu-devel; +Cc: alex.bennee, pbonzini, peter.maydell

On 08/19/2016 10:00 AM, Pranith Kumar wrote:
> This RFC patch series cleans up the tcg tests in tests/tcg folder.
>
> The tests have bit-rotten and were not compiling or running. I fixed
> the Makefiles to make them compile though there are tests which do not
> pass. I plan to fix them if you think this approach is reasonable.
>
> The motivation is to add litmus tests to each arch and have them run
> using the 'make check' target to test consistency on TCG.
>
> There are no maintainers listed for this test folder. So I am cc'ing
> people who I think might be interested.

By what mechanism are these tests to be run?
I can't see that they're run with "make check" after this patchset...


r~

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests
  2016-08-21  3:19 ` [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Richard Henderson
@ 2016-08-21  3:46   ` Pranith Kumar
  2016-08-21 10:41     ` Peter Maydell
  0 siblings, 1 reply; 11+ messages in thread
From: Pranith Kumar @ 2016-08-21  3:46 UTC (permalink / raw)
  To: Richard Henderson
  Cc: qemu-devel, Alex Bennée, Paolo Bonzini, Peter Maydell

On Sat, Aug 20, 2016 at 11:19 PM, Richard Henderson <rth@twiddle.net> wrote:
> On 08/19/2016 10:00 AM, Pranith Kumar wrote:
>>
>> This RFC patch series cleans up the tcg tests in tests/tcg folder.
>>
>> The tests have bit-rotten and were not compiling or running. I fixed
>> the Makefiles to make them compile though there are tests which do not
>> pass. I plan to fix them if you think this approach is reasonable.
>>
>> The motivation is to add litmus tests to each arch and have them run
>> using the 'make check' target to test consistency on TCG.
>>
>> There are no maintainers listed for this test folder. So I am cc'ing
>> people who I think might be interested.
>
>
> By what mechanism are these tests to be run?
> I can't see that they're run with "make check" after this patchset...

The tests currently fail, so I didn't think it would be appropriate to
hook them up.  If the rearrangement is acceptable and once I fix the
tests, I will hook up 'make check' to run these tests.

Do you think this plan is OK? Otherwise suggestions are welcome.

Thanks,
-- 
Pranith

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests
  2016-08-21  3:46   ` Pranith Kumar
@ 2016-08-21 10:41     ` Peter Maydell
  2016-08-22  9:19       ` Alex Bennée
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Maydell @ 2016-08-21 10:41 UTC (permalink / raw)
  To: Pranith Kumar
  Cc: Richard Henderson, qemu-devel, Alex Bennée, Paolo Bonzini

On 21 August 2016 at 04:46, Pranith Kumar <bobby.prani@gmail.com> wrote:
> The tests currently fail, so I didn't think it would be appropriate to
> hook them up.  If the rearrangement is acceptable and once I fix the
> tests, I will hook up 'make check' to run these tests.

So the question is: how will this work on systems which
don't have the relevant compiler toolchain for the target?
This has always been the stumbling block for tests which
want to run guest code: it's just too much of a pain for
most developers to have the toolchains available to build
the guest code.

I have a vague idea that we could use something involving
docker images so that you could define a test case including
what the toolchain it needed to build was, and then have
images so that in practice you could just use prebuilt
binaries for the test blobs. But I haven't really thought
much about it yet.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests
  2016-08-21 10:41     ` Peter Maydell
@ 2016-08-22  9:19       ` Alex Bennée
  0 siblings, 0 replies; 11+ messages in thread
From: Alex Bennée @ 2016-08-22  9:19 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Pranith Kumar, Richard Henderson, qemu-devel, Paolo Bonzini


Peter Maydell <peter.maydell@linaro.org> writes:

> On 21 August 2016 at 04:46, Pranith Kumar <bobby.prani@gmail.com> wrote:
>> The tests currently fail, so I didn't think it would be appropriate to
>> hook them up.  If the rearrangement is acceptable and once I fix the
>> tests, I will hook up 'make check' to run these tests.
>
> So the question is: how will this work on systems which
> don't have the relevant compiler toolchain for the target?
> This has always been the stumbling block for tests which
> want to run guest code: it's just too much of a pain for
> most developers to have the toolchains available to build
> the guest code.

We could just make running the tests optional on ./configure finding the
relevant cross compilers. The misc/ tests at the very least can be built
with the host compiler and run on a host-to-host linux-user build.

>
> I have a vague idea that we could use something involving
> docker images so that you could define a test case including
> what the toolchain it needed to build was, and then have
> images so that in practice you could just use prebuilt
> binaries for the test blobs. But I haven't really thought
> much about it yet.

Currently the docker support doesn't allow copying artefacts from the
build. But you can certainly run a make target in a (potentially)
cross arch docker container now. For example:

  make docker-test-quick@debian-bootstrap \
    EXTRA_CONFIGURE_OPTS="--enable-gprof --enable-gcov --disable-pie" \
    J=9 V=1 DEBUG=1

If we fix up make test to build misc + host compiler directory then they
will get run by the binfmt_misc enabled linux-user binary that was
copied when the image was created. You can update the image with the
current image easily enough:

  ./tests/docker/docker.py update qmu:debian-bootstrap ./arm-linux-user/qemu-arm

>
> thanks
> -- PMM


--
Alex Bennée

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [RFC PATCH 3/4] tcg/tests: Move mips test to arch specific folder
  2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 3/4] tcg/tests: Move mips test " Pranith Kumar
@ 2016-08-22  9:34   ` Alex Bennée
  2016-08-22 14:38     ` Pranith Kumar
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Bennée @ 2016-08-22  9:34 UTC (permalink / raw)
  To: Pranith Kumar; +Cc: qemu-devel, rth, pbonzini, peter.maydell


Pranith Kumar <bobby.prani@gmail.com> writes:

You have transposed the tcg/tests in your subject for this particular commit.

> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
>  tests/tcg/{ => mips}/hello-mips.c | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  rename tests/tcg/{ => mips}/hello-mips.c (100%)
>
> diff --git a/tests/tcg/hello-mips.c b/tests/tcg/mips/hello-mips.c
> similarity index 100%
> rename from tests/tcg/hello-mips.c
> rename to tests/tcg/mips/hello-mips.c


--
Alex Bennée

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [RFC PATCH 3/4] tcg/tests: Move mips test to arch specific folder
  2016-08-22  9:34   ` Alex Bennée
@ 2016-08-22 14:38     ` Pranith Kumar
  0 siblings, 0 replies; 11+ messages in thread
From: Pranith Kumar @ 2016-08-22 14:38 UTC (permalink / raw)
  To: Alex Bennée
  Cc: qemu-devel, Richard Henderson, Paolo Bonzini, Peter Maydell

On Mon, Aug 22, 2016 at 5:34 AM, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Pranith Kumar <bobby.prani@gmail.com> writes:
>
> You have transposed the tcg/tests in your subject for this particular commit.

I messed up the subject. I will fix this and resend.

-- 
Pranith

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-08-22 14:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-19 17:00 [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Pranith Kumar
2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 1/4] tests/tcg: Move i386 tests to arch specific folder Pranith Kumar
2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 2/4] tests/tcg: Move arm " Pranith Kumar
2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 3/4] tcg/tests: Move mips test " Pranith Kumar
2016-08-22  9:34   ` Alex Bennée
2016-08-22 14:38     ` Pranith Kumar
2016-08-19 17:00 ` [Qemu-devel] [RFC PATCH 4/4] tests/tcg: misc tests holds arch independent tests Pranith Kumar
2016-08-21  3:19 ` [Qemu-devel] [RFC PATCH 0/4] Clean up TCG tests Richard Henderson
2016-08-21  3:46   ` Pranith Kumar
2016-08-21 10:41     ` Peter Maydell
2016-08-22  9:19       ` Alex Bennée

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.