[flang-commits] [flang] 66c26d9 - [flang] Port test_any.sh tests to FileCheck: Hand port getdefinition* tests
Richard Barton via flang-commits
flang-commits at lists.llvm.org
Fri Jun 26 10:47:31 PDT 2020
Author: Richard Barton
Date: 2020-06-26T18:47:13+01:00
New Revision: 66c26d93b7be0e1cbd5e1c7615a0f591c975fd27
URL: https://github.com/llvm/llvm-project/commit/66c26d93b7be0e1cbd5e1c7615a0f591c975fd27
DIFF: https://github.com/llvm/llvm-project/commit/66c26d93b7be0e1cbd5e1c7615a0f591c975fd27.diff
LOG: [flang] Port test_any.sh tests to FileCheck: Hand port getdefinition* tests
These tests are sensitive to line numbers in the input and check output.
They also successively write to a temporary file then check that.
Fix the line number issues and replace the temporary file use with successive
calls to FileCheck with different check-prefixes.
Differential Revision: https://reviews.llvm.org/D82165
Added:
Modified:
flang/test/Semantics/getdefinition01.f90
flang/test/Semantics/getdefinition02.f
flang/test/Semantics/getdefinition03-a.f90
flang/test/Semantics/getdefinition04.f90
flang/test/Semantics/getdefinition05.f90
Removed:
################################################################################
diff --git a/flang/test/Semantics/getdefinition01.f90 b/flang/test/Semantics/getdefinition01.f90
index 3130246c0022..57141b671754 100644
--- a/flang/test/Semantics/getdefinition01.f90
+++ b/flang/test/Semantics/getdefinition01.f90
@@ -1,4 +1,3 @@
-!RUN: %S/test_any.sh %s %t %f18
! Tests -fget-definition returning source position of symbol definition.
module m1
private :: f
@@ -16,13 +15,13 @@ recursive pure function f() result(x)
end function
end module
-! EXEC: echo %t 1>&2;
-! EXEC: ${F18} -fget-definition 7 17 18 -fparse-only %s > %t;
-! EXEC: ${F18} -fget-definition 8 20 23 -fparse-only %s >> %t;
-! EXEC: ${F18} -fget-definition 15 3 4 -fparse-only %s >> %t;
-! EXEC: ${F18} -fget-definition -fparse-only %s >> %t 2>&1;
-! EXEC: cat %t | ${FileCheck} %s
-! CHECK:x:.*getdefinition01.f90, 6, 21-22
-! CHECK:yyy:.*getdefinition01.f90, 6, 24-27
-! CHECK:x:.*getdefinition01.f90, 14, 24-25
-! CHECK:Invalid argument to -fget-definitions
+! RUN and CHECK lines at the bottom as this test is sensitive to line numbers
+! RUN: %f18 -fget-definition 6 17 18 -fparse-only %s | FileCheck --check-prefix=CHECK1 %s
+! RUN: %f18 -fget-definition 7 20 23 -fparse-only %s | FileCheck --check-prefix=CHECK2 %s
+! RUN: %f18 -fget-definition 14 3 4 -fparse-only %s | FileCheck --check-prefix=CHECK3 %s
+! CHECK1: x:{{.*}}getdefinition01.f90, 5, 21-22
+! CHECK2: yyy:{{.*}}getdefinition01.f90, 5, 24-27
+! CHECK3: x:{{.*}}getdefinition01.f90, 13, 24-25
+
+! RUN: not %f18 -fget-definition -fparse-only %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
+! CHECK-ERROR: Invalid argument to -fget-definitions
diff --git a/flang/test/Semantics/getdefinition02.f b/flang/test/Semantics/getdefinition02.f
index 430c01e4e5ef..ee7a96750da5 100644
--- a/flang/test/Semantics/getdefinition02.f
+++ b/flang/test/Semantics/getdefinition02.f
@@ -1,4 +1,3 @@
-!RUN: %S/test_any.sh %s %t %f18
! Tests -fget-definition with fixed form.
module m2
private :: f
@@ -17,10 +16,10 @@ recursive pure function f() result(x)
end function
end module
-! EXEC: ${F18} -fget-definition 8 9 10 -fparse-only %s > %t;
-! EXEC: ${F18} -fget-definition 9 26 29 -fparse-only %s >> %t;
-! EXEC: ${F18} -fget-definition 16 9 10 -fparse-only %s >> %t;
-! EXEC: cat %t | ${FileCheck} %s
-! CHECK:x:.*getdefinition02.f, 6, 27-28
-! CHECK:yyy:.*getdefinition02.f, 6, 30-33
-! CHECK:x:.*getdefinition02.f, 15, 30-31
+! RUN and CHECK lines here as test is sensitive to line numbers
+! RUN: %f18 -fget-definition 7 9 10 -fparse-only %s 2>&1 | FileCheck --check-prefix=CHECK1 %s
+! RUN: %f18 -fget-definition 8 26 29 -fparse-only %s 2>&1 | FileCheck --check-prefix=CHECK2 %s
+! RUN: %f18 -fget-definition 15 9 10 -fparse-only %s 2>&1 | FileCheck --check-prefix=CHECK3 %s
+! CHECK1: x:{{.*}}getdefinition02.f, 5, 27-28
+! CHECK2: yyy:{{.*}}getdefinition02.f, 5, 30-33
+! CHECK3: x:{{.*}}getdefinition02.f, 14, 30-31
diff --git a/flang/test/Semantics/getdefinition03-a.f90 b/flang/test/Semantics/getdefinition03-a.f90
index 4111166d5f8a..ecf8c9b48389 100644
--- a/flang/test/Semantics/getdefinition03-a.f90
+++ b/flang/test/Semantics/getdefinition03-a.f90
@@ -1,5 +1,4 @@
! Tests -fget-definition with INCLUDE
-!RUN: %S/test_any.sh %s %t %f18
INCLUDE "Inputs/getdefinition03-b.f90"
program main
@@ -8,8 +7,7 @@ program main
x = f
end program
-! EXEC: ${F18} -fget-definition 8 6 7 -fparse-only %s > %t;
-! EXEC: ${F18} -fget-definition 8 2 3 -fparse-only %s >> %t;
-! EXEC: cat %t | ${FileCheck} %s;
-! CHECK:f:.*getdefinition03-b.f90, 2, 12-13
-! CHECK:x:.*getdefinition03-a.f90, 7, 13-14
+! RUN: %f18 -fget-definition 7 6 7 -fparse-only %s | FileCheck --check-prefix=CHECK1 %s
+! RUN: %f18 -fget-definition 7 2 3 -fparse-only %s | FileCheck --check-prefix=CHECK2 %s
+! CHECK1: f:{{.*}}getdefinition03-b.f90, 2, 12-13
+! CHECK2: x:{{.*}}getdefinition03-a.f90, 6, 13-14
diff --git a/flang/test/Semantics/getdefinition04.f90 b/flang/test/Semantics/getdefinition04.f90
index ab9564e28f4c..72429599595b 100644
--- a/flang/test/Semantics/getdefinition04.f90
+++ b/flang/test/Semantics/getdefinition04.f90
@@ -1,4 +1,3 @@
-!RUN: %S/test_any.sh %s %t %f18
! Tests -fget-definition with COMMON block with same name as variable.
program main
integer :: x
@@ -7,5 +6,5 @@ program main
x = y
end program
-! EXEC: ${F18} -fget-definition 7 3 4 -fparse-only %s | ${FileCheck} %s
-! CHECK:x:.*getdefinition04.f90, 4, 14-15
+! RUN: %f18 -fget-definition 6 3 4 -fparse-only %s | FileCheck %s
+! CHECK: x:{{.*}}getdefinition04.f90, 3, 14-15
diff --git a/flang/test/Semantics/getdefinition05.f90 b/flang/test/Semantics/getdefinition05.f90
index 81a5b605d028..315e9570d352 100644
--- a/flang/test/Semantics/getdefinition05.f90
+++ b/flang/test/Semantics/getdefinition05.f90
@@ -1,4 +1,3 @@
-!RUN: %S/test_any.sh %s %t %f18
! Tests -fget-symbols-sources with BLOCK that contains same variable name as
! another in an outer scope.
program main
@@ -13,9 +12,8 @@ program main
end program
!! Inner x
-! EXEC: ${F18} -fget-definition 10 5 6 -fparse-only %s > %t;
-! CHECK:x:.*getdefinition05.f90, 8, 16-17
+! RUN: %f18 -fget-definition 9 5 6 -fparse-only %s | FileCheck --check-prefix=CHECK1 %s
+! CHECK1: x:{{.*}}getdefinition05.f90, 7, 16-17
!! Outer y
-! EXEC: ${F18} -fget-definition 12 7 8 -fparse-only %s >> %t;
-! CHECK:y:.*getdefinition05.f90, 6, 14-15
-! EXEC: cat %t | ${FileCheck} %s;
+! RUN: %f18 -fget-definition 11 7 8 -fparse-only %s | FileCheck --check-prefix=CHECK2 %s
+! CHECK2: y:{{.*}}getdefinition05.f90, 5, 14-15
More information about the flang-commits
mailing list