Commit 476d125f authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook GitHub Bot

getdeps: improve how run_cmake.py invokes ctest

Summary:
Update the generated `run_cmake.py` script to tell ctest to print the test
output on failure.  Also pass in a `-j` flag to run tests in parallel by
default.

These flags are already passed in by default when running `getdeps.py test`;
this simply updates this developer utility script to do the same.

Reviewed By: wez

Differential Revision: D21307806

fbshipit-source-id: 42045b0f9362494042c79bc946a1004ff8ad98b6
parent 242186f5
......@@ -244,6 +244,17 @@ CMAKE_ENV = {env_str}
CMAKE_DEFINE_ARGS = {define_args_str}
def get_jobs_argument(num_jobs_arg: int) -> str:
if num_jobs_arg > 0:
return "-j" + str(num_jobs_arg)
import multiprocessing
num_jobs = multiprocessing.cpu_count()
if sys.platform == "win32":
num_jobs //= 2
return "-j" + str(num_jobs)
def main():
ap = argparse.ArgumentParser()
ap.add_argument(
......@@ -266,6 +277,14 @@ def main():
dest="mode",
help="An alias for --mode=build",
)
ap.add_argument(
"-j",
"--num-jobs",
action="store",
type=int,
default=0,
help="Run the build or tests with the specified number of parallel jobs",
)
ap.add_argument(
"--install",
action="store_const",
......@@ -300,9 +319,14 @@ def main():
target,
"--config",
"Release",
get_jobs_argument(args.num_jobs),
] + args.cmake_args
elif args.mode == "test":
full_cmd = CMD_PREFIX + [{dev_run_script}CTEST] + args.cmake_args
full_cmd = CMD_PREFIX + [
{dev_run_script}CTEST,
"--output-on-failure",
get_jobs_argument(args.num_jobs),
] + args.cmake_args
else:
ap.error("unknown invocation mode: %s" % (args.mode,))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment