summaryrefslogtreecommitdiff
path: root/contrib/gcc-test-suite/Makefile
blob: d78c178e90539104683462114fdeb7f0439f71e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Helper makefile which downloads (if required) and runs the GCC test suite (DejaGnu)
#
# Note: Before run please make sure to have your toolchain available in your path.
#
# Copyright 2010 DoréDevelopment
# 
# Author: Martin Lund <mgl@doredevelopment.dk>
#
# This program is free software; you can redistribute  it and/or modify it
# under  the terms of  the GNU General  Public License as published by the
# Free Software Foundation;  either version 2 of the  License, or (at your
# option) any later version.
#

# Internal configuration
TARGET:=@@DG_TARGET@@
TOPDIR:=$(shell pwd)
LOGDIR:=$(TOPDIR)/tmp

# Include default configuration
include default.cfg

# Add toolchain to path
PATH:=$(shell cd ../../bin && pwd):$(PATH)

# Select test set
ifeq ($(DG_TOOLNAME),gcc)
	DG_TESTS:=$(DG_C_TESTS)
endif
ifeq ($(DG_TOOLNAME),g++)
	DG_TESTS:=$(DG_CPP_TESTS)
endif

# Check that we have 'runtest' installed
RUNTEST=$(shell which runtest)
ifeq ($(RUNTEST),)
        $(error "DejaGnu 'runtest' not found - please install (eg. apt-get install dejagnu)")
endif

# Targets 
all: test

$(LOGDIR):
	@mkdir -p $@

$(LOGDIR)/site.exp: $(TOPDIR)/default.cfg $(LOGDIR)
	@{ echo 'lappend boards_dir "$(LOGDIR)"'; \
	  echo "set target_alias $(TARGET)"; } > $@

$(LOGDIR)/board.exp: $(TOPDIR)/default.cfg $(LOGDIR)
	@{ echo -e "load_generic_config \"unix\""; \
	echo -e "process_multilib_options \"\"" ; \
	echo "set_board_info bmk,use_alarm 1" ; \
	echo "set_board_info rsh_prog ssh" ; \
	echo "set_board_info rcp_prog scp" ; \
	echo "set_board_info hostname $(DG_TARGET_HOSTNAME)"; \
	echo "set_board_info username $(DG_TARGET_USERNAME)"; } > $@

# As Martin puts it:
#  > The thing is that when you run 50k+ test cases the odds are that at
#  > least one will fail and thus runtest basically always return an error
#  > despite the fact that the test session has executed successfully.
# So just ignore any error reported by runtest
test: $(LOGDIR)/board.exp $(LOGDIR)/site.exp $(LOGDIR)
	@runtest --tool $(DG_TOOLNAME)          \
	         --srcdir $(TOPDIR)/testsuite   \
	         --objdir $(LOGDIR)             \
	         --outdir $(LOGDIR)             \
	         --all                          \
	         --target $(TARGET)             \
	         --target_board board           \
	         $(DG_TESTS)                    \
	         GXX_UNDER_TEST=$(DG_TARGET)-g++ || true
	@printf "Result files available in '%s'\n" "$(LOGDIR)"

clean:
	rm -rf $(LOGDIR)

.PHONY: config test clean