From 3ef61ec22672c145cc93675c98845b27d272b961 Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Mon, 23 Sep 2019 16:39:57 -0700 Subject: [PATCH] [flang] Fix tests that use the same .mod file The tests run by `test_any.sh` don't redirect their .mod files to a different directory so they occasionally fail when the same file is accessed by different tests at the same time. With locking of module files implemented, this problem reproduces much more reliably Work around it by changing the module names to be distinct. Also remove some comments left over when copied from `test_symbols.sh` tests. Original-commit: flang-compiler/f18@f7b5c5f0fcbbac4736940761e6d43ec76a3a372a Reviewed-on: https://github.com/flang-compiler/f18/pull/758 --- flang/test/semantics/getdefinition01.f90 | 26 ++++++-------------- flang/test/semantics/getdefinition02.f | 26 ++++++-------------- flang/test/semantics/getdefinition03-a.f90 | 2 +- flang/test/semantics/getdefinition03-b.f90 | 2 +- flang/test/semantics/getsymbols01.f90 | 28 +++++++--------------- flang/test/semantics/getsymbols02-a.f90 | 4 ++-- flang/test/semantics/getsymbols02-b.f90 | 6 ++--- flang/test/semantics/getsymbols02-c.f90 | 6 ++--- flang/test/semantics/getsymbols03-a.f90 | 4 ++-- flang/test/semantics/getsymbols03-b.f90 | 2 +- 10 files changed, 35 insertions(+), 71 deletions(-) diff --git a/flang/test/semantics/getdefinition01.f90 b/flang/test/semantics/getdefinition01.f90 index 5b812114ad3e..b1b1c304b572 100644 --- a/flang/test/semantics/getdefinition01.f90 +++ b/flang/test/semantics/getdefinition01.f90 @@ -14,41 +14,29 @@ ! Tests -fget-definition returning source position of symbol definition. -!DEF: /m Module -module m - !DEF: /m/f PRIVATE, PURE, RECURSIVE Subprogram REAL(4) +module m1 private :: f contains - !DEF: /m/s BIND(C), PUBLIC, PURE Subprogram - !DEF: /m/s/x INTENT(IN) (implicit) ObjectEntity REAL(4) - !DEF: /m/s/y INTENT(INOUT) (implicit) ObjectEntity REAL(4) pure subroutine s (x, yyy) bind(c) - !REF: /m/s/x intent(in) :: x - !REF: /m/s/y intent(inout) :: yyy contains - !DEF: /m/s/ss PURE Subprogram pure subroutine ss end subroutine end subroutine - !REF: /m/f - !DEF: /m/f/x ALLOCATABLE ObjectEntity REAL(4) recursive pure function f() result(x) - !REF: /m/f/x real, allocatable :: x - !REF: /m/f/x x = 1.0 end function end module ! RUN: echo %t 1>&2; -! RUN: ${F18} -fget-definition 27 17 18 -fparse-only -fdebug-semantics %s > %t; -! RUN: ${F18} -fget-definition 29 20 23 -fparse-only -fdebug-semantics %s >> %t; -! RUN: ${F18} -fget-definition 41 3 4 -fparse-only -fdebug-semantics %s >> %t; +! RUN: ${F18} -fget-definition 21 17 18 -fparse-only -fdebug-semantics %s > %t; +! RUN: ${F18} -fget-definition 22 20 23 -fparse-only -fdebug-semantics %s >> %t; +! RUN: ${F18} -fget-definition 29 3 4 -fparse-only -fdebug-semantics %s >> %t; ! RUN: ${F18} -fget-definition -fparse-only -fdebug-semantics %s >> %t 2>&1; ! RUN: cat %t | ${FileCheck} %s -! CHECK:x:.*getdefinition01.f90, 25, 21-22 -! CHECK:yyy:.*getdefinition01.f90, 25, 24-27 -! CHECK:x:.*getdefinition01.f90, 39, 24-25 +! CHECK:x:.*getdefinition01.f90, 20, 21-22 +! CHECK:yyy:.*getdefinition01.f90, 20, 24-27 +! CHECK:x:.*getdefinition01.f90, 28, 24-25 ! CHECK:Invalid argument to -fget-definitions diff --git a/flang/test/semantics/getdefinition02.f b/flang/test/semantics/getdefinition02.f index 2802ec1e7cbe..9a4e01bcfa74 100644 --- a/flang/test/semantics/getdefinition02.f +++ b/flang/test/semantics/getdefinition02.f @@ -14,39 +14,27 @@ ! Tests -fget-definition with fixed form. - !DEF: /m Module - module m - !DEF: /m/f PRIVATE, PURE, RECURSIVE Subprogram REAL(4) + module m2 private :: f contains - !DEF: /m/s BIND(C), PUBLIC, PURE Subprogram - !DEF: /m/s/x INTENT(IN) (implicit) ObjectEntity REAL(4) - !DEF: /m/s/y INTENT(INOUT) (implicit) ObjectEntity REAL(4) pure subroutine s (x, yyy) bind(c) - !REF: /m/s/x intent(in) :: * x - !REF: /m/s/y intent(inout) :: yyy contains - !DEF: /m/s/ss PURE Subprogram pure subroutine ss end subroutine end subroutine - !REF: /m/f - !DEF: /m/f/x ALLOCATABLE ObjectEntity REAL(4) recursive pure function f() result(x) - !REF: /m/f/x real, allocatable :: x - !REF: /m/f/x x = 1.0 end function end module -! RUN: ${F18} -fget-definition 28 9 10 -fparse-only -fdebug-semantics %s > %t; -! RUN: ${F18} -fget-definition 30 26 29 -fparse-only -fdebug-semantics %s >> %t; -! RUN: ${F18} -fget-definition 42 9 10 -fparse-only -fdebug-semantics %s >> %t; +! RUN: ${F18} -fget-definition 22 9 10 -fparse-only -fdebug-semantics %s > %t; +! RUN: ${F18} -fget-definition 23 26 29 -fparse-only -fdebug-semantics %s >> %t; +! RUN: ${F18} -fget-definition 30 9 10 -fparse-only -fdebug-semantics %s >> %t; ! RUN: cat %t | ${FileCheck} %s -! CHECK:x:.*getdefinition02.f, 25, 27-28 -! CHECK:yyy:.*getdefinition02.f, 25, 30-33 -! CHECK:x:.*getdefinition02.f, 40, 30-31 +! CHECK:x:.*getdefinition02.f, 20, 27-28 +! CHECK:yyy:.*getdefinition02.f, 20, 30-33 +! CHECK:x:.*getdefinition02.f, 29, 30-31 diff --git a/flang/test/semantics/getdefinition03-a.f90 b/flang/test/semantics/getdefinition03-a.f90 index 0539a873e51e..a057a83cdd7f 100644 --- a/flang/test/semantics/getdefinition03-a.f90 +++ b/flang/test/semantics/getdefinition03-a.f90 @@ -17,7 +17,7 @@ INCLUDE "getdefinition03-b.f90" program main - use m + use m3 integer :: x x = f end program diff --git a/flang/test/semantics/getdefinition03-b.f90 b/flang/test/semantics/getdefinition03-b.f90 index 170d0f262dba..bdfa51f1986c 100644 --- a/flang/test/semantics/getdefinition03-b.f90 +++ b/flang/test/semantics/getdefinition03-b.f90 @@ -12,6 +12,6 @@ ! See the License for the specific language governing permissions and ! limitations under the License. -module m +module m3 public :: f end module diff --git a/flang/test/semantics/getsymbols01.f90 b/flang/test/semantics/getsymbols01.f90 index d7bc6f5b4ca1..cfb74efb1ab1 100644 --- a/flang/test/semantics/getsymbols01.f90 +++ b/flang/test/semantics/getsymbols01.f90 @@ -14,39 +14,27 @@ ! Tests -fget-symbols-sources finding all symbols in file. -!DEF: /m Module -module m - !DEF: /m/f PRIVATE, PURE, RECURSIVE Subprogram REAL(4) +module mm1 private :: f contains - !DEF: /m/s BIND(C), PUBLIC, PURE Subprogram - !DEF: /m/s/x INTENT(IN) (implicit) ObjectEntity REAL(4) - !DEF: /m/s/y INTENT(INOUT) (implicit) ObjectEntity REAL(4) pure subroutine s (x, y) bind(c) - !REF: /m/s/x intent(in) :: x - !REF: /m/s/y intent(inout) :: y contains - !DEF: /m/s/ss PURE Subprogram pure subroutine ss end subroutine end subroutine - !REF: /m/f - !DEF: /m/f/x ALLOCATABLE ObjectEntity REAL(4) recursive pure function f() result(x) - !REF: /m/f/x real, allocatable :: x - !REF: /m/f/x x = 1.0 end function end module ! RUN: ${F18} -fget-symbols-sources -fparse-only -fdebug-semantics %s 2>&1 | ${FileCheck} %s -! CHECK-ONCE:m:.*getsymbols01.f90, 18, 8-9 -! CHECK-ONCE:f:.*getsymbols01.f90, 37, 26-27 -! CHECK-ONCE:s:.*getsymbols01.f90, 25, 18-19 -! CHECK-ONCE:ss:.*getsymbols01.f90, 32, 19-21 -! CHECK-ONCE:x:.*getsymbols01.f90, 25, 21-22 -! CHECK-ONCE:y:.*getsymbols01.f90, 25, 24-25 -! CHECK-ONCE:x:.*getsymbols01.f90, 39, 24-25 +! CHECK-ONCE:mm1:.*getsymbols01.f90, 17, 8-11 +! CHECK-ONCE:f:.*getsymbols01.f90, 27, 26-27 +! CHECK-ONCE:s:.*getsymbols01.f90, 20, 18-19 +! CHECK-ONCE:ss:.*getsymbols01.f90, 24, 19-21 +! CHECK-ONCE:x:.*getsymbols01.f90, 20, 21-22 +! CHECK-ONCE:y:.*getsymbols01.f90, 20, 24-25 +! CHECK-ONCE:x:.*getsymbols01.f90, 28, 24-25 diff --git a/flang/test/semantics/getsymbols02-a.f90 b/flang/test/semantics/getsymbols02-a.f90 index 9180b9cb48aa..e7529e086d78 100644 --- a/flang/test/semantics/getsymbols02-a.f90 +++ b/flang/test/semantics/getsymbols02-a.f90 @@ -14,7 +14,7 @@ ! RUN: ${F18} -fparse-only -fdebug-semantics %s -module m2 +module mm2a implicit none private public :: get5 @@ -23,4 +23,4 @@ contains integer :: ret ret = 5 end function get5 -end module m2 +end module mm2a diff --git a/flang/test/semantics/getsymbols02-b.f90 b/flang/test/semantics/getsymbols02-b.f90 index d3d000dc095e..c9c2fe529a36 100644 --- a/flang/test/semantics/getsymbols02-b.f90 +++ b/flang/test/semantics/getsymbols02-b.f90 @@ -14,8 +14,8 @@ ! RUN: ${F18} -fparse-only -fdebug-semantics %s -module m1 -use m2 +module mm2b +use mm2a implicit none private public :: callget5 @@ -25,4 +25,4 @@ contains INTEGER :: ret ret = get5() end function callget5 -end module m1 +end module mm2b diff --git a/flang/test/semantics/getsymbols02-c.f90 b/flang/test/semantics/getsymbols02-c.f90 index 9ba11033d512..4ecf6f7582cd 100644 --- a/flang/test/semantics/getsymbols02-c.f90 +++ b/flang/test/semantics/getsymbols02-c.f90 @@ -15,12 +15,12 @@ ! Tests -fget-symbols-sources with modules. PROGRAM helloworld - use m1 + use mm2b implicit none integer::i i = callget5() ENDPROGRAM ! RUN: ${F18} -fget-symbols-sources -fparse-only -fdebug-semantics %s 2>&1 | ${FileCheck} %s -! CHECK:callget5: m1 -! CHECK:get5: m2 +! CHECK:callget5: mm2b +! CHECK:get5: mm2a diff --git a/flang/test/semantics/getsymbols03-a.f90 b/flang/test/semantics/getsymbols03-a.f90 index 6899d6d80a47..3a88eb13bab0 100644 --- a/flang/test/semantics/getsymbols03-a.f90 +++ b/flang/test/semantics/getsymbols03-a.f90 @@ -17,13 +17,13 @@ INCLUDE "getsymbols03-b.f90" program main - use m + use mm3 integer :: x x = f end program ! RUN: ${F18} -fget-symbols-sources -fparse-only -fdebug-semantics %s 2>&1 | ${FileCheck} %s -! CHECK:m:.*getsymbols03-b.f90, 15, 8-9 +! CHECK:mm3:.*getsymbols03-b.f90, 15, 8-11 ! CHECK:f:.*getsymbols03-b.f90, 16, 12-13 ! CHECK:main:.*getsymbols03-a.f90, 19, 9-13 ! CHECK:x:.*getsymbols03-a.f90, 21, 13-14 diff --git a/flang/test/semantics/getsymbols03-b.f90 b/flang/test/semantics/getsymbols03-b.f90 index 170d0f262dba..b6150a7e6277 100644 --- a/flang/test/semantics/getsymbols03-b.f90 +++ b/flang/test/semantics/getsymbols03-b.f90 @@ -12,6 +12,6 @@ ! See the License for the specific language governing permissions and ! limitations under the License. -module m +module mm3 public :: f end module