This patch updates most of the remaining regression tests (~400) to use
`flang-new` rather then `f18` when `FLANG_BUILD_NEW_DRIVER` is set.
This allows us to share more Flang regression tests between `f18` and
`flang-new`. A handful of tests have not been ported yet - these are
currently either failing or not supported by the new driver.
Summary of changes:
* RUN lines in tests are updated to use `%flang_fc1` instead of `%f18`
* option spellings in tests are updated to forms accepted by both `f18` and
`flang-new`
* variables in Bash scripts are renamed (e.g. F18 --> FLANG_FC1)
The updated tests will now be run with the new driver, `flang-new`,
whenever it is enabled (i.e when `FLANG_BUILD_NEW_DRIVER` is set).
Although this patch touches many files, vast majority of the changes are
automatic:
```
grep -IEZlr "%f18" flang/test/ | xargs -0 -l sed -i 's/%f18/%flang_fc1/g
```
Differential Revision: https://reviews.llvm.org/D100309
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Compile a source file and check errors against those listed in the file.
|
|
# Change the compiler by setting the FLANG_FC1 environment variable.
|
|
|
|
FLANG_FC1_OPTIONS="-fsyntax-only"
|
|
srcdir=$(dirname $0)
|
|
source $srcdir/common.sh
|
|
[[ ! -f $src ]] && die "File not found: $src"
|
|
|
|
log=$temp/log
|
|
actual=$temp/actual
|
|
expect=$temp/expect
|
|
diffs=$temp/diffs
|
|
|
|
cmd="$FLANG_FC1 $FLANG_FC1_OPTIONS $src"
|
|
( cd $temp; $cmd ) > $log 2>&1
|
|
if [[ $? -ge 128 ]]; then
|
|
cat $log
|
|
exit 1
|
|
fi
|
|
|
|
# $actual has errors from the compiler; $expect has them from !ERROR comments in source
|
|
# Format both as "<line>: <text>" so they can be diffed.
|
|
sed -n 's=^[^:]*:\([^:]*\):[^:]*: error: =\1: =p' $log > $actual
|
|
awk '
|
|
BEGIN { FS = "!ERROR: "; }
|
|
/^ *!ERROR: / { errors[nerrors++] = $2; next; }
|
|
{ for (i = 0; i < nerrors; ++i) printf "%d: %s\n", NR, errors[i]; nerrors = 0; }
|
|
' $src > $expect
|
|
|
|
if diff -U0 $actual $expect > $diffs; then
|
|
echo PASS
|
|
else
|
|
echo "$cmd"
|
|
< $diffs \
|
|
sed -n -e 's/^-\([0-9]\)/actual at \1/p' -e 's/^+\([0-9]\)/expect at \1/p' \
|
|
| sort -n -k 3
|
|
die FAIL
|
|
fi
|