1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-08 18:02:05 +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() buck_test_info = list_tests()
import os import os
from .facebook.testinfra import start_run
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:
json.dump(buck_test_info, f) json.dump(buck_test_info, f)
@@ -831,92 +833,95 @@ if __name__ == "__main__":
runs = [] runs = []
from sys import platform from sys import platform
if platform == "win32": with start_run(env["FBSOURCE_HASH"]) as run_id:
machine_suffix = self.build_opts.host_type.as_tuple_string() if platform == "win32":
testpilot_args = [ machine_suffix = self.build_opts.host_type.as_tuple_string()
"parexec-testinfra.exe", testpilot_args = [
"C:/tools/testpilot/sc_testpilot.par", "parexec-testinfra.exe",
# Need to force the repo type otherwise testpilot on windows "C:/tools/testpilot/sc_testpilot.par",
# can be confused (presumably sparse profile related) # Need to force the repo type otherwise testpilot on windows
"--force-repo", # can be confused (presumably sparse profile related)
"fbcode", "--force-repo",
"--force-repo-root", "fbcode",
self.build_opts.fbsource_dir, "--force-repo-root",
"--buck-test-info", self.build_opts.fbsource_dir,
buck_test_info_name, "--buck-test-info",
"--retry=%d" % retry, buck_test_info_name,
"-j=%s" % str(self.num_jobs), "--retry=%d" % retry,
"--test-config", "-j=%s" % str(self.num_jobs),
"platform=%s" % machine_suffix, "--test-config",
"buildsystem=getdeps", "platform=%s" % machine_suffix,
"--return-nonzero-on-failures", "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",
] ]
) else:
elif schedule_type == "testwarden": testpilot_args = [
# One run to assess new tests tpx,
runs.append( "--force-local-execution",
[ "--buck-test-info",
"--tag-new-tests", buck_test_info_name,
"--collection", "--retry=%d" % retry,
"oss-new-test-stress", "-j=%s" % str(self.num_jobs),
"--stress-runs", "--print-long-results",
"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: if owner:
self._run_cmd( testpilot_args += ["--contacts", owner]
testpilot_args + run,
cwd=self.build_opts.fbcode_builder_dir, if tpx and env:
env=env, testpilot_args.append("--env")
use_cmd_prefix=use_cmd_prefix, 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: else:
args = [ args = [
require_command(ctest, "ctest"), require_command(ctest, "ctest"),