gotest: Remove race in use of ../testdata.

From-SVN: r186781
This commit is contained in:
Ian Lance Taylor 2012-04-24 20:13:12 +00:00
parent 21e417158c
commit bc9201591d
1 changed files with 16 additions and 14 deletions

View File

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