From 16cf76f58a234c1e2a64382e6a9035a80c6db2e3 Mon Sep 17 00:00:00 2001 From: Martin Jambon Date: Tue, 16 Jun 2026 02:17:58 +0000 Subject: [PATCH] ppx-errors test: pass -noinit to suppress ~/.ocamlinit banner 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 --- tests/ppx-errors/dune | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/ppx-errors/dune b/tests/ppx-errors/dune index 7560f20..27c4b74 100755 --- a/tests/ppx-errors/dune +++ b/tests/ppx-errors/dune @@ -1,3 +1,8 @@ +; -noinit prevents the toplevel from reading ~/.ocamlinit. Without it, users +; whose ~/.ocamlinit contains the standard opam-generated "#use \"topfind\"" +; line would see the "Findlib has been successfully loaded..." banner printed +; to stdout, causing a diff against test.out.expected. The -noinit flag has +; been available since OCaml 4.02, so it is safe to use unconditionally here. (rule (targets test.out) (deps @@ -8,7 +13,8 @@ test.out (with-stdin-from test.ml - (run %{tt} -color never -noprompt -no-version -ppx "%{ppx} --as-ppx"))))) + (run %{tt} -color never -noprompt -no-version -noinit + -ppx "%{ppx} --as-ppx"))))) (rule (alias runtest)