test-suite: apply cleanup pass
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat May 22 22:04:31 2010 +0200 (2010-05-22)
changeset 196610ad7f230f4b
parent 1965 e3d532dd8b5d
child 1967 9d6f3c433257
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
contrib/gcc-test-suite/README
contrib/gcc-test-suite/default.cfg
scripts/build/test_suite/gcc.sh
scripts/crosstool-NG.sh.in
     1.1 --- a/contrib/gcc-test-suite/Makefile	Wed May 19 17:53:04 2010 +0200
     1.2 +++ b/contrib/gcc-test-suite/Makefile	Sat May 22 22:04:31 2010 +0200
     1.3 @@ -12,64 +12,68 @@
     1.4  # option) any later version.
     1.5  #
     1.6  
     1.7 -# Internal directory configuration
     1.8 -TOPDIR=${shell pwd}
     1.9 -TMPDIR=${TOPDIR}/tmp
    1.10 +# Internal configuration
    1.11 +TARGET:=@@DG_TARGET@@
    1.12 +TOPDIR:=$(shell pwd)
    1.13 +LOGDIR:=$(TOPDIR)/tmp
    1.14  
    1.15  # Include default configuration
    1.16  include default.cfg
    1.17  
    1.18  # Add toolchain to path
    1.19 -PATH:=${DG_TOOLCHAIN_DIR}:${PATH}
    1.20 +PATH:=$(shell cd ../../bin && pwd):$(PATH)
    1.21  
    1.22  # Select test set
    1.23 -ifeq (${DG_TOOLNAME},gcc)
    1.24 -	DG_TESTS=$(DG_C_TESTS)
    1.25 +ifeq ($(DG_TOOLNAME),gcc)
    1.26 +	DG_TESTS:=$(DG_C_TESTS)
    1.27  endif
    1.28 -ifeq (${DG_TOOLNAME},g++)
    1.29 -	DG_TESTS=$(DG_CPP_TESTS)
    1.30 +ifeq ($(DG_TOOLNAME),g++)
    1.31 +	DG_TESTS:=$(DG_CPP_TESTS)
    1.32  endif
    1.33  
    1.34  # Check that we have 'runtest' installed
    1.35  RUNTEST=$(shell which runtest)
    1.36 -ifeq "${RUNTEST}" ""
    1.37 +ifeq ($(RUNTEST),)
    1.38          $(error "DejaGnu 'runtest' not found - please install (eg. apt-get install dejagnu)")
    1.39  endif
    1.40  
    1.41  # Targets 
    1.42  all: test
    1.43  
    1.44 -gcc-testsuite-${DG_GCC_VERSION}.tar.gz:
    1.45 -#	wget -nc ${DG_GCC_URL}
    1.46 -    
    1.47 -gcc-${DG_GCC_VERSION}: gcc-testsuite-${DG_GCC_VERSION}.tar.gz
    1.48 -#	tar xzf gcc-testsuite-${DG_GCC_VERSION}.tar.gz
    1.49 +$(LOGDIR):
    1.50 +	@mkdir -p $@
    1.51  
    1.52 -config:
    1.53 -	@mkdir -p ${TMPDIR}
    1.54 -	@{ echo 'lappend boards_dir "."'; \
    1.55 -	  echo "set target_alias ${DG_TARGET}"; } > ${TMPDIR}/site.exp
    1.56 +$(LOGDIR)/site.exp: $(TOPDIR)/default.cfg $(LOGDIR)
    1.57 +	@{ echo 'lappend boards_dir "$(LOGDIR)"'; \
    1.58 +	  echo "set target_alias $(TARGET)"; } > $@
    1.59 +
    1.60 +$(LOGDIR)/board.exp: $(TOPDIR)/default.cfg $(LOGDIR)
    1.61  	@{ echo -e "load_generic_config \"unix\""; \
    1.62  	echo -e "process_multilib_options \"\"" ; \
    1.63  	echo "set_board_info bmk,use_alarm 1" ; \
    1.64  	echo "set_board_info rsh_prog ssh" ; \
    1.65  	echo "set_board_info rcp_prog scp" ; \
    1.66 -	echo "set_board_info hostname ${DG_TARGET_HOSTNAME}"; \
    1.67 -	echo "set_board_info username ${DG_TARGET_USERNAME}"; } > ${TMPDIR}/board.exp
    1.68 +	echo "set_board_info hostname $(DG_TARGET_HOSTNAME)"; \
    1.69 +	echo "set_board_info username $(DG_TARGET_USERNAME)"; } > $@
    1.70  
    1.71 -test: gcc-${DG_GCC_VERSION} config
    1.72 -	cd ${TMPDIR} && \
    1.73 -	runtest	--tool ${DG_TOOLNAME} \
    1.74 -		--srcdir ${DG_SRC_DIR} \
    1.75 -		--all \
    1.76 -		--target ${DG_TARGET} \
    1.77 -		--target_board board \
    1.78 -		${DG_TESTS} \
    1.79 -		GXX_UNDER_TEST=${DG_TARGET}-g++ ; \
    1.80 -	mv ${TMPDIR}/*.log ${TOPDIR} ; \
    1.81 -	mv ${TMPDIR}/*.sum ${TOPDIR}
    1.82 +# As Martin puts it:
    1.83 +#  > The thing is that when you run 50k+ test cases the odds are that at
    1.84 +#  > least one will fail and thus runtest basically always return an error
    1.85 +#  > despite the fact that the test session has executed successfully.
    1.86 +# So just ignore any error reported by runtest
    1.87 +test: $(LOGDIR)/board.exp $(LOGDIR)/site.exp $(LOGDIR)
    1.88 +	@runtest --tool $(DG_TOOLNAME)          \
    1.89 +	         --srcdir $(TOPDIR)/testsuite   \
    1.90 +	         --objdir $(LOGDIR)             \
    1.91 +	         --outdir $(LOGDIR)             \
    1.92 +	         --all                          \
    1.93 +	         --target $(TARGET)             \
    1.94 +	         --target_board board           \
    1.95 +	         $(DG_TESTS)                    \
    1.96 +	         GXX_UNDER_TEST=$(DG_TARGET)-g++ || true
    1.97 +	@printf "Result files available in '%s'\n" "$(LOGDIR)"
    1.98  
    1.99  clean:
   1.100 -	rm -rf gcc-testsuite-${DG_GCC_VERSION}.tar.gz gcc-${DG_GCC_VERSION} ${TMPDIR} *.log *.sum 
   1.101 +	rm -rf $(LOGDIR)
   1.102  
   1.103  .PHONY: config test clean
     2.1 --- a/contrib/gcc-test-suite/README	Wed May 19 17:53:04 2010 +0200
     2.2 +++ b/contrib/gcc-test-suite/README	Sat May 22 22:04:31 2010 +0200
     2.3 @@ -7,7 +7,6 @@
     2.4  
     2.5  * DejaGnu 'runtest' v1.4.4+
     2.6  * Make v3.81+
     2.7 -* wget
     2.8  
     2.9  
    2.10  Configuration
    2.11 @@ -19,16 +18,23 @@
    2.12  
    2.13  Available config variables:
    2.14  
    2.15 -DG_GCC_VERSION
    2.16 -DG_GCC_URL
    2.17  DG_TOOLNAME
    2.18 -DG_TARGET
    2.19 +  The name of the tool you want to test.
    2.20 +  Currently supported: gcc or g++
    2.21 +  Default: gcc
    2.22 +
    2.23  DG_TARGET_HOSTNAME
    2.24 +  The hostname or IP of the machine to execute run-tests
    2.25 +  Default: 127.0.0.1
    2.26 +
    2.27  DG_TARGET_USERNAME
    2.28 +  Execute the run-test as this user on DG_TARGET_HOSTNAME
    2.29 +  Default: root
    2.30 +
    2.31  DG_C_TESTS
    2.32  DG_CPP_TESTS
    2.33 -DG_TOOLCHAIN_DIR
    2.34 -DG_SRC_DIR
    2.35 +  The C/C++ tests you want to check
    2.36 +  Default: (empty, means all tests)
    2.37  
    2.38  
    2.39  Run examples
    2.40 @@ -53,19 +59,25 @@
    2.41  
    2.42  On host do: 
    2.43  ssh-keygen -t rsa (then simply press enter thru all steps)
    2.44 -scp ~/.ssh/id_rsa.pub <username>@<target IP>:~/
    2.45 -
    2.46 -On target do:
    2.47 -cd ~
    2.48 -mkdir .ssh
    2.49 -cat id_rsa.pub >> .ssh/authorized_keys
    2.50 -rm id_rsa.pub
    2.51 +ssh-copy-id -i ~/.ssh/id_rsa.pub <username>@<target IP>
    2.52  
    2.53  Now automatic ssh login should work - test by doing a simple ssh session to target.
    2.54  
    2.55  Note: The procedure might be slightly different for your particular target.
    2.56  
    2.57  
    2.58 +Getting rid of the test-suite
    2.59 +-----------------------------
    2.60 +
    2.61 +If you no longer have a need for the test-suite, then you can remove it altogether
    2.62 +from your toolchain. Just delete the test-suite/ dub-dir.
    2.63 +
    2.64 +
    2.65  Author
    2.66  ------
    2.67  Martin Lund <mgl@doredevelopment.dk>
    2.68 +  Initial content
    2.69 +
    2.70 +"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
    2.71 +  Getting rid of the test-suite
    2.72 +  Minor fixes
     3.1 --- a/contrib/gcc-test-suite/default.cfg	Wed May 19 17:53:04 2010 +0200
     3.2 +++ b/contrib/gcc-test-suite/default.cfg	Sat May 22 22:04:31 2010 +0200
     3.3 @@ -1,16 +1,9 @@
     3.4  # Default test suite configuration
     3.5  
     3.6 -# GCC configuration
     3.7 -DG_GCC_VERSION = 4.3.2
     3.8 -DG_GCC_URL = ftp://gcc.gnu.org/pub/gcc/releases/gcc-${DG_GCC_VERSION}/gcc-testsuite-${DG_GCC_VERSION}.tar.gz
     3.9 -
    3.10  # Default DejaGnu configuration
    3.11  DG_TOOLNAME = gcc
    3.12  DG_TARGET_HOSTNAME = 127.0.0.1
    3.13  DG_TARGET_USERNAME = root
    3.14 -DG_TARGET = powerpc-unknown-linux-gnu
    3.15 -DG_SRC_DIR = ${TOPDIR}/gcc-${DG_GCC_VERSION}/gcc/testsuite
    3.16 -DG_TOOLCHAIN_DIR = ${TOPDIR}/../../bin
    3.17  
    3.18  # Default tests
    3.19  DG_C_TESTS = 
     4.1 --- a/scripts/build/test_suite/gcc.sh	Wed May 19 17:53:04 2010 +0200
     4.2 +++ b/scripts/build/test_suite/gcc.sh	Sat May 22 22:04:31 2010 +0200
     4.3 @@ -14,22 +14,16 @@
     4.4   
     4.5      CT_DoStep INFO "Installing GCC test suite"
     4.6  
     4.7 -    CT_DoExecLog ALL mkdir -p "${CT_TEST_SUITE_DIR}/gcc-test-suite/gcc-${CT_CC_VERSION}/gcc"
     4.8 -    CT_DoExecLog ALL cp "${CT_TOP_DIR}/contrib/gcc-test-suite/Makefile" \
     4.9 -                        "${CT_TEST_SUITE_DIR}/gcc-test-suite"
    4.10 -    CT_DoExecLog ALL cp "${CT_TOP_DIR}/contrib/gcc-test-suite/default.cfg" \
    4.11 -                        "${CT_TEST_SUITE_DIR}/gcc-test-suite"
    4.12 -    CT_DoExecLog ALL cp "${CT_TOP_DIR}/contrib/gcc-test-suite/README" \
    4.13 -                        "${CT_TEST_SUITE_DIR}/gcc-test-suite"
    4.14 -    CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/testsuite" \
    4.15 -                           "${CT_TEST_SUITE_DIR}/gcc-test-suite/gcc-${CT_CC_VERSION}/gcc"
    4.16 -    sed "s/DG_GCC_VERSION .*/DG_GCC_VERSION = ${CT_CC_VERSION}/g" \
    4.17 -        ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg > \
    4.18 -        ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg.tmp
    4.19 -    sed "s/DG_TARGET .*/DG_TARGET = ${CT_TARGET}/g" \
    4.20 -        ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg.tmp > \
    4.21 -        ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg
    4.22 -    CT_DoExecLog ALL rm -f "${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg.tmp"
    4.23 +    CT_DoExecLog ALL mkdir -p "${CT_TEST_SUITE_DIR}/gcc"
    4.24 +    CT_DoExecLog ALL cp -a "${CT_LIB_DIR}/contrib/gcc-test-suite/default.cfg"               \
    4.25 +                           "${CT_LIB_DIR}/contrib/gcc-test-suite/Makefile"                  \
    4.26 +                           "${CT_LIB_DIR}/contrib/gcc-test-suite/README"                    \
    4.27 +                           "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/testsuite"               \
    4.28 +                           "${CT_TEST_SUITE_DIR}/gcc"
    4.29 +
    4.30 +    CT_DoExecLog ALL sed -i -r -e "s/@@DG_TARGET@@/${CT_TARGET}/g;"     \
    4.31 +                         "${CT_TEST_SUITE_DIR}/gcc/Makefile"
    4.32 +
    4.33      CT_EndStep
    4.34  }
    4.35  
     5.1 --- a/scripts/crosstool-NG.sh.in	Wed May 19 17:53:04 2010 +0200
     5.2 +++ b/scripts/crosstool-NG.sh.in	Sat May 22 22:04:31 2010 +0200
     5.3 @@ -602,6 +602,6 @@
     5.4  
     5.5  [ "${CT_LOG_FILE_COMPRESS}" = y ] && bzip2 -9 "${CT_LOG_FILE}"
     5.6  [ "${CT_INSTALL_DIR_RO}" = "y"  ] && chmod -R a-w "${CT_INSTALL_DIR}"
     5.7 -[ "${CT_TEST_SUITE}" = "y" ] && chmod -R a+w "${CT_TEST_SUITE_DIR}"
     5.8 +[ "${CT_TEST_SUITE}" = "y" ] && chmod -R u+w "${CT_TEST_SUITE_DIR}"
     5.9  
    5.10  trap - EXIT