From ab6a30c61c92d28da45b866086cc7969258ac666 Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Pani Date: Thu, 1 Apr 2021 02:38:44 -0700 Subject: [PATCH] OSS jobs to tpx Summary: Tpx works well for all OSS jobs, we should migrate to Tpx instead of relying testpilot. Reviewed By: marcelogomez Differential Revision: D27396539 fbshipit-source-id: dd1994be0eb3b4396764c1f3e68ddd6763b60139 --- build/fbcode_builder/getdeps/builder.py | 66 +++++++++++++++++------- build/fbcode_builder/getdeps/envfuncs.py | 4 ++ 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/build/fbcode_builder/getdeps/builder.py b/build/fbcode_builder/getdeps/builder.py index db42b1bc0..378b49065 100644 --- a/build/fbcode_builder/getdeps/builder.py +++ b/build/fbcode_builder/getdeps/builder.py @@ -668,11 +668,18 @@ if __name__ == "__main__": for test in data["tests"]: working_dir = get_property(test, "WORKING_DIRECTORY") labels = [] + machine_suffix = self.build_opts.host_type.as_tuple_string() + labels.append("tpx_test_config::buildsystem=getdeps") + labels.append("tpx_test_config::platform={}".format(machine_suffix)) + if get_property(test, "DISABLED"): labels.append("disabled") command = test["command"] if working_dir: command = [cmake, "-E", "chdir", working_dir] + command + + import os + tests.append( { "type": "custom", @@ -680,6 +687,10 @@ if __name__ == "__main__": % (self.manifest.name, test["name"], machine_suffix), "command": command, "labels": labels, + "env": {}, + "required_paths": [], + "contacts": [], + "cwd": os.getcwd(), } ) return tests @@ -689,36 +700,51 @@ if __name__ == "__main__": # better signals for flaky tests. retry = 0 + from sys import platform + testpilot = path_search(env, "testpilot") - if testpilot and not no_testpilot: + tpx = path_search(env, "tpx") + if (tpx or testpilot) and not no_testpilot: buck_test_info = list_tests() + import os + 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) env.set("http_proxy", "") env.set("https_proxy", "") - machine_suffix = self.build_opts.host_type.as_tuple_string() - runs = [] + from sys import platform - testpilot_args = [ - testpilot, - # 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.build_opts.num_jobs), - "--test-config", - "platform=%s" % machine_suffix, - "buildsystem=getdeps", - "--print-long-results", - ] + if platform == "win32": + machine_suffix = self.build_opts.host_type.as_tuple_string() + testpilot_args = [ + testpilot, + # 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.build_opts.num_jobs), + "--test-config", + "platform=%s" % machine_suffix, + "buildsystem=getdeps", + "--print-long-results", + ] + else: + testpilot_args = [ + tpx, + "--buck-test-info", + buck_test_info_name, + "--retry=%d" % retry, + "-j=%s" % str(self.build_opts.num_jobs), + "--print-long-results", + ] if owner: testpilot_args += ["--contacts", owner] diff --git a/build/fbcode_builder/getdeps/envfuncs.py b/build/fbcode_builder/getdeps/envfuncs.py index 496044b39..f2e13f16f 100644 --- a/build/fbcode_builder/getdeps/envfuncs.py +++ b/build/fbcode_builder/getdeps/envfuncs.py @@ -154,6 +154,10 @@ _path_search_cache = {} _not_found = object() +def tpx_path(): + return "xplat/testinfra/tpx/ctp.tpx" + + def path_search(env, exename, defval=None): """Search for exename in the PATH specified in env. exename is eg: `ninja` and this function knows to append a .exe