--test-options shouldn't change the configuration and rebuild all the packages in the project
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
Adding or removing --test-options to the `cabal test` command shouldn't have any affect on the configuration, but it does.
**To Reproduce**
Clone cabal repo and run,
```
cabal test integration-tests2
```
and then run,
```
cabal test integration-tests2 --test-options '-p "find root"'
```
this causes all the packages to reconfigure again:
```
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- Cabal-syntax-3.7.0.0 (lib) (configuration changed)
- safe-exceptions-0.1.7.2 (lib) (configuration changed)
- hackage-security-0.6.2.1 (lib) (dependency rebuilt)
- Cabal-3.7.0.0 (lib) (configuration changed)
- cabal-install-solver-3.7.0.0 (lib) (configuration changed)
- cabal-install-3.7.0.0 (lib) (configuration changed)
- cabal-install-3.7.0.0 (test:integration-tests2) (configuration changed)
Configuring library for safe-exceptions-0.1.7.2..
Configuring library for Cabal-syntax-3.7.0.0..
Preprocessing library for safe-exceptions-0.1.7.2..
Building library for safe-exceptions-0.1.7.2..
Preprocessing library for Cabal-syntax-3.7.0.0..
Building library for Cabal-syntax-3.7.0.0..
Configuring library for Cabal-3.7.0.0..
Preprocessing library for hackage-security-0.6.2.1..
Building library for hackage-security-0.6.2.1..
Preprocessing library for Cabal-3.7.0.0..
Building library for Cabal-3.7.0.0..
Configuring library for cabal-install-solver-3.7.0.0..
Preprocessing library for cabal-install-solver-3.7.0.0..
Building library for cabal-install-solver-3.7.0.0..
Configuring library for cabal-install-3.7.0.0..
Preprocessing library for cabal-install-3.7.0.0..
Building library for cabal-install-3.7.0.0..
Configuring test suite 'integration-tests2' for cabal-install-3.7.0.0..
Preprocessing test suite 'integration-tests2' for cabal-install-3.7.0.0..
Building test suite 'integration-tests2' for cabal-install-3.7.0.0..
Running 1 test suites...
```
Even running the exact command multiple times causes it print the following everytime:
```
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- cabal-install-3.7.0.0 (test:integration-tests2) (first run)
Preprocessing test suite 'integration-tests2' for cabal-install-3.7.0.0..
Building test suite 'integration-tests2' for cabal-install-3.7.0.0..
```
**Expected behavior**
The behaviour should be similar to running executables, where passing arguments to the executable doesn't result in change of configuration.
**System information**
- Operating system: nixos
- `cabal`, `ghc` versions: 3.6.2.0, 8.10.7
**Additional context**
I am not sure why it is that we send the arguments in `--test-options` for tests and not like how we pass them to executables (after `-- `), is it because test-options can contain templates?
Contributor guide
Research direction
Start by reproducing the issue with `cabal test integration-tests2`, then repeat it with `--test-options '-p "find root"'` and compare the reported rebuilds. Trace how `--test-options` affects configuration and test execution, using executable argument handling as the expected comparison. Done means changing or repeating test options does not reconfigure or rebuild unrelated packages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system, cli, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100