crosstool-ng/contrib/gcc-test-suite/Makefile
Erico Nunes f1b813c312 test-suite: define $tmpdir to $TOPDIR
The missing definition of $tmpdir caused it to default to /tmp, which
may cause problems when testcases generate temporary files in the
current directory ($TOPDIR) and then try to access them at $tmpdir.

Errors such as the following were reported in test-suite runs for both
arm and powerpc toolchains due to $tmpdir pointing to /tmp and files
being generated in $TOPDIR:

  error: could not open dump file '/tmp/dump1/dump-noaddr.c.011t.cfg':
  No such file or directory
  FAIL: gcc.c-torture/unsorted/dump-noaddr.c,  -O0   -dumpbase
  dump1/dump-noaddr.c -DMASK=1 -x c --param ggc-min-heapsize=1
  -fdump-ipa-all -fdump-rtl-all -fdump-tree-all -fdump-noaddr

  FAIL: gcc.dg/tree-prof/ic-misattribution-1.c execution:
  file ic-misattribution-1.gcda does not exist,  -fprofile-generate
  -D_PROFILE_GENERATE

Signed-off-by: Erico Nunes <erico.nunes@datacom.ind.br>
2015-06-10 16:20:45 -03:00

81 lines
2.5 KiB
Makefile

# 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 tmpdir "$(TOPDIR)"'; \
echo 'set target_alias $(TARGET)'; } > $@
$(LOGDIR)/board.exp: $(TOPDIR)/default.cfg $(LOGDIR)
@{ 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)'; } > $@
# 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=$(TARGET)-g++ || true
@printf "Result files available in '%s'\n" "$(LOGDIR)"
clean:
rm -rf $(LOGDIR)
.PHONY: config test clean