contrib/gcc-test-suite/Makefile
author Martin Lund <mgl@doredevelopment.dk>
Wed May 19 17:53:04 2010 +0200 (2010-05-19)
changeset 1965 e3d532dd8b5d
child 1966 10ad7f230f4b
permissions -rw-r--r--
test-suite: Added new test suite feature (experimental)

This patch adds support for installing the gcc test suite. A helper
Makefile is provided for building and running the gcc tests.

The default configuration runs all gcc tests and requires automatic
ssh/scp login access to a networked target board. See README for
more details.

Note: Current feature is tested with the powerpc-unknown-linux-gnu
sample but it should work with others as well.

Signed-off-by: Martin Lund <mgl@doredevelopment.dk>
     1 # Helper makefile which downloads (if required) and runs the GCC test suite (DejaGnu)
     2 #
     3 # Note: Before run please make sure to have your toolchain available in your path.
     4 #
     5 # Copyright 2010 DoréDevelopment
     6 # 
     7 # Author: Martin Lund <mgl@doredevelopment.dk>
     8 #
     9 # This program is free software; you can redistribute  it and/or modify it
    10 # under  the terms of  the GNU General  Public License as published by the
    11 # Free Software Foundation;  either version 2 of the  License, or (at your
    12 # option) any later version.
    13 #
    14 
    15 # Internal directory configuration
    16 TOPDIR=${shell pwd}
    17 TMPDIR=${TOPDIR}/tmp
    18 
    19 # Include default configuration
    20 include default.cfg
    21 
    22 # Add toolchain to path
    23 PATH:=${DG_TOOLCHAIN_DIR}:${PATH}
    24 
    25 # Select test set
    26 ifeq (${DG_TOOLNAME},gcc)
    27 	DG_TESTS=$(DG_C_TESTS)
    28 endif
    29 ifeq (${DG_TOOLNAME},g++)
    30 	DG_TESTS=$(DG_CPP_TESTS)
    31 endif
    32 
    33 # Check that we have 'runtest' installed
    34 RUNTEST=$(shell which runtest)
    35 ifeq "${RUNTEST}" ""
    36         $(error "DejaGnu 'runtest' not found - please install (eg. apt-get install dejagnu)")
    37 endif
    38 
    39 # Targets 
    40 all: test
    41 
    42 gcc-testsuite-${DG_GCC_VERSION}.tar.gz:
    43 #	wget -nc ${DG_GCC_URL}
    44     
    45 gcc-${DG_GCC_VERSION}: gcc-testsuite-${DG_GCC_VERSION}.tar.gz
    46 #	tar xzf gcc-testsuite-${DG_GCC_VERSION}.tar.gz
    47 
    48 config:
    49 	@mkdir -p ${TMPDIR}
    50 	@{ echo 'lappend boards_dir "."'; \
    51 	  echo "set target_alias ${DG_TARGET}"; } > ${TMPDIR}/site.exp
    52 	@{ echo -e "load_generic_config \"unix\""; \
    53 	echo -e "process_multilib_options \"\"" ; \
    54 	echo "set_board_info bmk,use_alarm 1" ; \
    55 	echo "set_board_info rsh_prog ssh" ; \
    56 	echo "set_board_info rcp_prog scp" ; \
    57 	echo "set_board_info hostname ${DG_TARGET_HOSTNAME}"; \
    58 	echo "set_board_info username ${DG_TARGET_USERNAME}"; } > ${TMPDIR}/board.exp
    59 
    60 test: gcc-${DG_GCC_VERSION} config
    61 	cd ${TMPDIR} && \
    62 	runtest	--tool ${DG_TOOLNAME} \
    63 		--srcdir ${DG_SRC_DIR} \
    64 		--all \
    65 		--target ${DG_TARGET} \
    66 		--target_board board \
    67 		${DG_TESTS} \
    68 		GXX_UNDER_TEST=${DG_TARGET}-g++ ; \
    69 	mv ${TMPDIR}/*.log ${TOPDIR} ; \
    70 	mv ${TMPDIR}/*.sum ${TOPDIR}
    71 
    72 clean:
    73 	rm -rf gcc-testsuite-${DG_GCC_VERSION}.tar.gz gcc-${DG_GCC_VERSION} ${TMPDIR} *.log *.sum 
    74 
    75 .PHONY: config test clean