-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[flang] Fix failure of regression tests on macOS #151812
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
Conversation
@llvm/pr-subscribers-flang-driver @llvm/pr-subscribers-flang-openmp Author: None (parabola94) ChangesSome tests in flang fail on macOS because of Full diff: https://github.com/llvm/llvm-project/pull/151812.diff 2 Files Affected:
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
|
@llvm/pr-subscribers-flang-fir-hlfir Author: None (parabola94) ChangesSome tests in flang fail on macOS because of Full diff: https://github.com/llvm/llvm-project/pull/151812.diff 2 Files Affected:
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do the clang tests handle this? Is it really necessary to remove -isysroot
like this? I have very limited experience building on MacOS though, so I'm afraid I cannot offer something more constructive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid modifying substitutions after the fact. It is confusing if %flang_fc1
means something in one test, but something else in another. Change
llvm-project/flang-rt/test/lit.cfg.py
Line 68 in 7cd1ce3
isysroot_flag = ["-isysroot", config.osx_sysroot] |
%flang_fc1_noisysroot
(or even better, only add -isysroot
it to tests that need it).
Could you add details on when -isysroot
is needed and when not? "some tests did not handle it appropriately" doesn't really explain anything. The change in target-enter-data-default-openmp52.f90
also seems to be different.
idx, driver = next(((i, subst) | ||
for i, subst in enumerate(config.substitutions) if "flang" in subst[0])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idx, driver = next(((i, subst) | |
for i, subst in enumerate(config.substitutions) if "flang" in subst[0])) | |
driver = next((subst | |
for subst in config.substitutions if "flang" in subst[0]), None) |
i
is not used; don't fail on StopIteration
if it is not in the list.
import re | ||
from lit.llvm import llvm_config | ||
|
||
# Drop -isysroot flag for darwin-version.f90. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is for this one test only? Could we limit the change for that test?
Thank you for your feedback. |
If I remove
So, when not using What is the issue with Since there are only 3 tests that need |
Actually, these tests are all failing now. I hadn't noticed it because I always use
From what I understood, setting
IMHO, considering the |
Thank you for your helpful comments.
This approach seems good to me as well. I closed this PR because my approach has some problems. |
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.