Commit c6e6dff1 authored by wez@fb.com's avatar wez@fb.com Committed by Facebook Github Bot

getdeps: update run_cmake.py to also support running tests

Summary: Add a `--mode=tests` behavior for invoking `ctest`

Reviewed By: simpkins

Differential Revision: D17610033

fbshipit-source-id: 6284fe1dbfb7adf38a67820c842a5531eefd72fa
parent 748c7e0c
...@@ -206,6 +206,7 @@ import subprocess ...@@ -206,6 +206,7 @@ import subprocess
import sys import sys
CMAKE = {cmake!r} CMAKE = {cmake!r}
CTEST = {ctest!r}
SRC_DIR = {src_dir!r} SRC_DIR = {src_dir!r}
BUILD_DIR = {build_dir!r} BUILD_DIR = {build_dir!r}
INSTALL_DIR = {install_dir!r} INSTALL_DIR = {install_dir!r}
...@@ -224,7 +225,7 @@ def main(): ...@@ -224,7 +225,7 @@ def main():
) )
ap.add_argument( ap.add_argument(
"--mode", "--mode",
choices=["configure", "build", "install"], choices=["configure", "build", "install", "test"],
default="configure", default="configure",
help="The mode to run: configure, build, or install. " help="The mode to run: configure, build, or install. "
"Defaults to configure", "Defaults to configure",
...@@ -243,6 +244,13 @@ def main(): ...@@ -243,6 +244,13 @@ def main():
dest="mode", dest="mode",
help="An alias for --mode=install", help="An alias for --mode=install",
) )
ap.add_argument(
"--test",
action="store_const",
const="test",
dest="mode",
help="An alias for --mode=test",
)
args = ap.parse_args() args = ap.parse_args()
# Strip off a leading "--" from the additional CMake arguments # Strip off a leading "--" from the additional CMake arguments
...@@ -264,6 +272,8 @@ def main(): ...@@ -264,6 +272,8 @@ def main():
"--config", "--config",
"Release", "Release",
] + args.cmake_args ] + args.cmake_args
elif args.mode == "test":
full_cmd = CMD_PREFIX + [CTEST] + args.cmake_args
else: else:
ap.error("unknown invocation mode: %s" % (args.mode,)) ap.error("unknown invocation mode: %s" % (args.mode,))
...@@ -396,6 +406,7 @@ if __name__ == "__main__": ...@@ -396,6 +406,7 @@ if __name__ == "__main__":
self._write_build_script( self._write_build_script(
cmd_prefix=self._get_cmd_prefix(), cmd_prefix=self._get_cmd_prefix(),
cmake=cmake, cmake=cmake,
ctest=path_search(env, "ctest"),
env=env, env=env,
define_args=define_args, define_args=define_args,
src_dir=self.src_dir, src_dir=self.src_dir,
......
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