Skip to content

Commit 723a31d

Browse files
committed
tests: add CLI integration tests, smoke wrappers, and CI
1 parent 575bf24 commit 723a31d

6 files changed

Lines changed: 746 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
unit-tests:
11+
name: Unit Tests (Python ${{ matrix.python-version }}, ${{ matrix.os }})
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
python-version: ["3.11", "3.12", "3.13"]
18+
steps:
19+
- uses: actions/checkout@v6
20+
with:
21+
submodules: true
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v6
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
cache: 'pip'
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -e "./amitools[vamos]"
33+
pip install "pytest>=7.0" "pytest-cov>=4.0" "pytest-timeout>=2.0"
34+
pip install -e "." --no-deps
35+
36+
- name: Verify machine68k
37+
run: |
38+
python -c "import machine68k; print(f'machine68k {machine68k.__version__}')"
39+
python -c "import machine68k; machine68k.CPU(1); print('CPU OK')"
40+
continue-on-error: true
41+
42+
- name: Run unit tests
43+
run: pytest tests/unit/ -v --timeout=30
44+
45+
integration-tests:
46+
name: Integration Tests (${{ matrix.os }})
47+
runs-on: ${{ matrix.os }}
48+
needs: unit-tests
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
# Windows excluded: machine68k segfaults due to opcode table
53+
# over-read (cnvogelg/machine68k#8) and JMP/CAS collision (#9).
54+
# Re-enable once upstream merges those fixes.
55+
os: [ubuntu-latest, macos-latest]
56+
steps:
57+
- uses: actions/checkout@v6
58+
with:
59+
submodules: true
60+
61+
- name: Set up Python 3.13
62+
uses: actions/setup-python@v6
63+
with:
64+
python-version: "3.13"
65+
cache: 'pip'
66+
67+
- name: Install dependencies
68+
run: |
69+
python -m pip install --upgrade pip
70+
pip install -e "./amitools[vamos]"
71+
pip install "pytest>=7.0" "pytest-cov>=4.0" "pytest-timeout>=2.0"
72+
pip install -e "." --no-deps
73+
74+
- name: Run integration tests
75+
run: pytest tests/integration/ -v -m "integration and not smoke" --timeout=60

TESTING.md

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ python3 tools/amifuse_matrix.py \
271271

272272
Then compare the results with:
273273

274-
[PERFORMANCE.md](/Users/stepan/git/AmiFuse-codex/PERFORMANCE.md)
274+
[PERFORMANCE.md](PERFORMANCE.md)
275275

276276
Important interpretation rules:
277277

@@ -293,7 +293,7 @@ the matrix is the main current performance harness.
293293

294294
The `amitools` submodule has its own test tree and README:
295295

296-
[amitools/test/README.md](/Users/stepan/git/AmiFuse-codex/amitools/test/README.md)
296+
[amitools/test/README.md](amitools/test/README.md)
297297

298298
The important buckets there are:
299299

@@ -341,6 +341,81 @@ In practice:
341341
- `readme smoke` catches CLI and docs drift
342342
- `amitools` tests catch lower-level runtime semantics
343343

344+
## Pytest Test Suite
345+
346+
The repo has a structured pytest suite under `tests/` that runs without
347+
external fixtures or a live FUSE mount.
348+
349+
### Quick Start
350+
351+
```sh
352+
# all pytest tests (unit + integration, excludes smoke)
353+
pytest tests/ -v --timeout=60
354+
355+
# unit tests only
356+
pytest tests/unit/ -v --timeout=30
357+
358+
# integration tests only (no smoke)
359+
pytest tests/integration/ -v -m "integration and not smoke" --timeout=60
360+
```
361+
362+
### Test Architecture
363+
364+
Tests are organized into four layers:
365+
366+
| Layer | Directory | What It Covers |
367+
|-------|-----------|----------------|
368+
| **Unit** | `tests/unit/` | Pure logic, mocked dependencies, no I/O |
369+
| **Integration** | `tests/integration/` | Cross-module with committed test fixtures |
370+
| **Smoke** | `tests/integration/` (marker) | Wrappers for `tools/` scripts, external fixtures |
371+
| **Legacy** | `tools/*.py` | Original matrix, readme, and format smoke scripts |
372+
373+
Unit and integration tests use committed fixtures under `tests/fixtures/`
374+
and can run anywhere (local, CI, fresh clone). Smoke tests require the
375+
external fixture tree at `~/AmigaOS/AmiFuse/` and are skipped when those
376+
paths are absent.
377+
378+
### Committed Test Fixtures
379+
380+
The `tests/fixtures/` directory contains small images and handler
381+
binaries checked into the repo:
382+
383+
| Path | Description |
384+
|------|-------------|
385+
| `fixtures/images/blank.adf` | Empty ADF floppy image |
386+
| `fixtures/images/test_ofs.adf` | OFS floppy with known directory tree |
387+
| `fixtures/images/test_ffs.adf` | FFS floppy with known directory tree |
388+
| `fixtures/images/pfs3_test.hdf` | PFS3 hard-drive image with test data |
389+
| `fixtures/images/pfs3_8mb.hdf` | 8 MB PFS3 image for write tests |
390+
| `fixtures/handlers/pfs3aio` | PFS3 handler binary |
391+
| `fixtures/icons/` | Reserved for `.info` icon fixtures (currently empty; icon-parser tests use synthetic data) |
392+
| `fixtures/generate_adf.py` | Script to regenerate ADF fixtures |
393+
394+
These fixtures are generated once and committed so CI does not need
395+
Amiga toolchains or large external downloads.
396+
397+
### Markers
398+
399+
| Marker | Description |
400+
|--------|-------------|
401+
| `integration` | Integration tests requiring real fixtures and machine68k |
402+
| `smoke` | Smoke test wrappers for `tools/` scripts (requires external fixtures) |
403+
| `slow` | Long-running tests |
404+
| `fuse` | Requires FUSE/WinFSP kernel driver |
405+
| `windows` | Windows-specific tests |
406+
| `macos` | macOS-specific tests |
407+
| `linux` | Linux-specific tests |
408+
409+
### CI
410+
411+
GitHub Actions runs on every push to `main` and on pull requests:
412+
413+
- **Unit tests:** 3 OS (Ubuntu, macOS, Windows) x 3 Python (3.11, 3.12, 3.13) = 9 jobs
414+
- **Integration tests:** 3 OS x Python 3.13 = 3 jobs, depends on unit-tests
415+
- **Smoke tests:** not in CI (require external fixtures)
416+
417+
Workflow file: `.github/workflows/ci.yml`
418+
344419
## Current Gaps
345420

346421
The following are still planned, not fully documented as standalone test
@@ -349,4 +424,6 @@ entry points yet:
349424
- far-end file I/O coverage inside a filesystem that spans a partition
350425
larger than `4GiB`
351426
- fuller long-run generated benchmark recipes
352-
- fixture-layout cleanup for `~/AmigaOS/AmiFuse/`
427+
- ~~fixture-layout cleanup for `~/AmigaOS/AmiFuse/`~~ (committed test
428+
fixtures now live in `tests/fixtures/`; external fixtures still used
429+
by smoke tests)

0 commit comments

Comments
 (0)