aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/contrib/gcc-test-suite.in47
-rw-r--r--config/test_suite.in7
-rw-r--r--contrib/gcc-test-suite/Makefile27
-rw-r--r--contrib/gcc-test-suite/default.cfg11
-rw-r--r--scripts/build/test_suite/gcc.sh13
5 files changed, 96 insertions, 9 deletions
diff --git a/config/contrib/gcc-test-suite.in b/config/contrib/gcc-test-suite.in
new file mode 100644
index 00000000..6a4c876f
--- /dev/null
+++ b/config/contrib/gcc-test-suite.in
@@ -0,0 +1,47 @@
+choice
+ bool "How to execute tests"
+ default TEST_SUITE_GCC_SSH
+
+config TEST_SUITE_GCC_SSH
+ bool "Run test suite on remote host"
+ help
+ Select this option to execute GCC tests on a remote host,
+ specified by TEST_SUITE_GCC_HOST.
+
+config TEST_SUITE_GCC_QEMU
+ bool "Run test suite using qemu"
+ help
+ Select this option to execute GCC tests using qemu on the local
+ host.
+
+endchoice
+
+config TEST_SUITE_GCC_TARGET_HOSTNAME
+ string "Remote host to execute GCC tests"
+ default "127.0.0.1"
+ depends on TEST_SUITE_GCC_SSH
+ help
+ Set this to the remote host name where gcc tests will be run.
+
+config TEST_SUITE_GCC_TARGET_USERNAME
+ string "Username on remote host"
+ default "root"
+ depends on TEST_SUITE_GCC_SSH
+ help
+ Set this to the username on the remote hosts for GCC tests.
+
+config TEST_SUITE_GCC_QEMU_PROGRAM
+ string "Qemu program"
+ depends on TEST_SUITE_GCC_QEMU
+ help
+ Specifies the qemu program name. If unset, this will be "qemu-"
+ followed by the first component of the target name.
+
+config TEST_SUITE_GCC_QEMU_ARGS
+ string "Qemu program args"
+ depends on TEST_SUITE_GCC_QEMU
+ default "-L @SYSROOT@"
+ help
+ Specifies any arguments needed by qemu before the executable
+ filename. If unset, this will be "-L" followed by the path to
+ the sysroot in the installed toolchain.
diff --git a/config/test_suite.in b/config/test_suite.in
index 978635d3..8cfe1434 100644
--- a/config/test_suite.in
+++ b/config/test_suite.in
@@ -17,11 +17,14 @@ config TEST_SUITE_GCC
The GCC test suite includes a collection of various toolchain tests for GCC -
it utilizes the DejaGnu test framework.
- For some tests a network enabled target with ssh server is required.
-
A helper Makefile is provided for running the tests - please see the included
README for information on how to run the test suite.
+if TEST_SUITE_GCC
+source "config/contrib/gcc-test-suite.in"
+endif
+
endmenu
endif
+
diff --git a/contrib/gcc-test-suite/Makefile b/contrib/gcc-test-suite/Makefile
index c3e17942..7dc836bc 100644
--- a/contrib/gcc-test-suite/Makefile
+++ b/contrib/gcc-test-suite/Makefile
@@ -13,16 +13,23 @@
#
# Internal configuration
-TARGET:=@@DG_TARGET@@
TOPDIR:=$(shell pwd)
LOGDIR:=$(TOPDIR)/tmp
# Include default configuration
include default.cfg
+TARGET:=$(DG_TARGET)
+
# Add toolchain to path
PATH:=$(shell cd ../../bin && pwd):$(PATH)
+# Set sysroot
+SYSROOT:=$(shell cd ../../$(TARGET)/sysroot && pwd)
+
+# Set qemu
+DG_QEMU_PROGRAM:=qemu-$(shell echo $(TARGET) | sed 's/-.*$$//')
+
# Select test set
ifeq ($(DG_TOOLNAME),gcc)
DG_TESTS:=$(DG_C_TESTS)
@@ -31,6 +38,12 @@ ifeq ($(DG_TOOLNAME),g++)
DG_TESTS:=$(DG_CPP_TESTS)
endif
+ifeq ($(DG_QEMU),y)
+ TARGET_BOARD=unix
+else
+ TARGET_BOARD=board
+endif
+
# Check that we have 'runtest' installed
RUNTEST=$(shell which runtest)
ifeq ($(RUNTEST),)
@@ -48,6 +61,7 @@ $(LOGDIR)/site.exp: $(TOPDIR)/default.cfg $(LOGDIR)
echo 'set tmpdir "$(TOPDIR)"'; \
echo 'set target_alias $(TARGET)'; } > $@
+# Create config for remote execution
$(LOGDIR)/board.exp: $(TOPDIR)/default.cfg $(LOGDIR)
@{ echo 'load_generic_config "unix"'; \
echo 'process_multilib_options ""'; \
@@ -57,19 +71,26 @@ $(LOGDIR)/board.exp: $(TOPDIR)/default.cfg $(LOGDIR)
echo 'set_board_info hostname $(DG_TARGET_HOSTNAME)'; \
echo 'set_board_info username $(DG_TARGET_USERNAME)'; } > $@
+# create config for local execution via qemu
+$(LOGDIR)/unix.exp: $(TOPDIR)/default.cfg $(LOGDIR)
+ @{ echo 'load_generic_config "unix"'; \
+ echo 'process_multilib_options ""'; \
+ echo 'set_board_info bmk,use_alarm 1'; \
+ echo 'set_board_info exec_shell "$(DG_QEMU_PROGRAM) $(DG_QEMU_ARGS)"'; } > $@
+
# As Martin puts it:
# > The thing is that when you run 50k+ test cases the odds are that at
# > least one will fail and thus runtest basically always return an error
# > despite the fact that the test session has executed successfully.
# So just ignore any error reported by runtest
-test: $(LOGDIR)/board.exp $(LOGDIR)/site.exp $(LOGDIR)
+test: $(LOGDIR)/$(TARGET_BOARD).exp $(LOGDIR)/site.exp $(LOGDIR)
@runtest --tool $(DG_TOOLNAME) \
--srcdir $(TOPDIR)/testsuite \
--objdir $(LOGDIR) \
--outdir $(LOGDIR) \
--all \
--target $(TARGET) \
- --target_board board \
+ --target_board $(TARGET_BOARD) \
$(DG_TESTS) \
GXX_UNDER_TEST=$(TARGET)-g++ || true
@printf "Result files available in '%s'\n" "$(LOGDIR)"
diff --git a/contrib/gcc-test-suite/default.cfg b/contrib/gcc-test-suite/default.cfg
index d523008b..2089d77a 100644
--- a/contrib/gcc-test-suite/default.cfg
+++ b/contrib/gcc-test-suite/default.cfg
@@ -1,9 +1,16 @@
# Default test suite configuration
+DG_TARGET = @@DG_TARGET@@
+
# Default DejaGnu configuration
DG_TOOLNAME = gcc
-DG_TARGET_HOSTNAME = 127.0.0.1
-DG_TARGET_USERNAME = root
+DG_SSH = @@DG_SSH@@
+DG_QEMU = @@DG_QEMU@@
+DG_TARGET_HOSTNAME = @@DG_TARGET_HOSTNAME@@
+DG_TARGET_USERNAME = @@DG_TARGET_USERNAME@@
+
+DG_QEMU_PROGRAM = @@DG_QEMU_PROGRAM@@
+DG_QEMU_ARGS = @@DG_QEMU_ARGS@@
# Default tests
DG_C_TESTS =
diff --git a/scripts/build/test_suite/gcc.sh b/scripts/build/test_suite/gcc.sh
index 6c6e5a72..25eee5ad 100644
--- a/scripts/build/test_suite/gcc.sh
+++ b/scripts/build/test_suite/gcc.sh
@@ -21,8 +21,17 @@ do_test_suite_gcc_build() {
"${CT_SRC_DIR}/gcc/gcc/testsuite" \
"${CT_TEST_SUITE_DIR}/gcc"
- CT_DoExecLog ALL sed -i -r -e "s/@@DG_TARGET@@/${CT_TARGET}/g;" \
- "${CT_TEST_SUITE_DIR}/gcc/Makefile"
+ DG_QEMU_ARGS=`echo "${CT_TEST_SUITE_GCC_QEMU_ARGS}" | sed 's/@SYSROOT@/$(SYSROOT)/'`
+
+ CT_DoExecLog ALL sed -i -r \
+ -e "s/@@DG_TARGET@@/${CT_TARGET}/g" \
+ -e "s/@@DG_SSH@@/${CT_TEST_SUITE_GCC_SSH}/g" \
+ -e "s/@@DG_QEMU@@/${CT_TEST_SUITE_GCC_QEMU}/g" \
+ -e "s/@@DG_TARGET_HOSTNAME@@/${CT_TEST_SUITE_GCC_TARGET_HOSTNAME}/g" \
+ -e "s/@@DG_TARGET_USERNAME@@/${CT_TEST_SUITE_GCC_TARGET_USERNAME}/g" \
+ -e "s/@@DG_QEMU_PROGRAM@@/${CT_TEST_SUITE_GCC_QEMU_PROGRAM}/g" \
+ -e "s/@@DG_QEMU_ARGS@@/${DG_QEMU_ARGS}/g" \
+ "${CT_TEST_SUITE_DIR}/gcc/default.cfg"
CT_EndStep
}