[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:46:04 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

Author: None (parabola94)

<details>
<summary>Changes</summary>

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.

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


2 Files Affected:

- (added) flang/test/Driver/lit.local.cfg (+10) 
- (modified) flang/test/Lower/OpenMP/target-enter-data-default-openmp52.f90 (+2-2) 


``````````diff
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

``````````

</details>


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


More information about the flang-commits mailing list