From 004a4c577b347b8edffd5c11677ac0770c25dd77 Mon Sep 17 00:00:00 2001 From: Jinxin Yang Date: Fri, 25 Oct 2019 15:56:53 -0700 Subject: [PATCH] [flang] [OpenMP] Test Infra update to support OpenMP symbol tests During the symbol tests, OpenMP directives (start with "!$omp") line needs to be saved for 1.f90 and 2.f90. Also moved "OPTIONS:" detection to common.sh as "$USER_OPTIONS" Original-commit: flang-compiler/f18@7d4e8e8ad52608ed9e4b5239371533cd28f0fbda --- flang/test/semantics/CMakeLists.txt | 12 ++++++------ flang/test/semantics/common.sh | 7 +++++-- flang/test/semantics/test_errors.sh | 7 +------ flang/test/semantics/test_symbols.sh | 9 +++++---- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/flang/test/semantics/CMakeLists.txt b/flang/test/semantics/CMakeLists.txt index 9ac632c8068d..02872e9b801e 100644 --- a/flang/test/semantics/CMakeLists.txt +++ b/flang/test/semantics/CMakeLists.txt @@ -158,12 +158,6 @@ set(ERROR_TESTS omp-resolve02.f90 omp-resolve03.f90 omp-resolve04.f90 - omp-symbol01.f90 - omp-symbol02.f90 - omp-symbol03.f90 - omp-symbol04.f90 - omp-symbol05.f90 - omp-symbol06.f90 omp-clause-validity01.f90 omp-loop-association.f90 # omp-nested01.f90 @@ -203,6 +197,12 @@ set(SYMBOL_TESTS symbol14.f90 symbol15.f90 symbol16.f90 + omp-symbol01.f90 + omp-symbol02.f90 + omp-symbol03.f90 + omp-symbol04.f90 + omp-symbol05.f90 + omp-symbol06.f90 kinds01.f90 kinds03.f90 procinterface01.f90 diff --git a/flang/test/semantics/common.sh b/flang/test/semantics/common.sh index 5a68dd6fd02b..8c2e32e00c68 100644 --- a/flang/test/semantics/common.sh +++ b/flang/test/semantics/common.sh @@ -14,8 +14,9 @@ # Common functionality for test scripts # Process arguments, expecting source file as 1st; optional path to f18 as 2nd -# Set: $F18 to the path to f18; $temp to an empty temp directory; and $src -# to the full path of the single source argument +# Set: $F18 to the path to f18; $temp to an empty temp directory; $src +# to the full path of the single source argument; and $USER_OPTIONS to the +# option list given in the $src file after string "OPTIONS:" PATH=/usr/bin:/bin @@ -35,5 +36,7 @@ case $1 in (/*) src=$1 ;; (*) src=$(dirname $0)/$1 ;; esac +USER_OPTIONS=`sed -n 's/^ *! *OPTIONS: *//p' $src` +echo $USER_OPTIONS temp=`mktemp -d ./tmp.XXXXXX` [[ $KEEP ]] || trap "rm -rf $temp" EXIT diff --git a/flang/test/semantics/test_errors.sh b/flang/test/semantics/test_errors.sh index b7ec8eb58175..54cf3ac3fa44 100755 --- a/flang/test/semantics/test_errors.sh +++ b/flang/test/semantics/test_errors.sh @@ -25,14 +25,9 @@ log=$temp/log actual=$temp/actual expect=$temp/expect diffs=$temp/diffs -options=$temp/options - -# See if there are additional options -sed -n 's/^ *! *OPTIONS: *//p' $src > $options -cat $options include=$(dirname $(dirname $F18))/include -cmd="$F18 $F18_OPTIONS -I$include `cat $options` $src" +cmd="$F18 $F18_OPTIONS $USER_OPTIONS -I$include $src" ( cd $temp; $cmd ) > $log 2>&1 if [[ $? -ge 128 ]]; then cat $log diff --git a/flang/test/semantics/test_symbols.sh b/flang/test/semantics/test_symbols.sh index 626f571aa8e3..124a5bb95f99 100755 --- a/flang/test/semantics/test_symbols.sh +++ b/flang/test/semantics/test_symbols.sh @@ -28,13 +28,14 @@ src2=$temp/2.f90 src3=$temp/3.f90 diffs=$temp/diffs -# Strip out blank lines and all comments except "!DEF:" and "!REF:" -sed -e 's/!\([DR]EF:\)/KEEP \1/' \ +# Strip out blank lines and all comments except "!DEF:", "!REF:", and "!$omp" +sed -e 's/!\([DR]EF:\)/KEEP \1/' -e 's/!\($omp\)/KEEP \1/' \ -e 's/!.*//' -e 's/ *$//' -e '/^$/d' -e 's/KEEP \([DR]EF:\)/!\1/' \ + -e 's/KEEP \($omp\)/!\1/' \ $src > $src1 -egrep -v '^ *!' $src1 > $src2 # strip out meaningful comments +egrep -v '![DR]EF:' $src1 > $src2 # strip out DEF and REF comments # compile, inserting comments for symbols: -( cd $temp; $F18 $F18_OPTIONS $(basename $src2) ) > $src3 +( cd $temp; $F18 $F18_OPTIONS $USER_OPTIONS $(basename $src2) ) > $src3 if diff -w -U999999 $src1 $src3 > $diffs; then echo PASS