1.1 --- a/config/config.in Sat May 22 12:37:02 2010 +0200
1.2 +++ b/config/config.in Wed May 19 17:53:04 2010 +0200
1.3 @@ -9,3 +9,4 @@
1.4 source "config/debug.in"
1.5 source "config/companion_libs.in"
1.6 source "config/companion_tools.in"
1.7 +source "config/test_suite.in"
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/config/test_suite.in Wed May 19 17:53:04 2010 +0200
2.3 @@ -0,0 +1,30 @@
2.4 +# Test suite config options
2.5 +
2.6 +if EXPERIMENTAL
2.7 +
2.8 +menu "Test suite"
2.9 +
2.10 +config TEST_SUITE
2.11 + bool
2.12 + default n
2.13 +
2.14 +config TEST_SUITE_GCC
2.15 + bool
2.16 + prompt "GCC test suite"
2.17 + depends on EXPERIMENTAL
2.18 + default n
2.19 + select TEST_SUITE
2.20 + help
2.21 + Select this option to install the GCC test suite in $CT_PREFIX_DIR/test_suite.
2.22 +
2.23 + The GCC test suite includes a collection of various toolchain tests for GCC -
2.24 + it utilizes the DejaGnu test framework.
2.25 +
2.26 + For some tests a network enabled target with ssh server is required.
2.27 +
2.28 + A helper Makefile is provided for running the tests - please see the included
2.29 + README for information on how to run the test suite.
2.30 +
2.31 +endmenu
2.32 +
2.33 +endif
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/contrib/gcc-test-suite/Makefile Wed May 19 17:53:04 2010 +0200
3.3 @@ -0,0 +1,75 @@
3.4 +# Helper makefile which downloads (if required) and runs the GCC test suite (DejaGnu)
3.5 +#
3.6 +# Note: Before run please make sure to have your toolchain available in your path.
3.7 +#
3.8 +# Copyright 2010 DoréDevelopment
3.9 +#
3.10 +# Author: Martin Lund <mgl@doredevelopment.dk>
3.11 +#
3.12 +# This program is free software; you can redistribute it and/or modify it
3.13 +# under the terms of the GNU General Public License as published by the
3.14 +# Free Software Foundation; either version 2 of the License, or (at your
3.15 +# option) any later version.
3.16 +#
3.17 +
3.18 +# Internal directory configuration
3.19 +TOPDIR=${shell pwd}
3.20 +TMPDIR=${TOPDIR}/tmp
3.21 +
3.22 +# Include default configuration
3.23 +include default.cfg
3.24 +
3.25 +# Add toolchain to path
3.26 +PATH:=${DG_TOOLCHAIN_DIR}:${PATH}
3.27 +
3.28 +# Select test set
3.29 +ifeq (${DG_TOOLNAME},gcc)
3.30 + DG_TESTS=$(DG_C_TESTS)
3.31 +endif
3.32 +ifeq (${DG_TOOLNAME},g++)
3.33 + DG_TESTS=$(DG_CPP_TESTS)
3.34 +endif
3.35 +
3.36 +# Check that we have 'runtest' installed
3.37 +RUNTEST=$(shell which runtest)
3.38 +ifeq "${RUNTEST}" ""
3.39 + $(error "DejaGnu 'runtest' not found - please install (eg. apt-get install dejagnu)")
3.40 +endif
3.41 +
3.42 +# Targets
3.43 +all: test
3.44 +
3.45 +gcc-testsuite-${DG_GCC_VERSION}.tar.gz:
3.46 +# wget -nc ${DG_GCC_URL}
3.47 +
3.48 +gcc-${DG_GCC_VERSION}: gcc-testsuite-${DG_GCC_VERSION}.tar.gz
3.49 +# tar xzf gcc-testsuite-${DG_GCC_VERSION}.tar.gz
3.50 +
3.51 +config:
3.52 + @mkdir -p ${TMPDIR}
3.53 + @{ echo 'lappend boards_dir "."'; \
3.54 + echo "set target_alias ${DG_TARGET}"; } > ${TMPDIR}/site.exp
3.55 + @{ echo -e "load_generic_config \"unix\""; \
3.56 + echo -e "process_multilib_options \"\"" ; \
3.57 + echo "set_board_info bmk,use_alarm 1" ; \
3.58 + echo "set_board_info rsh_prog ssh" ; \
3.59 + echo "set_board_info rcp_prog scp" ; \
3.60 + echo "set_board_info hostname ${DG_TARGET_HOSTNAME}"; \
3.61 + echo "set_board_info username ${DG_TARGET_USERNAME}"; } > ${TMPDIR}/board.exp
3.62 +
3.63 +test: gcc-${DG_GCC_VERSION} config
3.64 + cd ${TMPDIR} && \
3.65 + runtest --tool ${DG_TOOLNAME} \
3.66 + --srcdir ${DG_SRC_DIR} \
3.67 + --all \
3.68 + --target ${DG_TARGET} \
3.69 + --target_board board \
3.70 + ${DG_TESTS} \
3.71 + GXX_UNDER_TEST=${DG_TARGET}-g++ ; \
3.72 + mv ${TMPDIR}/*.log ${TOPDIR} ; \
3.73 + mv ${TMPDIR}/*.sum ${TOPDIR}
3.74 +
3.75 +clean:
3.76 + rm -rf gcc-testsuite-${DG_GCC_VERSION}.tar.gz gcc-${DG_GCC_VERSION} ${TMPDIR} *.log *.sum
3.77 +
3.78 +.PHONY: config test clean
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/contrib/gcc-test-suite/README Wed May 19 17:53:04 2010 +0200
4.3 @@ -0,0 +1,71 @@
4.4 +
4.5 +Helper Makefile for testing gcc toolchains using the gcc-testsuite
4.6 +==================================================================
4.7 +
4.8 +Requirements
4.9 +------------
4.10 +
4.11 +* DejaGnu 'runtest' v1.4.4+
4.12 +* Make v3.81+
4.13 +* wget
4.14 +
4.15 +
4.16 +Configuration
4.17 +-------------
4.18 +
4.19 +Edit default.cfg to reflect your toolchain and target configuration.
4.20 +
4.21 +Alternatively, override configuration variables on the command line.
4.22 +
4.23 +Available config variables:
4.24 +
4.25 +DG_GCC_VERSION
4.26 +DG_GCC_URL
4.27 +DG_TOOLNAME
4.28 +DG_TARGET
4.29 +DG_TARGET_HOSTNAME
4.30 +DG_TARGET_USERNAME
4.31 +DG_C_TESTS
4.32 +DG_CPP_TESTS
4.33 +DG_TOOLCHAIN_DIR
4.34 +DG_SRC_DIR
4.35 +
4.36 +
4.37 +Run examples
4.38 +------------
4.39 +
4.40 +The first two examples require a networked target with ssh access and automatic
4.41 +ssh login (see section below). Target SW should be compiled with the toolchain
4.42 +to be tested.
4.43 +
4.44 +Run default gcc compile/execution tests:
4.45 +$ make DG_TOOLNAME=gcc DG_TARGET_HOSTNAME=192.168.17.93 DG_TARGET_USERNAME=root
4.46 +
4.47 +Run default g++ compile/execution tests:
4.48 +$ make DG_TOOLNAME=g++ DG_TARGET_HOSTNAME=192.168.17.93 DG_TARGET_USERNAME=root
4.49 +
4.50 +Run selected gcc compile only tests (no target required):
4.51 +$ make DG_TOOLNAME=gcc DG_C_TESTS="compile.exp noncompile.exp"
4.52 +
4.53 +
4.54 +SSH automatic login configuration example
4.55 +-----------------------------------------
4.56 +
4.57 +On host do:
4.58 +ssh-keygen -t rsa (then simply press enter thru all steps)
4.59 +scp ~/.ssh/id_rsa.pub <username>@<target IP>:~/
4.60 +
4.61 +On target do:
4.62 +cd ~
4.63 +mkdir .ssh
4.64 +cat id_rsa.pub >> .ssh/authorized_keys
4.65 +rm id_rsa.pub
4.66 +
4.67 +Now automatic ssh login should work - test by doing a simple ssh session to target.
4.68 +
4.69 +Note: The procedure might be slightly different for your particular target.
4.70 +
4.71 +
4.72 +Author
4.73 +------
4.74 +Martin Lund <mgl@doredevelopment.dk>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/contrib/gcc-test-suite/default.cfg Wed May 19 17:53:04 2010 +0200
5.3 @@ -0,0 +1,17 @@
5.4 +# Default test suite configuration
5.5 +
5.6 +# GCC configuration
5.7 +DG_GCC_VERSION = 4.3.2
5.8 +DG_GCC_URL = ftp://gcc.gnu.org/pub/gcc/releases/gcc-${DG_GCC_VERSION}/gcc-testsuite-${DG_GCC_VERSION}.tar.gz
5.9 +
5.10 +# Default DejaGnu configuration
5.11 +DG_TOOLNAME = gcc
5.12 +DG_TARGET_HOSTNAME = 127.0.0.1
5.13 +DG_TARGET_USERNAME = root
5.14 +DG_TARGET = powerpc-unknown-linux-gnu
5.15 +DG_SRC_DIR = ${TOPDIR}/gcc-${DG_GCC_VERSION}/gcc/testsuite
5.16 +DG_TOOLCHAIN_DIR = ${TOPDIR}/../../bin
5.17 +
5.18 +# Default tests
5.19 +DG_C_TESTS =
5.20 +DG_CPP_TESTS =
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/scripts/build/test_suite.sh Wed May 19 17:53:04 2010 +0200
6.3 @@ -0,0 +1,41 @@
6.4 +# Wrapper to build the test suite facilities
6.5 +#
6.6 +# Current assumption: test suites are independent of each other
6.7 +# - no order handling required.
6.8 +
6.9 +# List all test suite facilities, and parse their scripts
6.10 +CT_TEST_SUITE_FACILITY_LIST=
6.11 +for f in "${CT_LIB_DIR}/scripts/build/test_suite/"*.sh; do
6.12 + _f="$(basename "${f}" .sh)"
6.13 + __f="CT_TEST_SUITE_${_f}"
6.14 + __f=`echo ${__f} | tr "[:lower:]" "[:upper:]"`
6.15 + if [ "${!__f}" = "y" ]; then
6.16 + CT_DoLog DEBUG "Enabling test suite '${_f}'"
6.17 + . "${f}"
6.18 + CT_TEST_SUITE_FACILITY_LIST="${CT_TEST_SUITE_FACILITY_LIST} ${_f}"
6.19 + else
6.20 + CT_DoLog DEBUG "Disabling test suite '${_f}'"
6.21 + fi
6.22 +done
6.23 +
6.24 +# Download the test suite facilities
6.25 +do_test_suite_get() {
6.26 + for f in ${CT_TEST_SUITE_FACILITY_LIST}; do
6.27 + do_test_suite_${f}_get
6.28 + done
6.29 +}
6.30 +
6.31 +# Extract and patch the test suite facilities
6.32 +do_test_suite_extract() {
6.33 + for f in ${CT_TEST_SUITE_FACILITY_LIST}; do
6.34 + do_test_suite_${f}_extract
6.35 + done
6.36 +}
6.37 +
6.38 +# Build the test suite facilities
6.39 +do_test_suite() {
6.40 + for f in ${CT_TEST_SUITE_FACILITY_LIST}; do
6.41 + do_test_suite_${f}_build
6.42 + done
6.43 +}
6.44 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/scripts/build/test_suite/gcc.sh Wed May 19 17:53:04 2010 +0200
7.3 @@ -0,0 +1,36 @@
7.4 +# This file adds the functions to build the GCC test suite
7.5 +# Copyright 2010 DoréDevelopment
7.6 +# Created by Martin Lund <mgl@doredevelopment.dk>
7.7 +# Licensed under the GPL v2. See COPYING in the root of this package
7.8 +
7.9 +do_test_suite_gcc_get() { :; }
7.10 +do_test_suite_gcc_extract() { :; }
7.11 +do_test_suite_gcc_build() { :; }
7.12 +
7.13 +# Overide functions depending on configuration
7.14 +if [ "${CT_TEST_SUITE_GCC}" = "y" ]; then
7.15 +
7.16 +do_test_suite_gcc_build() {
7.17 +
7.18 + CT_DoStep INFO "Installing GCC test suite"
7.19 +
7.20 + CT_DoExecLog ALL mkdir -p "${CT_TEST_SUITE_DIR}/gcc-test-suite/gcc-${CT_CC_VERSION}/gcc"
7.21 + CT_DoExecLog ALL cp "${CT_TOP_DIR}/contrib/gcc-test-suite/Makefile" \
7.22 + "${CT_TEST_SUITE_DIR}/gcc-test-suite"
7.23 + CT_DoExecLog ALL cp "${CT_TOP_DIR}/contrib/gcc-test-suite/default.cfg" \
7.24 + "${CT_TEST_SUITE_DIR}/gcc-test-suite"
7.25 + CT_DoExecLog ALL cp "${CT_TOP_DIR}/contrib/gcc-test-suite/README" \
7.26 + "${CT_TEST_SUITE_DIR}/gcc-test-suite"
7.27 + CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/testsuite" \
7.28 + "${CT_TEST_SUITE_DIR}/gcc-test-suite/gcc-${CT_CC_VERSION}/gcc"
7.29 + sed "s/DG_GCC_VERSION .*/DG_GCC_VERSION = ${CT_CC_VERSION}/g" \
7.30 + ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg > \
7.31 + ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg.tmp
7.32 + sed "s/DG_TARGET .*/DG_TARGET = ${CT_TARGET}/g" \
7.33 + ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg.tmp > \
7.34 + ${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg
7.35 + CT_DoExecLog ALL rm -f "${CT_TEST_SUITE_DIR}/gcc-test-suite/default.cfg.tmp"
7.36 + CT_EndStep
7.37 +}
7.38 +
7.39 +fi # CT_TEST_SUITE_GCC
8.1 --- a/scripts/crosstool-NG.sh.in Sat May 22 12:37:02 2010 +0200
8.2 +++ b/scripts/crosstool-NG.sh.in Wed May 19 17:53:04 2010 +0200
8.3 @@ -125,6 +125,7 @@
8.4 . "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh"
8.5 . "${CT_LIB_DIR}/scripts/build/cc/${CT_CC}.sh"
8.6 . "${CT_LIB_DIR}/scripts/build/debug.sh"
8.7 +. "${CT_LIB_DIR}/scripts/build/test_suite.sh"
8.8
8.9 # Target tuple: CT_TARGET needs a little love:
8.10 CT_DoBuildTargetTuple
8.11 @@ -159,6 +160,9 @@
8.12 CT_COMPLIBS_DIR="${CT_BUILD_DIR}/static"
8.13 fi
8.14
8.15 +# Compute test suite install directory
8.16 +CT_TEST_SUITE_DIR=${CT_INSTALL_DIR}/test-suite
8.17 +
8.18 # Note: we'll always install the core compiler in its own directory, so as to
8.19 # not mix the two builds: core and final.
8.20 CT_CC_CORE_STATIC_PREFIX_DIR="${CT_BUILD_DIR}/${CT_CC}-core-static"
8.21 @@ -518,6 +522,7 @@
8.22 do_cc_get
8.23 do_libc_get
8.24 do_debug_get
8.25 + do_test_suite_get
8.26 CT_EndStep
8.27 fi
8.28
8.29 @@ -548,6 +553,7 @@
8.30 do_cc_extract
8.31 do_libc_extract
8.32 do_debug_extract
8.33 + do_test_suite_extract
8.34 CT_EndStep
8.35 fi
8.36 fi
8.37 @@ -596,5 +602,6 @@
8.38
8.39 [ "${CT_LOG_FILE_COMPRESS}" = y ] && bzip2 -9 "${CT_LOG_FILE}"
8.40 [ "${CT_INSTALL_DIR_RO}" = "y" ] && chmod -R a-w "${CT_INSTALL_DIR}"
8.41 +[ "${CT_TEST_SUITE}" = "y" ] && chmod -R a+w "${CT_TEST_SUITE_DIR}"
8.42
8.43 trap - EXIT
9.1 --- a/steps.mk Sat May 22 12:37:02 2010 +0200
9.2 +++ b/steps.mk Wed May 19 17:53:04 2010 +0200
9.3 @@ -39,6 +39,7 @@
9.4 libelf_target \
9.5 binutils_target \
9.6 debug \
9.7 + test_suite \
9.8 finish \
9.9
9.10 # Make the list available to sub-processes (scripts/crosstool-NG.sh needs it)