[libcxx-commits] [PATCH] D111179: [libc++] Print the decoded version of substitutions in dsl.sh.py

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 5 13:35:12 PDT 2021


ldionne created this revision.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

It makes it much easier to debug the test when it fails.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111179

Files:
  libcxx/test/libcxx/selftest/dsl/dsl.sh.py


Index: libcxx/test/libcxx/selftest/dsl/dsl.sh.py
===================================================================
--- libcxx/test/libcxx/selftest/dsl/dsl.sh.py
+++ libcxx/test/libcxx/selftest/dsl/dsl.sh.py
@@ -43,6 +43,17 @@
 SOURCE_ROOT, EXEC_PATH, EXEC, CXX, FLAGS, COMPILE_FLAGS, LINK_FLAGS = args
 sys.argv[1:8] = []
 
+# Decode the substitutions that are base64 encoded.
+def base64Decode(sub, encoded):
+    decoded = lit.util.to_string(base64.b64decode(encoded))
+    print("Decoding substitution '{}' from base64: '{}'".format(sub, decoded))
+    return decoded
+CXX = base64Decode('%{cxx}', CXX)
+FLAGS = base64Decode('%{flags}', FLAGS)
+COMPILE_FLAGS = base64Decode('%{compile_flags}', COMPILE_FLAGS)
+LINK_FLAGS = base64Decode('%{link_flags}', LINK_FLAGS)
+EXEC = base64Decode('%{exec}', EXEC)
+
 class SetupConfigs(unittest.TestCase):
     """
     Base class for the tests below -- it creates a fake TestingConfig.
@@ -69,13 +80,12 @@
         self.config.test_source_root = SOURCE_ROOT
         self.config.test_exec_root = EXEC_PATH
         self.config.recursiveExpansionLimit = 10
-        base64Decode = lambda s: lit.util.to_string(base64.b64decode(s))
         self.config.substitutions = [
-            ('%{cxx}', base64Decode(CXX)),
-            ('%{flags}', base64Decode(FLAGS)),
-            ('%{compile_flags}', base64Decode(COMPILE_FLAGS)),
-            ('%{link_flags}', base64Decode(LINK_FLAGS)),
-            ('%{exec}', base64Decode(EXEC))
+            ('%{cxx}', CXX),
+            ('%{flags}', FLAGS),
+            ('%{compile_flags}', COMPILE_FLAGS),
+            ('%{link_flags}', LINK_FLAGS),
+            ('%{exec}', EXEC)
         ]
 
     def getSubstitution(self, substitution):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111179.377342.patch
Type: text/x-patch
Size: 1721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211005/d7c537a8/attachment.bin>


More information about the libcxx-commits mailing list