[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@f7b5c5f0fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/758
This commit is contained in:
Tim Keith 2019-09-23 16:39:57 -07:00 committed by GitHub
parent 73c630a4ea
commit 3ef61ec226
10 changed files with 35 additions and 71 deletions

View File

@ -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

View File

@ -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

View File

@ -17,7 +17,7 @@
INCLUDE "getdefinition03-b.f90"
program main
use m
use m3
integer :: x
x = f
end program

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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