Skip to content

Commit ac7af53

Browse files
authored
[flang] Fixed LIT tests to create modfiles in a temp dir. (llvm#144448)
1 parent 964888d commit ac7af53

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

flang/test/Semantics/modfile71.F90

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
!RUN: %flang_fc1 -fsyntax-only -fhermetic-module-files -DSTEP=1 %s
2-
!RUN: %flang_fc1 -fsyntax-only -DSTEP=2 %s
3-
!RUN: not %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s
1+
!RUN: rm -rf %t && mkdir -p %t
2+
!RUN: %flang_fc1 -fsyntax-only -fhermetic-module-files -DSTEP=1 -J%t %s
3+
!RUN: %flang_fc1 -fsyntax-only -DSTEP=2 -J%t %s
4+
!RUN: not %flang_fc1 -fsyntax-only -pedantic -J%t %s 2>&1 | FileCheck %s
45

56
! Tests that a module captured in a hermetic module file is compatible when
67
! USE'd with a module of the same name USE'd directly.

flang/test/Semantics/modfile75.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
!RUN: %flang -c -fhermetic-module-files -DWHICH=1 %s && %flang -c -fhermetic-module-files -DWHICH=2 %s && %flang_fc1 -fdebug-unparse %s | FileCheck %s
1+
!RUN: rm -rf %t && mkdir -p %t
2+
!RUN: %flang -c -fhermetic-module-files -DWHICH=1 -J%t %s && %flang -c -fhermetic-module-files -DWHICH=2 -J%t %s && %flang_fc1 -fdebug-unparse -J%t %s | FileCheck %s
23

34
#if WHICH == 1
45
module modfile75a

flang/test/Semantics/modfile76.F90

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
!RUN: %flang_fc1 -fsyntax-only -fhermetic-module-files -DSTEP=1 %s
2-
!RUN: %flang_fc1 -fsyntax-only %s
1+
!RUN: rm -rf %t && mkdir -p %t
2+
!RUN: %flang_fc1 -fsyntax-only -fhermetic-module-files -DSTEP=1 -J%t %s
3+
!RUN: %flang_fc1 -fsyntax-only -J%t %s
34

45
! Tests that a BIND(C) variable in a module A captured in a hermetic module
56
! file USE'd in a module B is not creating bogus complaints about BIND(C) name
67
! conflict when both module A and B are later accessed.
78

89
#if STEP == 1
9-
module modfile75a
10+
module modfile76a
1011
integer, bind(c) :: x
1112
end
1213

13-
module modfile75b
14-
use modfile75a ! capture hermetically
14+
module modfile76b
15+
use modfile76a ! capture hermetically
1516
end
1617

1718
#else
1819
subroutine test
19-
use modfile75a
20-
use modfile75b
20+
use modfile76a
21+
use modfile76b
2122
implicit none
2223
print *, x
2324
end subroutine

flang/test/Semantics/modfile77.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
!RUN: %flang -c -fhermetic-module-files -DWHICH=1 %s && %flang -c -fhermetic-module-files -DWHICH=2 %s && %flang -c -fhermetic-module-files %s && cat modfile77c.mod | FileCheck %s
1+
!RUN: rm -rf %t && mkdir -p %t
2+
!RUN: %flang -c -fhermetic-module-files -DWHICH=1 -J%t %s && %flang -c -fhermetic-module-files -DWHICH=2 -J%t %s && %flang -c -fhermetic-module-files -J%t %s && cat %t/modfile77c.mod | FileCheck %s
23

34
#if WHICH == 1
45
module modfile77a

flang/test/Semantics/modfile78.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
!RUN: %flang -c -fhermetic-module-files -DWHICH=1 %s && %flang -c -fhermetic-module-files -DWHICH=2 %s && %flang -c -fhermetic-module-files %s && cat modfile78c.mod | FileCheck %s
1+
!RUN: rm -rf %t && mkdir -p %t
2+
!RUN: %flang -c -fhermetic-module-files -DWHICH=1 -J%t %s && %flang -c -fhermetic-module-files -DWHICH=2 -J%t %s && %flang -c -fhermetic-module-files -J%t %s && cat %t/modfile78c.mod | FileCheck %s
23

34
#if WHICH == 1
45
module modfile78a

flang/test/Semantics/modfile79.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
!RUN: %flang -c -DWHICH=1 %s && FileCheck %s <modfile79a.mod && %flang -c -fhermetic-module-files -DWHICH=2 %s && %flang -c %s && FileCheck %s <modfile79a.mod
1+
!RUN: rm -rf %t && mkdir -p %t
2+
!RUN: %flang -c -DWHICH=1 -J%t %s && FileCheck %s <%t/modfile79a.mod && %flang -c -fhermetic-module-files -DWHICH=2 -J%t %s && %flang -c -J%t %s && FileCheck %s <%t/modfile79a.mod
23

34
!Ensure that writing modfile79c.mod doesn't cause a spurious
45
!regeneration of modfile79a.mod from its copy in the hermetic

0 commit comments

Comments
 (0)