Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions gitbug-java
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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",
)

Expand Down
13 changes: 6 additions & 7 deletions test/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down