Skip to content

[flang] Fixed LIT tests to create modfiles in a temp dir. #144448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions flang/test/Semantics/modfile71.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!RUN: %flang_fc1 -fsyntax-only -fhermetic-module-files -DSTEP=1 %s
!RUN: %flang_fc1 -fsyntax-only -DSTEP=2 %s
!RUN: not %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s
!RUN: rm -rf %t && mkdir -p %t
!RUN: %flang_fc1 -fsyntax-only -fhermetic-module-files -DSTEP=1 -J%t %s
!RUN: %flang_fc1 -fsyntax-only -DSTEP=2 -J%t %s
!RUN: not %flang_fc1 -fsyntax-only -pedantic -J%t %s 2>&1 | FileCheck %s

! Tests that a module captured in a hermetic module file is compatible when
! USE'd with a module of the same name USE'd directly.
Expand Down
3 changes: 2 additions & 1 deletion flang/test/Semantics/modfile75.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
!RUN: %flang -c -fhermetic-module-files -DWHICH=1 %s && %flang -c -fhermetic-module-files -DWHICH=2 %s && %flang_fc1 -fdebug-unparse %s | FileCheck %s
!RUN: rm -rf %t && mkdir -p %t
!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

#if WHICH == 1
module modfile75a
Expand Down
15 changes: 8 additions & 7 deletions flang/test/Semantics/modfile76.F90
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
!RUN: %flang_fc1 -fsyntax-only -fhermetic-module-files -DSTEP=1 %s
!RUN: %flang_fc1 -fsyntax-only %s
!RUN: rm -rf %t && mkdir -p %t
!RUN: %flang_fc1 -fsyntax-only -fhermetic-module-files -DSTEP=1 -J%t %s
!RUN: %flang_fc1 -fsyntax-only -J%t %s

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

#if STEP == 1
module modfile75a
module modfile76a
integer, bind(c) :: x
end

module modfile75b
use modfile75a ! capture hermetically
module modfile76b
use modfile76a ! capture hermetically
end

#else
subroutine test
use modfile75a
use modfile75b
use modfile76a
use modfile76b
implicit none
print *, x
end subroutine
Expand Down
3 changes: 2 additions & 1 deletion flang/test/Semantics/modfile77.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
!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
!RUN: rm -rf %t && mkdir -p %t
!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

#if WHICH == 1
module modfile77a
Expand Down
3 changes: 2 additions & 1 deletion flang/test/Semantics/modfile78.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
!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
!RUN: rm -rf %t && mkdir -p %t
!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

#if WHICH == 1
module modfile78a
Expand Down
3 changes: 2 additions & 1 deletion flang/test/Semantics/modfile79.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
!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
!RUN: rm -rf %t && mkdir -p %t
!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

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