From c49c4d2ee3a3a7ba465ef0ae5b69b6e30b22eb98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Tue, 11 Feb 2025 19:12:49 +0100 Subject: [PATCH 1/2] fix: fix act-cache setup --- gitbug-java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gitbug-java b/gitbug-java index 7fc271d..03ae9f5 100755 --- a/gitbug-java +++ b/gitbug-java @@ -101,16 +101,14 @@ class GitBugJavaCli(object): shutil.rmtree(source) os.remove(gitbug) - def __setup_act_cache(self, name: str, download_url: str): + def __setup_act_cache(self, download_url: str): # Download the zip - zip_path = Path(get_project_root(), f"{name}.zip") + zip_path = Path(get_project_root(), "act-cache.zip") if not zip_path.exists(): self.__download(download_url, zip_path) # Extract the zip - cache_path = Path(get_project_root(), name) - cache_path.mkdir(parents=True, exist_ok=True) with zipfile.ZipFile(zip_path, "r") as zip_ref: - zip_ref.extractall(cache_path) + zip_ref.extractall(get_project_root()) os.remove(zip_path) def pids(self): @@ -211,7 +209,6 @@ class GitBugJavaCli(object): "https://zenodo.org/records/10578617/files/gitbug-java_offline_environments_2.tar.gz?download=1", ) self.__setup_act_cache( - "act-cache", "https://zenodo.org/records/10592626/files/act-cache.zip?download=1", ) From cba62a8a731da7c6b07f5bdead0fbb808a1f6a0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Thu, 13 Feb 2025 14:33:17 +0100 Subject: [PATCH 2/2] fix test --- test/test_all.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/test_all.py b/test/test_all.py index 76a62eb..b0cfd18 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -23,8 +23,8 @@ def test_help(): def run_bug(bid: str, fixed: bool, act_cache_dir: str = "./act-cache"): # Setup temporary directory - temp_dir = os.path.join(tempfile.gettempdir(), bid, str(uuid.uuid4())) - output_dir = os.path.join(temp_dir, "gitbug-java-output", str(uuid.uuid4())) + temp_dir = Path(tempfile.gettempdir(), bid, str(uuid.uuid4())) + output_dir = Path(temp_dir, ".gitbug-java") try: # Checkout the bug and check correctness @@ -38,15 +38,14 @@ def run_bug(bid: str, fixed: bool, act_cache_dir: str = "./act-cache"): return # Run the bug and check results - run = run_command( - f"gitbug-java run {temp_dir} --act_cache_dir={act_cache_dir} --output={output_dir}" - ) - if not Path(output_dir, f"{bid}.json").exists(): + run = run_command(f"gitbug-java run {temp_dir} --act_cache_dir={act_cache_dir}") + test_results_path = Path(output_dir, "test-results.json") + if not test_results_path.exists(): print(f"{bid} ({fixed}) failed to find report") print(run.stdout.decode("utf-8")) print(run.stderr.decode("utf-8")) return False - with open(os.path.join(output_dir, f"{bid}.json"), "r") as f: + with open(test_results_path, "r") as f: report = json.loads(f.read()) if fixed and run.returncode != 0: