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