aboutsummaryrefslogtreecommitdiff
path: root/libgo/testsuite
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2015-01-15 00:27:56 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-01-15 00:27:56 +0000
commitf8d9fa9e80b57f89e7877ce6cad8a3464879009b (patch)
tree58a1724fee16d2b03c65678c4dd9b50bb97137a9 /libgo/testsuite
parent6bd3f109d8d8fa58eeccd6b3504721b4f20c00c2 (diff)
downloadgcc-f8d9fa9e80b57f89e7877ce6cad8a3464879009b.zip
gcc-f8d9fa9e80b57f89e7877ce6cad8a3464879009b.tar.gz
gcc-f8d9fa9e80b57f89e7877ce6cad8a3464879009b.tar.bz2
libgo, compiler: Upgrade libgo to Go 1.4, except for runtime.
This upgrades all of libgo other than the runtime package to the Go 1.4 release. In Go 1.4 much of the runtime was rewritten into Go. Merging that code will take more time and will not change the API, so I'm putting it off for now. There are a few runtime changes anyhow, to accomodate other packages that rely on minor modifications to the runtime support. The compiler changes slightly to add a one-bit flag to each type descriptor kind that is stored directly in an interface, which for gccgo is currently only pointer types. Another one-bit flag (gcprog) is reserved because it is used by the gc compiler, but gccgo does not currently use it. There is another error check in the compiler since I ran across it during testing. gotools/: * Makefile.am (go_cmd_go_files): Sort entries. Add generate.go. * Makefile.in: Rebuild. From-SVN: r219627
Diffstat (limited to 'libgo/testsuite')
-rwxr-xr-xlibgo/testsuite/gotest29
1 files changed, 25 insertions, 4 deletions
diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest
index 1bcd4b9..3596d72 100755
--- a/libgo/testsuite/gotest
+++ b/libgo/testsuite/gotest
@@ -335,6 +335,15 @@ if [ "x$xgofiles" != "x" ]; then
havex=true
fi
+testmain=
+if $havex && fgrep 'func TestMain(' $xgofiles >/dev/null 2>&1; then
+ package=`grep '^package[ ]' $xgofiles | sed 1q | sed -e 's/.* //'`
+ testmain="${package}.TestMain"
+elif test -n "$gofiles" && fgrep 'func TestMain(' $gofiles >/dev/null 2>&1; then
+ package=`grep '^package[ ]' $gofiles | sed 1q | sed -e 's/.* //'`
+ testmain="${package}.TestMain"
+fi
+
set -e
package=`echo ${srcdir} | sed -e 's|^.*libgo/go/||'`
@@ -415,14 +424,19 @@ localname() {
fi
echo 'import "testing"'
echo 'import __regexp__ "regexp"' # rename in case tested package is called regexp
+ if ! test -n "$testmain"; then
+ echo 'import __os__ "os"'
+ fi
# test array
echo
echo 'var tests = []testing.InternalTest {'
for i in $tests
do
n=$(testname $i)
- j=$(localname $i)
- echo ' {"'$n'", '$j'},'
+ if test "$n" != "TestMain"; then
+ j=$(localname $i)
+ echo ' {"'$n'", '$j'},'
+ fi
done
echo '}'
@@ -467,8 +481,15 @@ func matchString(pat, str string) (result bool, err error) {
}
func main() {
- testing.Main(matchString, tests, benchmarks, examples)
-}'
+ m := testing.MainStart(matchString, tests, benchmarks, examples)
+'
+ if test -n "$testmain"; then
+ echo " ${testmain}(m)"
+ else
+ echo ' __os__.Exit(m.Run())'
+ fi
+
+ echo '}'
}>_testmain.go
case "x$dejagnu" in