From 07ef4f41861ef4c4e6b786f9ce684b40ca78cd11 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Mon, 9 Dec 2024 09:05:56 -0500 Subject: [PATCH] Don't use same project twice in tests --- .../ConditionalAndImport/cabal.out | 157 ++++++++++++------ .../ConditionalAndImport/cabal.test.hs | 9 +- .../woops-0-packages-in-root.project | 3 + .../woops-0-packages-in-woops.project | 3 + .../{woops-0.project => woops-0.config} | 0 5 files changed, 116 insertions(+), 56 deletions(-) create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/woops-0-packages-in-root.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/woops-0-packages-in-woops.project rename cabal-testsuite/PackageTests/ConditionalAndImport/{woops-0.project => woops-0.config} (100%) diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out index 323f5e0289e..37b4b4b8f36 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out @@ -382,50 +382,62 @@ Up to date # checking if we detect when the same config is imported via many different paths (we don't) # cabal v2-build Configuration is affected by the following files: -- woops-0.project +- woops-0-packages-in-root.project - with-ghc.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project +- woops-0.config + imported by: woops-0-packages-in-root.project - woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops-4.config imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops-6.config imported by: woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops-6.config imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops-6.config imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops-8.config imported by: woops/woops-7.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops-8.config imported by: woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops-8.config imported by: woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops-8.config imported by: woops/woops-7.config imported by: woops-6.config @@ -434,39 +446,49 @@ Configuration is affected by the following files: imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-7.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config @@ -474,19 +496,23 @@ Configuration is affected by the following files: imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-9.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-9.config imported by: woops-8.config imported by: woops/woops-7.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-9.config imported by: woops-8.config imported by: woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-9.config imported by: woops-8.config imported by: woops/woops-7.config @@ -494,7 +520,8 @@ Configuration is affected by the following files: imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - woops/woops-9.config imported by: woops-8.config imported by: woops/woops-7.config @@ -504,31 +531,37 @@ Configuration is affected by the following files: imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-4.config imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-6.config imported by: woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-6.config imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-6.config imported by: woops/woops-5.config @@ -536,17 +569,20 @@ Configuration is affected by the following files: imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-8.config imported by: woops/woops-7.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-8.config imported by: woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-8.config imported by: woops/woops-7.config @@ -554,7 +590,8 @@ Configuration is affected by the following files: imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops-8.config imported by: woops/woops-7.config @@ -564,48 +601,58 @@ Configuration is affected by the following files: imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-7.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-7.config imported by: woops-6.config @@ -614,22 +661,26 @@ Configuration is affected by the following files: imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-9.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-9.config imported by: woops-8.config imported by: woops/woops-7.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-9.config imported by: woops-8.config imported by: woops/woops-7.config imported by: woops-6.config imported by: woops/woops-5.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-9.config imported by: woops-8.config @@ -638,7 +689,8 @@ Configuration is affected by the following files: imported by: woops/woops-5.config imported by: woops-4.config imported by: woops/woops-3.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project - https://www.stackage.org/lts-21.25/cabal.config imported by: woops/woops-9.config imported by: woops-8.config @@ -649,7 +701,8 @@ Configuration is affected by the following files: imported by: woops/woops-3.config imported by: woops-2.config imported by: woops/woops-1.config - imported by: woops-0.project + imported by: woops-0.config + imported by: woops-0-packages-in-root.project Resolving dependencies... Up to date # checking "using config from message" without URI imports diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs index 22e16ba23a3..519b1225734 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs @@ -259,7 +259,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do yopping <- cabal' "v2-build" [ "--project-file=yops-0.project" ] log "checking if we detect when the same config is imported via many different paths (we don't)" - woopping <- cabal' "v2-build" [ "--project-file=woops-0.project" ] + woopping <- cabal' "v2-build" [ "--project-file=woops-0-packages-in-root.project" ] log "checking \"using config from message\" without URI imports" withDirectory "yops" $ do @@ -298,7 +298,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do log "checking \"using config from message\" with URI imports" withDirectory "woops" $ do - woopping <- fails $ cabal' "v2-build" [ "--dry-run", "--project-file=../woops-0.project" ] + woopping <- fails $ cabal' "v2-build" [ "--dry-run", "--project-dir=..", "--project-file=woops-0-packages-in-woops.project" ] -- Use assertRegex when the output is tainted by the temp directory, like -- this: @@ -309,8 +309,9 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do assertRegex "Project configuration with URI imports is listed in full" "When using configuration from:(\n|\r\n) \ - \ .*woops-0\\.project(\n|\r\n) \ + \ .*woops-0-packages-in-woops\\.project(\n|\r\n) \ \ .*with-ghc\\.config(\n|\r\n) \ + \ .*woops-0\\.config(\n|\r\n) \ \ .*woops-2\\.config(\n|\r\n) \ \ .*woops-4\\.config(\n|\r\n) \ \ .*woops-6\\.config(\n|\r\n) \ @@ -325,7 +326,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do assertOutputContains "The following errors occurred: \ - \ - The package directory '.' does not contain any .cabal file." + \ - The package directory 'woops' does not contain any .cabal file." woopping return () diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/woops-0-packages-in-root.project b/cabal-testsuite/PackageTests/ConditionalAndImport/woops-0-packages-in-root.project new file mode 100644 index 00000000000..a1f15f5d996 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/woops-0-packages-in-root.project @@ -0,0 +1,3 @@ +packages: . + +import: woops-0.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/woops-0-packages-in-woops.project b/cabal-testsuite/PackageTests/ConditionalAndImport/woops-0-packages-in-woops.project new file mode 100644 index 00000000000..ba0c872a487 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/woops-0-packages-in-woops.project @@ -0,0 +1,3 @@ +packages: woops + +import: woops-0.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/woops-0.project b/cabal-testsuite/PackageTests/ConditionalAndImport/woops-0.config similarity index 100% rename from cabal-testsuite/PackageTests/ConditionalAndImport/woops-0.project rename to cabal-testsuite/PackageTests/ConditionalAndImport/woops-0.config