2010-05-19 15:53:04 +00:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2010-05-22 20:04:31 +00:00
|
|
|
# Internal configuration
|
|
|
|
TARGET:=@@DG_TARGET@@
|
|
|
|
TOPDIR:=$(shell pwd)
|
|
|
|
LOGDIR:=$(TOPDIR)/tmp
|
2010-05-19 15:53:04 +00:00
|
|
|
|
|
|
|
# Include default configuration
|
|
|
|
include default.cfg
|
|
|
|
|
|
|
|
# Add toolchain to path
|
2010-05-22 20:04:31 +00:00
|
|
|
PATH:=$(shell cd ../../bin && pwd):$(PATH)
|
2010-05-19 15:53:04 +00:00
|
|
|
|
|
|
|
# Select test set
|
2010-05-22 20:04:31 +00:00
|
|
|
ifeq ($(DG_TOOLNAME),gcc)
|
|
|
|
DG_TESTS:=$(DG_C_TESTS)
|
2010-05-19 15:53:04 +00:00
|
|
|
endif
|
2010-05-22 20:04:31 +00:00
|
|
|
ifeq ($(DG_TOOLNAME),g++)
|
|
|
|
DG_TESTS:=$(DG_CPP_TESTS)
|
2010-05-19 15:53:04 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Check that we have 'runtest' installed
|
|
|
|
RUNTEST=$(shell which runtest)
|
2010-05-22 20:04:31 +00:00
|
|
|
ifeq ($(RUNTEST),)
|
2010-05-19 15:53:04 +00:00
|
|
|
$(error "DejaGnu 'runtest' not found - please install (eg. apt-get install dejagnu)")
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Targets
|
|
|
|
all: test
|
|
|
|
|
2010-05-22 20:04:31 +00:00
|
|
|
$(LOGDIR):
|
|
|
|
@mkdir -p $@
|
2010-05-19 15:53:04 +00:00
|
|
|
|
2010-05-22 20:04:31 +00:00
|
|
|
$(LOGDIR)/site.exp: $(TOPDIR)/default.cfg $(LOGDIR)
|
|
|
|
@{ echo 'lappend boards_dir "$(LOGDIR)"'; \
|
2010-11-01 00:12:39 +00:00
|
|
|
echo 'set target_alias $(TARGET)'; } > $@
|
2010-05-22 20:04:31 +00:00
|
|
|
|
|
|
|
$(LOGDIR)/board.exp: $(TOPDIR)/default.cfg $(LOGDIR)
|
2010-11-01 00:12:39 +00:00
|
|
|
@{ echo 'load_generic_config "unix"'; \
|
|
|
|
echo '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)'; } > $@
|
2010-05-19 15:53:04 +00:00
|
|
|
|
2010-05-22 20:04:31 +00:00
|
|
|
# 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) \
|
2010-11-03 17:36:51 +00:00
|
|
|
GXX_UNDER_TEST=$(TARGET)-g++ || true
|
2010-05-22 20:04:31 +00:00
|
|
|
@printf "Result files available in '%s'\n" "$(LOGDIR)"
|
2010-05-19 15:53:04 +00:00
|
|
|
|
|
|
|
clean:
|
2010-05-22 20:04:31 +00:00
|
|
|
rm -rf $(LOGDIR)
|
2010-05-19 15:53:04 +00:00
|
|
|
|
|
|
|
.PHONY: config test clean
|