[libcxx-commits] [PATCH] D76785: [libc++] Set filesystem test flags in a lit.local.cfg
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 25 10:48:10 PDT 2020
ldionne created this revision.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous.
Herald added a project: libc++.
Herald added a reviewer: libc++.
ldionne added a parent revision: D76731: [libc++] Do not rely on the environment to run filesystem tests.
ldionne updated this revision to Diff 252623.
ldionne added a comment.
Make sure we don't modify the cxx compiler flags globally
This reduces the complexity of our already complex global lit configuration,
and also avoids cluttering the compilation commands for all tests with
things that are only relevant to the filesystem tests.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76785
Files:
libcxx/test/std/input.output/filesystems/lit.local.cfg
libcxx/utils/libcxx/test/config.py
Index: libcxx/utils/libcxx/test/config.py
===================================================================
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -140,7 +140,6 @@
self.configure_execute_external()
self.configure_ccache()
self.configure_compile_flags()
- self.configure_filesystem_compile_flags()
self.configure_link_flags()
self.configure_env()
self.configure_color_diagnostics()
@@ -724,21 +723,6 @@
self.config.available_features.add('libcpp-abi-unstable')
self.cxx.compile_flags += ['-D_LIBCPP_ABI_UNSTABLE']
- def configure_filesystem_compile_flags(self):
- static_env = os.path.join(self.libcxx_src_root, 'test', 'std',
- 'input.output', 'filesystems', 'Inputs', 'static_test_env')
- static_env = os.path.realpath(static_env)
- assert os.path.isdir(static_env)
- self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="%s"' % static_env]
-
- dynamic_helper = os.path.join(self.libcxx_src_root, 'test', 'support',
- 'filesystem_dynamic_test_helper.py')
- assert os.path.isfile(dynamic_helper)
-
- self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="%s %s"'
- % (sys.executable, dynamic_helper)]
-
-
def configure_link_flags(self):
# Configure library path
self.configure_link_flags_cxx_library_path()
Index: libcxx/test/std/input.output/filesystems/lit.local.cfg
===================================================================
--- libcxx/test/std/input.output/filesystems/lit.local.cfg
+++ libcxx/test/std/input.output/filesystems/lit.local.cfg
@@ -1,5 +1,24 @@
+import copy
+import os
+import sys
+
# Disable all of the filesystem tests if the dylib under test doesn't support them.
if 'dylib-has-no-filesystem' in config.available_features:
config.unsupported = True
if 'c++filesystem-disabled' in config.available_features:
config.unsupported = True
+
+config.test_format.cxx = copy.deepcopy(config.test_format.cxx)
+
+inputs = os.path.join(os.path.dirname(__file__), 'Inputs', 'static_test_env')
+config.test_format.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="{}"'.format(inputs)]
+
+dynamic_env = os.path.join(config.test_exec_root, 'filesystem', 'Output', 'dynamic_env')
+dynamic_env = os.path.realpath(dynamic_env)
+if not os.path.isdir(dynamic_env):
+ os.makedirs(dynamic_env)
+config.test_format.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="{}"'.format(dynamic_env)]
+
+dynamic_helper = os.path.join(config.test_source_root, 'support', 'filesystem_dynamic_test_helper.py')
+assert os.path.isfile(dynamic_helper)
+config.test_format.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="{} {}"'.format(sys.executable, dynamic_helper)]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76785.252623.patch
Type: text/x-patch
Size: 2943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200325/3b061032/attachment.bin>
More information about the libcxx-commits
mailing list