hackage-server icon indicating copy to clipboard operation
hackage-server copied to clipboard

BuildReports: Add test report log

Open ysangkok opened this issue 5 months ago • 3 comments

The test report log contains the actual output emitted by the test-suite in a given Cabal package.

The test log only contains the logs of the build of the test.

Fixes #1397.

Demo

image

These were the logs as emitted by cabal run exe:hackage-build -- build testpkg -v:

Downloading
http://localhost:8080/package/testpkg-0.4.0.1/testpkg-0.4.0.1.tar.gz
Unpacking to testpkg-0.4.0.1/
Building testpkg-0.4.0.1
cabal
--config-file=/home/janus/flipstone/hackage-server/build-cache/cabal-config
v1-install --enable-documentation
--htmldir=/home/janus/flipstone/hackage-server/build-cache/tmp-install/haddocks/$pkgid-docs
--disable-optimization --ghc-option -O0 --disable-library-for-ghci
--package-db=clear --package-db=global
--package-db=/home/janus/flipstone/hackage-server/build-cache/tmp-install/packages.db
--reinstall --force-reinstalls
--haddock-html-location=/package/$pkg-$version/docs
--haddock-contents-location=/package/$pkg-$version --haddock-hyperlink-source
--prefix=/home/janus/flipstone/hackage-server/build-cache/tmp-install
--build-summary=/home/janus/flipstone/hackage-server/build-cache/tmp-install/reports/$pkgid.report
--report-planning-failure --haddock-html --haddock-hoogle
--haddock-option=--quickjump testpkg-0.4.0.1
Build results for testpkg-0.4.0.1:
/home/janus/flipstone/hackage-server/build-cache/results/testpkg-0.4.0.1.report
/home/janus/flipstone/hackage-server/build-cache/results/testpkg-0.4.0.1-docs.tar.gz
/home/janus/flipstone/hackage-server/build-cache/results/testpkg-0.4.0.1.log
Testing testpkg-0.4.0.1
cabal
--config-file=/home/janus/flipstone/hackage-server/build-cache/cabal-config
v2-test all --enable-coverage
--test-log=/home/janus/flipstone/hackage-server/build-cache/tmp-install/reports/testpkg-0.4.0.1.test
--test-show-details=never --disable-optimization
Test results for testpkg-0.4.0.1:
/home/janus/flipstone/hackage-server/build-cache/results/testpkg-0.4.0.1.test

Cabal file fragment:

test-suite simple
    main-is: Main.hs
    hs-source-dirs: test
    type: exitcode-stdio-1.0
    build-depends: base >=4 && <5
    default-language: Haskell2010

Main.hs (of test-suite) contents:

main = putStrLn "this is printed from custom test suite"

ysangkok avatar Jul 17 '25 06:07 ysangkok

this looks good to me. @bgamari i think we'll need to deploy the builder and the main hackage in sync for this... when you get time, take a look and then we can coordinate?

gbaz avatar Jul 17 '25 19:07 gbaz

I tried testing the migration locally, and I am getting an error with Acid.Core "too few bytes". So there must be some problem with this PR, or maybe it is exposing an existing issue... I will report back if I find out what the problem is. I think I'll try to write a unit test for this.

ysangkok avatar Aug 06 '25 15:08 ysangkok

I've done some migration testsusing the following REPL code:

ghci> :set -XScopedTypeVariables 
ghci> :m +Distribution.Server.Features.BuildReports.BuildReports Data.Acid.Core Data.SafeCopy Data.Map Test.QuickCheck Data.Either
ghci> b :: PkgBuildReports_v4  <- generate arbitrary
ghci> isRight (serialiserDecode safeCopySerialiser (serialiserEncode safeCopySerialiser b) :: Either String PkgBuildReports)
True

I still haven't discovered any issues...

ysangkok avatar Aug 08 '25 03:08 ysangkok

@gbaz Do you have any ideas for how to advance this? I'd be curious to know if you can reproduce my issue with your local instance.

ysangkok avatar Dec 17 '25 18:12 ysangkok