summaryrefslogtreecommitdiff
path: root/libgo/testsuite
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libgo/testsuite
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libgo/testsuite')
-rw-r--r--libgo/testsuite/Makefile.am21
-rw-r--r--libgo/testsuite/Makefile.in413
-rw-r--r--libgo/testsuite/config/default.exp17
-rwxr-xr-xlibgo/testsuite/gotest343
-rw-r--r--libgo/testsuite/lib/libgo.exp50
-rw-r--r--libgo/testsuite/libgo.testmain/testmain.exp60
6 files changed, 904 insertions, 0 deletions
diff --git a/libgo/testsuite/Makefile.am b/libgo/testsuite/Makefile.am
new file mode 100644
index 000000000..8c6249d9d
--- /dev/null
+++ b/libgo/testsuite/Makefile.am
@@ -0,0 +1,21 @@
+## Process this file with automake to produce Makefile.in.
+
+AUTOMAKE_OPTIONS = foreign dejagnu
+
+# Setup the testing framework, if you have one
+EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \
+ echo $(top_builddir)/../expect/expect ; \
+ else echo expect ; fi`
+
+RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
+ echo $(top_srcdir)/../dejagnu/runtest ; \
+ else echo runtest; fi`
+
+# When running the tests we set GCC_EXEC_PREFIX to the install tree so that
+# files that have already been installed there will be found. The -B option
+# overrides it, so use of GCC_EXEC_PREFIX will not result in using GCC files
+# from the install tree.
+
+AM_RUNTESTFLAGS = "TEST_GCC_EXEC_PREFIX=$(libdir)/gcc"
+
+CLEANFILES = *.log *.sum
diff --git a/libgo/testsuite/Makefile.in b/libgo/testsuite/Makefile.in
new file mode 100644
index 000000000..28cc9b9c0
--- /dev/null
+++ b/libgo/testsuite/Makefile.in
@@ -0,0 +1,413 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = testsuite
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/multi.m4 \
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/unwind_ipinfo.m4 \
+ $(top_srcdir)/config/go.m4 $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DEJATOOL = $(PACKAGE)
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GOARCH = @GOARCH@
+GOC = @GOC@
+GOCFLAGS = @GOCFLAGS@
+GOOS = @GOOS@
+GO_DEBUG_PROC_REGS_OS_ARCH_FILE = @GO_DEBUG_PROC_REGS_OS_ARCH_FILE@
+GO_SYSCALLS_SYSCALL_OS_ARCH_FILE = @GO_SYSCALLS_SYSCALL_OS_ARCH_FILE@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBFFI = @LIBFFI@
+LIBFFIINCS = @LIBFFIINCS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MATH_LIBS = @MATH_LIBS@
+MKDIR_P = @MKDIR_P@
+NET_LIBS = @NET_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJCOPY = @OBJCOPY@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPLIT_STACK = @SPLIT_STACK@
+STRINGOPS_FLAG = @STRINGOPS_FLAG@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WARN_FLAGS = @WARN_FLAGS@
+WERROR = @WERROR@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+glibgo_prefixdir = @glibgo_prefixdir@
+glibgo_toolexecdir = @glibgo_toolexecdir@
+glibgo_toolexeclibdir = @glibgo_toolexeclibdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libtool_VERSION = @libtool_VERSION@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign dejagnu
+
+# Setup the testing framework, if you have one
+EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \
+ echo $(top_builddir)/../expect/expect ; \
+ else echo expect ; fi`
+
+RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
+ echo $(top_srcdir)/../dejagnu/runtest ; \
+ else echo runtest; fi`
+
+
+# When running the tests we set GCC_EXEC_PREFIX to the install tree so that
+# files that have already been installed there will be found. The -B option
+# overrides it, so use of GCC_EXEC_PREFIX will not result in using GCC files
+# from the install tree.
+AM_RUNTESTFLAGS = "TEST_GCC_EXEC_PREFIX=$(libdir)/gcc"
+CLEANFILES = *.log *.sum
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign testsuite/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-DEJAGNU: site.exp
+ srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
+ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+ then :; else exit_status=1; fi; \
+ done; \
+ else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi; \
+ exit $$exit_status
+site.exp: Makefile
+ @echo 'Making a new site.exp file...'
+ @echo '## these variables are automatically generated by make ##' >site.tmp
+ @echo '# Do not edit here. If you wish to override these values' >>site.tmp
+ @echo '# edit the last section' >>site.tmp
+ @echo 'set srcdir $(srcdir)' >>site.tmp
+ @echo "set objdir `pwd`" >>site.tmp
+ @echo 'set build_alias "$(build_alias)"' >>site.tmp
+ @echo 'set build_triplet $(build_triplet)' >>site.tmp
+ @echo 'set host_alias "$(host_alias)"' >>site.tmp
+ @echo 'set host_triplet $(host_triplet)' >>site.tmp
+ @echo 'set target_alias "$(target_alias)"' >>site.tmp
+ @echo 'set target_triplet $(target_triplet)' >>site.tmp
+ @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
+ @test ! -f site.exp || \
+ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+ @-rm -f site.bak
+ @test ! -f site.exp || mv site.exp site.bak
+ @mv site.tmp site.exp
+
+distclean-DEJAGNU:
+ -rm -f site.exp site.bak
+ -l='$(DEJATOOL)'; for tool in $$l; do \
+ rm -f $$tool.sum $$tool.log; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-DEJAGNU distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \
+ clean-libtool distclean distclean-DEJAGNU distclean-generic \
+ distclean-libtool dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libgo/testsuite/config/default.exp b/libgo/testsuite/config/default.exp
new file mode 100644
index 000000000..c82d65870
--- /dev/null
+++ b/libgo/testsuite/config/default.exp
@@ -0,0 +1,17 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# 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 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+load_lib "standard.exp"
diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest
new file mode 100755
index 000000000..28aba6e2d
--- /dev/null
+++ b/libgo/testsuite/gotest
@@ -0,0 +1,343 @@
+#!/bin/sh
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+# Using all the *_test.go files in the current directory, write out a file
+# _testmain.go that runs all its tests. Compile everything and run the
+# tests.
+# If files are named on the command line, use them instead of *_test.go.
+
+# Makes egrep,grep work better in general if we put them
+# in ordinary C mode instead of what the current language is.
+unset LANG
+export LC_ALL=C
+export LC_CTYPE=C
+
+GC=${GC:-gccgo}
+GL=${GL:-${GC-gccgo}}
+GOLIBS=
+export GC GL GOLIBS
+
+NM=${NM:-nm}
+
+# srcdir is where the source files are found. basedir is where the
+# source file paths are relative to.
+# gofiles are the test files. pkgfiles are the source files.
+srcdir=.
+basedir=.
+gofiles=""
+pkgfiles=""
+loop=true
+keep=false
+prefix=
+dejagnu=no
+while $loop; do
+ case "x$1" in
+ x--srcdir)
+ srcdir=$2
+ shift
+ shift
+ ;;
+ x--srcdir=*)
+ srcdir=`echo $1 | sed -e 's/^--srcdir=//'`
+ shift
+ ;;
+ x--basedir)
+ basedir=$2
+ shift
+ shift
+ ;;
+ x--basedir=*)
+ basedir=`echo $1 | sed -e 's/^--basedir=//'`
+ shift
+ ;;
+ x--prefix)
+ prefix=$2
+ shift
+ shift
+ ;;
+ x--prefix=*)
+ prefix=`echo $1 | sed -e 's/^--prefix=//'`
+ shift
+ ;;
+ x--keep)
+ keep=true
+ shift
+ ;;
+ x--pkgfiles)
+ pkgfiles=$2
+ shift
+ shift
+ ;;
+ x--pkgfiles=*)
+ pkgfiles=`echo $1 | sed -e 's/^--pkgfiles=//'`
+ shift
+ ;;
+ x--dejagnu)
+ dejagnu=$2
+ shift
+ shift
+ ;;
+ x--dejagnu=*)
+ dejagnu=`echo $1 | sed -e 's/^--dejagnu=//'`
+ shift
+ ;;
+ x-*)
+ loop=false
+ ;;
+ x)
+ loop=false
+ ;;
+ *)
+ gofiles="$gofiles $1"
+ shift
+ ;;
+ esac
+done
+
+DIR=gotest$$
+rm -rf $DIR
+mkdir $DIR
+
+cd $DIR
+
+if test $keep = false; then
+ trap "cd ..; rm -rf $DIR" 0 1 2 3 14 15
+else
+ trap "cd ..; echo Keeping $DIR" 0 1 2 3 14 15
+fi
+
+case "$srcdir" in
+ /*)
+ ;;
+ *)
+ srcdir="../$srcdir"
+ ;;
+esac
+
+SRCDIR=$srcdir
+export SRCDIR
+
+case "$basedir" in
+ /*)
+ ;;
+ *)
+ basedir="../$basedir"
+ ;;
+esac
+
+# Link all the files/directories in srcdir into our working directory,
+# so that the tests do not have to refer to srcdir to find test data.
+ln -s $srcdir/* .
+
+# Copy the .go files because io/utils_test.go expects a regular file.
+case "x$gofiles" in
+x)
+ case "x$pkgfiles" in
+ x)
+ for f in `cd $srcdir; ls *.go`; do
+ rm -f $f;
+ cp $srcdir/$f .
+ done
+ ;;
+ *)
+ for f in $pkgfiles; do
+ if test -f $basedir/$f; then
+ b=`basename $f`
+ rm -f $b
+ cp $basedir/$f $b
+ elif test -f ../$f; then
+ b=`basename $f`
+ rm -f $b
+ cp ../$f $b
+ else
+ echo "file $f not found" 1>&2
+ exit 1
+ fi
+ done
+ for f in `cd $srcdir; ls *_test.go`; do
+ rm -f $f
+ cp $srcdir/$f .
+ done
+ ;;
+ esac
+ ;;
+*)
+ for f in $gofiles; do
+ b=`basename $f`
+ rm -f $b
+ cp $basedir/$f $b
+ done
+ case "x$pkgfiles" in
+ x)
+ for f in `cd $srcdir; ls *.go | grep -v *_test.go`; do
+ rm -f $f
+ cp $srcdir/$f .
+ done
+ ;;
+ *)
+ for f in $pkgfiles; do
+ if test -f $basedir/$f; then
+ b=`basename $f`
+ rm -f $b
+ cp $basedir/$f $b
+ elif test -f ../$f; then
+ b=`basename $f`
+ rm -f $b
+ cp ../$f $b
+ else
+ echo "file $f not found" 1>&2
+ exit 1
+ fi
+ done
+ ;;
+ esac
+ ;;
+esac
+
+# Some tests expect the _obj directory created by the gc Makefiles.
+mkdir _obj
+
+# Some tests expect the _test directory created by the gc Makefiles.
+mkdir _test
+
+case "x$gofiles" in
+x)
+ gofiles=$(echo -n $(ls *_test.go 2>/dev/null))
+esac
+
+case "x$gofiles" in
+x)
+ echo 'no test files found' 1>&2
+ exit 1
+esac
+
+# Run any commands given in sources, like
+# // gotest: $GC foo.go
+# to build any test-only dependencies.
+holdGC="$GC"
+GC="$GC -g -c -I ."
+sed -n 's/^\/\/ gotest: //p' $gofiles | sh
+GC="$holdGC"
+
+case "x$pkgfiles" in
+x)
+ pkgbasefiles=$(echo -n $(ls *.go | grep -v _test.go 2>/dev/null))
+ ;;
+*)
+ for f in $pkgfiles; do
+ pkgbasefiles="$pkgbasefiles `basename $f`"
+ done
+ ;;
+esac
+
+case "x$pkgfiles" in
+x)
+ echo 'no source files found' 1>&2
+ exit 1
+ ;;
+esac
+
+# Split $gofiles into external gofiles (those in *_test packages)
+# and internal ones (those in the main package).
+xgofiles=$(echo $(grep '^package[ ]' $gofiles /dev/null | grep ':.*_test' | sed 's/:.*//'))
+gofiles=$(echo $(grep '^package[ ]' $gofiles /dev/null | grep -v ':.*_test' | sed 's/:.*//'))
+
+# External $O file
+xofile=""
+havex=false
+if [ "x$xgofiles" != "x" ]; then
+ xofile="_xtest_.o"
+ havex=true
+fi
+
+set -e
+
+package=`echo ${srcdir} | sed -e 's|^.*libgo/go/||'`
+
+prefixarg=
+if test -n "$prefix"; then
+ prefixarg="-fgo-prefix=$prefix"
+fi
+
+$GC -g $prefixarg -c -I . -o _gotest_.o $gofiles $pkgbasefiles
+if $havex; then
+ mkdir -p `dirname $package`
+ cp _gotest_.o `dirname $package`/lib`basename $package`.a
+ $GC -g -c -I . -o $xofile $xgofiles
+fi
+
+# They all compile; now generate the code to call them.
+{
+ # test functions are named TestFoo
+ # the grep -v eliminates methods and other special names
+ # that have multiple dots.
+ pattern='Test([^a-z].*)?'
+ # The -p option tells GNU nm not to sort.
+ # The -v option tells Solaris nm to sort by value.
+ tests=$($NM -p -v _gotest_.o $xofile | egrep ' T .*\.'$pattern'$' | grep -v '\..*\..*\.' | sed 's/.* //' | sed 's/.*\.\(.*\.\)/\1/')
+ if [ "x$tests" = x ]; then
+ echo 'gotest: warning: no tests matching '$pattern in _gotest_.o $xofile 1>&2
+ exit 2
+ fi
+
+ # package spec
+ echo 'package main'
+ echo
+ # imports
+ if echo "$tests" | egrep -v '_test\.' >/dev/null; then
+ echo 'import "./_gotest_"'
+ fi
+ if $havex; then
+ echo 'import "./_xtest_"'
+ fi
+ if [ $package != "testing" ]; then
+ echo 'import "testing"'
+ echo 'import __regexp__ "regexp"' # rename in case tested package is called regexp
+ fi
+ # test array
+ echo
+ echo 'var tests = []testing.InternalTest {'
+ for i in $tests
+ do
+ echo ' { "'$i'", '$i' },'
+ done
+ echo '}'
+ # body
+ echo
+ echo 'func main() {'
+ echo ' testing.Main(__regexp__.MatchString, tests)'
+ echo '}'
+}>_testmain.go
+
+case "x$dejagnu" in
+xno)
+ ${GC} -g -c _testmain.go
+ ${GL} *.o ${GOLIBS}
+ ./a.out "$@"
+ ;;
+xyes)
+ rm -rf ../testsuite/*.o
+ files=`echo *`
+ for f in $files; do
+ if test "$f" = "_obj" || test "$f" = "_test"; then
+ continue
+ fi
+ rm -rf ../testsuite/$f
+ if test -f $f; then
+ cp $f ../testsuite/
+ else
+ ln -s ../$DIR/$f ../testsuite/
+ fi
+ done
+ cd ../testsuite
+ rm -rf _obj _test
+ mkdir _obj _test
+ $MAKE check RUNTESTFLAGS="$RUNTESTFLAGS GOTEST_TMPDIR=$DIR"
+ # Useful when using make check-target-libgo
+ cat libgo.log >> libgo-all.log
+ cat libgo.sum >> libgo-all.sum
+ rm -rf $files
+ ;;
+esac
diff --git a/libgo/testsuite/lib/libgo.exp b/libgo/testsuite/lib/libgo.exp
new file mode 100644
index 000000000..a6d44323d
--- /dev/null
+++ b/libgo/testsuite/lib/libgo.exp
@@ -0,0 +1,50 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# 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 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
+if {$gccdir != ""} {
+ set gccdir [file dirname $gccdir]
+}
+set GOC_UNDER_TEST "$gccdir/gccgo -B$gccdir/"
+set TESTING_IN_BUILD_TREE 1
+
+if [info exists GOTEST_TMPDIR] {
+ set tmpdir $GOTEST_TMPDIR
+}
+
+proc go_maybe_build_wrapper { args } {
+ libgo_maybe_build_wrapper $args
+}
+
+# DejaGnu does not have proper library search paths for load_lib.
+# We have to explicitly load everything that go.exp wants to load.
+
+proc load_gcc_lib { filename } {
+ global srcdir loaded_libs
+
+ load_file $srcdir/../../gcc/testsuite/lib/$filename
+ set loaded_libs($filename) ""
+}
+
+load_gcc_lib prune.exp
+load_gcc_lib target-libpath.exp
+load_gcc_lib wrapper.exp
+load_gcc_lib gcc-defs.exp
+load_gcc_lib go.exp
+
+proc libgo_init { args } {
+ go_init $args
+}
diff --git a/libgo/testsuite/libgo.testmain/testmain.exp b/libgo/testsuite/libgo.testmain/testmain.exp
new file mode 100644
index 000000000..efdd28d91
--- /dev/null
+++ b/libgo/testsuite/libgo.testmain/testmain.exp
@@ -0,0 +1,60 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# 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 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+load_lib libgo.exp
+
+lappend options "additional_flags=-I. -w -g"
+
+if [istarget "*-*-rtems*"] {
+ global options
+
+ verbose -log "Executing on host: tar cf FilesystemImage -h -C \
+ $tool_root_dir/$tool/${GOTEST_TMPDIR} ."
+ if [catch "exec tar cf FilesystemImage -h -C \
+ $tool_root_dir/$tool/${GOTEST_TMPDIR} ." error] {
+ perror "Error during tar of local filesystem: $error"
+ exit 1
+ }
+
+ verbose -log "Executing on host: ${RTEMS_BIN2C} FilesystemImage FilesystemImage"
+ if [catch "exec ${RTEMS_BIN2C} FilesystemImage FilesystemImage" error] {
+ perror "Error when creating FilesystemImage source file: $error"
+ exit 1
+ }
+ set comp_output [target_compile "${RTEMS_LIBGO_INIT}" \
+ "./rtems_libgo_init.o" "object" $options]
+ if ![ string match "" $comp_output ] {
+ verbose -log $comp_output
+ exit 1
+ }
+}
+
+set object_files [glob -nocomplain "*.o"]
+if [info exists gluefile] {
+ regsub $gluefile $object_files "" object_files
+}
+
+set comp_output [go_target_compile "$object_files _testmain.go" \
+ "./a.exe" "executable" $options]
+if ![ string match "" $comp_output ] {
+ verbose -log $comp_output
+ exit 1
+}
+
+set result [libgo_load "./a.exe" "" ""]
+
+set status [lindex $result 0]
+$status go