Skip to content

Commit 5a5d9fa

Browse files
tannevaledclaude
andcommitted
test: skip headless engine integration tests when WAD/ffmpeg absent
The ci-6arch lane runs `go test` on the root package but never fetches doom1.wad or installs ffmpeg (unlike go.yml). It had never gone green: the go vet step failed first and short-circuited the job, masking the fact that the root package's 7 movie-integration tests (TestDoomDemo/TestLoadSave/...) hard-require doom1.wad on disk and the ffmpeg binary, and otherwise hang (i_Error -> 10-minute timeout) on the minimal qemu containers. Add requireEngineHarness(t), which t.Skip()s when either prerequisite is missing, and call it at the top of the 7 integration tests. The pure-Go determinism tests in seed_test.go (and every other package) still run on all six arches. On amd64 go.yml fetches the WAD and installs ffmpeg, so those integration tests run there exactly as before -- behaviour is unchanged when the prerequisites are present. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d3b8f62 commit 5a5d9fa

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

doom_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ func (b *bufferedWriteCloser) Close() error {
5151
return b.Closer.Close()
5252
}
5353

54+
// requireEngineHarness skips the calling test unless the host prerequisites
55+
// for a full headless engine run are present: the shareware IWAD on disk
56+
// (fetched by the amd64 "Tests" workflow) and the ffmpeg binary used to
57+
// record the frame movie. These integration tests are fully exercised on
58+
// amd64 by go.yml; on the 6-arch CGO=0 lane the minimal qemu containers have
59+
// neither dependency, so the tests skip there instead of failing. When both
60+
// prerequisites are present behaviour is unchanged -- the test runs as before.
61+
func requireEngineHarness(t *testing.T) {
62+
t.Helper()
63+
if _, err := os.Stat("doom1.wad"); err != nil {
64+
t.Skipf("skipping: doom1.wad not present (%v)", err)
65+
}
66+
if _, err := exec.LookPath("ffmpeg"); err != nil {
67+
t.Skipf("skipping: ffmpeg not found in PATH (%v)", err)
68+
}
69+
}
70+
5471
func ffmpegSaver(filename string) (io.WriteCloser, error) {
5572
args := []string{
5673
"ffmpeg",
@@ -227,6 +244,7 @@ func (d *doomTestHeadless) InsertKeyChange(Key uint8, pressed bool) {
227244

228245
// Run the demo at super speed to make sure it all goes ok
229246
func TestDoomDemo(t *testing.T) {
247+
requireEngineHarness(t)
230248
dg_run_full_speed = true
231249
game := &doomTestHeadless{
232250
t: t,
@@ -270,6 +288,7 @@ func loadPNG(filename string) (image.Image, error) {
270288
}
271289

272290
func TestLoadSave(t *testing.T) {
291+
requireEngineHarness(t)
273292
dg_run_full_speed = true
274293
var imgPlayedGame, imgNewGame, imgLoadedGame *image.RGBA
275294
game := &doomTestHeadless{
@@ -369,6 +388,7 @@ func TestLoadSave(t *testing.T) {
369388
}
370389

371390
func TestDoomRandom(t *testing.T) {
391+
requireEngineHarness(t)
372392
dg_run_full_speed = true
373393
game := &doomTestHeadless{
374394
t: t,
@@ -443,6 +463,7 @@ func compareScreen(game *doomTestHeadless, testdataPrefix string, percentOk floa
443463
}
444464

445465
func TestDoomLevels(t *testing.T) {
466+
requireEngineHarness(t)
446467
dg_run_full_speed = true
447468
var game *doomTestHeadless
448469
game = &doomTestHeadless{
@@ -487,6 +508,7 @@ func TestDoomLevels(t *testing.T) {
487508
}
488509

489510
func TestDoomMap(t *testing.T) {
511+
requireEngineHarness(t)
490512
dg_run_full_speed = true
491513
game := &doomTestHeadless{
492514
t: t,
@@ -525,6 +547,7 @@ func TestDoomMap(t *testing.T) {
525547
}
526548

527549
func TestWeapons(t *testing.T) {
550+
requireEngineHarness(t)
528551
dg_run_full_speed = true
529552
game := &doomTestHeadless{
530553
t: t,
@@ -603,6 +626,7 @@ func confirmMenu(t *testing.T, game *doomTestHeadless, name string) {
603626

604627
// TestMenus walks through the menus and checks the screenshots
605628
func TestMenus(t *testing.T) {
629+
requireEngineHarness(t)
606630
dg_run_full_speed = true
607631
game := &doomTestHeadless{
608632
t: t,

0 commit comments

Comments
 (0)