From dbd5e50583752baccb59d981c2e434d3e518f762 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Sat, 22 May 2010 22:04:31 +0200 Subject: [PATCH] test-suite: apply cleanup pass Remove all non-modifiable items (target tuple, gcc version, toolchain path...) Makefile syntax ( use $(...) instead of ${...} ) Update doc Space-damage cleanups --- contrib/gcc-test-suite/Makefile | 68 ++++++++++++++++-------------- contrib/gcc-test-suite/README | 38 +++++++++++------ contrib/gcc-test-suite/default.cfg | 7 --- scripts/build/test_suite/gcc.sh | 26 +++++------- scripts/crosstool-NG.sh.in | 2 +- 5 files changed, 72 insertions(+), 69 deletions(-) diff --git a/contrib/gcc-test-suite/Makefile b/contrib/gcc-test-suite/Makefile index 96b954df..d78c178e 100644 --- a/contrib/gcc-test-suite/Makefile +++ b/contrib/gcc-test-suite/Makefile @@ -12,64 +12,68 @@ # option) any later version. # -# Internal directory configuration -TOPDIR=${shell pwd} -TMPDIR=${TOPDIR}/tmp +# Internal configuration +TARGET:=@@DG_TARGET@@ +TOPDIR:=$(shell pwd) +LOGDIR:=$(TOPDIR)/tmp # Include default configuration include default.cfg # Add toolchain to path -PATH:=${DG_TOOLCHAIN_DIR}:${PATH} +PATH:=$(shell cd ../../bin && pwd):$(PATH) # Select test set -ifeq (${DG_TOOLNAME},gcc) - DG_TESTS=$(DG_C_TESTS) +ifeq ($(DG_TOOLNAME),gcc) + DG_TESTS:=$(DG_C_TESTS) endif -ifeq (${DG_TOOLNAME},g++) - DG_TESTS=$(DG_CPP_TESTS) +ifeq ($(DG_TOOLNAME),g++) + DG_TESTS:=$(DG_CPP_TESTS) endif # Check that we have 'runtest' installed RUNTEST=$(shell which runtest) -ifeq "${RUNTEST}" "" +ifeq ($(RUNTEST),) $(error "DejaGnu 'runtest' not found - please install (eg. apt-get install dejagnu)") endif # Targets all: test -gcc-testsuite-${DG_GCC_VERSION}.tar.gz: -# wget -nc ${DG_GCC_URL} - -gcc-${DG_GCC_VERSION}: gcc-testsuite-${DG_GCC_VERSION}.tar.gz -# tar xzf gcc-testsuite-${DG_GCC_VERSION}.tar.gz +$(LOGDIR): + @mkdir -p $@ -config: - @mkdir -p ${TMPDIR} - @{ echo 'lappend boards_dir "."'; \ - echo "set target_alias ${DG_TARGET}"; } > ${TMPDIR}/site.exp +$(LOGDIR)/site.exp: $(TOPDIR)/default.cfg $(LOGDIR) + @{ echo 'lappend boards_dir "$(LOGDIR)"'; \ + echo "set target_alias $(TARGET)"; } > $@ + +$(LOGDIR)/board.exp: $(TOPDIR)/default.cfg $(LOGDIR) @{ echo -e "load_generic_config \"unix\""; \ echo -e "process_multilib_options \"\"" ; \ echo "set_board_info bmk,use_alarm 1" ; \ echo "set_board_info rsh_prog ssh" ; \ echo "set_board_info rcp_prog scp" ; \ - echo "set_board_info hostname ${DG_TARGET_HOSTNAME}"; \ - echo "set_board_info username ${DG_TARGET_USERNAME}"; } > ${TMPDIR}/board.exp + echo "set_board_info hostname $(DG_TARGET_HOSTNAME)"; \ + echo "set_board_info username $(DG_TARGET_USERNAME)"; } > $@ -test: gcc-${DG_GCC_VERSION} config - cd ${TMPDIR} && \ - runtest --tool ${DG_TOOLNAME} \ - --srcdir ${DG_SRC_DIR} \ - --all \ - --target ${DG_TARGET} \ - --target_board board \ - ${DG_TESTS} \ - GXX_UNDER_TEST=${DG_TARGET}-g++ ; \ - mv ${TMPDIR}/*.log ${TOPDIR} ; \ - mv ${TMPDIR}/*.sum ${TOPDIR} +# 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) + @runtest --tool $(DG_TOOLNAME) \ + --srcdir $(TOPDIR)/testsuite \ + --objdir $(LOGDIR) \ + --outdir $(LOGDIR) \ + --all \ + --target $(TARGET) \ + --target_board board \ + $(DG_TESTS) \ + GXX_UNDER_TEST=$(DG_TARGET)-g++ || true + @printf "Result files available in '%s'\n" "$(LOGDIR)" clean: - rm -rf gcc-testsuite-${DG_GCC_VERSION}.tar.gz gcc-${DG_GCC_VERSION} ${TMPDIR} *.log *.sum + rm -rf $(LOGDIR) .PHONY: config test clean diff --git a/contrib/gcc-test-suite/README b/contrib/gcc-test-suite/README index 99d61cce..0c81be9d 100644 --- a/contrib/gcc-test-suite/README +++ b/contrib/gcc-test-suite/README @@ -7,7 +7,6 @@ Requirements * DejaGnu 'runtest' v1.4.4+ * Make v3.81+ -* wget Configuration @@ -19,16 +18,23 @@ Alternatively, override configuration variables on the command line. Available config variables: -DG_GCC_VERSION -DG_GCC_URL DG_TOOLNAME -DG_TARGET + The name of the tool you want to test. + Currently supported: gcc or g++ + Default: gcc + DG_TARGET_HOSTNAME + The hostname or IP of the machine to execute run-tests + Default: 127.0.0.1 + DG_TARGET_USERNAME + Execute the run-test as this user on DG_TARGET_HOSTNAME + Default: root + DG_C_TESTS DG_CPP_TESTS -DG_TOOLCHAIN_DIR -DG_SRC_DIR + The C/C++ tests you want to check + Default: (empty, means all tests) Run examples @@ -53,19 +59,25 @@ SSH automatic login configuration example On host do: ssh-keygen -t rsa (then simply press enter thru all steps) -scp ~/.ssh/id_rsa.pub @:~/ - -On target do: -cd ~ -mkdir .ssh -cat id_rsa.pub >> .ssh/authorized_keys -rm id_rsa.pub +ssh-copy-id -i ~/.ssh/id_rsa.pub @ Now automatic ssh login should work - test by doing a simple ssh session to target. Note: The procedure might be slightly different for your particular target. +Getting rid of the test-suite +----------------------------- + +If you no longer have a need for the test-suite, then you can remove it altogether +from your toolchain. Just delete the test-suite/ dub-dir. + + Author ------ Martin Lund + Initial content + +"Yann E. MORIN" + Getting rid of the test-suite + Minor fixes diff --git a/contrib/gcc-test-suite/default.cfg b/contrib/gcc-test-suite/default.cfg index d9e2bfeb..d523008b 100644 --- a/contrib/gcc-test-suite/default.cfg +++ b/contrib/gcc-test-suite/default.cfg @@ -1,16 +1,9 @@ # Default test suite configuration -# GCC configuration -DG_GCC_VERSION = 4.3.2 -DG_GCC_URL = ftp://gcc.gnu.org/pub/gcc/releases/gcc-${DG_GCC_VERSION}/gcc-testsuite-${DG_GCC_VERSION}.tar.gz - # Default DejaGnu configuration DG_TOOLNAME = gcc DG_TARGET_HOSTNAME = 127.0.0.1 DG_TARGET_USERNAME = root -DG_TARGET = powerpc-unknown-linux-gnu -DG_SRC_DIR = ${TOPDIR}/gcc-${DG_GCC_VERSION}/gcc/testsuite -DG_TOOLCHAIN_DIR = ${TOPDIR}/../../bin # Default tests DG_C_TESTS = diff --git a/scripts/build/test_suite/gcc.sh b/scripts/build/test_suite/gcc.sh index 1b652691..c2493c05 100644 --- a/scripts/build/test_suite/gcc.sh +++ b/scripts/build/test_suite/gcc.sh @@ -14,22 +14,16 @@ do_test_suite_gcc_build() { CT_DoStep INFO "Installing GCC test suite" - CT_DoExecLog ALL mkdir -p "${CT_TEST_SUITE_DIR}/gcc-test-suite/gcc-${CT_CC_VERSION}/gcc" - CT_DoExecLog ALL cp "${CT_TOP_DIR}/contrib/gcc-test-suite/Makefile" \ - "${CT_TEST_SUITE_DIR}/gcc-test-suite" - CT_DoExecLog ALL cp "${CT_TOP_DIR}/contrib/gcc-test-suite/default.cfg" \ - "${CT_TEST_SUITE_DIR}/gcc-test-suite" - CT_DoExecLog ALL cp "${CT_TOP_DIR}/contrib/gcc-test-suite/README" \ - "${CT_TEST_SUITE_DIR}/gcc-test-suite" - CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/testsuite" \ - "${CT_TEST_SUITE_DIR}/gcc-test-suite/gcc-${CT_CC_VERSION}/gcc" - sed "s/DG_GCC_VERSION .*/DG_GCC_VERSION = ${CT_CC_VERSION}/g" \ - ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg > \ - ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg.tmp - sed "s/DG_TARGET .*/DG_TARGET = ${CT_TARGET}/g" \ - ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg.tmp > \ - ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg - CT_DoExecLog ALL rm -f "${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg.tmp" + CT_DoExecLog ALL mkdir -p "${CT_TEST_SUITE_DIR}/gcc" + CT_DoExecLog ALL cp -a "${CT_LIB_DIR}/contrib/gcc-test-suite/default.cfg" \ + "${CT_LIB_DIR}/contrib/gcc-test-suite/Makefile" \ + "${CT_LIB_DIR}/contrib/gcc-test-suite/README" \ + "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/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" + CT_EndStep } diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index 29ae4a15..45386de0 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -602,6 +602,6 @@ exec >/dev/null 2>&1 [ "${CT_LOG_FILE_COMPRESS}" = y ] && bzip2 -9 "${CT_LOG_FILE}" [ "${CT_INSTALL_DIR_RO}" = "y" ] && chmod -R a-w "${CT_INSTALL_DIR}" -[ "${CT_TEST_SUITE}" = "y" ] && chmod -R a+w "${CT_TEST_SUITE_DIR}" +[ "${CT_TEST_SUITE}" = "y" ] && chmod -R u+w "${CT_TEST_SUITE_DIR}" trap - EXIT