Skip to contentSkip to conversation

Clean up TCG tests

PATCH In review Pranith Kumar 4 participants 15 messages Sep 17, 2016 – Nov 3, 2016

lore
Share & tools
lore
#0 lore raw

v3 cover Clean up TCG tests

Hello,

This 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 but there are tests which do not pass.

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.

As suggested by rth in v1 posting, I hooked up 'tests-tcg' target to run native tests. Detecting cross compilers or running the tests in docker containers are suggested ideas to make running the tests easier.

v3:
- Update with review feedback from Alex Bennée.

v2:
- Add tests-tcg target to invoke native tests.

Pranith Kumar (6):
tests/tcg: Move i386 tests to arch specific folder tests/tcg: Move arm tests to arch specific folder tests/tcg: Move mips test to arch specific folder tests/tcg: Create and populate misc tests for arch independent tests tests/tcg: Add and update Makefiles
tests/tcg: Add tests-tcg hook in Makefile

 tests/Makefile.include                  |   1 +
 tests/tcg/Makefile                      | 156 --------------------------------
 tests/tcg/Makefile.include              |  34 +++++++
 tests/tcg/alpha/Makefile                |  38 +++++---
 tests/tcg/arm/Makefile                  |  51 +++++++++++
 tests/tcg/{ => arm}/hello-arm.c         |   0
 tests/tcg/{ => arm}/test-arm-iwmmxt.s   |   0
 tests/tcg/cris/Makefile                 |  17 +++-
 tests/tcg/i386/Makefile                 |  87 ++++++++++++++++++
 tests/tcg/{ => i386}/hello-i386.c       |   9 +-
 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/lm32/Makefile                 |  17 +++-
 tests/tcg/mips/Makefile                 |  46 ++++++++++
 tests/tcg/{ => mips}/hello-mips.c       |   0
 tests/tcg/mips/mips32-dsp/Makefile      |  17 +++-
 tests/tcg/mips/mips32-dspr2/Makefile    |  17 +++-
 tests/tcg/mips/mips64-dsp/Makefile      |  18 +++-
 tests/tcg/mips/mips64-dspr2/Makefile    |  17 +++-
 tests/tcg/misc/Makefile                 |  81 +++++++++++++++++
 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
 tests/tcg/openrisc/Makefile             |  19 +++-
 tests/tcg/xtensa/Makefile               |  17 +++-
 35 files changed, 457 insertions(+), 188 deletions(-)
 delete mode 100644 tests/tcg/Makefile
 create mode 100644 tests/tcg/Makefile.include
 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 (71%)
 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%)
 create mode 100644 tests/tcg/mips/Makefile
 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%)
Signature · 1 line
2.9.3
#1 lore raw

PATCH v3 1/6 tests/tcg: Move i386 tests to arch specific folder

---
 tests/tcg/Makefile                      | 156 --------------------------------
 tests/tcg/i386/Makefile                 |  88 ++++++++++++++++++
 tests/tcg/{ => i386}/hello-i386.c       |   9 +-
 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, 93 insertions(+), 160 deletions(-)
 delete mode 100644 tests/tcg/Makefile
 create mode 100644 tests/tcg/i386/Makefile
 rename tests/tcg/{ => i386}/hello-i386.c (71%)
 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%)
tests/tcg/Makefile deleted +0 -156
deleted file mode 100644
index 89e3342..0000000
@@ -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)
tests/tcg/i386/Makefile new file +88 -0

88 lines not on this page · raw message

tests/tcg/i386/hello-i386.c renamed from tests/tcg/hello-i386.c +5 -4
similarity index 71%
rename from tests/tcg/hello-i386.c
rename to tests/tcg/i386/hello-i386.c
index fa00380..ab55922 100644
@@ -1,6 +1,7 @@
 #include <asm/unistd.h>
+#include <stddef.h>
 
-static inline void exit(int status)
+static inline void _exit(int status)
 {
   int __res;
   __asm__ volatile ("movl %%ecx,%%ebx\n"\
@@ -8,7 +9,7 @@ static inline void exit(int status)
 		    :  "=a" (__res) : "0" (__NR_exit),"c" ((long)(status)));
 }
 
-static inline int write(int fd, const char * buf, int len)
+static inline size_t _write(int fd, const void * buf, size_t len)
 {
   int status;
   __asm__ volatile ("pushl %%ebx\n"\
@@ -22,6 +23,6 @@ static inline int write(int fd, const char * buf, int len)
 
 void _start(void)
 {
-    write(1, "Hello World\n", 12);
-    exit(0);
+    _write(1, "Hello World\n", 12);
+    _exit(0);
 }
tests/tcg/i386/pi_10.com renamed from tests/tcg/pi_10.com +0 -0
similarity index 100%
rename from tests/tcg/pi_10.com
rename to tests/tcg/i386/pi_10.com
tests/tcg/i386/runcom.c renamed from tests/tcg/runcom.c +0 -0
similarity index 100%
rename from tests/tcg/runcom.c
rename to tests/tcg/i386/runcom.c
tests/tcg/i386/test-i386-code16.S renamed from tests/tcg/test-i386-code16.S +0 -0
similarity index 100%
rename from tests/tcg/test-i386-code16.S
rename to tests/tcg/i386/test-i386-code16.S
tests/tcg/i386/test-i386-fprem.c renamed from tests/tcg/test-i386-fprem.c +0 -0
similarity index 100%
rename from tests/tcg/test-i386-fprem.c
rename to tests/tcg/i386/test-i386-fprem.c
tests/tcg/i386/test-i386-muldiv.h renamed from tests/tcg/test-i386-muldiv.h +0 -0
similarity index 100%
rename from tests/tcg/test-i386-muldiv.h
rename to tests/tcg/i386/test-i386-muldiv.h
tests/tcg/i386/test-i386-shift.h renamed from tests/tcg/test-i386-shift.h +0 -0
similarity index 100%
rename from tests/tcg/test-i386-shift.h
rename to tests/tcg/i386/test-i386-shift.h
tests/tcg/i386/test-i386-ssse3.c renamed from tests/tcg/test-i386-ssse3.c +0 -0
similarity index 100%
rename from tests/tcg/test-i386-ssse3.c
rename to tests/tcg/i386/test-i386-ssse3.c
tests/tcg/i386/test-i386-vm86.S renamed from tests/tcg/test-i386-vm86.S +0 -0
similarity index 100%
rename from tests/tcg/test-i386-vm86.S
rename to tests/tcg/i386/test-i386-vm86.S
tests/tcg/i386/test-i386.c renamed from tests/tcg/test-i386.c +0 -0
similarity index 100%
rename from tests/tcg/test-i386.c
rename to tests/tcg/i386/test-i386.c
tests/tcg/i386/test-i386.h renamed from tests/tcg/test-i386.h +0 -0
similarity index 100%
rename from tests/tcg/test-i386.h
rename to tests/tcg/i386/test-i386.h
Signature · 1 line
2.9.3
#4 lore raw

PATCH v3 2/6 tests/tcg: Move arm tests to arch specific folder

In reply to Pranith Kumar
---
 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%)
tests/tcg/arm/Makefile new file +45 -0
new file mode 100644
index 0000000..c2ae491
@@ -0,0 +1,45 @@
+BUILD_DIR?=$(CURDIR)
+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)
tests/tcg/arm/hello-arm.c renamed from tests/tcg/hello-arm.c +0 -0
similarity index 100%
rename from tests/tcg/hello-arm.c
rename to tests/tcg/arm/hello-arm.c
tests/tcg/arm/test-arm-iwmmxt.s renamed from tests/tcg/test-arm-iwmmxt.s +0 -0
similarity index 100%
rename from tests/tcg/test-arm-iwmmxt.s
rename to tests/tcg/arm/test-arm-iwmmxt.s
Signature · 1 line
2.9.3
#5 lore raw

PATCH v3 3/6 tests/tcg: Move mips test to arch specific folder

In reply to Pranith Kumar
---
 tests/tcg/{ => mips}/hello-mips.c | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename tests/tcg/{ => mips}/hello-mips.c (100%)
tests/tcg/mips/hello-mips.c renamed from tests/tcg/hello-mips.c +0 -0
similarity index 100%
rename from tests/tcg/hello-mips.c
rename to tests/tcg/mips/hello-mips.c
Signature · 1 line
2.9.3
#6 lore raw

PATCH v3 4/6 tests/tcg: Create and populate misc tests for arch independent tests

In reply to Pranith Kumar
---
 tests/tcg/misc/Makefile           | 81 +++++++++++++++++++++++++++++++++++++++
 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, 84 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%)
tests/tcg/misc/Makefile new file +81 -0
new file mode 100644
index 0000000..0aa6f2e
@@ -0,0 +1,81 @@
+# -*- Mode: makefile -*-
+#
+# Generic linux-user TCG tests
+#
+# These tests all use standard non-architecture specific APIs so can
+# be built for all TCG targets. The Make is expected to be called in
+# the ${BUILD_DIR}/$(TARGET_NAME_ARCH)-linux-user/tests directory
+#
+# To build for other architectures call make with CROSS_CC set
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/misc)
+
+QEMU=$(BUILD_DIR)/$(TARGET_NAME)-linux-user/qemu-$(TARGET_NAME)
+
+# Compiler set-up, default to system compiler if not set
+CROSS_CC?=$(CC)
+
+CFLAGS=-Wall -O2 -g -fno-strict-aliasing -static
+LDFLAGS=
+
+TESTS=linux-test \
+      testthread \
+      sha1 \
+      test-mmap
+
+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
+
+# These two need to be re-written as relying on glib (rather than just glibc)
+# test_path: test_path.o
+# 	$(CROSS_CC) $^ -o $@ -lglib-2.0
+
+# test_path.o: test_path.c
+# 	$(CROSS_CC) $^ -c -o $@ $(QEMU_INCLUDES) `pkg-config --cflags --libs glib-2.0`
+
+testthread: testthread.c
+	$(CROSS_CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
+
+# generic Linux and CPU test
+linux-test: linux-test.c
+	$(CROSS_CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
+
+test-mmap: test-mmap.c
+	$(CROSS_CC) $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $< -static
+
+# speed test
+sha1: sha1.c
+	$(CROSS_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
+
+speed: sha1
+	time ./sha1
+	time $(QEMU) ./sha1
+
+clean:
+	rm -f *~ *.o $(TESTS)
tests/tcg/misc/linux-test.c renamed from tests/tcg/linux-test.c +3 -0
similarity index 99%
rename from tests/tcg/linux-test.c
rename to tests/tcg/misc/linux-test.c
index 5070d31..41ad91c 100644
@@ -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"
tests/tcg/misc/sha1.c renamed from tests/tcg/sha1.c +0 -0
similarity index 100%
rename from tests/tcg/sha1.c
rename to tests/tcg/misc/sha1.c
tests/tcg/misc/test-mmap.c renamed from tests/tcg/test-mmap.c +0 -0
similarity index 100%
rename from tests/tcg/test-mmap.c
rename to tests/tcg/misc/test-mmap.c
tests/tcg/misc/test_path.c renamed from tests/tcg/test_path.c +0 -0
similarity index 100%
rename from tests/tcg/test_path.c
rename to tests/tcg/misc/test_path.c
tests/tcg/misc/testthread.c renamed from tests/tcg/testthread.c +0 -0
similarity index 100%
rename from tests/tcg/testthread.c
rename to tests/tcg/misc/testthread.c
Signature · 1 line
2.9.3
#7 lore raw

PATCH v3 5/6 tests/tcg: Add and update Makefiles

In reply to Pranith Kumar
---
 tests/tcg/alpha/Makefile             | 38 +++++++++++++++++++----------
 tests/tcg/arm/Makefile               | 28 +++++++++++++---------
 tests/tcg/cris/Makefile              | 17 +++++++++++--
 tests/tcg/i386/Makefile              | 23 +++++++++---------
 tests/tcg/lm32/Makefile              | 17 +++++++++++--
 tests/tcg/mips/Makefile              | 46 ++++++++++++++++++++++++++++++++++++
 tests/tcg/mips/mips32-dsp/Makefile   | 17 +++++++++++--
 tests/tcg/mips/mips32-dspr2/Makefile | 17 +++++++++++--
 tests/tcg/mips/mips64-dsp/Makefile   | 18 ++++++++++++--
 tests/tcg/mips/mips64-dspr2/Makefile | 17 ++++++++++++-
 tests/tcg/openrisc/Makefile          | 19 ++++++++++++---
 tests/tcg/xtensa/Makefile            | 17 +++++++++++--
 12 files changed, 223 insertions(+), 51 deletions(-)
 create mode 100644 tests/tcg/mips/Makefile
tests/tcg/alpha/Makefile +26 -12
index 2b1f03d..e20315f 100644
@@ -1,33 +1,47 @@
-CROSS=alpha-linux-gnu-
-CC=$(CROSS)gcc
-AS=$(CROSS)as
+# -*- Mode: makefile -*-
+#
+# Alpha linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/alpha-linux-user/tests directory
+#
 
-SIM=../../alpha-linux-user/qemu-alpha
+BUILD_DIR?=$(CURDIR)
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
 
-CFLAGS=-O
-LINK=$(CC) -o $@ crt.o $< -nostdlib
+$(call set-vpath, $(SRC_PATH)/tests/tcg/alpha)
+
+QEMU=$(BUILD_DIR)/alpha-linux-user/qemu-alpha
+
+# Compiler set-up, default to system compiler if not set
+CROSS_CC?=$(CC)
+
+CFLAGS=-Wall -O2 -g -fno-strict-aliasing -static
+LDFLAGS=-nostdlib
 
 TESTS=test-cond test-cmov
 
 all: hello-alpha $(TESTS)
 
 hello-alpha: hello-alpha.o crt.o
-	$(LINK)
+	$(CROSS_CC) -o $@ crt.o $< $(LDFLAGS)
 
 test-cond: test-cond.o crt.o
-	$(LINK)
+	$(CROSS_CC) -o $@ crt.o $< $(LDFLAGS)
 
 test-cmov.o: test-cond.c
-	$(CC) -c $(CFLAGS) -DTEST_CMOV -o $@ $<
+	$(CROSS_CC) -c $(CFLAGS) -DTEST_CMOV -o $@ $<
 
 test-cmov: test-cmov.o crt.o
-	$(LINK)
+	$(CROSS_CC) -o $@ crt.o $< $(LDFLAGS)
 
 test-ovf: test-ovf.o crt.o
-	$(LINK)
+	$(CROSS_CC) -o $@ crt.o $< $(LDFLAGS)
 
 check: $(TESTS)
-	for f in $(TESTS); do $(SIM) $$f || exit 1; done
+	for f in $(TESTS); do $(QEMU) $$f || exit 1; done
 
 clean:
 	$(RM) *.o *~ hello-alpha $(TESTS)
tests/tcg/arm/Makefile +17 -11
index c2ae491..8eafae6 100644
@@ -1,21 +1,27 @@
-BUILD_DIR?=$(CURDIR)
-SRC_PATH=../../../
-include $(BUILD_DIR)/config-host.mak
+# -*- Mode: makefile -*-
+#
+# Arm linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/arm-linux-user/tests directory
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
 include $(SRC_PATH)/rules.mak
 
 $(call set-vpath, $(SRC_PATH)/tests/tcg/arm)
 
 QEMU=$(BUILD_DIR)/arm-linux-user/qemu-arm
 
+# Compiler set-up, default to system compiler if not set
+CROSS_CC?=$(CC)
+
 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))
@@ -33,13 +39,13 @@ run-arm-iwmmxt: arm-iwmmxt
 
 # arm test
 hello-arm: hello-arm.o
-	arm-linux-gnueabi-ld -o $@ $<
+	$(CROSS_CC) -o $@ $<
 
 hello-arm.o: hello-arm.c
-	arm-linux-gnueabi-gcc -Wall -g -O2 -c -o $@ $<
+	$(CROSS_CC) -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 $@
+	cpp < $< | $(CROSS_CC) -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
 
 clean:
 	rm -f *~ *.o $(TESTS)
tests/tcg/cris/Makefile +15 -2
index d34bfd8..aa8be36 100644
@@ -1,7 +1,20 @@
--include ../../../config-host.mak
+# -*- Mode: makefile -*-
+#
+# Cris linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/cris-linux-user/tests directory
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/arm)
 
 CROSS=crisv32-axis-linux-gnu-
-SIM=../../../cris-linux-user/qemu-cris -L ./
+SIM=$(BUILD_DIR)/cris-linux-user/qemu-cris -L ./
 SIMG=cris-axis-linux-gnu-run --sysroot=./
 
 CC      = $(CROSS)gcc
tests/tcg/i386/Makefile +11 -12
index 15f77af..20b80fe 100644
@@ -1,6 +1,14 @@
-BUILD_DIR=../../../build/
-SRC_PATH=../../../
-include $(BUILD_DIR)/config-host.mak
+# -*- Mode: makefile -*-
+#
+# i386 linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/i386-linux-user/tests directory
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
 include $(SRC_PATH)/rules.mak
 
 $(call set-vpath, $(SRC_PATH)/tests/tcg/i386)
@@ -14,15 +22,9 @@ 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)
@@ -57,9 +59,6 @@ run-test-x86_64: test-x86_64
 	-$(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
tests/tcg/lm32/Makefile +15 -2
index 57e7363..ad5d9a7 100644
@@ -1,8 +1,21 @@
--include ../../../config-host.mak
+# -*- Mode: makefile -*-
+#
+# lm32 linux-system TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/lm32-softmmu/tests directory
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/lm32)
 
 CROSS=lm32-elf-
 
-SIM = qemu-system-lm32
+QEMU=$(BUILD_DIR)/lm32-softmmu/qemu-system-lm32
 SIMFLAGS = -M lm32-evr -nographic -semihosting -net none -kernel
 
 CC      = $(CROSS)gcc
tests/tcg/mips/Makefile new file +46 -0

46 lines not on this page · raw message

tests/tcg/mips/mips32-dsp/Makefile +15 -2
index c3a0a00..996b9a0 100644
@@ -1,8 +1,21 @@
--include ../../config-host.mak
+# -*- Mode: makefile -*-
+#
+# mipsel linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/mipsel-linux-user/tests directory
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/mips/mips32-dsp)
 
 CROSS=mips64el-unknown-linux-gnu-
 
-SIM=qemu-mipsel
+SIM=$(BUILD_DIR)/mipsel-linux-user/qemu-mipsel
 SIM_FLAGS=-cpu 74Kf
 
 CC      = $(CROSS)gcc
tests/tcg/mips/mips32-dspr2/Makefile +15 -2
index ed19581..e99f2bc 100644
@@ -1,8 +1,21 @@
--include ../../config-host.mak
+# -*- Mode: makefile -*-
+#
+# mipsel linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/mipsel-linux-user/tests directory
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/mips/mips32-dsp)
 
 CROSS=mips64el-unknown-linux-gnu-
 
-SIM=qemu-mipsel
+SIM=$(BUILD_DIR)/mipsel-linux-user/qemu-mipsel
 SIM_FLAGS=-cpu 74Kf
 
 CC      = $(CROSS)gcc
tests/tcg/mips/mips64-dsp/Makefile +16 -2
index b2ac6b3..4ee3bbb 100644
@@ -1,7 +1,21 @@
+# -*- Mode: makefile -*-
+#
+# mips64el linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/mips64el-linux-user/tests directory
+#
 
-CROSS_COMPILE	?= mips64el-unknown-linux-gnu-
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
 
-SIM = qemu-system-mips64el
+$(call set-vpath, $(SRC_PATH)/tests/tcg/mips/mips64-dsp)
+
+CROSS=mips64el-unknown-linux-gnu-
+
+SIM=$(BUILD_DIR)/mipsel-linux-user/qemu-mips64el
 SIMFLAGS = -nographic -cpu mips64dspr2 -kernel
 
 AS      = $(CROSS_COMPILE)as
tests/tcg/mips/mips64-dspr2/Makefile +16 -1
index ba44bb9..8510d8c 100644
@@ -1,6 +1,21 @@
+# -*- Mode: makefile -*-
+#
+# mips64el linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/mips64el-linux-user/tests directory
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/mips/mips64-dsp)
+
 CROSS_COMPILE	?= mips64el-unknown-linux-gnu-
 
-SIM = qemu-system-mips64el
+SIM=$(BUILD_DIR)/mipsel-linux-user/qemu-mips64el
 SIMFLAGS = -nographic -cpu mips64dspr2 -kernel
 
 AS      = $(CROSS_COMPILE)as
tests/tcg/openrisc/Makefile +16 -3
index 7e65888..071aaab 100644
@@ -1,8 +1,21 @@
--include ../../config-host.mak
+# -*- Mode: makefile -*-
+#
+# openrisc linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/or32-linux-user/tests directory
+#
 
-CROSS = or32-linux-
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/openrisc)
 
-SIM = qemu-or32
+SIM=$(BUILD_DIR)/or32-linux-user/qemu-mips
+
+CROSS = or32-linux-
 
 CC = $(CROSS)gcc
 
tests/tcg/xtensa/Makefile +15 -2
index 522a63e..e3269ed 100644
@@ -1,10 +1,23 @@
--include ../../../config-host.mak
+# -*- Mode: makefile -*-
+#
+# xtensa linux TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/xtensa-softmmu/tests directory
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+include ../config-target.mak		# TARGET_NAME
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/xtensa)
 
 CORE=dc232b
 CROSS=xtensa-$(CORE)-elf-
 
 ifndef XT
-SIM = ../../../xtensa-softmmu/qemu-system-xtensa
+SIM = $(BUILD_DIR)/xtensa-softmmu/qemu-system-xtensa
 SIMFLAGS = -M sim -cpu $(CORE) -nographic -semihosting $(EXTFLAGS) -kernel
 SIMDEBUG = -s -S
 else
Signature · 1 line
2.9.3
#9 lore raw

PATCH v3 6/6 tests/tcg: Add tests-tcg hook in Makefile

In reply to Pranith Kumar
---
 tests/Makefile.include     |  1 +
 tests/tcg/Makefile.include | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 tests/tcg/Makefile.include
tests/Makefile.include +1 -0
index 2f11064..5f314ed 100644
@@ -803,3 +803,4 @@ all: $(QEMU_IOTESTS_HELPERS-y)
 
 -include $(wildcard tests/*.d)
 -include $(wildcard tests/libqos/*.d)
+-include $(SRC_PATH)/tests/tcg/Makefile.include
tests/tcg/Makefile.include new file +34 -0
new file mode 100644
index 0000000..a55cb03
@@ -0,0 +1,34 @@
+#
+# linux-user TCG tests
+#
+# The Make is expected to be invoked in the ${BUILD_DIR} directory
+# using the tests-tcg target
+#
+BUILD_DIR?=$(CURDIR)
+include $(BUILD_DIR)/config-host.mak	# brings in SRC_PATH
+
+UNAME_P := $(shell uname -p)
+
+tests-tcg: prepare $(UNAME_P)
+
+prepare:
+	mkdir -p $(BUILD_DIR)/$(UNAME_P)-linux-user/tests/
+
+x86_64:
+	cd $(BUILD_DIR)/x86_64-linux-user/tests/ && \
+	make -f $(SRC_PATH)/tests/tcg/i386/Makefile
+
+i386:
+	cd $(BUILD_DIR)/i386-linux-user/tests/ && \
+	make -f $(SRC_PATH)/tests/tcg/i386/Makefile
+
+arm:
+	cd $(BUILD_DIR)/arm-linux-user/tests/ && \
+	make -f $(SRC_PATH)/tests/tcg/arm/Makefile
+
+aarch64:
+	cd $(BUILD_DIR)/aarch64-linux-user/tests/ && \
+	make -f $(SRC_PATH)/tests/tcg/arm/Makefile
+
+.PHONY: tests-tcg
+
Signature · 1 line
2.9.3
#2 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/tcg: Move i386 tests to arch specific folder

In reply to Pranith Kumar

Hi

Quoted 17 lines · Pranith Kumar
---
 tests/tcg/Makefile                      | 156
--------------------------------
 tests/tcg/i386/Makefile                 |  88 ++++++++++++++++++
 tests/tcg/{ => i386}/hello-i386.c       |   9 +-
 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

Moving i386 specific files to their own subdir like the rest of the archs is a good idea to me.

 13 files changed, 93 insertions(+), 160 deletions(-)
Quoted 192 lines
 delete mode 100644 tests/tcg/Makefile
 create mode 100644 tests/tcg/i386/Makefile
 rename tests/tcg/{ => i386}/hello-i386.c (71%)
 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%)
tests/tcg/Makefile deleted +0 -29
deleted file mode 100644
index 89e3342..0000000
@@ -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

tests/tcg/Makefile deleted +0 -28
-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

tests/tcg/Makefile deleted +0 -5
-
-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

tests/tcg/Makefile deleted +0 -5
-
-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

tests/tcg/Makefile deleted +0 -31
-
-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

tests/tcg/Makefile deleted +0 -7
-
-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

tests/tcg/Makefile deleted +0 -54
-
-# 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)
tests/tcg/i386/Makefile new file +0 -0
new file mode 100644
index 0000000..15f77af

tests/tcg/i386/Makefile line 1

Quoted 1 line
tests/tcg/i386/Makefile new file +1 -0
@@ -0,0 +1,88 @@
+BUILD_DIR=../../../build/

Looks like you are hardcoding a custom path here.

There are many Makefile changes that I think you should split to help review.

+SRC_PATH=../../../

Quoted 7 lines
tests/tcg/i386/Makefile new file +6 -0
+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

tests/tcg/i386/Makefile line 18

Quoted 10 lines
tests/tcg/i386/Makefile new file +10 -0
+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
+

Not relevant anymore

tests/tcg/i386/Makefile line 21

Quoted 4 lines
tests/tcg/i386/Makefile new file +3 -0
+# runcom maps page 0, so it requires root privileges
+# also, pi_10.com runs indefinitely
+

+I386_TESTS=hello-i386 \

tests/tcg/i386/Makefile line 29

Quoted 9 lines
tests/tcg/i386/Makefile new file +5 -0
+          test-i386 \
+          test-i386-fprem
+          # runcom
+
+# native i386 compilers sometimes are not biarch.  assume cross-compilers

are

tests/tcg/i386/Makefile new file +2 -0
+ifneq ($(ARCH),i386)
+I386_TESTS+=run-test-x86_64

btw this is wrong, it should be test-x86_64, since run- is prepended later

+endif

Quoted 100 lines
tests/tcg/i386/Makefile new file +18 -0
+
+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

tests/tcg/i386/Makefile new file +5 -0
+
+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

tests/tcg/i386/Makefile new file +5 -0
+
+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

tests/tcg/i386/Makefile new file +15 -0
+
+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

tests/tcg/i386/Makefile new file +7 -1
+
+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

tests/tcg/i386/Makefile new file +7 -0
+
+# 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 \

tests/tcg/i386/Makefile new file +1 -0
+           test-x86_64.log test-x86_64.ref qruncom $(I386_TESTS)
tests/tcg/i386/hello-i386.c renamed from tests/tcg/hello-i386.c +3 -2
similarity index 71%
rename from tests/tcg/hello-i386.c
rename to tests/tcg/i386/hello-i386.c
index fa00380..ab55922 100644
@@ -1,6 +1,7 @@
 #include <asm/unistd.h>
+#include <stddef.h>
 
-static inline void exit(int status)
+static inline void _exit(int status)
 {
   int __res;
   __asm__ volatile ("movl %%ecx,%%ebx\n"\
@@ -8,7 +9,7 @@ static inline void exit(int status)
                    :  "=a" (__res) : "0" (__NR_exit),"c"
 ((long)(status)));
 }
 
-static inline int write(int fd, const char * buf, int len)
+static inline size_t _write(int fd, const void * buf, size_t len)
 {
   int status;
   __asm__ volatile ("pushl %%ebx\n"\
tests/tcg/i386/hello-i386.c renamed from tests/tcg/hello-i386.c +2 -2
@@ -22,6 +23,6 @@ static inline int write(int fd, const char * buf, int
 len)
 
 void _start(void)
 {
-    write(1, "Hello World\n", 12);
-    exit(0);
+    _write(1, "Hello World\n", 12);
+    _exit(0);
Quoted 2 lines

}

This could be a seperate patch

Quoted 46 lines
tests/tcg/i386/pi_10.com renamed from tests/tcg/pi_10.com +0 -0
similarity index 100%
rename from tests/tcg/pi_10.com
rename to tests/tcg/i386/pi_10.com
tests/tcg/i386/runcom.c renamed from tests/tcg/runcom.c +0 -0
similarity index 100%
rename from tests/tcg/runcom.c
rename to tests/tcg/i386/runcom.c
tests/tcg/i386/test-i386-code16.S renamed from tests/tcg/test-i386-code16.S +0 -0
similarity index 100%
rename from tests/tcg/test-i386-code16.S
rename to tests/tcg/i386/test-i386-code16.S
tests/tcg/i386/test-i386-fprem.c renamed from tests/tcg/test-i386-fprem.c +0 -0
similarity index 100%
rename from tests/tcg/test-i386-fprem.c
rename to tests/tcg/i386/test-i386-fprem.c
tests/tcg/i386/test-i386-muldiv.h renamed from tests/tcg/test-i386-muldiv.h +0 -0
similarity index 100%
rename from tests/tcg/test-i386-muldiv.h
rename to tests/tcg/i386/test-i386-muldiv.h
tests/tcg/i386/test-i386-shift.h renamed from tests/tcg/test-i386-shift.h +0 -0
similarity index 100%
rename from tests/tcg/test-i386-shift.h
rename to tests/tcg/i386/test-i386-shift.h
tests/tcg/i386/test-i386-ssse3.c renamed from tests/tcg/test-i386-ssse3.c +0 -0
similarity index 100%
rename from tests/tcg/test-i386-ssse3.c
rename to tests/tcg/i386/test-i386-ssse3.c
tests/tcg/i386/test-i386-vm86.S renamed from tests/tcg/test-i386-vm86.S +0 -0
similarity index 100%
rename from tests/tcg/test-i386-vm86.S
rename to tests/tcg/i386/test-i386-vm86.S
tests/tcg/i386/test-i386.c renamed from tests/tcg/test-i386.c +0 -0
similarity index 100%
rename from tests/tcg/test-i386.c
rename to tests/tcg/i386/test-i386.c
tests/tcg/i386/test-i386.h renamed from tests/tcg/test-i386.h +0 -1
similarity index 100%
rename from tests/tcg/test-i386.h
rename to tests/tcg/i386/test-i386.h
--

2.9.3

Quoted 1 line

--

Marc-André Lureau

#10 lore raw
In reply to Pranith Kumar

Hi Pranith

Quoted 5 lines · Pranith Kumar

Hello,

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

Incidentally, I was also looking at reorganizing tests/tcg last week. I think your series brings some necessary improvements, but it will probably need more iterations before it is accepted. Could you split off your obvious changes, such as test build fixes? I think it would help to get those out of the way first (cc -trivial). Also it would help if you documented the makefile changes.

Quoted 7 lines

The tests have bit-rotten and were not compiling or running. I fixed the Makefiles to make them compile but there are tests which do not pass.

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

Quoted 8 lines

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

As suggested by rth in v1 posting, I hooked up 'tests-tcg' target to run native tests. Detecting cross compilers or running the tests in docker containers are suggested ideas to make running the tests easier.

It doesn't make much sense to me to run only native tests (the uname -p), could you explain the rationale? Instead, I would check what cross-compilers and qemu targets are available to run the appropriate tests.

Quoted 78 lines

v3:
- Update with review feedback from Alex Bennée.

v2:
- Add tests-tcg target to invoke native tests.

Pranith Kumar (6):
tests/tcg: Move i386 tests to arch specific folder tests/tcg: Move arm tests to arch specific folder tests/tcg: Move mips test to arch specific folder tests/tcg: Create and populate misc tests for arch independent tests tests/tcg: Add and update Makefiles
tests/tcg: Add tests-tcg hook in Makefile

 tests/Makefile.include                  |   1 +
 tests/tcg/Makefile                      | 156
--------------------------------
 tests/tcg/Makefile.include              |  34 +++++++
 tests/tcg/alpha/Makefile                |  38 +++++---
 tests/tcg/arm/Makefile                  |  51 +++++++++++
 tests/tcg/{ => arm}/hello-arm.c         |   0
 tests/tcg/{ => arm}/test-arm-iwmmxt.s   |   0
 tests/tcg/cris/Makefile                 |  17 +++-
 tests/tcg/i386/Makefile                 |  87 ++++++++++++++++++
 tests/tcg/{ => i386}/hello-i386.c       |   9 +-
 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/lm32/Makefile                 |  17 +++-
 tests/tcg/mips/Makefile                 |  46 ++++++++++
 tests/tcg/{ => mips}/hello-mips.c       |   0
 tests/tcg/mips/mips32-dsp/Makefile      |  17 +++-
 tests/tcg/mips/mips32-dspr2/Makefile    |  17 +++-
 tests/tcg/mips/mips64-dsp/Makefile      |  18 +++-
 tests/tcg/mips/mips64-dspr2/Makefile    |  17 +++-
 tests/tcg/misc/Makefile                 |  81 +++++++++++++++++
 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
 tests/tcg/openrisc/Makefile             |  19 +++-
 tests/tcg/xtensa/Makefile               |  17 +++-
 35 files changed, 457 insertions(+), 188 deletions(-)
 delete mode 100644 tests/tcg/Makefile
 create mode 100644 tests/tcg/Makefile.include
 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 (71%)
 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%)
 create mode 100644 tests/tcg/mips/Makefile
 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%)
Quoted 5 lines

--
2.9.3

--

Marc-André Lureau

#11 lore raw

Hi Marc,

Quoted 9 lines · Marc-André Lureau

Hi Pranith

Quoted 5 lines · Pranith Kumar

Hello,

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

Quoted 6 lines

Incidentally, I was also looking at reorganizing tests/tcg last week. I think your series brings some necessary improvements, but it will probably need more iterations before it is accepted. Could you split off your obvious changes, such as test build fixes? I think it would help to get those out of the way first (cc -trivial). Also it would help if you documented the makefile changes.

OK, I will split up the patches into trivial fixes and document the changes to Makefiles.

Quoted 18 lines
Quoted 9 lines

The tests have bit-rotten and were not compiling or running. I fixed the Makefiles to make them compile but there are tests which do not pass.

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

Quoted 8 lines

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

As suggested by rth in v1 posting, I hooked up 'tests-tcg' target to run native tests. Detecting cross compilers or running the tests in docker containers are suggested ideas to make running the tests easier.

Quoted 4 lines

It doesn't make much sense to me to run only native tests (the uname -p), could you explain the rationale? Instead, I would check what cross-compilers and qemu targets are available to run the appropriate tests.

Detecting cross compilers is not perfect right now, so I hooked up only the native tests. If you know of a reliable way to detect the presence of cross compilers, please let me know :)

Cross compilation tests are supposed to be called by providing a CROSS_CC env variable populated with the installed cross compiler from the build/<arch>-linux-user/tests/ directory (as documented in the arm Makefile header).

I did not touch the make files for most archs which already had the cross compiler hard-coded. I can modify them to make them similar to what I did for ARM.

Signature · 1 line
Pranith
#3 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/tcg: Move i386 tests to arch specific folder

In reply to Marc-André Lureau
Quoted 8 lines · Marc-André Lureau

tests/tcg/i386/Makefile line 1

Quoted 6 lines

index 0000000..15f77af

tests/tcg/i386/Makefile new file +1 -0
@@ -0,0 +1,88 @@
+BUILD_DIR=../../../build/

Looks like you are hardcoding a custom path here.

Missed this one. Will fix it up.

Quoted 3 lines

There are many Makefile changes that I think you should split to help review.

OK, I will do that. I did not think it was worth splitting it up since I was being lazy, but yes, it will help make the review easier I guess.

Quoted 13 lines

+SRC_PATH=../../../

Quoted 11 lines
tests/tcg/i386/Makefile new file +11 -0
+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
Quoted 8 lines

tests/tcg/i386/Makefile line 18

Quoted 6 lines
tests/tcg/i386/Makefile new file +5 -0
+#CFLAGS+=-msse2
+LDFLAGS=
+
+# TODO: automatically detect ARM and MIPS compilers, and run those too
+

Not relevant anymore

Noted.

Quoted 7 lines

tests/tcg/i386/Makefile line 21

Quoted 6 lines
tests/tcg/i386/Makefile new file +3 -0
+# runcom maps page 0, so it requires root privileges
+# also, pi_10.com runs indefinitely
+

+I386_TESTS=hello-i386 \

Quoted 12 lines

tests/tcg/i386/Makefile line 29

Quoted 9 lines
tests/tcg/i386/Makefile new file +5 -0
+          test-i386 \
+          test-i386-fprem
+          # runcom
+
+# native i386 compilers sometimes are not biarch.  assume cross-compilers

are

tests/tcg/i386/Makefile new file +2 -0
+ifneq ($(ARCH),i386)
+I386_TESTS+=run-test-x86_64

btw this is wrong, it should be test-x86_64, since run- is prepended later

Will fix.

Quoted 24 lines
Quoted 24 lines
tests/tcg/i386/hello-i386.c renamed from tests/tcg/hello-i386.c +3 -2
@@ -1,6 +1,7 @@
 #include <asm/unistd.h>
+#include <stddef.h>
 
-static inline void exit(int status)
+static inline void _exit(int status)
 {
   int __res;
   __asm__ volatile ("movl %%ecx,%%ebx\n"\
@@ -8,7 +9,7 @@ static inline void exit(int status)
                    :  "=a" (__res) : "0" (__NR_exit),"c"
 ((long)(status)));
 }
 
-static inline int write(int fd, const char * buf, int len)
+static inline size_t _write(int fd, const void * buf, size_t len)
 {
   int status;
   __asm__ volatile ("pushl %%ebx\n"\
tests/tcg/i386/hello-i386.c renamed from tests/tcg/hello-i386.c +0 -0
@@ -22,6 +23,6 @@ static inline int write(int fd, const char * buf, int
 len)
 
Quoted 11 lines
Quoted 8 lines
tests/tcg/i386/hello-i386.c renamed from tests/tcg/hello-i386.c +2 -2
 void _start(void)
 {
-    write(1, "Hello World\n", 12);
-    exit(0);
+    _write(1, "Hello World\n", 12);
+    _exit(0);

}

This could be a seperate patch

OK, will do.

Signature · 1 line
Pranith
#12 lore raw
In reply to Pranith Kumar

Hi

Quoted 10 lines · Pranith Kumar

Hi Marc,

Quoted 3 lines · Marc-André Lureau

Hi Pranith

On Sat, Sep 17, 2016 at 6:05 PM Pranith Kumar <[email protected]>

Quoted 1 line · wrote:
Quoted 14 lines
Quoted 7 lines
Quoted 5 lines

Hello,

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

Incidentally, I was also looking at reorganizing tests/tcg last week. I think your series brings some necessary improvements, but it will

probably

Quoted 4 lines

need more iterations before it is accepted. Could you split off your obvious changes, such as test build fixes? I think it would help to get those out of the way first (cc -trivial). Also it would help if you documented the makefile changes.

fwiw, here is my wip at cleaning up tests/tcg:
https://github.com/elmarco/qemu/tree/tcg-tests/tests/tcg

The build-sys there has a lot of benefits over what is in tests/tcg today:
- uses implicit rules, for building, for running qemu
- dependency tracking
- generate gitignore, clean rule
- detects cross-compiler and qemu, skip the test when unavailable

I have quite a lot of trouble finding suitable cross-compilers for the various archs. crosstool-ng helped me to build some of them, but it's not obvious how to build the various archs, and when it builds, it often fails/crash. Anyway, this can hopefully give some ideas/inspiration. I did port i386/x64 and arm, and fixes a couple of qemu bugs on the way. (but arm mmap test still crashes qemu for ex).

OK, I will split up the patches into trivial fixes and document the changes

Quoted 44 lines

to
Makefiles.

Quoted 18 lines
Quoted 9 lines

The tests have bit-rotten and were not compiling or running. I fixed the Makefiles to make them compile but there are tests which do not pass.

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

Quoted 8 lines

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

As suggested by rth in v1 posting, I hooked up 'tests-tcg' target to run native tests. Detecting cross compilers or running the tests in docker containers are suggested ideas to make running the tests easier.

Quoted 3 lines

It doesn't make much sense to me to run only native tests (the uname -p), could you explain the rationale? Instead, I would check what cross-compilers and qemu targets are available to run the appropriate

tests.

Quoted 1 line

Detecting cross compilers is not perfect right now, so I hooked up only the native tests. If you know of a reliable way to detect the presence of cross compilers, please let me know :)

Cross compilation tests are supposed to be called by providing a CROSS_CC env
variable populated with the installed cross compiler from the build/<arch>-linux-user/tests/ directory (as documented in the arm Makefile header).

I did not touch the make files for most archs which already had the cross compiler hard-coded. I can modify them to make them similar to what I did for
ARM.

--
Pranith

Signature · 1 line
Marc-André Lureau
#8 lore raw

Re: [Qemu-devel] [PATCH 5/6] tests/tcg: Add and update Makefiles

In reply to Pranith Kumar

Hello,

On Sat, Sep 17, 2016 at 7:03 AM, Pranith Kumar <[email protected]> wrote:

[...]

tests/tcg/xtensa/Makefile line 3

Quoted 9 lines
tests/tcg/xtensa/Makefile +3 -1
index 522a63e..e3269ed 100644
@@ -1,10 +1,23 @@
--include ../../../config-host.mak
+# -*- Mode: makefile -*-
+#
+# xtensa linux TCG tests

These are system tests, not linux tests.

tests/tcg/xtensa/Makefile line 6

Quoted 3 lines
tests/tcg/xtensa/Makefile +3 -0
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/xtensa-softmmu/tests directory

There's no such directory under the BUILD_DIR.
If I create it and then try to run tests as
make -C xtensa-softmmu/tests -f ../../tests/tcg/xtensa/Makefile
it fails with the following error:
make: Entering directory 'build-xtensa-tcg-tests/xtensa-softmmu/tests'
make: *** No rule to make target 'test_b.tst', needed by 'build'. Stop.

Quoted 18 lines
tests/tcg/xtensa/Makefile +9 -1
+#
+
+BUILD_DIR=../..
+include $(BUILD_DIR)/config-host.mak   # brings in SRC_PATH
+include ../config-target.mak           # TARGET_NAME
+include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH)/tests/tcg/xtensa)
 
 CORE=dc232b
 CROSS=xtensa-$(CORE)-elf-
 
 ifndef XT
-SIM = ../../../xtensa-softmmu/qemu-system-xtensa
+SIM = $(BUILD_DIR)/xtensa-softmmu/qemu-system-xtensa
 SIMFLAGS = -M sim -cpu $(CORE) -nographic -semihosting $(EXTFLAGS) -kernel
 SIMDEBUG = -s -S
 else
Signature · 2 lines
Thanks.
-- Max
#13 lore raw
In reply to Marc-André Lureau
Quoted 37 lines · Marc-André Lureau

Hi

Quoted 10 lines · Pranith Kumar

Hi Marc,

Quoted 3 lines · Marc-André Lureau

Hi Pranith

On Sat, Sep 17, 2016 at 6:05 PM Pranith Kumar <[email protected]>

Quoted 1 line · wrote:
Quoted 14 lines
Quoted 7 lines
Quoted 5 lines

Hello,

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

Incidentally, I was also looking at reorganizing tests/tcg last week. I think your series brings some necessary improvements, but it will

probably

Quoted 4 lines

need more iterations before it is accepted. Could you split off your obvious changes, such as test build fixes? I think it would help to get those out of the way first (cc -trivial). Also it would help if you documented the makefile changes.

fwiw, here is my wip at cleaning up tests/tcg:
https://github.com/elmarco/qemu/tree/tcg-tests/tests/tcg

The build-sys there has a lot of benefits over what is in tests/tcg today:
- uses implicit rules, for building, for running qemu
- dependency tracking
- generate gitignore, clean rule
- detects cross-compiler and qemu, skip the test when unavailable

Quoted 10 lines

I have quite a lot of trouble finding suitable cross-compilers for the various archs. crosstool-ng helped me to build some of them, but it's not obvious how to build the various archs, and when it builds, it often fails/crash. Anyway, this can hopefully give some ideas/inspiration. I did port i386/x64 and arm, and fixes a couple of qemu bugs on the way. (but arm mmap test still crashes qemu for ex).

OK, I will split up the patches into trivial fixes and document the changes

Quoted 2 lines

to
Makefiles.

Where did we get to with these changes? Who's posting the next series?

--
Alex Bennée

#14 lore raw

Hi Alex,

I have a merged branch with these changes but it needs more work. I will post the next version soon(for some definition of soon :)

You can find the in-progress branch here:

https://github.com/pranith/qemu tcg_test_cleanup_v4

Thanks,

Quoted 55 lines · Alex Bennée
Quoted 37 lines · Marc-André Lureau

Hi

Quoted 10 lines · Pranith Kumar

Hi Marc,

Quoted 3 lines · Marc-André Lureau

Hi Pranith

On Sat, Sep 17, 2016 at 6:05 PM Pranith Kumar <[email protected]>

Quoted 1 line · wrote:
Quoted 14 lines
Quoted 7 lines
Quoted 5 lines

Hello,

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

Incidentally, I was also looking at reorganizing tests/tcg last week. I think your series brings some necessary improvements, but it will

probably

Quoted 4 lines

need more iterations before it is accepted. Could you split off your obvious changes, such as test build fixes? I think it would help to get those out of the way first (cc -trivial). Also it would help if you documented the makefile changes.

fwiw, here is my wip at cleaning up tests/tcg:
https://github.com/elmarco/qemu/tree/tcg-tests/tests/tcg

The build-sys there has a lot of benefits over what is in tests/tcg today:
- uses implicit rules, for building, for running qemu
- dependency tracking
- generate gitignore, clean rule
- detects cross-compiler and qemu, skip the test when unavailable

Quoted 10 lines

I have quite a lot of trouble finding suitable cross-compilers for the various archs. crosstool-ng helped me to build some of them, but it's not obvious how to build the various archs, and when it builds, it often fails/crash. Anyway, this can hopefully give some ideas/inspiration. I did port i386/x64 and arm, and fixes a couple of qemu bugs on the way. (but arm mmap test still crashes qemu for ex).

OK, I will split up the patches into trivial fixes and document the changes

Quoted 2 lines

to
Makefiles.

Where did we get to with these changes? Who's posting the next series?

--
Alex Bennée

Signature · 1 line
Pranith