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

Conversation

vzakhari
Copy link
Contributor

No description provided.

@vzakhari vzakhari requested a review from klausler June 16, 2025 22:43
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Jun 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 16, 2025

@llvm/pr-subscribers-flang-semantics

Author: Slava Zakharin (vzakhari)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/144448.diff

6 Files Affected:

  • (modified) flang/test/Semantics/modfile71.F90 (+4-3)
  • (modified) flang/test/Semantics/modfile75.F90 (+2-1)
  • (modified) flang/test/Semantics/modfile76.F90 (+8-7)
  • (modified) flang/test/Semantics/modfile77.F90 (+2-1)
  • (modified) flang/test/Semantics/modfile78.F90 (+2-1)
  • (modified) flang/test/Semantics/modfile79.F90 (+2-1)
diff --git a/flang/test/Semantics/modfile71.F90 b/flang/test/Semantics/modfile71.F90
index 7c3c7f5b48958..7f32eb18c6f8f 100644
--- a/flang/test/Semantics/modfile71.F90
+++ b/flang/test/Semantics/modfile71.F90
@@ -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.
diff --git a/flang/test/Semantics/modfile75.F90 b/flang/test/Semantics/modfile75.F90
index aba00ffac848a..8f7adafe7204d 100644
--- a/flang/test/Semantics/modfile75.F90
+++ b/flang/test/Semantics/modfile75.F90
@@ -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
diff --git a/flang/test/Semantics/modfile76.F90 b/flang/test/Semantics/modfile76.F90
index 50ee9a088e119..c7ae91bd42bed 100644
--- a/flang/test/Semantics/modfile76.F90
+++ b/flang/test/Semantics/modfile76.F90
@@ -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
diff --git a/flang/test/Semantics/modfile77.F90 b/flang/test/Semantics/modfile77.F90
index a82904ebbcc22..9ad615c16c43c 100644
--- a/flang/test/Semantics/modfile77.F90
+++ b/flang/test/Semantics/modfile77.F90
@@ -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
diff --git a/flang/test/Semantics/modfile78.F90 b/flang/test/Semantics/modfile78.F90
index cb3eccd9a4108..19b9ac39de934 100644
--- a/flang/test/Semantics/modfile78.F90
+++ b/flang/test/Semantics/modfile78.F90
@@ -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
diff --git a/flang/test/Semantics/modfile79.F90 b/flang/test/Semantics/modfile79.F90
index 7d3b42166654e..ae156527b3bf3 100644
--- a/flang/test/Semantics/modfile79.F90
+++ b/flang/test/Semantics/modfile79.F90
@@ -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

@vzakhari vzakhari merged commit ac7af53 into llvm:main Jun 16, 2025
9 of 10 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 17, 2025

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building flang at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/35009

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Flang :: Semantics/modfile75.F90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
rm -rf /build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp && mkdir -p /build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp # RUN: at line 1
+ rm -rf /build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp
+ mkdir -p /build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp
/build/buildbot/premerge-monolithic-linux/build/bin/flang -c -fhermetic-module-files -DWHICH=1 -J/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90 && /build/buildbot/premerge-monolithic-linux/build/bin/flang -c -fhermetic-module-files -DWHICH=2 -J/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90 && /build/buildbot/premerge-monolithic-linux/build/bin/flang -fc1 -fdebug-unparse -J/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90 | /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90 # RUN: at line 2
+ /build/buildbot/premerge-monolithic-linux/build/bin/flang -c -fhermetic-module-files -DWHICH=1 -J/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90
+ /build/buildbot/premerge-monolithic-linux/build/bin/flang -c -fhermetic-module-files -DWHICH=2 -J/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90
+ /build/buildbot/premerge-monolithic-linux/build/bin/flang -fc1 -fdebug-unparse -J/build/buildbot/premerge-monolithic-linux/build/tools/flang/test/Semantics/Output/modfile75.F90.tmp /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90
+ /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90
error: Semantic errors in /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90:16:11: error: Must be a constant value
    integer(c_int) n
            ^^^^^
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck /build/buildbot/premerge-monolithic-linux/llvm-project/flang/test/Semantics/modfile75.F90

--

********************


@vzakhari
Copy link
Contributor Author

vzakhari commented Jun 17, 2025

There are stale modfile75*.mod files somewhere in the build directory where the LIT tests are run, so the buildbots will continue to fail until the build dir is cleaned-up.

@vzakhari
Copy link
Contributor Author

ab7aaac should take care of the buildbots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants