Skip to content

Commit c1df771

Browse files
Niles Rogofffacebook-github-bot
authored andcommitted
Retry bistro tests up to 5 times
Differential Revision: D25985696 fbshipit-source-id: 52ede8dc494f8bf1991dbfed455fbc6bbba83d87
1 parent 444748f commit c1df771

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

build/fbcode_builder/getdeps/builder.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,23 @@ def run_tests(
294294
):
295295
env = self._compute_env(install_dirs)
296296
build_dir = os.path.join(self.src_dir, "bistro", "bistro", "cmake", "Release")
297-
self._run_cmd(
298-
["ctest", build_dir],
299-
cwd=build_dir,
300-
env=env,
301-
)
297+
NUM_RETRIES = 5
298+
for i in range(NUM_RETRIES):
299+
cmd = ["ctest", "--output-on-failure"]
300+
if i > 0:
301+
cmd.append("--rerun-failed")
302+
cmd.append(build_dir)
303+
try:
304+
self._run_cmd(
305+
cmd,
306+
cwd=build_dir,
307+
env=env,
308+
)
309+
except Exception:
310+
print(f"Tests failed... retrying ({i+1}/{NUM_RETRIES})")
311+
else:
312+
return
313+
raise Exception(f"Tests failed even after {NUM_RETRIES} retries")
302314

303315

304316
class CMakeBuilder(BuilderBase):

0 commit comments

Comments
 (0)