[libcxx-commits] [PATCH] D99726: [libc++] Fix codesigning in run.py

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 1 10:40:13 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG232d3a3e4755: [libc++] Fix codesigning in run.py (authored by ldionne).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99726/new/

https://reviews.llvm.org/D99726

Files:
  libcxx/utils/run.py


Index: libcxx/utils/run.py
===================================================================
--- libcxx/utils/run.py
+++ libcxx/utils/run.py
@@ -29,13 +29,18 @@
     args = parser.parse_args()
     commandLine = args.command
 
-    # Do any necessary codesigning.
+    # HACK:
+    # If an argument is a file that ends in `.tmp.exe`, assume it is the name
+    # of an executable generated by a test file. We call these test-executables
+    # below. This allows us to do custom processing like codesigning test-executables.
+    # It's also possible for there to be no such executable, for example in the case
+    # of a .sh.cpp test.
+    isTestExe = lambda exe: exe.endswith('.tmp.exe') and os.path.exists(exe)
+
+    # Do any necessary codesigning of test-executables found in the command line.
     if args.codesign_identity:
-        exe = commandLine[0]
-        rc = subprocess.call(['xcrun', 'codesign', '-f', '-s', args.codesign_identity, exe], env={})
-        if rc != 0:
-            sys.stderr.write('Failed to codesign: ' + exe)
-            return rc
+        for exe in filter(isTestExe, commandLine):
+            subprocess.check_call(['xcrun', 'codesign', '-f', '-s', args.codesign_identity, exe], env={})
 
     # Extract environment variables into a dictionary
     env = {k : v  for (k, v) in map(lambda s: s.split('=', 1), args.env)}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99726.334757.patch
Type: text/x-patch
Size: 1361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210401/2c6ee602/attachment-0001.bin>


More information about the libcxx-commits mailing list