[libcxx-commits] [libcxx] 89fe36d - [libc++] Make sure substitutions are expanded inside FILE_DEPENDENCIES

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 31 10:57:23 PDT 2020


Author: Louis Dionne
Date: 2020-03-31T13:57:17-04:00
New Revision: 89fe36d08a9ad01f7f5a4a704a6f7382e26b32f9

URL: https://github.com/llvm/llvm-project/commit/89fe36d08a9ad01f7f5a4a704a6f7382e26b32f9
DIFF: https://github.com/llvm/llvm-project/commit/89fe36d08a9ad01f7f5a4a704a6f7382e26b32f9.diff

LOG: [libc++] Make sure substitutions are expanded inside FILE_DEPENDENCIES

Added: 
    

Modified: 
    libcxx/test/libcxx/selftest/test.file_dependencies.sh.cpp
    libcxx/utils/libcxx/test/format.py

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/selftest/test.file_dependencies.sh.cpp b/libcxx/test/libcxx/selftest/test.file_dependencies.sh.cpp
index 1d85b6021acc..5974393b1370 100644
--- a/libcxx/test/libcxx/selftest/test.file_dependencies.sh.cpp
+++ b/libcxx/test/libcxx/selftest/test.file_dependencies.sh.cpp
@@ -8,5 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // FILE_DEPENDENCIES: test.pass.cpp
+// FILE_DEPENDENCIES: %s
 
 // RUN: echo %{file_dependencies} | grep 'test.pass.cpp'
+// RUN: echo %{file_dependencies} | grep '%s'

diff  --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py
index 6dabc03c2a7a..a9eb7d9855c5 100644
--- a/libcxx/utils/libcxx/test/format.py
+++ b/libcxx/utils/libcxx/test/format.py
@@ -112,8 +112,6 @@ def _execute(self, test, lit_config):
         script = lit.TestRunner.parseIntegratedTestScript(
             test, additional_parsers=parsers, require_script=is_sh_test)
 
-        local_cwd = os.path.dirname(test.getSourcePath())
-        data_files = [os.path.join(local_cwd, f) for f in test.file_dependencies]
         # Check if a result for the test was returned. If so return that
         # result.
         if isinstance(script, lit.Test.Result):
@@ -128,7 +126,14 @@ def _execute(self, test, lit_config):
         tmpDir, tmpBase = lit.TestRunner.getTempPaths(test)
         substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir,
                                                                tmpBase)
+
+        # Apply substitutions in FILE_DEPENDENCIES markup
+        data_files = lit.TestRunner.applySubstitutions(test.file_dependencies, substitutions,
+                                                       recursion_limit=10)
+        local_cwd = os.path.dirname(test.getSourcePath())
+        data_files = [f if os.path.isabs(f) else os.path.join(local_cwd, f) for f in data_files]
         substitutions.append(('%{file_dependencies}', ' '.join(data_files)))
+
         script = lit.TestRunner.applySubstitutions(script, substitutions,
                                                    recursion_limit=10)
 


        


More information about the libcxx-commits mailing list