fix: have benchmark test clean working directory

Before checking out different commits, clean the working directory to
avoid checkout failures to to temporary files created during benchmark
execution (as is done by linux-loader)

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
This commit is contained in:
Patrick Roy
2024-10-17 10:15:50 +01:00
committed by ShadowCurse
parent 209c04eb5e
commit 212241789d

View File

@@ -101,14 +101,21 @@ def _run_critcmp():
print(p.stderr.decode("utf-8")) print(p.stderr.decode("utf-8"))
def _clean_workdir():
subprocess.run("git restore .", shell=True, check=True)
subprocess.run("git clean -fd", shell=True, check=True)
def _git_checkout_upstream_branch(): def _git_checkout_upstream_branch():
subprocess.run( subprocess.run(
"git fetch {} {}".format(REMOTE, BASE_BRANCH), shell=True, check=True "git fetch {} {}".format(REMOTE, BASE_BRANCH), shell=True, check=True
) )
_clean_workdir()
subprocess.run("git checkout FETCH_HEAD", shell=True, check=True) subprocess.run("git checkout FETCH_HEAD", shell=True, check=True)
def _git_checkout_pr_branch(): def _git_checkout_pr_branch():
_clean_workdir()
subprocess.run( subprocess.run(
"git checkout -", "git checkout -",
shell=True, shell=True,