Haddock test suite failure -- can anyone guide me?

Zubin Duggal zubin at well-typed.com
Fri May 31 10:07:55 UTC 2024


If my reading of the diffs is correct (which I'm not sure it is), then
it seems some identifiers in the hyperlinked source are missing type
information.

Looking at one of the changes

Diff for file "src/Classes.html":
1194c1194,1198
<       ><span class="hs-identifier hs-type"
---
>       ><span class="annottext"
> 	>a -> b -> a
> forall a b. a -> b -> a
> </span
> 	><span class="hs-identifier hs-var"
1281c1285,1289
<       ><span class="hs-identifier hs-type"
---
>       ><span class="annottext"
> 	>a -> b -> a
> forall a b. a -> b -> a
> </span
> 	><span class="hs-identifier hs-var"


It seems like at certain identifiers, the types a -> b -> a
and forall a b. a -> b -> a is now not being emitted in a place that
they previously were.

The html files are munged quite a bit to normalise spurious differences,
but unfortunately this means that they don't render in a browser so well.

If you have two builds of haddock (one prior to your patch, possibly
even the one from your boot ghc bindist), you can run 

haddock-clean --html --hyperlinked-source utils/haddock/hypsrc-test/src/Classes.hs
haddock-your-tree --html --hyperlinked-source utils/haddock/hypsrc-test/src/Classes.hs

and then inspect/compare the rendered hyperlinked source file it
produces (for the above command it would be in `src/Classes.html`) with
your web browser.

In the case of `Classes.hs`, it seems like perhaps some annotations on
some of the `($)` operators in the following snippet are missing, and
you can find out exactly which one by hovering over each of the `$`
symbols and comparing with the output from a clean/unpatched haddock
build.

instance Plugh Either where
     plugh (Left a) _ = Right $ const a
     plugh (Right a) _ = Right $ const a
     plugh _ (Left b) = Left $ const b
     plugh _ (Right b) = Left $ const b

These annotations are produced by walking the typechecked AST and asking
for the types of each `Id` or `HsVar` etc. nodes, so anything your
patched changed regarding how the AST is constructed could be to blame.

On 24/05/31 10:41, Simon Peyton Jones wrote:
>THanks.  But the trouble is that I don't know whether to accept the change
>or not. Is it OK?  How could I tell?
>
>The point of a test is to fail when one has introduced a bug.  This fails
>-- have I introduced a bug?
>
>Thanks
>
>S
>
>On Fri, 31 May 2024 at 08:58, Zubin Duggal <zubin at well-typed.com> wrote:
>
>> You run this locally exactly the same as any other test, using
>>
>> hadrian/build test --only=haddockHypsrcTest
>>
>> or
>>
>> TEST="haddockHypsrcTest" hadrian/build test
>>
>> I recommend accepting the changes by passing the `-a` option to hadrian,
>> and then looking over the changes locally using `git diff`.
>>
>> The diffs reported by the test case itself can be confusing and I think
>> (not sure) that they are in reversed order to what you would normally
>> expect.
>>
>> On 24/05/31 08:48, Simon Peyton Jones wrote:
>> >Dear Haddock experts
>> >
>> >I'm getting a failure on !12492
>> ><https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12492> that I can't
>> >understand or debug.  Can someone guide me?
>> >
>> >Failure is this:
>> >/builds/ghc/ghc/tmp/ghctest-2jo7oz8x/test
>> >spaces/testsuite/tests/haddock/haddock_testsuite/haddockHypsrcTest.run
>> >haddockHypsrcTest [bad exit code (2)] (normal)
>> >
>> >A snip of the log is at the end of this message.
>> >
>> >I want to
>> >
>> >   - understand what it does
>> >   - repro it locally.
>> >
>> >Trying the latter, I tried with my HEAD build and did
>> >bash$ cd testsuite/tests/haddock/haddock_testsuite
>> >bash$ make hypsrcTest
>> >
>> >but that failed on almost all the tests it does, even though HEAD is
>> >presumably OK.
>> >
>> >I'm  stumped.  Any ideas?  The patch only changes the type checker!
>> >
>> >Thanks
>> >
>> >SImion
>> >
>> >This is the log from !12492
>> >
>> >Wrong exit code for haddockHypsrcTest()(expected 0 , actual 2 )
>> >Stdout ( haddockHypsrcTest ):
>> >[1 of 7] Compiling Test.Haddock.Process (
>>
>> >/builds/ghc/ghc/testsuite/../utils/haddock/haddock-test/src/Test/Haddock/Process.hs,
>> >Test/Haddock/Process.o )
>> >[2 of 7] Compiling Test.Haddock.Utils (
>>
>> >/builds/ghc/ghc/testsuite/../utils/haddock/haddock-test/src/Test/Haddock/Utils.hs,
>> >Test/Haddock/Utils.o )
>> >[3 of 7] Compiling Test.Haddock.Config (
>>
>> >/builds/ghc/ghc/testsuite/../utils/haddock/haddock-test/src/Test/Haddock/Config.hs,
>> >Test/Haddock/Config.o )
>> >[4 of 7] Compiling Test.Haddock (
>>
>> >/builds/ghc/ghc/testsuite/../utils/haddock/haddock-test/src/Test/Haddock.hs,
>> >Test/Haddock.o )
>> >[5 of 7] Compiling Test.Haddock.Xhtml (
>>
>> >/builds/ghc/ghc/testsuite/../utils/haddock/haddock-test/src/Test/Haddock/Xhtml.hs,
>> >Test/Haddock/Xhtml.o )
>> >[6 of 7] Compiling Main (
>> >/builds/ghc/ghc/testsuite/../utils/haddock/hypsrc-test/Main.hs, Main.o )
>> >[7 of 7] Linking hypsrc-test
>> >Haddock version 2.30.0, (c) Simon Marlow 2006
>> >Ported to use the GHC API by David Waern 2006-2008
>> >9.11.20240530
>> >Generating documentation...
>> >Testing output files...
>> >Checking "src/TemplateHaskellSplices.html"... PASS
>> >Checking "src/Bug1091.html"... PASS
>> >Checking "src/Polymorphism.html"... PASS
>> >Checking "src/UsingQuasiquotes.html"... PASS
>> >Checking "src/Records.html"... PASS
>> >Checking "src/Quasiquoter.html"... PASS
>> >Checking "src/CPP.html"... PASS
>> >Checking "src/Operators.html"... PASS
>> >Checking "src/Literals.html"... PASS
>> >Checking "src/LinkingIdentifiers.html"... PASS
>> >Checking "src/Classes.html"... FAIL
>> >Checking "src/PositionPragmas.html"... PASS
>> >Checking "src/Types.html"... PASS
>> >Checking "src/TemplateHaskellQuasiquotes.html"... PASS
>> >Checking "src/Constructors.html"... FAIL
>> >Checking "src/Identifiers.html"... FAIL
>> >Diffing failed cases...
>> >Diff for file "src/Classes.html":
>> >1194c1194,1198
>> >< ><span class="hs-identifier hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >a -> b -> a
>> >> forall a b. a -> b -> a
>> >> </span
>> >> ><span class="hs-identifier hs-var"
>> >1281c1285,1289
>> >< ><span class="hs-identifier hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >a -> b -> a
>> >> forall a b. a -> b -> a
>> >> </span
>> >> ><span class="hs-identifier hs-var"
>> >1368c1376,1380
>> >< ><span class="hs-identifier hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >b -> a -> b
>> >> forall a b. a -> b -> a
>> >> </span
>> >> ><span class="hs-identifier hs-var"
>> >1455c1467,1471
>> >< ><span class="hs-identifier hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >b -> a -> b
>> >> forall a b. a -> b -> a
>> >> </span
>> >> ><span class="hs-identifier hs-var"
>> >Diff for file "src/Constructors.html":
>> >1325c1325,1329
>> >< ><span class="hs-operator hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >([Int] -> Int) -> (Norf -> [Int]) -> Norf -> Int
>> >> forall b c a. (b -> c) -> (a -> b) -> a -> c
>> >> </span
>> >> ><span class="hs-operator hs-var"
>> >Diff for file "src/Identifiers.html":
>> >1190c1190,1194
>> >< ><span class="hs-operator hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >(String -> IO ()) -> (Int -> String) -> Int -> IO ()
>> >> forall b c a. (b -> c) -> (a -> b) -> a -> c
>> >> </span
>> >> ><span class="hs-operator hs-var"
>> >1216,1217c1220,1224
>> >< ><a href="Identifiers.html#foo"
>> >< ><span class="hs-identifier hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >Int -> Int -> Int
>> >> </span
>> >> ><a href="Identifiers.html#foo"
>> >> ><span class="hs-identifier hs-var"
>> >1260c1267,1271
>> >< ><span class="hs-operator hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >(String -> IO ()) -> (Int -> String) -> Int -> IO ()
>> >> forall b c a. (b -> c) -> (a -> b) -> a -> c
>> >> </span
>> >> ><span class="hs-operator hs-var"
>> >1286,1287c1297,1301
>> >< ><a href="Identifiers.html#quux"
>> >< ><span class="hs-identifier hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >Int -> Int
>> >> </span
>> >> ><a href="Identifiers.html#quux"
>> >> ><span class="hs-identifier hs-var"
>> >1319c1333,1337
>> >< ><span class="hs-operator hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >(String -> IO ()) -> (Int -> String) -> Int -> IO ()
>> >> forall b c a. (b -> c) -> (a -> b) -> a -> c
>> >> </span
>> >> ><span class="hs-operator hs-var"
>> >1345,1346c1363,1367
>> >< ><a href="Identifiers.html#norf"
>> >< ><span class="hs-identifier hs-type"
>> >---
>> >> ><span class="annottext"
>> >> >Int -> Int -> Int -> Int
>> >> </span
>> >> ><a href="Identifiers.html#norf"
>> >> ><span class="hs-identifier hs-var"
>> >Stderr run ( haddockHypsrcTest ):
>> >gmake: *** [Makefile:68: hypsrcTest] Error 1
>> >*** unexpected failure for haddockHypsrcTest(normal)
>>
>> >_______________________________________________
>> >ghc-devs mailing list
>> >ghc-devs at haskell.org
>> >http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>>
>>


More information about the ghc-devs mailing list