All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pranith Kumar <bobby.prani@gmail.com>
To: alex.bennee@linaro.org
Cc: qemu-devel@nongnu.org, rth@twiddle.net
Subject: [Qemu-devel] [PATCH 18/19] tests/tcg: Add and update Makefiles
Date: Thu,  1 Dec 2016 00:14:32 -0500	[thread overview]
Message-ID: <20161201051433.17168-19-bobby.prani@gmail.com> (raw)
In-Reply-To: <20161201051433.17168-1-bobby.prani@gmail.com>

This commit fixes the makefiles to bring them to the desired state.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 tests/tcg/alpha/Makefile             | 38 +++++++++++++++++++----------
 tests/tcg/arm/Makefile               | 32 +++++++++++++++----------
 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, 225 insertions(+), 53 deletions(-)
 create mode 100644 tests/tcg/mips/Makefile

diff --git a/tests/tcg/alpha/Makefile b/tests/tcg/alpha/Makefile
index 2b1f03d..e20315f 100644
--- a/tests/tcg/alpha/Makefile
+++ b/tests/tcg/alpha/Makefile
@@ -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)
diff --git a/tests/tcg/arm/Makefile b/tests/tcg/arm/Makefile
index c2ae491..a7c8953 100644
--- a/tests/tcg/arm/Makefile
+++ b/tests/tcg/arm/Makefile
@@ -1,20 +1,26 @@
-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
 
-QEMU_INCLUDES += -I$(BUILD_DIR)
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
-LDFLAGS=
-
-# TODO: automatically detect ARM and MIPS compilers, and run those too
+# Compiler set-up, default to system compiler if not set
+CROSS_CC?=$(CC)
 
-# runcom maps page 0, so it requires root privileges
-# also, pi_10.com runs indefinitely
+QEMU_INCLUDES += -I$(BUILD_DIR)
+CFLAGS=-Wall -O2 -g -fno-strict-aliasing -nostdlib
+LDFLAGS=-nostdlib
 
 TESTS=hello-arm arm-iwmmxt
 
@@ -33,13 +39,13 @@ run-arm-iwmmxt: arm-iwmmxt
 
 # arm test
 hello-arm: hello-arm.o
-	arm-linux-gnueabi-ld -o $@ $<
+	$(CROSS_CC) $(LDFLAGS) -o $@ $<
 
 hello-arm.o: hello-arm.c
-	arm-linux-gnueabi-gcc -Wall -g -O2 -c -o $@ $<
+	$(CROSS_CC) $(CFLAGS) -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)
diff --git a/tests/tcg/cris/Makefile b/tests/tcg/cris/Makefile
index 6b3dba4..009c3f4 100644
--- a/tests/tcg/cris/Makefile
+++ b/tests/tcg/cris/Makefile
@@ -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
diff --git a/tests/tcg/i386/Makefile b/tests/tcg/i386/Makefile
index 97c1a97..55a45ad 100644
--- a/tests/tcg/i386/Makefile
+++ b/tests/tcg/i386/Makefile
@@ -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,14 +22,8 @@ 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-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
diff --git a/tests/tcg/lm32/Makefile b/tests/tcg/lm32/Makefile
index 57e7363..ad5d9a7 100644
--- a/tests/tcg/lm32/Makefile
+++ b/tests/tcg/lm32/Makefile
@@ -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
diff --git a/tests/tcg/mips/Makefile b/tests/tcg/mips/Makefile
new file mode 100644
index 0000000..a56d6c8
--- /dev/null
+++ b/tests/tcg/mips/Makefile
@@ -0,0 +1,46 @@
+# -*- Mode: makefile -*-
+#
+# mips linux-user TCG tests
+#
+# The Make is expected to be called in the
+# ${BUILD_DIR}/mips-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)
+
+QEMU=$(BUILD_DIR)/mips-linux-user/qemu-mips
+
+# Compiler set-up, default to system compiler if not set
+CROSS_CC?=$(CC)
+
+CFLAGS=-Wall -O2 -g -fno-strict-aliasing
+LDFLAGS=
+
+TESTS=hello-mips
+
+all: $(patsubst %,run-%,$(TESTS))
+test: all
+
+# rules to run tests
+
+run-%: %
+	$(QEMU) ./$*
+
+#.PHONY: $(patsubst %,run-%,$(TESTS))
+
+run-hello-mips: hello-mips
+
+# mips test
+hello-mips: hello-mips.o
+	$(CROSS_CC) -o $@ $<
+
+hello-mips.o: hello-mips.c
+	$(CROSS_CC) -Wall -g -O2 -c -o $@ $<
+
+clean:
+	rm -f *~ *.o $(TESTS)
diff --git a/tests/tcg/mips/mips32-dsp/Makefile b/tests/tcg/mips/mips32-dsp/Makefile
index c3a0a00..996b9a0 100644
--- a/tests/tcg/mips/mips32-dsp/Makefile
+++ b/tests/tcg/mips/mips32-dsp/Makefile
@@ -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
diff --git a/tests/tcg/mips/mips32-dspr2/Makefile b/tests/tcg/mips/mips32-dspr2/Makefile
index ed19581..e99f2bc 100644
--- a/tests/tcg/mips/mips32-dspr2/Makefile
+++ b/tests/tcg/mips/mips32-dspr2/Makefile
@@ -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
diff --git a/tests/tcg/mips/mips64-dsp/Makefile b/tests/tcg/mips/mips64-dsp/Makefile
index b2ac6b3..4ee3bbb 100644
--- a/tests/tcg/mips/mips64-dsp/Makefile
+++ b/tests/tcg/mips/mips64-dsp/Makefile
@@ -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
diff --git a/tests/tcg/mips/mips64-dspr2/Makefile b/tests/tcg/mips/mips64-dspr2/Makefile
index ba44bb9..8510d8c 100644
--- a/tests/tcg/mips/mips64-dspr2/Makefile
+++ b/tests/tcg/mips/mips64-dspr2/Makefile
@@ -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
diff --git a/tests/tcg/openrisc/Makefile b/tests/tcg/openrisc/Makefile
index 7e65888..071aaab 100644
--- a/tests/tcg/openrisc/Makefile
+++ b/tests/tcg/openrisc/Makefile
@@ -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
 
diff --git a/tests/tcg/xtensa/Makefile b/tests/tcg/xtensa/Makefile
index 522a63e..e3269ed 100644
--- a/tests/tcg/xtensa/Makefile
+++ b/tests/tcg/xtensa/Makefile
@@ -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
-- 
2.10.2

  parent reply	other threads:[~2016-12-01  5:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01  5:14 [Qemu-devel] [PATCH v5 00/19] Cleanup of TCG tests Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 01/19] linux-user: fix settime old value location Pranith Kumar
2016-12-09 17:01   ` Alex Bennée
2016-12-10 11:22   ` Laurent Vivier
2016-12-01  5:14 ` [Qemu-devel] [PATCH 02/19] linux-user: fix tcg/mmap test Pranith Kumar
2016-12-09 17:12   ` Alex Bennée
2016-12-10 14:08   ` Laurent Vivier
2016-12-01  5:14 ` [Qemu-devel] [PATCH 03/19] check-help: add some hint to run a single test Pranith Kumar
2016-12-09 17:14   ` Alex Bennée
2016-12-01  5:14 ` [Qemu-devel] [PATCH 04/19] tests/tcg: comment unused code Pranith Kumar
2016-12-09 17:15   ` Alex Bennée
2016-12-01  5:14 ` [Qemu-devel] [PATCH 06/19] linux-test: fix build Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 07/19] linux-test: fix set/getitimer returned timer check Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 08/19] Fix test-i386-fprem compilation Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 09/19] test-i386: modernize vector code v4sf Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 10/19] tests/tcg: Move arm tests to arch specific folder Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 11/19] tests/tcg: Move mips test " Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 12/19] tests/tcg: Add tests-tcg hook in Makefile Pranith Kumar
2016-12-13 17:10   ` Alex Bennée
2016-12-01  5:14 ` [Qemu-devel] [PATCH 13/19] tests/tcg/i386: Fix hello-i386 test Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 14/19] tests/tcg: Move i386 tests to arch specific folder Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 15/19] tests/tcg/i386: Fix test-i386 compilation Pranith Kumar
2016-12-01  5:14 ` [Qemu-devel] [PATCH 16/19] tests/tcg: Fix compilation of linux-test.c Pranith Kumar
2016-12-13 13:37   ` Alex Bennée
2016-12-01  5:14 ` [Qemu-devel] [PATCH 17/19] tests/tcg: Move independent tests to misc dir Pranith Kumar
2016-12-13 13:38   ` Alex Bennée
2016-12-01  5:14 ` Pranith Kumar [this message]
2016-12-14 15:46   ` [Qemu-devel] [PATCH 18/19] tests/tcg: Add and update Makefiles Alex Bennée
2016-12-01  5:14 ` [Qemu-devel] [PATCH 19/19] tests/tcg: test-i386.c: Fix format warnings Pranith Kumar
2016-12-01  9:22 ` [Qemu-devel] [PATCH v5 00/19] Cleanup of TCG tests Peter Maydell
2016-12-01 13:17   ` Pranith Kumar
2016-12-13 13:31 ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161201051433.17168-19-bobby.prani@gmail.com \
    --to=bobby.prani@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.