aboutsummaryrefslogtreecommitdiff
path: root/scripts/llvm.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/llvm.py')
-rw-r--r--scripts/llvm.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/scripts/llvm.py b/scripts/llvm.py
index ff8ecb1..be4628f 100644
--- a/scripts/llvm.py
+++ b/scripts/llvm.py
@@ -8,6 +8,7 @@ from modules.llvm import build_llvm
from modules.llvm import LLVMBuildConfig
from modules.llvm import LLVMSubproject
from modules.llvm import LLVMSourceConfig
+from modules.llvm import run_test_suite
from modules.utils import CommandPrinter
from modules.utils import CommandRunner
from modules.utils import get_remote_branch
@@ -132,6 +133,23 @@ def run_build(args):
die("Failed to build {} because:\n{}".format(args.build, str(exc)))
+def run_the_test_suite(args):
+ """Run the test-suite in a given sandbox."""
+ if args.dry:
+ consumer = CommandPrinter()
+ else:
+ consumer = CommandRunner()
+
+ compilers = ["--cc={}".format(args.cc)]
+ if args.cxx:
+ compilers.append("--cxx={}".format(args.cxx))
+
+ try:
+ run_test_suite(consumer, args.sandbox, args.testsuite, args.lit,
+ compilers + args.flags)
+ except RuntimeError as exc:
+ die("Failed to run the test-suite because:\n{}".format(str(exc)))
+
##########################################################################
# Command line parsing #
##########################################################################
@@ -261,6 +279,53 @@ build.add_argument(
"'--build-flag=-FLAG' to pass it.")
build.set_defaults(run_command=run_build)
+# Subcommand for running the test-suite
+runTestSuite = subcommands.add_parser(
+ 'run-test-suite',
+ help="Run the test-suite in the given sandbox.")
+runTestSuite.add_argument(
+ '--sandbox',
+ required=True,
+ help="Path to the sandbox. It must point to a virtualenv with a LNT setup.")
+runTestSuite.add_argument(
+ '--test-suite',
+ dest="testsuite",
+ required=True,
+ help="Path to the test-suite repo.")
+runTestSuite.add_argument(
+ '--use-lit',
+ dest="lit",
+ required=True,
+ help="Path to llvm-lit.")
+runTestSuite.add_argument(
+ '--lnt-flag',
+ dest='flags',
+ metavar='FLAG',
+ default=[],
+ action='append',
+ help="Additional flags to be passed to LNT when running the test-suite."
+ "May be passed several times. If your flag starts with a '-', use "
+ "'--lnt-flag=-FLAG' to pass it.")
+runTestSuite.add_argument(
+ # We can pass --cc through the --lnt-flag interface, but we generally won't
+ # want to test the system compiler, so force the user to be specific.
+ '--cc',
+ required=True,
+ help="The path to the C compiler that we're testing.")
+runTestSuite.add_argument(
+ # For symmetry, we also provide a --cxx argument, but this one isn't
+ # required since LNT tries to guess it based on the value of --cc.
+ '--cxx',
+ required=False,
+ help="The path to the C++ compiler that we're testing.")
+runTestSuite.add_argument(
+ '-n', '--dry-run',
+ dest='dry',
+ action='store_true',
+ default=False,
+ help="Print the commands instead of executing them.")
+runTestSuite.set_defaults(run_command=run_the_test_suite)
+
args = options.parse_args()
if args.subcommand == "projects" and args.add and not args.repos:
projs.error(