contrib/gcc-test-suite/Makefile
author Zhenqiang Chen <zhenqiang.chen@linaro.org>
Fri Nov 18 15:29:18 2011 +0800 (2011-11-18)
changeset 2778 986e1c75432a
parent 2170 4f8aa694f9c0
permissions -rw-r--r--
config/toolchain: Add "Enable nls" in "Toolchain options".

Reviewed-by: Michael Hope
Signed-off-by: Zhenqiang Chen <zhenqiang.chen@linaro.org>
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
yann@1966
    15
# Internal configuration
yann@1966
    16
TARGET:=@@DG_TARGET@@
yann@1966
    17
TOPDIR:=$(shell pwd)
yann@1966
    18
LOGDIR:=$(TOPDIR)/tmp
mgl@1965
    19
mgl@1965
    20
# Include default configuration
mgl@1965
    21
include default.cfg
mgl@1965
    22
mgl@1965
    23
# Add toolchain to path
yann@1966
    24
PATH:=$(shell cd ../../bin && pwd):$(PATH)
mgl@1965
    25
mgl@1965
    26
# Select test set
yann@1966
    27
ifeq ($(DG_TOOLNAME),gcc)
yann@1966
    28
	DG_TESTS:=$(DG_C_TESTS)
mgl@1965
    29
endif
yann@1966
    30
ifeq ($(DG_TOOLNAME),g++)
yann@1966
    31
	DG_TESTS:=$(DG_CPP_TESTS)
mgl@1965
    32
endif
mgl@1965
    33
mgl@1965
    34
# Check that we have 'runtest' installed
mgl@1965
    35
RUNTEST=$(shell which runtest)
yann@1966
    36
ifeq ($(RUNTEST),)
mgl@1965
    37
        $(error "DejaGnu 'runtest' not found - please install (eg. apt-get install dejagnu)")
mgl@1965
    38
endif
mgl@1965
    39
mgl@1965
    40
# Targets 
mgl@1965
    41
all: test
mgl@1965
    42
yann@1966
    43
$(LOGDIR):
yann@1966
    44
	@mkdir -p $@
mgl@1965
    45
yann@1966
    46
$(LOGDIR)/site.exp: $(TOPDIR)/default.cfg $(LOGDIR)
yann@1966
    47
	@{ echo 'lappend boards_dir "$(LOGDIR)"'; \
andyg1001@2170
    48
	   echo 'set target_alias $(TARGET)';     } > $@
yann@1966
    49
yann@1966
    50
$(LOGDIR)/board.exp: $(TOPDIR)/default.cfg $(LOGDIR)
andyg1001@2170
    51
	@{ echo 'load_generic_config "unix"';                    \
andyg1001@2170
    52
	   echo 'process_multilib_options ""';                   \
andyg1001@2170
    53
	   echo 'set_board_info bmk,use_alarm 1';                \
andyg1001@2170
    54
	   echo 'set_board_info rsh_prog ssh';                   \
andyg1001@2170
    55
	   echo 'set_board_info rcp_prog scp';                   \
andyg1001@2170
    56
	   echo 'set_board_info hostname $(DG_TARGET_HOSTNAME)'; \
andyg1001@2170
    57
	   echo 'set_board_info username $(DG_TARGET_USERNAME)'; } > $@
mgl@1965
    58
yann@1966
    59
# As Martin puts it:
yann@1966
    60
#  > The thing is that when you run 50k+ test cases the odds are that at
yann@1966
    61
#  > least one will fail and thus runtest basically always return an error
yann@1966
    62
#  > despite the fact that the test session has executed successfully.
yann@1966
    63
# So just ignore any error reported by runtest
yann@1966
    64
test: $(LOGDIR)/board.exp $(LOGDIR)/site.exp $(LOGDIR)
yann@1966
    65
	@runtest --tool $(DG_TOOLNAME)          \
yann@1966
    66
	         --srcdir $(TOPDIR)/testsuite   \
yann@1966
    67
	         --objdir $(LOGDIR)             \
yann@1966
    68
	         --outdir $(LOGDIR)             \
yann@1966
    69
	         --all                          \
yann@1966
    70
	         --target $(TARGET)             \
yann@1966
    71
	         --target_board board           \
yann@1966
    72
	         $(DG_TESTS)                    \
yann@2172
    73
	         GXX_UNDER_TEST=$(TARGET)-g++   || true
yann@1966
    74
	@printf "Result files available in '%s'\n" "$(LOGDIR)"
mgl@1965
    75
mgl@1965
    76
clean:
yann@1966
    77
	rm -rf $(LOGDIR)
mgl@1965
    78
mgl@1965
    79
.PHONY: config test clean