From e9920a6861b5257f0f24e5092d6f3f1ea1493916 Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Wed, 19 Jun 2019 13:18:17 -0700 Subject: [PATCH] [flang] Prevent .mod files from being left by tests test_symbols.sh and test_folding.sh were running the compiler in the test directory (e.g. `/test/semantics`). This meant that .mod files were being left there because they weren't cleaned up. Change to run the compiler in the temp directory created for each test. It is deleted at the end so files aren't left behind. Original-commit: flang-compiler/f18@4f9735ada7b142e7a013bede4a3d258b6620a573 Reviewed-on: https://github.com/flang-compiler/f18/pull/506 --- flang/test/evaluate/test_folding.sh | 11 ++++++----- flang/test/semantics/test_symbols.sh | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/flang/test/evaluate/test_folding.sh b/flang/test/evaluate/test_folding.sh index 1e273de..71cda86 100755 --- a/flang/test/evaluate/test_folding.sh +++ b/flang/test/evaluate/test_folding.sh @@ -35,7 +35,7 @@ PATH=/usr/bin:/bin srcdir=$(dirname $0) -F18CC=${F18:-../../tools/f18/f18} +F18CC=${F18:-../../../tools/f18/f18} CMD="$F18CC -fdebug-dump-symbols -fparse-only" if [[ $# < 1 ]]; then @@ -66,10 +66,11 @@ actual_warnings=$temp/actwarnings.log expected_warnings=$temp/expwarnings.log warning_diffs=$temp/warnings.diff -if $CMD $src > $src1 2> $messages # compile, dumping symbols -then : -else echo FAIL compilation - exit 1 +if ! ( cd $temp; $CMD $src ) > $src1 2> $messages # compile, dumping symbols +then + cat $messages + echo FAIL compilation + exit 1 fi # Get all PARAMETER declarations diff --git a/flang/test/semantics/test_symbols.sh b/flang/test/semantics/test_symbols.sh index c64753a..f1da1ba0 100755 --- a/flang/test/semantics/test_symbols.sh +++ b/flang/test/semantics/test_symbols.sh @@ -20,7 +20,7 @@ PATH=/usr/bin:/bin srcdir=$(dirname $0) -CMD="${F18:-../../tools/f18/f18} -funparse-with-symbols" +CMD="${F18:-../../../tools/f18/f18} -funparse-with-symbols" if [[ $# != 1 ]]; then echo "Usage: $0 " @@ -44,7 +44,7 @@ sed -e 's/!\([DR]EF:\)/KEEP \1/' \ -e 's/!.*//' -e 's/ *$//' -e '/^$/d' -e 's/KEEP \([DR]EF:\)/!\1/' \ $src > $src1 egrep -v '^ *!' $src1 > $src2 # strip out meaningful comments -$CMD $src2 > $src3 # compile, inserting comments for symbols +( cd $temp; $CMD $(basename $src2) ) > $src3 # compile, inserting comments for symbols if diff -w -U999999 $src1 $src3 > $diffs; then echo PASS -- 2.7.4