diff mbox

libgo patch committed: Remove race in use of ../testdata

Message ID mcr7gx4vqfv.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor April 24, 2012, 8:13 p.m. UTC
This patch to the libgo testsuite driver removes a race in the use of
the ../testdata directory.  This is PR go/52462.  Ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline and 4.7 branch.

Ian
diff mbox

Patch

diff -r 0b5618e33848 libgo/testsuite/gotest
--- a/libgo/testsuite/gotest	Tue Apr 24 12:11:37 2012 -0700
+++ b/libgo/testsuite/gotest	Tue Apr 24 13:10:27 2012 -0700
@@ -136,18 +136,20 @@ 
 mkdir $DIR
 
 cd $DIR
+mkdir test
+cd test
 
 if test $keep = false; then
-  trap "cd ..; rm -rf $DIR" 0 1 2 3 14 15
+  trap "cd ../..; rm -rf $DIR" 0 1 2 3 14 15
 else
-  trap "cd ..; echo Keeping $DIR" 0 1 2 3 14 15
+  trap "cd ../..; echo Keeping $DIR" 0 1 2 3 14 15
 fi
 
 case "$srcdir" in
 	/*)
 		;;
 	*)
-		srcdir="../$srcdir"
+		srcdir="../../$srcdir"
                 ;;
 esac
 
@@ -158,7 +160,7 @@ 
 	/*)
 		;;
 	*)
-		basedir="../$basedir"
+		basedir="../../$basedir"
                 ;;
 esac
 
@@ -189,10 +191,10 @@ 
 			b=`basename $f`
 			rm -f $b
 			cp $basedir/$f $b
-		    elif test -f ../$f; then
+		    elif test -f ../../$f; then
 			b=`basename $f`
 			rm -f $b
-			cp ../$f $b
+			cp ../../$f $b
 		    else
 			echo "file $f not found" 1>&2
 			exit 1
@@ -224,10 +226,10 @@ 
 			b=`basename $f`
 			rm -f $b
 			cp $basedir/$f $b
-		    elif test -f ../$f; then
+		    elif test -f ../../$f; then
 			b=`basename $f`
 			rm -f $b
-			cp ../$f $b
+			cp ../../$f $b
 		    else
 			echo "file $f not found" 1>&2
 			exit 1
@@ -455,27 +457,27 @@ 
 	exit $status
 	;;
 xyes)
-	rm -rf ../testsuite/*.o
+	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
+		rm -rf ../../testsuite/$f
 		if test -f $f; then
-			cp $f ../testsuite/
+			cp $f ../../testsuite/
 		else
-			ln -s ../$DIR/$f ../testsuite/
+			ln -s ../$DIR/test/$f ../../testsuite/
 		fi
 	done
-	cd ../testsuite
+	cd ../../testsuite
 	rm -rf _obj _test
 	mkdir _obj _test
 	if test "$testname" != ""; then
 	    GOTESTNAME="$testname"
 	    export GOTESTNAME
 	fi
-	$MAKE check RUNTESTFLAGS="$RUNTESTFLAGS GOTEST_TMPDIR=$DIR"
+	$MAKE check RUNTESTFLAGS="$RUNTESTFLAGS GOTEST_TMPDIR=$DIR/test"
 	# Useful when using make check-target-libgo
 	cat libgo.log >> libgo-all.log
 	cat libgo.sum >> libgo-all.sum