Skip to content

Commit

Permalink
Ignore and report corrupt arcs in parsing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Brachi committed Jul 26, 2024
1 parent 17fa458 commit 3107ebc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/mtfw/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,26 @@ def _files_per_arc(file_extension, arc_paths, app_id):
from albam.engines.mtfw.archive import ArcWrapper
final = []
ids = []
failed_arcs = []
for arc_path in arc_paths:
arc_name = os.path.basename(arc_path)
try:
arc = ArcWrapper(arc_path)
except OSError as err: # TODO: skip/xfail
if err.errno == 24:
raise RuntimeError("Exceeded open file limits. Try running `ulimit -S -n 4096`")
except Exception:
failed_arcs.append(arc_path)
continue

file_entries = arc.get_file_entries_by_extension(file_extension)
if not file_entries:
del arc
continue
for fe in file_entries:
final.append((arc, fe, app_id))
ids.append("::".join((arc_name, f"{fe.file_path}.{file_extension}")))
if failed_arcs:
print(f"failed to load the following arc files: {failed_arcs}")

return final, ids

0 comments on commit 3107ebc

Please sign in to comment.