1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-07 07:02:53 +03:00

test: create a testinfra run and pass it to tpx/testpilot

Reviewed By: danalex97

Differential Revision: D37196281

fbshipit-source-id: e23c2122711594f8baaa2999853351a3fcf6d559
This commit is contained in:
Xavier Deguillard
2022-06-16 12:24:36 -07:00
committed by Facebook GitHub Bot
parent 6c039a848e
commit 5f9415de2b

View File

@@ -822,6 +822,8 @@ if __name__ == "__main__":
buck_test_info = list_tests()
import os
from .facebook.testinfra import start_run
buck_test_info_name = os.path.join(self.build_dir, ".buck-test-info.json")
with open(buck_test_info_name, "w") as f:
json.dump(buck_test_info, f)
@@ -831,92 +833,95 @@ if __name__ == "__main__":
runs = []
from sys import platform
if platform == "win32":
machine_suffix = self.build_opts.host_type.as_tuple_string()
testpilot_args = [
"parexec-testinfra.exe",
"C:/tools/testpilot/sc_testpilot.par",
# Need to force the repo type otherwise testpilot on windows
# can be confused (presumably sparse profile related)
"--force-repo",
"fbcode",
"--force-repo-root",
self.build_opts.fbsource_dir,
"--buck-test-info",
buck_test_info_name,
"--retry=%d" % retry,
"-j=%s" % str(self.num_jobs),
"--test-config",
"platform=%s" % machine_suffix,
"buildsystem=getdeps",
"--return-nonzero-on-failures",
]
else:
testpilot_args = [
tpx,
"--force-local-execution",
"--buck-test-info",
buck_test_info_name,
"--retry=%d" % retry,
"-j=%s" % str(self.num_jobs),
"--print-long-results",
]
if owner:
testpilot_args += ["--contacts", owner]
if tpx and env:
testpilot_args.append("--env")
testpilot_args.extend(f"{key}={val}" for key, val in env.items())
if test_filter:
testpilot_args += ["--", test_filter]
if schedule_type == "continuous":
runs.append(
[
"--tag-new-tests",
"--collection",
"oss-continuous",
"--purpose",
"continuous",
with start_run(env["FBSOURCE_HASH"]) as run_id:
if platform == "win32":
machine_suffix = self.build_opts.host_type.as_tuple_string()
testpilot_args = [
"parexec-testinfra.exe",
"C:/tools/testpilot/sc_testpilot.par",
# Need to force the repo type otherwise testpilot on windows
# can be confused (presumably sparse profile related)
"--force-repo",
"fbcode",
"--force-repo-root",
self.build_opts.fbsource_dir,
"--buck-test-info",
buck_test_info_name,
"--retry=%d" % retry,
"-j=%s" % str(self.num_jobs),
"--test-config",
"platform=%s" % machine_suffix,
"buildsystem=getdeps",
"--return-nonzero-on-failures",
]
)
elif schedule_type == "testwarden":
# One run to assess new tests
runs.append(
[
"--tag-new-tests",
"--collection",
"oss-new-test-stress",
"--stress-runs",
"10",
"--purpose",
"stress-run-new-test",
else:
testpilot_args = [
tpx,
"--force-local-execution",
"--buck-test-info",
buck_test_info_name,
"--retry=%d" % retry,
"-j=%s" % str(self.num_jobs),
"--print-long-results",
]
)
# And another for existing tests
runs.append(
[
"--tag-new-tests",
"--collection",
"oss-existing-test-stress",
"--stress-runs",
"10",
"--purpose",
"stress-run",
]
)
else:
runs.append(["--collection", "oss-diff", "--purpose", "diff"])
for run in runs:
self._run_cmd(
testpilot_args + run,
cwd=self.build_opts.fbcode_builder_dir,
env=env,
use_cmd_prefix=use_cmd_prefix,
)
if owner:
testpilot_args += ["--contacts", owner]
if tpx and env:
testpilot_args.append("--env")
testpilot_args.extend(f"{key}={val}" for key, val in env.items())
testpilot_args += ["--run-id", str(run_id)]
if test_filter:
testpilot_args += ["--", test_filter]
if schedule_type == "continuous":
runs.append(
[
"--tag-new-tests",
"--collection",
"oss-continuous",
"--purpose",
"continuous",
]
)
elif schedule_type == "testwarden":
# One run to assess new tests
runs.append(
[
"--tag-new-tests",
"--collection",
"oss-new-test-stress",
"--stress-runs",
"10",
"--purpose",
"stress-run-new-test",
]
)
# And another for existing tests
runs.append(
[
"--tag-new-tests",
"--collection",
"oss-existing-test-stress",
"--stress-runs",
"10",
"--purpose",
"stress-run",
]
)
else:
runs.append(["--collection", "oss-diff", "--purpose", "diff"])
for run in runs:
self._run_cmd(
testpilot_args + run,
cwd=self.build_opts.fbcode_builder_dir,
env=env,
use_cmd_prefix=use_cmd_prefix,
)
else:
args = [
require_command(ctest, "ctest"),