95 Commits

Author SHA1 Message Date
774ccbc8ae Fix tests compilation in MSVC. 2026-04-04 15:54:38 +01:00
2aac1ce89c refactor: update file I/O to support large files with aaru_off_t type 2026-04-04 15:10:46 +01:00
7fb5f81f88 test: update PS3 encryption map to support 64 regions 2026-04-02 22:56:16 +01:00
e9fb0099ee build: enhance Windows test setup by copying runtime DLLs post-build 2026-04-02 22:54:38 +01:00
6e8f1a3d65 Merge pull request #34 from RomTholos/test/identify
test: add aaruf_identify and aaruf_identify_stream tests
2026-04-02 22:48:24 +01:00
95571af03c Merge pull request #33 from RomTholos/test/mode2-regression
test: add Mode 2 CD read path regression tests
2026-04-02 22:47:03 +01:00
Kevin Bortis
79b2c0dff8 test: add Mode 2 CD read path regression tests
7 tests across two files covering three upstreamed Mode 2 bug fixes:

mode2_nocrc.cpp — fix/mode2-form2-nocrc-edc regression:
- NoCrcEdcBytesAreZero: Form 2 sectors with zero EDC read back with
  bytes 2348..2351 zeroed (not uninitialized). Uses poisoned buffer
  (0xCC fill) to detect missing memset.
- ValidEdcSurvivesRoundtrip: sanity check that valid-EDC sectors are
  not treated as NoCrc.
- MixedNoCrcAndValidEdcPerSector: alternating NoCrc/Ok sectors verify
  per-sector DDT suffix status tracking.

mode2_errored.cpp — fix/mode2-errored-suffix-read and
fix/mode2-form-detection-read regressions:
- ErroredForm2SuffixRestored: wrong EDC (0xDEADBEEF) survives roundtrip
  through the 4-byte suffix buffer for Form 2 errored sectors.
- ErroredForm1SuffixRestored: full 280-byte suffix (EDC+ECC) survives
  roundtrip for Form 1 errored sectors.
- MixedErroredForm1AndForm2: alternating forms in one track, verifying
  the DDT correctly dispatches per-sector.
- DisagreeingSubheaderUsesForm2: subheader copy 1 says Form 1, copy 2
  says Form 2 — verifies OR logic picks Form 2 and all 2324 bytes of
  user data are intact (old bug corrupted bytes 2072+).

All tests use programmatic fixtures via aaruf_create/write_sector_long
with crafted 2352-byte sectors — no external data files needed.
2026-04-02 07:56:21 +02:00
Kevin Bortis
2a2db120cf test: add aaruf_identify and aaruf_identify_stream tests
15 tests covering the image identification API:

- Happy path: valid V1 and V2 images via both file path and stream
- Error handling: NULL stream, empty file, truncated header
- Format validation: wrong magic bytes, future version, legacy DIC_MAGIC
- Stream behavior: mid-position seek-to-zero before reading
- File path errors: non-existent path, non-Aaru file, NULL path

Uses existing V1/V2 .aif fixtures from tests/data/ plus crafted
in-memory headers via tmpfile() for edge cases.
2026-04-02 07:55:58 +02:00
Kevin Bortis
910680fea9 Add zstd compression roundtrip tests 2026-04-02 07:47:39 +02:00
62202a5c29 Merge pull request #32 from RomTholos/fix/verify-v1-lzma-crc
Fix v1 image verification and add aaruf_verify_image tests
2026-04-01 22:41:49 +01:00
Kevin Bortis
83433faaf7 Fix v1 image verification and add aaruf_verify_image tests
V1 images stored cmpCrc64 over the full LZMA payload including the
5-byte properties prefix, but verify.c unconditionally skipped the
prefix before computing the CRC. This caused aaruf_verify_image() to
report AARUF_ERROR_INVALID_BLOCK_CRC on every valid v1 image.

The fix makes the LZMA properties skip conditional on v2+ images:
- V1: CRC computed over full cmpLength (properties included), then byte-swapped
- V2+: CRC computed over cmpLength minus 5 (properties excluded), no byte-swap

Applies to DataBlock, DeDuplicationTable (v1), and DeDuplicationTable2.

Verified against fixtures created by Aaru 5.3 (v1) and aaruformattool (v2).

Tests added (14 total, VerifyImageFixture suite):
- Happy path: floptical/mf2hd/cdmode1 for both v1 and v2 (6 tests)
- Invalid context: NULL and garbage (2 tests)
- Corruption detection: data block v1/v2, TracksBlock (3 tests)
- Index corruption: invalid offset, bad signature (2 tests)
- Programmatic round-trip: create + write + close + verify (1 test)
2026-04-01 20:49:25 +02:00
Kevin Bortis
5e00a01e21 Add FLAC error handling regression tests
Regression tests for the error handling improvements in
fix/flac-error-handling (PR #23). The fix changed decode/encode to
return 0 instead of (size_t)-1 on failure, added NULL allocation
checks, and fixed a decoder memory leak on init failure.

Tests added (flacErrors suite):
- decode_garbage_returns_zero: random non-FLAC data
- decode_truncated_flac_returns_zero: valid magic, truncated stream
- decode_empty_input_returns_zero: NULL source buffer
- decode_zero_length_returns_zero: non-NULL but zero-length source
- encode_zero_length_no_crash: NULL source, verifies no crash/leak
- encode_garbage_roundtrip_fails_cleanly: non-PCM encode + decode
- decode_dst_too_small_returns_zero: undersized output buffer

All tests are self-contained (no fixture files needed) and pass
under AddressSanitizer.
2026-04-01 20:24:13 +02:00
85098b0b9e [spec] Fix data type typo. 2026-03-29 18:30:59 +01:00
a15cc47b84 Fix stream position calculation for junk region: adjust to use block start for seed alignment 2026-03-16 19:30:07 +00:00
58a78c795c Refactor include paths for PS3 tools: update headers to use the ps3 directory 2026-03-16 19:07:19 +00:00
7b05275c47 Add tests for Nintendo GameCube/Wii LFG PRNG and junk map serialization 2026-03-16 19:05:09 +00:00
98ec0c4add Refactor file structure: rename and reorganize PS3 and Wii U source files for better clarity and maintainability 2026-03-16 17:21:58 +00:00
a8f500fd5f Refactor AES-128 implementation: move source files to lib directory and update includes 2026-03-16 10:48:54 +00:00
eec6c33195 Add minimal ISO 9660 reader and tests for PlayStation 3 2026-03-15 21:03:40 +00:00
8bbda5bf2b Add PARAM.SFO parser for PlayStation 3 game metadata 2026-03-15 20:07:52 +00:00
04f9204a25 Add IRD file parser for PlayStation 3 disc images 2026-03-15 19:49:12 +00:00
85dc9ea1b8 Added PS3 encryption. 2026-03-15 18:32:08 +00:00
608b391c96 Added AES128. 2026-03-15 18:31:19 +00:00
d53faf7a38 Rename track type enums for consistency 2026-03-15 18:18:15 +00:00
43b226bbfa Rename sector tags. 2026-03-14 19:54:52 +00:00
77446b88f1 Update third party dependencies. 2026-01-04 16:04:10 +00:00
6a15b73cd5 Update test files. 2025-12-31 16:58:31 +00:00
9c27fa4d4b Update test data files. 2025-12-31 16:22:24 +00:00
e065d4d074 Free ECC context during cleanup to prevent memory leaks 2025-12-28 17:58:59 +00:00
484d045277 Refine ASAN_OPTIONS handling for test discovery and execution 2025-12-28 16:56:45 +00:00
480bc9f6dc Reduce buffer size for 'gtest' in image creation to prevent potential issues 2025-12-28 16:31:46 +00:00
0ac80e99b9 Update test files. 2025-12-28 16:30:59 +00:00
b6f26c9c9c Add address sanitizer optional usage. 2025-12-28 15:57:23 +00:00
57aa701363 Improve test data file copying logic for in-tree builds 2025-12-26 20:20:51 +00:00
050810c91d Update copyright year to 2026. 2025-12-23 08:23:40 +00:00
d4f83cf9e4 Update copyright year to 2026. 2025-12-23 08:15:35 +00:00
76a013cd04 Add tests for subchannel data. 2025-12-10 08:45:15 +00:00
25bad474ec Add test for negative sectors. 2025-11-22 13:50:10 +00:00
b600857b2e Add unit test for resuming images. 2025-10-21 16:42:40 +01:00
eae5514ce3 Update all calls to aaruf_open. 2025-10-21 15:36:43 +01:00
cdddd3a3fd Update test images. 2025-10-18 17:20:59 +01:00
f9565219db Replace static fake UTF-16LE hex string with direct string literal for 'gtest' 2025-10-18 16:55:28 +01:00
37b842d1c2 Add audio image creation test. 2025-10-18 16:46:04 +01:00
f6b1ac2af2 Add sector status parameter to read sector functions in tests 2025-10-11 13:29:22 +01:00
756d965e2a Refactor CMakeLists.txt for improved organization and add test data copying 2025-10-11 01:11:30 +01:00
07e00162e3 Add test for CD MODE 2 image V2. 2025-10-10 23:28:36 +01:00
7c032ec25f Add test for CD MODE 2 image V1. 2025-10-10 23:25:13 +01:00
9a94c36a43 Add test for CD MODE 1 image V2. 2025-10-10 23:04:02 +01:00
20506c2066 Add test for opening cdmode1_v1 image and verify its properties 2025-10-10 15:36:55 +01:00
30e2024622 Add test image creation with table shift of 9. 2025-10-10 11:44:55 +01:00