mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-10 05:22:59 +03:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c79e5e51a9
commit
0511f0c4dd
@@ -244,6 +244,17 @@ CMAKE_ENV = {env_str}
|
|||||||
CMAKE_DEFINE_ARGS = {define_args_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():
|
def main():
|
||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
ap.add_argument(
|
ap.add_argument(
|
||||||
@@ -266,6 +277,14 @@ def main():
|
|||||||
dest="mode",
|
dest="mode",
|
||||||
help="An alias for --mode=build",
|
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(
|
ap.add_argument(
|
||||||
"--install",
|
"--install",
|
||||||
action="store_const",
|
action="store_const",
|
||||||
@@ -300,9 +319,14 @@ def main():
|
|||||||
target,
|
target,
|
||||||
"--config",
|
"--config",
|
||||||
"Release",
|
"Release",
|
||||||
|
get_jobs_argument(args.num_jobs),
|
||||||
] + args.cmake_args
|
] + args.cmake_args
|
||||||
elif args.mode == "test":
|
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:
|
else:
|
||||||
ap.error("unknown invocation mode: %s" % (args.mode,))
|
ap.error("unknown invocation mode: %s" % (args.mode,))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user