[flang-commits] [flang] [flang] Fix failure of regression tests on macOS (PR #151812)

via flang-commits flang-commits at lists.llvm.org
Sat Aug 2 02:45:34 PDT 2025


https://github.com/parabola94 created https://github.com/llvm/llvm-project/pull/151812

Some tests in flang fail on macOS because of `SDKROOT`. It appends`-isysroot` flag, but some tests did not handle it appropriately. This patch fixes #150765.

>From 533adc99642618377febe1639a1aaa6efdc077f0 Mon Sep 17 00:00:00 2001
From: parabola94 <heavybaby5000 at toki.waseda.jp>
Date: Sat, 26 Jul 2025 23:59:25 +0900
Subject: [PATCH] [flang] Fix failure of regression tests on macOS

---
 flang/test/Driver/lit.local.cfg                        | 10 ++++++++++
 .../OpenMP/target-enter-data-default-openmp52.f90      |  4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)
 create mode 100644 flang/test/Driver/lit.local.cfg

diff --git a/flang/test/Driver/lit.local.cfg b/flang/test/Driver/lit.local.cfg
new file mode 100644
index 0000000000000..aef6bd734300f
--- /dev/null
+++ b/flang/test/Driver/lit.local.cfg
@@ -0,0 +1,10 @@
+import re
+from lit.llvm import llvm_config
+
+# Drop -isysroot flag for darwin-version.f90.
+idx, driver = next(((i, subst)
+    for i, subst in enumerate(config.substitutions) if "flang" in subst[0]))
+subst_key, command = driver
+command = re.sub(' -isysroot [^ ]+', '', command)
+config.substitutions.insert(idx, (subst_key, command))
+config.substitutions.remove(driver)
diff --git a/flang/test/Lower/OpenMP/target-enter-data-default-openmp52.f90 b/flang/test/Lower/OpenMP/target-enter-data-default-openmp52.f90
index 0d4fd964b71ec..72b5fea2c171e 100644
--- a/flang/test/Lower/OpenMP/target-enter-data-default-openmp52.f90
+++ b/flang/test/Lower/OpenMP/target-enter-data-default-openmp52.f90
@@ -1,7 +1,7 @@
 ! This test checks the lowering and application of default map types for the target enter/exit data constructs and map clauses
 
-!RUN: %flang -fc1 -emit-fir -fopenmp -fopenmp-version=52 -o - %s | FileCheck %s --check-prefix=CHECK-52
-!RUN: not %flang -fc1 -emit-fir -fopenmp -fopenmp-version=51 -o - %s 2>&1| FileCheck %s --check-prefix=CHECK-51
+!RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-version=52 -o - %s | FileCheck %s --check-prefix=CHECK-52
+!RUN: not %flang_fc1 -emit-fir -fopenmp -fopenmp-version=51 -o - %s 2>&1| FileCheck %s --check-prefix=CHECK-51
 
 module test
   real, allocatable :: A



More information about the flang-commits mailing list