[libcxx-commits] [PATCH] D84052: [libcxx][lit] Add a new executor that only compiles tests
Alexander Richardson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 17 10:24:45 PDT 2020
arichardson created this revision.
arichardson added reviewers: libc++, ldionne.
Herald added subscribers: libcxx-commits, dexonsmith.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.
This executor is very useful when you are running tests on a slow
(single-threaded) QEMU emulator via ssh (as is the case in our CHERI fork)
since you can't use the -j flag of lit to speed things up.
In the past I have used this as a basic regression test when adding new
compiler features to check that no new LLVM assertions are triggered.
I originally added this executor for the old test format to the CHERI fork
of libc++. This change is a simple port of the executor to the new format.
I have since added wrapper scripts that start multiple QEMU instances and
distribute the testcases across these instances, but this executor is still
useful and in our CI jobs we use this as an first-stage executor for
libunwind/libcxx to avoid the long-running testing via SSH when there are
obvious bugs in the compiler.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D84052
Files:
libcxx/utils/compile_only.py
Index: libcxx/utils/compile_only.py
===================================================================
--- /dev/null
+++ libcxx/utils/compile_only.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+#===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===----------------------------------------------------------------------===##
+
+"""compile_only.py is a utility for simulating running of a program."""
+
+import argparse
+import subprocess
+import sys
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--execdir', type=str, required=True)
+ parser.add_argument('--codesign_identity', type=str, required=False, default=None)
+ parser.add_argument('--env', type=str, nargs='*', required=False, default=dict())
+ (args, remaining) = parser.parse_known_args(sys.argv[1:])
+
+ if len(remaining) < 2:
+ sys.stderr.write('Missing actual commands to run')
+ exit(1)
+ commandLine = remaining[1:] # Skip the '--'
+
+ # Do any necessary codesigning.
+ 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
+
+ # Extract environment variables into a dictionary
+ env = {k : v for (k, v) in map(lambda s: s.split('=', 1), args.env)}
+ # Run the command line with the given environment in the execution directory.
+ print("Would have run", subprocess.list2cmdline(commandLine), "in", args.execdir, "with env=", env)
+
+
+if __name__ == '__main__':
+ exit(main())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84052.278835.patch
Type: text/x-patch
Size: 1877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200717/f47b384f/attachment-0001.bin>
More information about the libcxx-commits
mailing list