Skip to content

Commit 570960c

Browse files
authored
Merge pull request #9954 from mpickering/wip/package-db-more
More consistently pass --package-db flag to tests
2 parents bfd9bfb + 2b44677 commit 570960c

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

cabal-testsuite/PackageTests/CustomTestCoverage/cabal.out

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ Build profile: -w ghc-<GHCVER> -O1
44
In order, the following will be built:
55
- plain-0.1.0.0 *test (first run)
66
Configuring plain-0.1.0.0...
7-
Preprocessing library for plain-0.1.0.0..
8-
Building library for plain-0.1.0.0..
9-
Preprocessing test suite 'test' for plain-0.1.0.0..
10-
Building test suite 'test' for plain-0.1.0.0..
7+
Preprocessing library for plain-0.1.0.0...
8+
Building library for plain-0.1.0.0...
9+
Preprocessing test suite 'test' for plain-0.1.0.0...
10+
Building test suite 'test' for plain-0.1.0.0...
1111
Running 1 test suites...
1212
Test suite test: RUNNING...
1313
Test suite test: PASS
14-
Test suite logged to: cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/test/plain-0.1.0.0-test.log
15-
Test coverage report written to cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/hpc/vanilla/html/test/hpc_index.html
14+
Test suite logged to: <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/test/plain-0.1.0.0-test.log
15+
Package coverage report written to <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/hpc/vanilla/html/hpc_index.html
1616
1 of 1 test suites (1 of 1 test cases) passed.
17-
Package coverage report written to cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/hpc/vanilla/html/plain-0.1.0.0/hpc_index.html
17+
Package coverage report written to <ROOT>/cabal.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/plain-0.1.0.0/hpc/vanilla/html/hpc_index.html

cabal-testsuite/PackageTests/Regression/T9640/cabal.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ In order, the following will be built:
77
- one-custom-0.1.0.0 (lib:one-custom) (requires build)
88
- depend-on-custom-with-exe-0.1.0.0 (lib) (first run)
99
Configuring one-custom-0.1.0.0...
10-
Preprocessing library for one-custom-0.1.0.0..
11-
Building library for one-custom-0.1.0.0..
10+
Preprocessing library for one-custom-0.1.0.0...
11+
Building library for one-custom-0.1.0.0...
1212
Installing library in <PATH>
1313
Warning: depend-on-custom-with-exe.cabal:16:1: Ignoring trailing fields after sections: "ghc-options"
1414
Configuring library for depend-on-custom-with-exe-0.1.0.0...

cabal-testsuite/src/Test/Cabal/DecodeShowBuildInfo.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import System.Exit
2121
--
2222
-- Results can be read via 'withPlan', 'buildInfoFile' and 'decodeBuildInfoFile'.
2323
runShowBuildInfo :: [String] -> TestM ()
24-
runShowBuildInfo args = cabal "build" ("--enable-build-info":args)
24+
runShowBuildInfo args = noCabalPackageDb $ cabal "build" ("--enable-build-info":args)
2525

2626
-- | Read 'build-info.json' for a given package and component
2727
-- from disk and record the content. Helpful for defining test-cases

cabal-testsuite/src/Test/Cabal/Prelude.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ cabalGArgs global_args cmd args input = do
316316
| cmd `elem` ["v2-sdist", "path"]
317317
= [ "--project-file=" ++ fp | Just fp <- [testCabalProjectFile env] ]
318318

319-
| cmd == "v2-clean"
319+
| cmd == "v2-clean" || cmd == "clean"
320320
= [ "--builddir", testDistDir env ]
321321
++ [ "--project-file=" ++ fp | Just fp <- [testCabalProjectFile env] ]
322322

@@ -325,10 +325,14 @@ cabalGArgs global_args cmd args input = do
325325
, "-j1" ]
326326
++ [ "--project-file=" ++ fp | Just fp <- [testCabalProjectFile env] ]
327327
++ ["--package-db=" ++ db | Just db <- [testPackageDbPath env]]
328+
| "v1-" `isPrefixOf` cmd
329+
= [ "--builddir", testDistDir env ]
330+
++ install_args
328331

329332
| otherwise
330-
= [ "--builddir", testDistDir env ] ++
331-
install_args
333+
= [ "--builddir", testDistDir env ]
334+
++ ["--package-db=" ++ db | Just db <- [testPackageDbPath env]]
335+
++ install_args
332336

333337
install_args
334338
| cmd == "v1-install" || cmd == "v1-build" = [ "-j1" ]

0 commit comments

Comments
 (0)