mgl@1965: # Helper makefile which downloads (if required) and runs the GCC test suite (DejaGnu) mgl@1965: # mgl@1965: # Note: Before run please make sure to have your toolchain available in your path. mgl@1965: # mgl@1965: # Copyright 2010 DoréDevelopment mgl@1965: # mgl@1965: # Author: Martin Lund mgl@1965: # mgl@1965: # This program is free software; you can redistribute it and/or modify it mgl@1965: # under the terms of the GNU General Public License as published by the mgl@1965: # Free Software Foundation; either version 2 of the License, or (at your mgl@1965: # option) any later version. mgl@1965: # mgl@1965: yann@1966: # Internal configuration yann@1966: TARGET:=@@DG_TARGET@@ yann@1966: TOPDIR:=$(shell pwd) yann@1966: LOGDIR:=$(TOPDIR)/tmp mgl@1965: mgl@1965: # Include default configuration mgl@1965: include default.cfg mgl@1965: mgl@1965: # Add toolchain to path yann@1966: PATH:=$(shell cd ../../bin && pwd):$(PATH) mgl@1965: mgl@1965: # Select test set yann@1966: ifeq ($(DG_TOOLNAME),gcc) yann@1966: DG_TESTS:=$(DG_C_TESTS) mgl@1965: endif yann@1966: ifeq ($(DG_TOOLNAME),g++) yann@1966: DG_TESTS:=$(DG_CPP_TESTS) mgl@1965: endif mgl@1965: mgl@1965: # Check that we have 'runtest' installed mgl@1965: RUNTEST=$(shell which runtest) yann@1966: ifeq ($(RUNTEST),) mgl@1965: $(error "DejaGnu 'runtest' not found - please install (eg. apt-get install dejagnu)") mgl@1965: endif mgl@1965: mgl@1965: # Targets mgl@1965: all: test mgl@1965: yann@1966: $(LOGDIR): yann@1966: @mkdir -p $@ mgl@1965: yann@1966: $(LOGDIR)/site.exp: $(TOPDIR)/default.cfg $(LOGDIR) yann@1966: @{ echo 'lappend boards_dir "$(LOGDIR)"'; \ yann@1966: echo "set target_alias $(TARGET)"; } > $@ yann@1966: yann@1966: $(LOGDIR)/board.exp: $(TOPDIR)/default.cfg $(LOGDIR) mgl@1965: @{ echo -e "load_generic_config \"unix\""; \ mgl@1965: echo -e "process_multilib_options \"\"" ; \ mgl@1965: echo "set_board_info bmk,use_alarm 1" ; \ mgl@1965: echo "set_board_info rsh_prog ssh" ; \ mgl@1965: echo "set_board_info rcp_prog scp" ; \ yann@1966: echo "set_board_info hostname $(DG_TARGET_HOSTNAME)"; \ yann@1966: echo "set_board_info username $(DG_TARGET_USERNAME)"; } > $@ mgl@1965: yann@1966: # As Martin puts it: yann@1966: # > The thing is that when you run 50k+ test cases the odds are that at yann@1966: # > least one will fail and thus runtest basically always return an error yann@1966: # > despite the fact that the test session has executed successfully. yann@1966: # So just ignore any error reported by runtest yann@1966: test: $(LOGDIR)/board.exp $(LOGDIR)/site.exp $(LOGDIR) yann@1966: @runtest --tool $(DG_TOOLNAME) \ yann@1966: --srcdir $(TOPDIR)/testsuite \ yann@1966: --objdir $(LOGDIR) \ yann@1966: --outdir $(LOGDIR) \ yann@1966: --all \ yann@1966: --target $(TARGET) \ yann@1966: --target_board board \ yann@1966: $(DG_TESTS) \ yann@1966: GXX_UNDER_TEST=$(DG_TARGET)-g++ || true yann@1966: @printf "Result files available in '%s'\n" "$(LOGDIR)" mgl@1965: mgl@1965: clean: yann@1966: rm -rf $(LOGDIR) mgl@1965: mgl@1965: .PHONY: config test clean