Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal test doesn't change to package directory #10704

Open
Tracked by #74
phadej opened this issue Jan 3, 2025 · 7 comments · May be fixed by #10725
Open
Tracked by #74

cabal test doesn't change to package directory #10704

phadej opened this issue Jan 3, 2025 · 7 comments · May be fixed by #10725

Comments

@phadej
Copy link
Collaborator

phadej commented Jan 3, 2025

See https://github.com/phadej/regression-simple/actions/runs/12600704188/job/35120309804?pr=14

I'm puzzled what's happening, as I cannot reproduce that locally. Locally cabal test changes directory.

The important part of log:

["--working-dir=/__w/regression-simple/regression-simple/unpacked/regression-simple-0.2.2","test","--verbose=2","--builddir=/__w/regression-simple/regression-simple/dist-newstyle/build/x86_64-linux/ghc-8.8.4/regression-simple-0.2.2/t/regression-simple-tests","--log=$pkgid-$test-suite.log","--machine-log=$pkgid.log","--show-details=direct","regression-simple-tests"]
Reading installed packages...
Running: /github/home/.ghcup/ghc/8.8.4/bin/ghc-pkg-8.8.4 dump --global -v0
Running: /github/home/.ghcup/ghc/8.8.4/bin/ghc-pkg-8.8.4 dump '--package-db=/github/home/.cabal/store/ghc-8.8.4/package.db' -v0
Running: /github/home/.ghcup/ghc/8.8.4/bin/ghc-pkg-8.8.4 dump '--package-db=/__w/regression-simple/regression-simple/dist-newstyle/packagedb/ghc-8.8.4' -v0
Running: /github/home/.ghcup/ghc/8.8.4/bin/ghc-pkg-8.8.4 dump '--package-db=/__w/regression-simple/regression-simple/dist-newstyle/build/x86_64-linux/ghc-8.8.4/regression-simple-0.2.2/t/regression-simple-tests/package.conf.inplace' -v0
Running: /github/home/.ghcup/ghc/8.8.4/bin/ghc --print-libdir -hide-all-packages '+RTS' -M3G -RTS '-Werror=missing-methods'
Running 1 test suites...
Test suite regression-simple-tests: RUNNING...
Running: /__w/regression-simple/regression-simple/dist-newstyle/build/x86_64-linux/ghc-8.8.4/regression-simple-0.2.2/t/regression-simple-tests/build/regression-simple-tests/regression-simple-tests
"/__w/regression-simple/regression-simple"

the --working-dir argument is the package directory, but when program is run, it's not respected, the test suite starts with

getCurrentDirectory >>= print
@phadej
Copy link
Collaborator Author

phadej commented Jan 3, 2025

I tried with cabal-install-3.12.1.0, and that works. So some change in 3.14 makes CI fail.

@phadej
Copy link
Collaborator Author

phadej commented Jan 3, 2025

Locally I see

Running: /opt/ghcup/.ghcup/bin/cabal-3.14.1.0 act-as-setup '--build-type=Simple' -- '--working-dir=/codetmp/p/u/regression-simple-0.2.1' test '--verbose=2' '--builddir=/codetmp/p/dist-newstyle/build/x86_64-linux/ghc-8.8.4/regression-simple-0.2.1/t/regression-simple-tests' '--log=$pkgid-$test-suite.log' '--machine-log=$pkgid.log' '--show-details=direct' regression-simple-tests

but on CI I see

Using internal setup method with build-type Simple and args:
["--working-dir=/__w/regression-simple/regression-simple/unpacked/regression-simple-0.2.2","test","--verbose=2","--builddir=/__w/regression-simple/regression-simple/dist-newstyle/build/x86_64-linux/ghc-9.8.4/regression-simple-0.2.2/t/regression-simple-tests","--log=$pkgid-$test-suite.log","--machine-log=$pkgid.log","--show-details=direct","regression-simple-tests"]

Now I can reproduce this locally, if I add -j1 argument, then cabal-install uses internal setup method and --working-dir directory change fails.

@phadej
Copy link
Collaborator Author

phadej commented Jan 3, 2025

I suspect this is bug is introduced in 7b90583. Ping @sheaf.

Currently cabal-install-3.14 is unusable in my CI setups without workarounds.

@phadej
Copy link
Collaborator Author

phadej commented Jan 4, 2025

This issue is causing problems with aeson test-suite.

@andreasabel
Copy link
Member

This seems in particular to affect haskell-ci generated workflows with a cabal testsuite that accesses files.
Another example of such failure seems to be: https://github.com/hackage-trustees/hackage-cli/actions/runs/12653979112/job/35260731276?pr=74#step:23:32

@mpickering
Copy link
Collaborator

I have been assigned to look into this.

@mpickering mpickering self-assigned this Jan 8, 2025
mpickering added a commit to mpickering/cabal that referenced this issue Jan 8, 2025
A simple fix to run the test executable in the `-working-dir`.

Fixes haskell#10704
@mpickering mpickering linked a pull request Jan 8, 2025 that will close this issue
6 tasks
mpickering added a commit to mpickering/cabal that referenced this issue Jan 8, 2025
A simple fix to run the test executable in the `-working-dir`.

Fixes haskell#10704
@mpickering
Copy link
Collaborator

Fix in #10725

mpickering added a commit to mpickering/cabal that referenced this issue Jan 8, 2025
A simple fix to run the test executable in the `-working-dir`.

Fixes haskell#10704
mpickering added a commit to mpickering/cabal that referenced this issue Jan 8, 2025
A simple fix to run the test executable in the `-working-dir`.

Fixes haskell#10704
mpickering added a commit to mpickering/cabal that referenced this issue Jan 9, 2025
A simple fix to run the test executable in the `-working-dir`.

Fixes haskell#10704
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants