mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-08 18:02:05 +03:00
Add option to run tests without Testpilot even when it's available
Summary: - Added a commandline flag to ignore testpilot even when it's available - Fixed an oversight that caused getdeps to return 0 even if ctest tests have failed. Reviewed By: wez Differential Revision: D23161362 fbshipit-source-id: 1ed97c481315e2b39f1128680386390930194970
This commit is contained in:
committed by
Facebook GitHub Bot
parent
dbc1028cfe
commit
1273272066
@@ -696,12 +696,14 @@ class TestCmd(ProjectCmdBase):
|
|||||||
builder = m.create_builder(
|
builder = m.create_builder(
|
||||||
loader.build_opts, src_dir, build_dir, inst_dir, ctx, loader
|
loader.build_opts, src_dir, build_dir, inst_dir, ctx, loader
|
||||||
)
|
)
|
||||||
|
|
||||||
builder.run_tests(
|
builder.run_tests(
|
||||||
install_dirs,
|
install_dirs,
|
||||||
schedule_type=args.schedule_type,
|
schedule_type=args.schedule_type,
|
||||||
owner=args.test_owner,
|
owner=args.test_owner,
|
||||||
test_filter=args.filter,
|
test_filter=args.filter,
|
||||||
retry=args.retry,
|
retry=args.retry,
|
||||||
|
no_testpilot=args.no_testpilot,
|
||||||
)
|
)
|
||||||
|
|
||||||
install_dirs.append(inst_dir)
|
install_dirs.append(inst_dir)
|
||||||
@@ -719,6 +721,11 @@ class TestCmd(ProjectCmdBase):
|
|||||||
help="Number of immediate retries for failed tests "
|
help="Number of immediate retries for failed tests "
|
||||||
"(noop in continuous and testwarden runs)",
|
"(noop in continuous and testwarden runs)",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--no-testpilot",
|
||||||
|
help="Do not use Test Pilot even when available",
|
||||||
|
action="store_true",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@cmd("generate-github-actions", "generate a GitHub actions configuration")
|
@cmd("generate-github-actions", "generate a GitHub actions configuration")
|
||||||
|
@@ -100,7 +100,9 @@ class BuilderBase(object):
|
|||||||
dep_dirs = self.get_dev_run_extra_path_dirs(install_dirs, dep_munger)
|
dep_dirs = self.get_dev_run_extra_path_dirs(install_dirs, dep_munger)
|
||||||
dep_munger.emit_dev_run_script(script_path, dep_dirs)
|
dep_munger.emit_dev_run_script(script_path, dep_dirs)
|
||||||
|
|
||||||
def run_tests(self, install_dirs, schedule_type, owner, test_filter, retry):
|
def run_tests(
|
||||||
|
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
|
||||||
|
):
|
||||||
""" Execute any tests that we know how to run. If they fail,
|
""" Execute any tests that we know how to run. If they fail,
|
||||||
raise an exception. """
|
raise an exception. """
|
||||||
pass
|
pass
|
||||||
@@ -543,7 +545,9 @@ if __name__ == "__main__":
|
|||||||
env=env,
|
env=env,
|
||||||
)
|
)
|
||||||
|
|
||||||
def run_tests(self, install_dirs, schedule_type, owner, test_filter, retry):
|
def run_tests(
|
||||||
|
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
|
||||||
|
):
|
||||||
env = self._compute_env(install_dirs)
|
env = self._compute_env(install_dirs)
|
||||||
ctest = path_search(env, "ctest")
|
ctest = path_search(env, "ctest")
|
||||||
cmake = path_search(env, "cmake")
|
cmake = path_search(env, "cmake")
|
||||||
@@ -618,7 +622,7 @@ if __name__ == "__main__":
|
|||||||
retry = 0
|
retry = 0
|
||||||
|
|
||||||
testpilot = path_search(env, "testpilot")
|
testpilot = path_search(env, "testpilot")
|
||||||
if testpilot:
|
if testpilot and not no_testpilot:
|
||||||
buck_test_info = list_tests()
|
buck_test_info = list_tests()
|
||||||
buck_test_info_name = os.path.join(self.build_dir, ".buck-test-info.json")
|
buck_test_info_name = os.path.join(self.build_dir, ".buck-test-info.json")
|
||||||
with open(buck_test_info_name, "w") as f:
|
with open(buck_test_info_name, "w") as f:
|
||||||
@@ -709,12 +713,17 @@ if __name__ == "__main__":
|
|||||||
retcode = self._run_cmd(
|
retcode = self._run_cmd(
|
||||||
args, env=env, use_cmd_prefix=use_cmd_prefix, allow_fail=True
|
args, env=env, use_cmd_prefix=use_cmd_prefix, allow_fail=True
|
||||||
)
|
)
|
||||||
|
|
||||||
if retcode == 0:
|
if retcode == 0:
|
||||||
break
|
break
|
||||||
if count == 0:
|
if count == 0:
|
||||||
# Only add this option in the second run.
|
# Only add this option in the second run.
|
||||||
args += ["--rerun-failed"]
|
args += ["--rerun-failed"]
|
||||||
count += 1
|
count += 1
|
||||||
|
if retcode != 0:
|
||||||
|
# Allow except clause in getdeps.main to catch and exit gracefully
|
||||||
|
# This allows non-testpilot runs to fail through the same logic as failed testpilot runs, which may become handy in case if post test processing is needed in the future
|
||||||
|
raise subprocess.CalledProcessError(retcode, args)
|
||||||
|
|
||||||
|
|
||||||
class NinjaBootstrap(BuilderBase):
|
class NinjaBootstrap(BuilderBase):
|
||||||
@@ -1067,7 +1076,9 @@ incremental = false
|
|||||||
)
|
)
|
||||||
self.recreate_dir(build_source_dir, os.path.join(self.inst_dir, "source"))
|
self.recreate_dir(build_source_dir, os.path.join(self.inst_dir, "source"))
|
||||||
|
|
||||||
def run_tests(self, install_dirs, schedule_type, owner, test_filter, retry):
|
def run_tests(
|
||||||
|
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
|
||||||
|
):
|
||||||
if test_filter:
|
if test_filter:
|
||||||
args = ["--", test_filter]
|
args = ["--", test_filter]
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user