[flang-commits] [flang] [Flang][test] Account for FLANG_TEST_Fortran_FLAGS (PR #213964)

Michael Kruse via flang-commits flang-commits at lists.llvm.org
Thu Aug 6 03:43:49 PDT 2026


https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/213964

>From 9e6592bdc82adab0ff01694f17a0a6435815b30c Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Tue, 4 Aug 2026 16:34:13 +0200
Subject: [PATCH 1/4] Fix additional compile info

---
 flang/test/Driver/compiler-options.f90 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/flang/test/Driver/compiler-options.f90 b/flang/test/Driver/compiler-options.f90
index 92efbc0044b35..89cfac7a73e9e 100644
--- a/flang/test/Driver/compiler-options.f90
+++ b/flang/test/Driver/compiler-options.f90
@@ -1,6 +1,10 @@
 ! RUN: %flang -S -emit-llvm -o - %s | FileCheck %s
 ! Test communication of COMPILER_OPTIONS from flang to flang -fc1.
-! CHECK: [[OPTSVAR:@_QQclX[0-9A-Fa-f]+]] = {{[a-z]+}} constant [[[OPTSLEN:[0-9]+]] x i8] c"-S -emit-llvm -o -"
+! In a Flang-standalone build, the driver also injects its own implicit
+! search-path options (e.g. -fintrinsic-modules-path=...) ahead of the
+! options given on the command line above, so allow (and ignore) an
+! arbitrary prefix before the flags under test here.
+! CHECK: [[OPTSVAR:@_QQclX[0-9A-Fa-f]+]] = {{[a-z]+}} constant [[[OPTSLEN:[0-9]+]] x i8] c"{{.*}}-S -emit-llvm -o -"
 program main
     use ISO_FORTRAN_ENV, only: compiler_options
     implicit none

>From 6855e996781e849e50c7156095fdf786490b14f0 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Tue, 4 Aug 2026 17:50:36 +0200
Subject: [PATCH 2/4] Use %%flang to apply flang_test_FLANG_TEST_Fortran_FLAGS

---
 flang/test/Semantics/bug2236.f90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/test/Semantics/bug2236.f90 b/flang/test/Semantics/bug2236.f90
index ec101ecf467e7..450888fee9e59 100644
--- a/flang/test/Semantics/bug2236.f90
+++ b/flang/test/Semantics/bug2236.f90
@@ -1,4 +1,4 @@
-!RUN: flang -c -Xflang -fdisable-real-10 %s 2>&1 | FileCheck --allow-empty %s
+!RUN: %flang -c -Xflang -fdisable-real-10 %s 2>&1 | FileCheck --allow-empty %s
 !REQUIRES: x86-registered-target
 !CHECK-NOT: error
 !Ensure ieee_arithmetic.mod can be used even when REAL(10) is disabled.

>From debd8b24031a5354ce642f0808197f475a13308a Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Wed, 5 Aug 2026 10:39:55 +0200
Subject: [PATCH 3/4] Allow trailing path separator

---
 flang/test/Driver/intrinsic-module-path_per_target.f90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/test/Driver/intrinsic-module-path_per_target.f90 b/flang/test/Driver/intrinsic-module-path_per_target.f90
index b0a2ac9c7c6b4..23f49096d198e 100644
--- a/flang/test/Driver/intrinsic-module-path_per_target.f90
+++ b/flang/test/Driver/intrinsic-module-path_per_target.f90
@@ -42,7 +42,7 @@
 !-----------------------------------------
 
 ! DEFAULTPATH:      "-fc1"
-! DEFAULTPATH-SAME: "-fintrinsic-modules-path" "{{.*(\\\\|/)}}finclude{{(\\\\|/)}}flang{{(\\\\|/)}}{{[^/\]+}}"
+! DEFAULTPATH-SAME: "-fintrinsic-modules-path" "{{.*(\\\\|/)}}finclude{{(\\\\|/)}}flang{{(\\\\|/)}}{{[^/\]+[/\]?}}"
 
 ! NOINPUTONE: Source file 'basictestmoduleone.mod' was not found
 ! NOINPUTTWO: Source file 'basictestmoduletwo.mod' was not found

>From a91b21533a58888b1648b263c569ed80e3d05c31 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Thu, 6 Aug 2026 12:39:13 +0200
Subject: [PATCH 4/4] Disable test that requires an authentic cmdline

---
 flang/test/Driver/compiler-options.f90 | 8 +++-----
 flang/test/lit.cfg.py                  | 5 +++++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/flang/test/Driver/compiler-options.f90 b/flang/test/Driver/compiler-options.f90
index 89cfac7a73e9e..a0dff5ef514c7 100644
--- a/flang/test/Driver/compiler-options.f90
+++ b/flang/test/Driver/compiler-options.f90
@@ -1,10 +1,8 @@
 ! RUN: %flang -S -emit-llvm -o - %s | FileCheck %s
+! REQUIRES: flang-authentic-cmdline
+
 ! Test communication of COMPILER_OPTIONS from flang to flang -fc1.
-! In a Flang-standalone build, the driver also injects its own implicit
-! search-path options (e.g. -fintrinsic-modules-path=...) ahead of the
-! options given on the command line above, so allow (and ignore) an
-! arbitrary prefix before the flags under test here.
-! CHECK: [[OPTSVAR:@_QQclX[0-9A-Fa-f]+]] = {{[a-z]+}} constant [[[OPTSLEN:[0-9]+]] x i8] c"{{.*}}-S -emit-llvm -o -"
+! CHECK: [[OPTSVAR:@_QQclX[0-9A-Fa-f]+]] = {{[a-z]+}} constant [[[OPTSLEN:[0-9]+]] x i8] c"-S -emit-llvm -o -"
 program main
     use ISO_FORTRAN_ENV, only: compiler_options
     implicit none
diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py
index 121854efe1f61..270ba98374013 100644
--- a/flang/test/lit.cfg.py
+++ b/flang/test/lit.cfg.py
@@ -217,6 +217,11 @@ def get_resource_module_intrinsic_dir(modfile):
     ),
 ]
 
+# Some tests expect the command line to be verbatim what is specified on the
+# RUN: line.
+if not flang_extra_search_args:
+  config.available_features.add("flang-authentic-cmdline")
+
 # Flang has several unimplemented features. TODO messages are used to mark
 # and fail if these features are exercised. Some TODOs exit with a non-zero
 # exit code, but others abort the execution in assert builds.



More information about the flang-commits mailing list