[flang-commits] [flang] [flang][driver] Fix Driver/isysroot.f90 test (PR #78478)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Wed Jan 17 09:18:54 PST 2024


https://github.com/luporl created https://github.com/llvm/llvm-project/pull/78478

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


>From ff9f2b98fcc561e9b0ed20b87a8b93331a1eb51f Mon Sep 17 00:00:00 2001
From: Leandro Lupori <leandro.lupori at linaro.org>
Date: Wed, 17 Jan 2024 13:12:48 -0300
Subject: [PATCH] [flang][driver] Fix Driver/isysroot.f90 test

Check for DEFAULT_SYSROOT, because when it is set -isysroot has no
effect.
---
 flang/test/Driver/isysroot.f90 | 2 ++
 flang/test/lit.cfg.py          | 4 ++++
 flang/test/lit.site.cfg.py.in  | 1 +
 3 files changed, 7 insertions(+)

diff --git a/flang/test/Driver/isysroot.f90 b/flang/test/Driver/isysroot.f90
index 7f021d9c6f9c42..28b435cce08edd 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 2e0a494ef4bc68..9b8bb83ca23c74 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 32099f43d3135f..16411d82908cae 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)



More information about the flang-commits mailing list