Skip to content

Commit ac2d4e7

Browse files
authored
fix: fix act-cache setup (#39)
* fix: fix act-cache setup * fix test
1 parent 5f044c8 commit ac2d4e7

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

gitbug-java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,14 @@ class GitBugJavaCli(object):
101101
shutil.rmtree(source)
102102
os.remove(gitbug)
103103

104-
def __setup_act_cache(self, name: str, download_url: str):
104+
def __setup_act_cache(self, download_url: str):
105105
# Download the zip
106-
zip_path = Path(get_project_root(), f"{name}.zip")
106+
zip_path = Path(get_project_root(), "act-cache.zip")
107107
if not zip_path.exists():
108108
self.__download(download_url, zip_path)
109109
# Extract the zip
110-
cache_path = Path(get_project_root(), name)
111-
cache_path.mkdir(parents=True, exist_ok=True)
112110
with zipfile.ZipFile(zip_path, "r") as zip_ref:
113-
zip_ref.extractall(cache_path)
111+
zip_ref.extractall(get_project_root())
114112
os.remove(zip_path)
115113

116114
def pids(self):
@@ -211,7 +209,6 @@ class GitBugJavaCli(object):
211209
"https://zenodo.org/records/10578617/files/gitbug-java_offline_environments_2.tar.gz?download=1",
212210
)
213211
self.__setup_act_cache(
214-
"act-cache",
215212
"https://zenodo.org/records/10592626/files/act-cache.zip?download=1",
216213
)
217214

test/test_all.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def test_help():
2323

2424
def run_bug(bid: str, fixed: bool, act_cache_dir: str = "./act-cache"):
2525
# Setup temporary directory
26-
temp_dir = os.path.join(tempfile.gettempdir(), bid, str(uuid.uuid4()))
27-
output_dir = os.path.join(temp_dir, "gitbug-java-output", str(uuid.uuid4()))
26+
temp_dir = Path(tempfile.gettempdir(), bid, str(uuid.uuid4()))
27+
output_dir = Path(temp_dir, ".gitbug-java")
2828

2929
try:
3030
# Checkout the bug and check correctness
@@ -38,15 +38,14 @@ def run_bug(bid: str, fixed: bool, act_cache_dir: str = "./act-cache"):
3838
return
3939

4040
# Run the bug and check results
41-
run = run_command(
42-
f"gitbug-java run {temp_dir} --act_cache_dir={act_cache_dir} --output={output_dir}"
43-
)
44-
if not Path(output_dir, f"{bid}.json").exists():
41+
run = run_command(f"gitbug-java run {temp_dir} --act_cache_dir={act_cache_dir}")
42+
test_results_path = Path(output_dir, "test-results.json")
43+
if not test_results_path.exists():
4544
print(f"{bid} ({fixed}) failed to find report")
4645
print(run.stdout.decode("utf-8"))
4746
print(run.stderr.decode("utf-8"))
4847
return False
49-
with open(os.path.join(output_dir, f"{bid}.json"), "r") as f:
48+
with open(test_results_path, "r") as f:
5049
report = json.loads(f.read())
5150

5251
if fixed and run.returncode != 0:

0 commit comments

Comments
 (0)