haskell / haskell/cabal

Is the use of doctests in validate.sh up to date?

Open
#9,623 2 comments 0 reactions 0 assignees View on GitHub
cabal-validate continuous-integration re: doctest status: consider closing type: user-question
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

Is the use of doctests in `validate.sh` up to date? In `Makefile` we're using;

https://github.com/haskell/cabal/blob/28e2926e40e04eb0b6ca4377e2e394400f6263d6/Makefile#L6

https://github.com/haskell/cabal/blob/28e2926e40e04eb0b6ca4377e2e394400f6263d6/Makefile#L93-L98

The doctest step is not using the `cabal repl --with-ghc=doctest` method but shouldn't it since that is now the recommended way, https://github.com/haskell/cabal/issues/8504#issuecomment-1289809764?

https://github.com/haskell/cabal/blob/28e2926e40e04eb0b6ca4377e2e394400f6263d6/validate.sh#L387-L392

If I `--help`, `--list-steps` and then walk through the steps in order, all with the `--doctest` option, it fails at the `doctest` step;

```
$ sh validate.sh --help
./validate.sh - build & test

Usage: ./validate.sh [options]
A script which runs all the tests.

Available options:
-j, --jobs JOBS cabal build -j argument (default: 24)
--libonly Test only Cabal-the-library
--cli Test both Cabal-the-library and cabal-install
--(no-)run-lib-tests Run library tests
--(no-)run-cli-tests Run client tests
--(no-)run-lib-suite Run cabal-testsuite with library
--(no-)run-cli-suite Run cabal-testsuite with client
-w, --with-compiler HC With compiler
--with-cabal CABAL With cabal-install
--extra-hc HC Extra compiler to run test-suite with
--(no-)doctest Run doctest on library
--(no-)solver-benchmarks Build and trial run solver-benchmarks
--complete-hackage-tests Run hackage-tests on complete Hackage data
--partial-hackage-tests Run hackage-tests on parts of Hackage data
-v, --verbose Verbose output
-q, --quiet Less output
-s, --step STEP Run only specific step (can be specified multiple times)
--list-steps List steps and build-targets and exit
--help Print this message and exit

$ sh validate.sh --list-steps --doctest
Targets: Cabal cabal-testsuite Cabal-tests Cabal-QuickCheck Cabal-tree-diff Cabal-described cabal-install cabal-install-solver cabal-benchmarks
Steps: print-config print-tool-versions build doctest lib-tests lib-suite cli-tests cli-suite time-summary

$ sh validate.sh -s print-config --doctest
=== print-config ============================================================= 11:51:30 ===
compiler: ghc
runhaskell: ghc
cabal-install: cabal
jobs: -j24
Cabal tests: true
cabal-install tests: true
cabal-testsuite: true
library only: false
dependencies only: false
doctest: true
benchmarks: false
verbose: false
extra compilers:

$ sh validate.sh -s print-tool-versions --doctest
=== print-tool-versions ====================================================== 11:51:51 ===
ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.4.8
<<< ghc --version (0/0 sec)

cabal --version
cabal-install version 3.11.0.0
compiled using version 3.11.0.0 of the Cabal library
<<< cabal --version (0/0 sec)

$ sh validate.sh -s build --doctest
...

=== Step Build: actual build ================================================= 11:52:36 ===
cabal build -j24 -w ghc --builddir=dist-newstyle-validate-ghc-9.4.8 --project-file=cabal.project.validate Cabal cabal-testsuite Cabal-tests Cabal-QuickCheck Cabal-tree-diff Cabal-described cabal-install cabal-install-solver cabal-benchmarks
Up to date
<<< cabal build -j24 -w ghc --builddir=dist-newstyle-validate-ghc-9.4.8 --project-file=cabal.project.validate Cabal cabal-testsuite Cabal-tests Cabal-QuickCheck Cabal-tree-diff Cabal-described cabal-install cabal-install-solver cabal-benchmarks (0/0 sec)

$ sh validate.sh -j 24 -s doctest --doctest
=== Cabal: doctest =========================================================== 11:53:14 ===
validate.sh: 389: cabal-env: not found
validate.sh: 390: cabal-env: not found
doctest -package-env=doctest-Cabal --fast Cabal/Distribution Cabal/Language
doctest: Package environment "doctest-Cabal" not found
<<< doctest -package-env=doctest-Cabal --fast Cabal/Distribution Cabal/Language (0/0 sec, 1)
<<< doctest -package-env=doctest-Cabal --fast Cabal/Distribution Cabal/Language (0/0 sec, 1)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.