Skip to content

ppx-errors test: avoid output variability due to user's .ocamlinit - #51

Merged
nojb merged 1 commit into
LexiFi:masterfrom
mjambon:noinit
Jun 16, 2026
Merged

ppx-errors test: avoid output variability due to user's .ocamlinit#51
nojb merged 1 commit into
LexiFi:masterfrom
mjambon:noinit

Conversation

@mjambon

@mjambon mjambon commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

I was getting spurious output from #topfind;; in this test involving the toplevel, causing a test failure in some environments. The solution is to disable the loading of the user's .ocamlinit which is generally a good idea for test reproducibility.

This change is also part of the more complex #47 (https://github.com/LexiFi/landmarks/pull/47/changes#diff-5c5c8d61086236b6ab5bc885c7ff38168f88423d03d55b4257e4c42364488ae2)

When opam is installed the standard way, opam init creates ~/.ocamlinit
containing '#use "topfind"'. When the custom toplevel (tt.exe) starts via
Topmain.main(), it reads that file, which dynamically loads findlib_top.cma
and calls Topfind.announce(), printing "Findlib has been successfully
loaded..." to stdout and breaking the diff against test.out.expected.

Fix: pass -noinit so the toplevel skips all init files. The flag has been
available since OCaml 4.02 and the test is only enabled for >= 4.08, so
there is no compatibility concern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@nojb nojb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nojb
nojb merged commit ff20bae into LexiFi:master Jun 16, 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.

2 participants