Skip to content
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

[flang][driver] Fix Driver/isysroot.f90 test #78478

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

luporl
Copy link
Contributor

@luporl luporl commented Jan 17, 2024

Check for DEFAULT_SYSROOT, because when it is set -isysroot has no
effect.

Check for DEFAULT_SYSROOT, because when it is set -isysroot has no
effect.
@llvmbot llvmbot added flang:driver flang Flang issues not falling into any other category labels Jan 17, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 17, 2024

@llvm/pr-subscribers-flang-driver

Author: Leandro Lupori (luporl)

Changes

Check for DEFAULT_SYSROOT, because when it is set -isysroot has no
effect.


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

3 Files Affected:

  • (modified) flang/test/Driver/isysroot.f90 (+2)
  • (modified) flang/test/lit.cfg.py (+4)
  • (modified) flang/test/lit.site.cfg.py.in (+1)
diff --git a/flang/test/Driver/isysroot.f90 b/flang/test/Driver/isysroot.f90
index 7f021d9c6f9c429..28b435cce08edd3 100644
--- a/flang/test/Driver/isysroot.f90
+++ b/flang/test/Driver/isysroot.f90
@@ -1,6 +1,8 @@
 ! Verify that the -isysroot flag is known to the frontend and, on Darwin,
 ! is passed on to the linker.
 
+! When DEFAULT_SYSROOT is set -isysroot has no effect.
+! REQUIRES: !default_sysroot
 ! RUN: %flang -### --target=aarch64-apple-darwin -isysroot /path/to/sysroot \
 ! RUN:        %s 2>&1 | FileCheck %s --check-prefix=CHECK-DARWIN
 ! RUN: %flang -### --target=aarch64-linux-gnu -isysroot /path/to/sysroot \
diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py
index 2e0a494ef4bc68a..9b8bb83ca23c74a 100644
--- a/flang/test/lit.cfg.py
+++ b/flang/test/lit.cfg.py
@@ -123,6 +123,10 @@
 if config.osx_sysroot:
     isysroot_flag = ["-isysroot", config.osx_sysroot]
 
+# Check for DEFAULT_SYSROOT, because when it is set -isysroot has no effect.
+if config.default_sysroot:
+    config.available_features.add("default_sysroot")
+
 # For each occurrence of a flang tool name, replace it with the full path to
 # the build directory holding that tool.
 tools = [
diff --git a/flang/test/lit.site.cfg.py.in b/flang/test/lit.site.cfg.py.in
index 32099f43d3135f4..16411d82908cae3 100644
--- a/flang/test/lit.site.cfg.py.in
+++ b/flang/test/lit.site.cfg.py.in
@@ -24,6 +24,7 @@ config.linked_bye_extension = @LLVM_BYE_LINK_INTO_TOOLS@
 config.cc = "@CMAKE_C_COMPILER@"
 config.osx_sysroot = path(r"@CMAKE_OSX_SYSROOT@")
 config.targets_to_build = "@TARGETS_TO_BUILD@"
+config.default_sysroot = "@DEFAULT_SYSROOT@"
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)

@luporl
Copy link
Contributor Author

luporl commented Jan 17, 2024

Tested on MacOS. When DEFAULT_SYSROOT is set isysroot.f90 becomes unsupported and when not set the test passes.

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a ton!

Copy link
Collaborator

@kkwli kkwli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG. Thanks.

@luporl
Copy link
Contributor Author

luporl commented Jan 18, 2024

Thanks for the quick reviews.

@luporl luporl merged commit 07abde2 into llvm:main Jan 18, 2024
6 checks passed
@luporl luporl deleted the luporl-fix-isysroot branch January 18, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:driver flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants