diff mbox

Go testsuite patch committed: Set GOARCH environment variable

Message ID mcr8vyr0wi9.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 12, 2011, 12:57 a.m. UTC
This patch from Rainer Orth fixes the Go testsuite to set the GOARCH
environment variable, as expected by one of the tests.  Bootstrapped and
ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2011-01-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* go.test/go-test.exp (go-set-goarch): New proc.
	(go-gc-tests): Use it.
diff mbox

Patch

diff -r 72fce0443d71 gcc/testsuite/go.test/go-test.exp
--- a/gcc/testsuite/go.test/go-test.exp	Sat Jan 08 12:30:04 2011 +0100
+++ b/gcc/testsuite/go.test/go-test.exp	Sun Jan 09 12:31:06 2011 +0100
@@ -1,4 +1,4 @@ 
-#   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+#   Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
 #   Written by Ian Lance Taylor <iant@google.com>.
 
 # This program is free software; you can redistribute it and/or modify
@@ -106,6 +106,41 @@ 
     file delete $filename
 }
 
+# N.B. Keep in sync with libgo/configure.ac.
+proc go-set-goarch { } {
+    global target_triplet
+
+    switch -glob $target_triplet {
+	"arm*-*-*" -
+	"ep9312*-*-*" -
+	"strongarm*-*-*" -
+	"xscale-*-*" {
+	    set goarch "arm"
+	}
+	"i?86-*-*" -
+	"x86_64-*-*" {
+	    if [check_effective_target_ilp32] {
+		set goarch "386"
+	    } else {
+		set goarch "amd64"
+	    }
+	}
+	"sparc*-*-*" {
+	    if [check_effective_target_ilp32] {
+		set goarch "sparc"
+	    } else {
+		set goarch "sparcv9"
+	    }
+	}
+	default {
+	    perror "$target_triplet: unhandled architecture"
+	    return ""
+	}	
+    }
+    verbose -log "Setting GOARCH=$goarch" 1
+    setenv GOARCH $goarch
+}
+
 proc go-gc-tests { } {
     global srcdir subdir
     global runtests
@@ -122,6 +157,9 @@ 
 	set DEFAULT_GOCFLAGS " -pedantic-errors"
     }
 
+    # Set GOARCH for tests that need it.
+    go-set-goarch
+
     # Running all the torture options takes too long and, since the
     # frontend ignores the standard options, it doesn't significantly
     # improve testing.