Skip to content

Run the engine's offline test suite on Windows#25

Closed
xroche wants to merge 8 commits into
masterfrom
test/engine-suite-tier1
Closed

Run the engine's offline test suite on Windows#25
xroche wants to merge 8 commits into
masterfrom
test/engine-suite-tier1

Conversation

@xroche

@xroche xroche commented Jul 13, 2026

Copy link
Copy Markdown
Owner

The engine ships ~90 tests and not one has ever run on Windows — they only run under make check on Linux and macOS. This is Tier 1: the 50 offline ones (no network, no server), driven from PATH against the httrack.exe we now ship. They are the engine's tests, but ours is the binary that reaches users, and this code has never been executed on this platform.

Two things worth calling out. core.autocrlf is pinned off, because the scripts are #!/bin/bash and the engine has no .gitattributes — a converting checkout rewrites them and bash dies on $'\r'. And the step asserts tests actually ran, not merely that none failed: every gate in these scripts exits 77 (no python3, no HTTPS, no codec), so a suite that quietly degrades to "everything skipped" would otherwise report success having tested nothing.

Expect this to go red first. Any failure here is either a real Windows bug in code that has never run on Windows, or a POSIX assumption in a test — both are worth knowing. Tier 2 (the local Python HTTPS server crawls, ~40 more) follows once this is stable.

xroche and others added 8 commits July 13, 2026 19:18
The engine ships ~90 tests and not one has ever run on Windows: they only run under
`make check` on Linux and macOS. Start with the 50 offline ones -- no network, no
server, just httrack.exe driven from PATH. They are the engine's tests, but ours is
the binary that ships, and this code has never executed on this platform.

Pin core.autocrlf: the scripts are #!/bin/bash and the engine has no .gitattributes,
so a converting checkout would rewrite them and bash would die on $'\r'.

Assert tests actually ran, rather than that none failed. Every gate in these scripts
exits 77 -- no python3, no HTTPS, no codec -- so a suite that quietly degrades to
"everything skipped" would otherwise report success having tested nothing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A 25-line tail cannot tell a real Windows bug from a POSIX assumption in the test,
and 16 of the 50 fail.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
httrack.exe is a native binary, so MSYS rewrites any argument shaped like a POSIX
path -- and a URL path is shaped exactly like one. '-#test=mime /a/b.html' reached
the engine as 'C:/Program Files/Git/a/b.html', and four tests failed silently on it.

Switch the rewriting off and give the tests a temp dir that is already a Windows
path, so nothing needs translating in either direction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A shell heredoc expanded the backticks in the previous commit and substituted the
example away, leaving "# into ." Same code, readable reason.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
They pipe stderr to /dev/null and print one word, so a Windows failure reads "FAIL"
and nothing more. The engine side needs the assertion, not the verdict.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both sides added a step at the same point and neither replaces the other: the
version-metadata check from master, then the engine test suite. Tests run on the
staged binaries, before signing rewrites them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Several of these assert with `test "$(httrack ...)" == "..." || exit 1`, which prints
nothing at all when it fails. Re-run the test under a trace and keep it, so the log
holds the call that failed and what it actually printed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
It prints nothing and the test only sees an empty string, which is what a process
that died silently looks like. The self-test drives the matcher deep on purpose and
Windows gives a thread 1MB of stack where Linux gives 8MB.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xroche

xroche commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

Closing: the engine adopted this, which is where it belongs.

xroche/httrack now runs the offline suite in its own Windows CI on every push and every PR (#577) — same loop, MSYS_NO_PATHCONV, the "a skip is not a pass" floor, log upload — and it shipped the .gitattributes that made the core.autocrlf pin here necessary. Running the same 54 tests again in this repo would add ~10 minutes per build for no new signal: we already build the engine, CRT-check it, and run the installed httrack.exe -#h.

What the exercise turned up, all now fixed upstream:

Plus the two test-portability issues (ftp-line's missing Windows skip, filelist's reliance on chmod 000).

The GUI has the same ANSI/UTF-8 mismatch by a different door — it builds its own argv and calls hts_main2() directly, bypassing the engine's fix entirely. That is #28.

Tier 2 (the local Python HTTPS crawl suite, ~40 tests) is still unrun on Windows, and now belongs in the engine repo too.

@xroche xroche closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant