-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang][LIT] Add LIT "features" for build configs with ICU or iconv #159245
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
base: main
Are you sure you want to change the base?
[clang][LIT] Add LIT "features" for build configs with ICU or iconv #159245
Conversation
... in preparation for `-finput-charset` and `-fexec-charset` tests that rely on the availability of one or the other; however, this does not address the problem of varying `iconv` support of (and names for) character encodings. Co-authored-by: Abhina Sreeskantharajan <Abhina.Sreeskantharajan@ibm.com>
@llvm/pr-subscribers-clang Author: Hubert Tong (hubert-reinterpretcast) Changes... in preparation for Full diff: https://github.com/llvm/llvm-project/pull/159245.diff 4 Files Affected:
diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index e9f4f83f98923..cf746367202ad 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -16,6 +16,8 @@ llvm_canonicalize_cmake_booleans(
LLVM_BUILD_EXAMPLES
LLVM_BYE_LINK_INTO_TOOLS
LLVM_ENABLE_PLUGINS
+ HAVE_ICU
+ HAVE_ICONV
LLVM_ENABLE_ZLIB
LLVM_ENABLE_ZSTD
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index f50953a93a412..c6d2164a5041c 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -18,6 +18,8 @@ config.clang_lib_dir = path(r"@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.target_triple = "@LLVM_TARGET_TRIPLE@"
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
+config.have_icu = @HAVE_ICU@
+config.have_iconv = @HAVE_ICONV@
config.have_zlib = @LLVM_ENABLE_ZLIB@
config.have_zstd = @LLVM_ENABLE_ZSTD@
config.clang_objc_rewriter = @CLANG_ENABLE_OBJC_REWRITER@
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index ed2bfa6df68f4..ebc2a7c6cf890 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -310,6 +310,7 @@ if (LLVM_ENABLE_ICU STREQUAL FORCE_ON AND LLVM_ENABLE_ICONV STREQUAL FORCE_ON)
endif()
# Check for ICU. Only allow an optional, dynamic link for ICU so we don't impact LLVM's licensing.
+set(HAVE_ICU 0)
if(LLVM_ENABLE_ICU AND NOT(LLVM_ENABLE_ICONV STREQUAL FORCE_ON))
set(LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}")
@@ -326,6 +327,7 @@ if(LLVM_ENABLE_ICU AND NOT(LLVM_ENABLE_ICONV STREQUAL FORCE_ON))
endif()
# Check only for builtin iconv to avoid licensing issues.
+set(HAVE_ICONV 0)
if(LLVM_ENABLE_ICONV AND NOT HAVE_ICU)
if (LLVM_ENABLE_ICONV STREQUAL FORCE_ON)
find_package(Iconv REQUIRED)
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index 2f2df68ac0cff..b2f5e0f965940 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -145,6 +145,12 @@ def __init__(self, lit_config, config):
have_zstd = getattr(config, "have_zstd", None)
if have_zstd:
features.add("zstd")
+ have_icu = getattr(config, "have_icu", None)
+ if have_icu:
+ features.add("icu")
+ have_iconv = getattr(config, "have_iconv", None)
+ if have_iconv:
+ features.add("iconv")
if getattr(config, "reverse_iteration", None):
features.add("reverse_iteration")
|
@llvm/pr-subscribers-testing-tools Author: Hubert Tong (hubert-reinterpretcast) Changes... in preparation for Full diff: https://github.com/llvm/llvm-project/pull/159245.diff 4 Files Affected:
diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index e9f4f83f98923..cf746367202ad 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -16,6 +16,8 @@ llvm_canonicalize_cmake_booleans(
LLVM_BUILD_EXAMPLES
LLVM_BYE_LINK_INTO_TOOLS
LLVM_ENABLE_PLUGINS
+ HAVE_ICU
+ HAVE_ICONV
LLVM_ENABLE_ZLIB
LLVM_ENABLE_ZSTD
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index f50953a93a412..c6d2164a5041c 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -18,6 +18,8 @@ config.clang_lib_dir = path(r"@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.target_triple = "@LLVM_TARGET_TRIPLE@"
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
+config.have_icu = @HAVE_ICU@
+config.have_iconv = @HAVE_ICONV@
config.have_zlib = @LLVM_ENABLE_ZLIB@
config.have_zstd = @LLVM_ENABLE_ZSTD@
config.clang_objc_rewriter = @CLANG_ENABLE_OBJC_REWRITER@
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index ed2bfa6df68f4..ebc2a7c6cf890 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -310,6 +310,7 @@ if (LLVM_ENABLE_ICU STREQUAL FORCE_ON AND LLVM_ENABLE_ICONV STREQUAL FORCE_ON)
endif()
# Check for ICU. Only allow an optional, dynamic link for ICU so we don't impact LLVM's licensing.
+set(HAVE_ICU 0)
if(LLVM_ENABLE_ICU AND NOT(LLVM_ENABLE_ICONV STREQUAL FORCE_ON))
set(LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}")
@@ -326,6 +327,7 @@ if(LLVM_ENABLE_ICU AND NOT(LLVM_ENABLE_ICONV STREQUAL FORCE_ON))
endif()
# Check only for builtin iconv to avoid licensing issues.
+set(HAVE_ICONV 0)
if(LLVM_ENABLE_ICONV AND NOT HAVE_ICU)
if (LLVM_ENABLE_ICONV STREQUAL FORCE_ON)
find_package(Iconv REQUIRED)
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index 2f2df68ac0cff..b2f5e0f965940 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -145,6 +145,12 @@ def __init__(self, lit_config, config):
have_zstd = getattr(config, "have_zstd", None)
if have_zstd:
features.add("zstd")
+ have_icu = getattr(config, "have_icu", None)
+ if have_icu:
+ features.add("icu")
+ have_iconv = getattr(config, "have_iconv", None)
+ if have_iconv:
+ features.add("iconv")
if getattr(config, "reverse_iteration", None):
features.add("reverse_iteration")
|
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.
LGTM
... in preparation for
-finput-charset
and-fexec-charset
tests that rely on the availability of one or the other; however, this does not address the problem of varyingiconv
support of (and names for) character encodings.