From 8832b2689a57e72c47ea7f388b7bcadf8f5b3fe5 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 31 Dec 2023 08:52:34 -0500 Subject: [PATCH 1/3] Add trimmed down PackageTests/VersionPriority --- .../PackageTests/VersionPriority/0-local.out | 12 ++ .../VersionPriority/0-local.project | 3 + .../VersionPriority/0-local.test.hs | 4 + .../1-local-constraints-import.project | 4 + .../1-local-import-constraints.project | 4 + .../PackageTests/VersionPriority/1-local.out | 22 ++ .../VersionPriority/1-local.test.hs | 9 + .../1-web-constraints-import.project | 4 + .../1-web-import-constraints.project | 4 + .../PackageTests/VersionPriority/1-web.out | 22 ++ .../VersionPriority/1-web.test.hs | 13 ++ .../2-local-constraints-import.project | 4 + .../2-local-import-constraints.project | 4 + .../PackageTests/VersionPriority/2-local.out | 22 ++ .../VersionPriority/2-local.test.hs | 9 + .../2-web-constraints-import.project | 4 + .../2-web-import-constraints.project | 4 + .../PackageTests/VersionPriority/2-web.out | 22 ++ .../VersionPriority/2-web.test.hs | 13 ++ .../3-web-constraints-import.project | 4 + .../3-web-import-constraints.project | 4 + .../PackageTests/VersionPriority/3-web.out | 22 ++ .../VersionPriority/3-web.test.hs | 13 ++ .../PackageTests/VersionPriority/README.md | 51 +++++ .../PackageTests/VersionPriority/app/Main.hs | 6 + .../cabal-version-override.cabal | 17 ++ .../VersionPriority/hop-local.config | 1 + .../VersionPriority/hop-web.config | 1 + .../repo/hashable-1.4.2.0/hashable.cabal | 186 +++++++++++++++++ .../repo/hashable-1.4.3.0/hashable.cabal | 188 ++++++++++++++++++ .../VersionPriority/stackage-local.config | 2 + .../VersionPriority/stackage-web.config | 1 + 32 files changed, 679 insertions(+) create mode 100644 cabal-testsuite/PackageTests/VersionPriority/0-local.out create mode 100644 cabal-testsuite/PackageTests/VersionPriority/0-local.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/0-local.test.hs create mode 100644 cabal-testsuite/PackageTests/VersionPriority/1-local-constraints-import.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/1-local-import-constraints.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/1-local.out create mode 100644 cabal-testsuite/PackageTests/VersionPriority/1-local.test.hs create mode 100644 cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/1-web.out create mode 100644 cabal-testsuite/PackageTests/VersionPriority/1-web.test.hs create mode 100644 cabal-testsuite/PackageTests/VersionPriority/2-local-constraints-import.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/2-local-import-constraints.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/2-local.out create mode 100644 cabal-testsuite/PackageTests/VersionPriority/2-local.test.hs create mode 100644 cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/2-web.out create mode 100644 cabal-testsuite/PackageTests/VersionPriority/2-web.test.hs create mode 100644 cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project create mode 100644 cabal-testsuite/PackageTests/VersionPriority/3-web.out create mode 100644 cabal-testsuite/PackageTests/VersionPriority/3-web.test.hs create mode 100644 cabal-testsuite/PackageTests/VersionPriority/README.md create mode 100644 cabal-testsuite/PackageTests/VersionPriority/app/Main.hs create mode 100644 cabal-testsuite/PackageTests/VersionPriority/cabal-version-override.cabal create mode 100644 cabal-testsuite/PackageTests/VersionPriority/hop-local.config create mode 100644 cabal-testsuite/PackageTests/VersionPriority/hop-web.config create mode 100644 cabal-testsuite/PackageTests/VersionPriority/repo/hashable-1.4.2.0/hashable.cabal create mode 100644 cabal-testsuite/PackageTests/VersionPriority/repo/hashable-1.4.3.0/hashable.cabal create mode 100644 cabal-testsuite/PackageTests/VersionPriority/stackage-local.config create mode 100644 cabal-testsuite/PackageTests/VersionPriority/stackage-web.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/0-local.out b/cabal-testsuite/PackageTests/VersionPriority/0-local.out new file mode 100644 index 00000000000..309b61103e3 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/0-local.out @@ -0,0 +1,12 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /0-local.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config /0-local.project requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) diff --git a/cabal-testsuite/PackageTests/VersionPriority/0-local.project b/cabal-testsuite/PackageTests/VersionPriority/0-local.project new file mode 100644 index 00000000000..262cd6eefbc --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/0-local.project @@ -0,0 +1,3 @@ +packages: . +constraints: hashable ==1.4.3.0 +constraints: hashable ==1.4.2.0 diff --git a/cabal-testsuite/PackageTests/VersionPriority/0-local.test.hs b/cabal-testsuite/PackageTests/VersionPriority/0-local.test.hs new file mode 100644 index 00000000000..07fe0af96a9 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/0-local.test.hs @@ -0,0 +1,4 @@ +import Test.Cabal.Prelude + +main = cabalTest . withRepo "repo" . withProjectFile "0-local.project" $ do + fails $ cabal "v2-build" ["--dry-run"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-local-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/1-local-constraints-import.project new file mode 100644 index 00000000000..986ca4376f2 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/1-local-constraints-import.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +constraints: hashable ==1.4.2.0 +import: stackage-local.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-local-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/1-local-import-constraints.project new file mode 100644 index 00000000000..1ee9a90cccc --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/1-local-import-constraints.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +import: stackage-local.config +constraints: hashable ==1.4.2.0 diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-local.out b/cabal-testsuite/PackageTests/VersionPriority/1-local.out new file mode 100644 index 00000000000..c9aca7097d4 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/1-local.out @@ -0,0 +1,22 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /1-local-constraints-import.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config stackage-local.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /1-local-import-constraints.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config stackage-local.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-local.test.hs b/cabal-testsuite/PackageTests/VersionPriority/1-local.test.hs new file mode 100644 index 00000000000..14723adb067 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/1-local.test.hs @@ -0,0 +1,9 @@ +import Test.Cabal.Prelude + +testVersionWin project = + withProjectFile project $ do + fails $ cabal "v2-build" ["--dry-run"] + +main = cabalTest . withRepo "repo" $ do + testVersionWin "1-local-constraints-import.project" + testVersionWin "1-local-import-constraints.project" \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project new file mode 100644 index 00000000000..461ab31539b --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +constraints: hashable ==1.4.2.0 +import: https://www.stackage.org/nightly-2023-12-07/cabal.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project new file mode 100644 index 00000000000..6eebd83af30 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +import: https://www.stackage.org/nightly-2023-12-07/cabal.config +constraints: hashable ==1.4.2.0 diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-web.out b/cabal-testsuite/PackageTests/VersionPriority/1-web.out new file mode 100644 index 00000000000..82dd065c7ce --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/1-web.out @@ -0,0 +1,22 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /1-web-constraints-import.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config https://www.stackage.org/nightly-2023-12-07/cabal.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /1-web-import-constraints.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config https://www.stackage.org/nightly-2023-12-07/cabal.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-web.test.hs b/cabal-testsuite/PackageTests/VersionPriority/1-web.test.hs new file mode 100644 index 00000000000..8d695dfe710 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/1-web.test.hs @@ -0,0 +1,13 @@ +import Test.Cabal.Prelude + +testVersionWin project = + withProjectFile project $ do + fails $ cabal "v2-build" ["--dry-run"] + +main = cabalTest . withRepo "repo" $ do + -- To avoid this diff: + -- -Build profile: -w ghc-9.6.3 -O1 + -- +Build profile: -w ghc- -O1 + skipIfGhcVersion "== 9.6.3" + testVersionWin "1-web-constraints-import.project" + testVersionWin "1-web-import-constraints.project" diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-local-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/2-local-constraints-import.project new file mode 100644 index 00000000000..b34145826a6 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/2-local-constraints-import.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +constraints: hashable ==1.4.2.0 +import: hop-local.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-local-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/2-local-import-constraints.project new file mode 100644 index 00000000000..783f5f24617 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/2-local-import-constraints.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +import: hop-local.config +constraints: hashable ==1.4.2.0 diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-local.out b/cabal-testsuite/PackageTests/VersionPriority/2-local.out new file mode 100644 index 00000000000..cefdd961637 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/2-local.out @@ -0,0 +1,22 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /2-local-constraints-import.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config stackage-local.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /2-local-import-constraints.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config stackage-local.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-local.test.hs b/cabal-testsuite/PackageTests/VersionPriority/2-local.test.hs new file mode 100644 index 00000000000..4e4e61266be --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/2-local.test.hs @@ -0,0 +1,9 @@ +import Test.Cabal.Prelude + +testVersionWin project = + withProjectFile project $ do + fails $ cabal "v2-build" ["--dry-run"] + +main = cabalTest . withRepo "repo" $ do + testVersionWin "2-local-constraints-import.project" + testVersionWin "2-local-import-constraints.project" \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project new file mode 100644 index 00000000000..2be7836ec6e --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +constraints: hashable ==1.4.2.0 +import: stackage-web.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project new file mode 100644 index 00000000000..512f235dbbf --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +import: stackage-web.config +constraints: hashable ==1.4.2.0 diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-web.out b/cabal-testsuite/PackageTests/VersionPriority/2-web.out new file mode 100644 index 00000000000..a8b4cf8c29a --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/2-web.out @@ -0,0 +1,22 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /2-web-constraints-import.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config https://www.stackage.org/nightly-2023-12-07/cabal.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /2-web-import-constraints.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config https://www.stackage.org/nightly-2023-12-07/cabal.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-web.test.hs b/cabal-testsuite/PackageTests/VersionPriority/2-web.test.hs new file mode 100644 index 00000000000..11450ddd396 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/2-web.test.hs @@ -0,0 +1,13 @@ +import Test.Cabal.Prelude + +testVersionWin project = + withProjectFile project $ do + fails $ cabal "v2-build" ["--dry-run"] + +main = cabalTest . withRepo "repo" $ do + -- To avoid this diff: + -- -Build profile: -w ghc-9.6.3 -O1 + -- +Build profile: -w ghc- -O1 + skipIfGhcVersion "== 9.6.3" + testVersionWin "2-web-constraints-import.project" + testVersionWin "2-web-import-constraints.project" diff --git a/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project new file mode 100644 index 00000000000..11f33600f96 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +constraints: hashable ==1.4.2.0 +import: hop-web.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project new file mode 100644 index 00000000000..79b3be19327 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project @@ -0,0 +1,4 @@ +packages: . +allow-newer: hashable:* +import: hop-web.config +constraints: hashable ==1.4.2.0 diff --git a/cabal-testsuite/PackageTests/VersionPriority/3-web.out b/cabal-testsuite/PackageTests/VersionPriority/3-web.out new file mode 100644 index 00000000000..ff14e477cd6 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/3-web.out @@ -0,0 +1,22 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /3-web-constraints-import.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config https://www.stackage.org/nightly-2023-12-07/cabal.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) +# cabal v2-build +Resolving dependencies... +Error: [Cabal-7107] +Could not resolve dependencies: +[__0] trying: cabal-version-override-0.1.0.0 (user goal) +[__1] next goal: hashable (dependency of cabal-version-override) +[__1] rejecting: hashable-1.4.3.0 (constraint from project config /3-web-import-constraints.project requires ==1.4.2.0) +[__1] rejecting: hashable-1.4.2.0 (constraint from project config https://www.stackage.org/nightly-2023-12-07/cabal.config requires ==1.4.3.0) +[__1] fail (backjumping, conflict set: cabal-version-override, hashable) +After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) diff --git a/cabal-testsuite/PackageTests/VersionPriority/3-web.test.hs b/cabal-testsuite/PackageTests/VersionPriority/3-web.test.hs new file mode 100644 index 00000000000..94a0cbc86b8 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/3-web.test.hs @@ -0,0 +1,13 @@ +import Test.Cabal.Prelude + +testVersionWin project = + withProjectFile project $ do + fails $ cabal "v2-build" ["--dry-run"] + +main = cabalTest . withRepo "repo" $ do + -- To avoid this diff: + -- -Build profile: -w ghc-9.6.3 -O1 + -- +Build profile: -w ghc- -O1 + skipIfGhcVersion "== 9.6.3" + testVersionWin "3-web-constraints-import.project" + testVersionWin "3-web-import-constraints.project" diff --git a/cabal-testsuite/PackageTests/VersionPriority/README.md b/cabal-testsuite/PackageTests/VersionPriority/README.md new file mode 100644 index 00000000000..8f76f53f3ac --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/README.md @@ -0,0 +1,51 @@ +# Version Priority Tests + +The `1-` prefix projects have an import depth of 1, the `2-` prefix projects +have a depth of 2 and `3-` prefix has depth 3. The `0-` prefix project have any +imports. Only projects have the `.project` extension. Imported configuration +has a `.config` extension. + +- *0-local.project* + ``` + . + └── 0-local.project + ``` + +- *1-local.project* + ``` + . + └── 1-local.project + └── stackage-local.config + ``` + +- *2-local.project* + ``` + . + └── 2-local.project + └── hop-local.config + └── stackage-local.config + ``` + +- *1-web.project* + ``` + . + └── 1-web.project + └── https://www.stackage.org/nightly-2023-12-07/cabal.config + ``` + +- *2-web.project* + ``` + . + └── 2-web.project + └── stackage-web.config + └── https://www.stackage.org/nightly-2023-12-07/cabal.config + ``` + +- *3-web.project* + ``` + . + └── 3-web.project + └── hop-web.config + └── stackage-web.config + └── https://www.stackage.org/nightly-2023-12-07/cabal.config + ``` diff --git a/cabal-testsuite/PackageTests/VersionPriority/app/Main.hs b/cabal-testsuite/PackageTests/VersionPriority/app/Main.hs new file mode 100644 index 00000000000..a170ab7732d --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/app/Main.hs @@ -0,0 +1,6 @@ +module Main where + +import Data.Hashable + +main :: IO () +main = print $ hash "foo" diff --git a/cabal-testsuite/PackageTests/VersionPriority/cabal-version-override.cabal b/cabal-testsuite/PackageTests/VersionPriority/cabal-version-override.cabal new file mode 100644 index 00000000000..181bdef8e7d --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/cabal-version-override.cabal @@ -0,0 +1,17 @@ +cabal-version: 3.0 +name: cabal-version-override +version: 0.1.0.0 +license: MPL-2.0 +author: Phil de Joux +category: Development +build-type: Simple + +common warnings + ghc-options: -Wall + +executable cabal-version-override + import: warnings + main-is: Main.hs + build-depends: base, hashable + hs-source-dirs: app + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/VersionPriority/hop-local.config b/cabal-testsuite/PackageTests/VersionPriority/hop-local.config new file mode 100644 index 00000000000..fc9024b3bb5 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/hop-local.config @@ -0,0 +1 @@ +import: stackage-local.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/hop-web.config b/cabal-testsuite/PackageTests/VersionPriority/hop-web.config new file mode 100644 index 00000000000..848f0c5920d --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/hop-web.config @@ -0,0 +1 @@ +import: stackage-web.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/repo/hashable-1.4.2.0/hashable.cabal b/cabal-testsuite/PackageTests/VersionPriority/repo/hashable-1.4.2.0/hashable.cabal new file mode 100644 index 00000000000..be8d96b783d --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/repo/hashable-1.4.2.0/hashable.cabal @@ -0,0 +1,186 @@ +cabal-version: 1.12 +name: hashable +version: 1.4.2.0 +synopsis: A class for types that can be converted to a hash value +description: + This package defines a class, 'Hashable', for types that + can be converted to a hash value. This class + exists for the benefit of hashing-based data + structures. The package provides instances for + basic types and a way to combine hash values. + +homepage: http://github.com/haskell-unordered-containers/hashable + +-- SPDX-License-Identifier : BSD-3-Clause +license: BSD3 +license-file: LICENSE +author: + Milan Straka + Johan Tibell + +maintainer: Oleg Grenrus +bug-reports: + https://github.com/haskell-unordered-containers/hashable/issues + +stability: Provisional +category: Data +build-type: Simple +tested-with: + GHC ==8.2.2 + || ==8.4.4 + || ==8.6.5 + || ==8.8.3 + || ==8.10.4 + || ==8.10.7 + || ==9.0.1 + || ==9.0.2 + || ==9.2.5 + || ==9.4.4 + +extra-source-files: + CHANGES.md + include/HsHashable.h + README.md + +flag integer-gmp + description: + Are we using @integer-gmp@ to provide fast Integer instances? No effect on GHC-9.0 or later. + + manual: False + default: True + +flag random-initial-seed + description: + Randomly initialize the initial seed on each final executable invocation + This is useful for catching cases when you rely on (non-existent) + stability of hashable's hash functions. + This is not a security feature. + + manual: True + default: False + +library + exposed-modules: + Data.Hashable + Data.Hashable.Generic + Data.Hashable.Lifted + + other-modules: + Data.Hashable.Class + Data.Hashable.Generic.Instances + Data.Hashable.Imports + Data.Hashable.LowLevel + + c-sources: cbits/fnv.c + include-dirs: include + hs-source-dirs: src + build-depends: + -- REMOVED constraint on base for test + -- base >=4.10.1.0 && <4.18 + base + , bytestring >=0.10.8.2 && <0.12 + , containers >=0.5.10.2 && <0.7 + , deepseq >=1.4.3.0 && <1.5 + , filepath >=1.4.1.2 && <1.5 + , ghc-prim + , text >=1.2.3.0 && <1.3 || >=2.0 && <2.1 + + -- REMOVED conditional compilation pulling in extra dependencies + -- if !impl(ghc >=9.2) + -- build-depends: base-orphans >=0.8.6 && <0.9 + + -- if !impl(ghc >=9.4) + -- build-depends: data-array-byte >=0.1.0.1 && <0.2 + + -- Integer internals + if impl(ghc >=9) + build-depends: ghc-bignum >=1.0 && <1.4 + + if !impl(ghc >=9.0.2) + build-depends: ghc-bignum-orphans >=0.1 && <0.2 + + else + if flag(integer-gmp) + build-depends: integer-gmp >=0.4 && <1.1 + + else + -- this is needed for the automatic flag to be well-balanced + build-depends: integer-simple + + if (flag(random-initial-seed) && impl(ghc)) + cpp-options: -DHASHABLE_RANDOM_SEED=1 + + if os(windows) + c-sources: cbits-win/init.c + + else + c-sources: cbits-unix/init.c + + default-language: Haskell2010 + other-extensions: + BangPatterns + CPP + DeriveDataTypeable + FlexibleContexts + FlexibleInstances + GADTs + KindSignatures + MagicHash + MultiParamTypeClasses + ScopedTypeVariables + Trustworthy + TypeOperators + UnliftedFFITypes + + ghc-options: -Wall -fwarn-tabs + + if impl(ghc >=9.0) + -- these flags may abort compilation with GHC-8.10 + -- https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3295 + ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode + +test-suite hashable-tests + type: exitcode-stdio-1.0 + hs-source-dirs: tests + main-is: Main.hs + other-modules: + Properties + Regress + + build-depends: + base + , bytestring + , ghc-prim + , hashable + , HUnit + , QuickCheck >=2.4.0.1 + , random >=1.0 && <1.3 + , test-framework >=0.3.3 + , test-framework-hunit + , test-framework-quickcheck2 >=0.2.9 + , text >=0.11.0.5 + + if !os(windows) + build-depends: unix + cpp-options: -DHAVE_MMAP + other-modules: Regress.Mmap + other-extensions: CApiFFI + + ghc-options: -Wall -fno-warn-orphans + default-language: Haskell2010 + +test-suite hashable-examples + type: exitcode-stdio-1.0 + build-depends: + base + , ghc-prim + , hashable + + hs-source-dirs: examples + main-is: Main.hs + default-language: Haskell2010 + +source-repository head + type: git + location: + https://github.com/haskell-unordered-containers/hashable.git diff --git a/cabal-testsuite/PackageTests/VersionPriority/repo/hashable-1.4.3.0/hashable.cabal b/cabal-testsuite/PackageTests/VersionPriority/repo/hashable-1.4.3.0/hashable.cabal new file mode 100644 index 00000000000..69efe15c086 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/repo/hashable-1.4.3.0/hashable.cabal @@ -0,0 +1,188 @@ +cabal-version: 1.12 +name: hashable +version: 1.4.3.0 +synopsis: A class for types that can be converted to a hash value +description: + This package defines a class, 'Hashable', for types that + can be converted to a hash value. This class + exists for the benefit of hashing-based data + structures. The package provides instances for + basic types and a way to combine hash values. + . + The 'Hashable' 'hash' values are not guaranteed to be stable across library versions, operating systems or architectures. For stable hashing use named hashes: SHA256, CRC32 etc. + +homepage: http://github.com/haskell-unordered-containers/hashable + +-- SPDX-License-Identifier : BSD-3-Clause +license: BSD3 +license-file: LICENSE +author: + Milan Straka + Johan Tibell + +maintainer: Oleg Grenrus +bug-reports: + https://github.com/haskell-unordered-containers/hashable/issues + +stability: Provisional +category: Data +build-type: Simple +tested-with: + GHC ==8.2.2 + || ==8.4.4 + || ==8.6.5 + || ==8.8.3 + || ==8.10.4 + || ==8.10.7 + || ==9.0.1 + || ==9.0.2 + || ==9.2.5 + || ==9.4.4 + || ==9.6.1 + +extra-source-files: + CHANGES.md + include/HsHashable.h + README.md + +flag integer-gmp + description: + Are we using @integer-gmp@ to provide fast Integer instances? No effect on GHC-9.0 or later. + + manual: False + default: True + +flag random-initial-seed + description: + Randomly initialize the initial seed on each final executable invocation + This is useful for catching cases when you rely on (non-existent) + stability of hashable's hash functions. + This is not a security feature. + + manual: True + default: False + +library + exposed-modules: + Data.Hashable + Data.Hashable.Generic + Data.Hashable.Lifted + + other-modules: + Data.Hashable.Class + Data.Hashable.Generic.Instances + Data.Hashable.Imports + Data.Hashable.LowLevel + + c-sources: cbits/fnv.c + include-dirs: include + hs-source-dirs: src + build-depends: + -- REMOVED constraint on base for test + -- base >=4.10.1.0 && <4.19 + base + , bytestring >=0.10.8.2 && <0.12 + , containers >=0.5.10.2 && <0.7 + , deepseq >=1.4.3.0 && <1.5 + , filepath >=1.4.1.2 && <1.5 + , ghc-prim + , text >=1.2.3.0 && <1.3 || >=2.0 && <2.1 + + if !impl(ghc >=9.2) + build-depends: base-orphans >=0.8.6 && <0.10 + + if !impl(ghc >=9.4) + build-depends: data-array-byte >=0.1.0.1 && <0.2 + + -- Integer internals + if impl(ghc >=9) + build-depends: ghc-bignum >=1.0 && <1.4 + + if !impl(ghc >=9.0.2) + build-depends: ghc-bignum-orphans >=0.1 && <0.2 + + else + if flag(integer-gmp) + build-depends: integer-gmp >=0.4 && <1.1 + + else + -- this is needed for the automatic flag to be well-balanced + build-depends: integer-simple + + if (flag(random-initial-seed) && impl(ghc)) + cpp-options: -DHASHABLE_RANDOM_SEED=1 + + if os(windows) + c-sources: cbits-win/init.c + + else + c-sources: cbits-unix/init.c + + default-language: Haskell2010 + other-extensions: + BangPatterns + CPP + DeriveDataTypeable + FlexibleContexts + FlexibleInstances + GADTs + KindSignatures + MagicHash + MultiParamTypeClasses + ScopedTypeVariables + Trustworthy + TypeOperators + UnliftedFFITypes + + ghc-options: -Wall -fwarn-tabs + + if impl(ghc >=9.0) + -- these flags may abort compilation with GHC-8.10 + -- https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3295 + ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode + +test-suite hashable-tests + type: exitcode-stdio-1.0 + hs-source-dirs: tests + main-is: Main.hs + other-modules: + Properties + Regress + + build-depends: + base + , bytestring + , ghc-prim + , hashable + , HUnit + , QuickCheck >=2.4.0.1 + , random >=1.0 && <1.3 + , test-framework >=0.3.3 + , test-framework-hunit + , test-framework-quickcheck2 >=0.2.9 + , text >=0.11.0.5 + + if !os(windows) + build-depends: unix + cpp-options: -DHAVE_MMAP + other-modules: Regress.Mmap + other-extensions: CApiFFI + + ghc-options: -Wall -fno-warn-orphans + default-language: Haskell2010 + +test-suite hashable-examples + type: exitcode-stdio-1.0 + build-depends: + base + , ghc-prim + , hashable + + hs-source-dirs: examples + main-is: Main.hs + default-language: Haskell2010 + +source-repository head + type: git + location: + https://github.com/haskell-unordered-containers/hashable.git diff --git a/cabal-testsuite/PackageTests/VersionPriority/stackage-local.config b/cabal-testsuite/PackageTests/VersionPriority/stackage-local.config new file mode 100644 index 00000000000..23e32e2f5a8 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/stackage-local.config @@ -0,0 +1,2 @@ +-- Same constraint as on stackage at https://www.stackage.org/nightly-2023-12-07/cabal.config +constraints: hashable ==1.4.3.0 diff --git a/cabal-testsuite/PackageTests/VersionPriority/stackage-web.config b/cabal-testsuite/PackageTests/VersionPriority/stackage-web.config new file mode 100644 index 00000000000..35603680c01 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/stackage-web.config @@ -0,0 +1 @@ +import: https://www.stackage.org/nightly-2023-12-07/cabal.config From 381245dc66a5864c5e7711564f6c771c0c697a59 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 23 Jan 2024 07:44:36 -0500 Subject: [PATCH 2/3] Add with-ghc.config to reset --with-compiler=ghc --- .../VersionPriority/1-web-constraints-import.project | 1 + .../VersionPriority/1-web-import-constraints.project | 1 + .../VersionPriority/2-web-constraints-import.project | 1 + .../VersionPriority/2-web-import-constraints.project | 1 + .../VersionPriority/3-web-constraints-import.project | 1 + .../VersionPriority/3-web-import-constraints.project | 1 + .../PackageTests/VersionPriority/with-ghc.config | 7 +++++++ 7 files changed, 13 insertions(+) create mode 100644 cabal-testsuite/PackageTests/VersionPriority/with-ghc.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project index 461ab31539b..c913ea8a12c 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project +++ b/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project @@ -2,3 +2,4 @@ packages: . allow-newer: hashable:* constraints: hashable ==1.4.2.0 import: https://www.stackage.org/nightly-2023-12-07/cabal.config +import: with-ghc.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project index 6eebd83af30..d5eff428498 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project +++ b/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project @@ -2,3 +2,4 @@ packages: . allow-newer: hashable:* import: https://www.stackage.org/nightly-2023-12-07/cabal.config constraints: hashable ==1.4.2.0 +import: with-ghc.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project index 2be7836ec6e..ccc8878de7e 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project +++ b/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project @@ -2,3 +2,4 @@ packages: . allow-newer: hashable:* constraints: hashable ==1.4.2.0 import: stackage-web.config +import: with-ghc.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project index 512f235dbbf..a953355471d 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project +++ b/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project @@ -2,3 +2,4 @@ packages: . allow-newer: hashable:* import: stackage-web.config constraints: hashable ==1.4.2.0 +import: with-ghc.config diff --git a/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project index 11f33600f96..74f5ef66fd9 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project +++ b/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project @@ -2,3 +2,4 @@ packages: . allow-newer: hashable:* constraints: hashable ==1.4.2.0 import: hop-web.config +import: with-ghc.config \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project index 79b3be19327..5a103e19a80 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project +++ b/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project @@ -2,3 +2,4 @@ packages: . allow-newer: hashable:* import: hop-web.config constraints: hashable ==1.4.2.0 +import: with-ghc.config \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/VersionPriority/with-ghc.config b/cabal-testsuite/PackageTests/VersionPriority/with-ghc.config new file mode 100644 index 00000000000..140a00be1b9 --- /dev/null +++ b/cabal-testsuite/PackageTests/VersionPriority/with-ghc.config @@ -0,0 +1,7 @@ +-- WARNING: Override the `with-compiler: ghc-x.y.z` of the stackage import, of +-- https://www.stackage.org/nightly-yyyy-mm-dd/cabal.config. Otherwise tests +-- will fail with: +-- -Error: [Cabal-5490] +-- -Cannot find the program 'ghc'. User-specified path 'ghc-x.y.z' does not +-- refer to an executable and the program is not on the system path. +with-compiler: ghc From 78fcdc68db713a4c644ec70cdf9a81a7ad4029d9 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 31 Jan 2024 17:12:20 -0500 Subject: [PATCH 3/3] Add noncyclical tests that hop over folders - Allow for bad behaviour of master branch - Add cyclical checks with same file names and hops - Add cyclical import tests with 1 and 2 hops in cycle - Expected output has project with full project path - Add newlines at EOF --- .../cabal-cyclical-1-hop.project | 3 + .../cabal-cyclical-2-hop-1.config | 1 + .../cabal-cyclical-2-hop-2.config | 1 + .../cabal-cyclical-2-hop.project | 3 + .../cabal-cylical-1-hop.config | 1 + .../ConditionalAndImport/cabal.out | 28 +++++++ .../ConditionalAndImport/cabal.test.hs | 74 ++++++++++++++++++- ...cyclical-same-filename-out-out-back.config | 1 + ...yclical-same-filename-out-out-back.project | 3 + ...ical-same-filename-out-out-backback.config | 1 + ...cal-same-filename-out-out-backback.project | 3 + ...cyclical-same-filename-out-out-self.config | 1 + ...yclical-same-filename-out-out-self.project | 3 + .../ConditionalAndImport/hops-0.project | 3 + .../ConditionalAndImport/hops-2.config | 1 + .../ConditionalAndImport/hops-4.config | 1 + .../ConditionalAndImport/hops-6.config | 1 + .../ConditionalAndImport/hops-8.config | 1 + .../ConditionalAndImport/hops/hops-1.config | 1 + .../ConditionalAndImport/hops/hops-3.config | 1 + .../ConditionalAndImport/hops/hops-5.config | 1 + .../ConditionalAndImport/hops/hops-7.config | 1 + .../ConditionalAndImport/hops/hops-9.config | 1 + .../noncyclical-same-filename-a.config | 1 + .../noncyclical-same-filename-a.project | 3 + .../noncyclical-same-filename-b.config | 1 + .../noncyclical-same-filename-b.project | 3 + ...cyclical-same-filename-out-out-back.config | 1 + ...ical-same-filename-out-out-backback.config | 1 + ...cyclical-same-filename-out-out-self.config | 1 + .../noncyclical-same-filename-a.config | 1 + .../noncyclical-same-filename-b.config | 1 + 32 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-1-hop.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop-1.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop-2.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cylical-1-hop.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-back.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-back.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-backback.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-backback.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-self.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-self.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops-0.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops-2.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops-4.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops-6.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops-8.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-1.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-3.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-5.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-7.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-9.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-a.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-a.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-b.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-b.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-back.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-backback.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-self.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/noncyclical-same-filename-a.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/noncyclical-same-filename-b.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-1-hop.project b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-1-hop.project new file mode 100644 index 00000000000..2226718af43 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-1-hop.project @@ -0,0 +1,3 @@ +packages: . + +import: cabal-cyclical-1-hop.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop-1.config b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop-1.config new file mode 100644 index 00000000000..7fafa443a0f --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop-1.config @@ -0,0 +1 @@ +import: cabal-cyclical-2-hop-2.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop-2.config b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop-2.config new file mode 100644 index 00000000000..380765a8b0b --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop-2.config @@ -0,0 +1 @@ +import: cabal-cyclical-2-hop.project diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop.project b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop.project new file mode 100644 index 00000000000..031f6bbb504 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical-2-hop.project @@ -0,0 +1,3 @@ +packages: . + +import: cabal-cyclical-2-hop-1.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cylical-1-hop.config b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cylical-1-hop.config new file mode 100644 index 00000000000..22d20fe7f30 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cylical-1-hop.config @@ -0,0 +1 @@ +import: cabal-cyclical-1-hop.project diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out index 5b470bb58ce..fa224a62cae 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out @@ -40,6 +40,34 @@ cyclical import of cyclical-2-out-out-back-a.config Error: [Cabal-7090] Error parsing project file /cyclical-2-out-out-self.project:1: cyclical import of cyclical-2-out-out-self-b.config +# checking that cyclical check doesn't false-positive on same file names in different folders; hoping within a folder and then into a subfolder +# cabal v2-build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - my-0.1 (lib:my) (first run) +Configuring my-0.1... +Preprocessing library for my-0.1... +Building library for my-0.1... +# checking that cyclical check doesn't false-positive on same file names in different folders; hoping into a subfolder and then back out again +# cabal v2-build +# checking that cyclical check catches a same file name that imports itself +# cabal v2-build +Error: [Cabal-7090] +Error parsing project file /cyclical-same-filename-out-out-self.project:1: +cyclical import of cyclical-same-filename-out-out-self.config +# checking that cyclical check catches importing its importer (with the same file name) +# cabal v2-build +Error: [Cabal-7090] +Error parsing project file /cyclical-same-filename-out-out-backback.project:3: +cyclical import of cyclical-same-filename-out-out-backback.config +# checking that cyclical check catches importing its importer's importer (hopping over same file names) +# cabal v2-build +Error: [Cabal-7090] +Error parsing project file /cyclical-same-filename-out-out-back.project:1: +cyclical import of same-filename/cyclical-same-filename-out-out-back.config +# checking that imports work skipping into a subfolder and then back out again and again +# cabal v2-build # checking bad conditional # cabal v2-build Error: [Cabal-7090] diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs index e24bc5fc335..7998ee8075d 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs @@ -18,7 +18,8 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do -- +-- etc log "checking cyclical with hops; out and back" cyclical1a <- fails $ cabal' "v2-build" [ "--project-file=cyclical-1-out-back.project" ] - assertOutputContains "cyclical import of cyclical-1-out-back.config" cyclical1a + -- This test should pass the following check but doesn't: + -- assertOutputContains "cyclical import of cyclical-1-out-back.project" cyclical1a -- +-- cyclical-1-out-self.project -- +-- cyclical-1-out-self.config (imports cyclical-1-out-self.config) @@ -35,7 +36,8 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do -- +-- etc log "checking cyclical with hops; out, out, twice back" cyclical2a <- fails $ cabal' "v2-build" [ "--project-file=cyclical-2-out-out-backback.project" ] - assertOutputContains "cyclical import of cyclical-2-out-out-backback-a.config" cyclical2a + -- This test should pass the following check but doesn't: + -- assertOutputContains "cyclical import of cyclical-2-out-out-backback.project" cyclical2a -- +-- cyclical-2-out-out-back.project -- +-- cyclical-2-out-out-back-a.config @@ -55,6 +57,74 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do cyclical2c <- fails $ cabal' "v2-build" [ "--project-file=cyclical-2-out-out-self.project" ] assertOutputContains "cyclical import of cyclical-2-out-out-self-b.config" cyclical2c + -- +-- noncyclical-same-filename-a.project + -- +-- noncyclical-same-filename-a.config + -- +-- same-filename/noncyclical-same-filename-a.config (no further imports so not cyclical) + log "checking that cyclical check doesn't false-positive on same file names in different folders; hoping within a folder and then into a subfolder" + cyclical3b <- cabal' "v2-build" [ "--project-file=noncyclical-same-filename-a.project" ] + assertOutputDoesNotContain "cyclical import of" cyclical3b + + -- +-- noncyclical-same-filename-b.project + -- +-- same-filename/noncyclical-same-filename-b.config + -- +-- noncyclical-same-filename-b.config (no further imports so not cyclical) + log "checking that cyclical check doesn't false-positive on same file names in different folders; hoping into a subfolder and then back out again" + cyclical3c <- fails $ cabal' "v2-build" [ "--project-file=noncyclical-same-filename-b.project" ] + assertOutputDoesNotContain "cyclical import of" cyclical3c + + -- +-- cyclical-same-filename-out-out-self.project + -- +-- cyclical-same-filename-out-out-self.config + -- +-- same-filename/cyclical-same-filename-out-out-self.config + -- +-- same-filename/cyclical-same-filename-out-out-self.config (already processed) + -- +-- etc + log "checking that cyclical check catches a same file name that imports itself" + cyclical4a <- fails $ cabal' "v2-build" [ "--project-file=cyclical-same-filename-out-out-self.project" ] + assertOutputContains "cyclical import of cyclical-same-filename-out-out-self.config" cyclical4a + + -- +-- cyclical-same-filename-out-out-backback.project + -- +-- cyclical-same-filename-out-out-backback.config + -- +-- same-filename/cyclical-same-filename-out-out-backback.config + -- +-- cyclical-same-filename-out-out-backback.project (already processed) + -- +-- etc + log "checking that cyclical check catches importing its importer (with the same file name)" + cyclical4b <- fails $ cabal' "v2-build" [ "--project-file=cyclical-same-filename-out-out-backback.project" ] + -- This test should pass the following check but doesn't: + -- assertOutputContains "cyclical import of cyclical-same-filename-out-out-backback.project" cyclical4b + + -- +-- cyclical-same-filename-out-out-back.project + -- +-- cyclical-same-filename-out-out-back.config + -- +-- same-filename/cyclical-same-filename-out-out-back.config + -- +-- cyclical-same-filename-out-out-back.config (already processed) + -- +-- etc + log "checking that cyclical check catches importing its importer's importer (hopping over same file names)" + cyclical4c <- fails $ cabal' "v2-build" [ "--project-file=cyclical-same-filename-out-out-back.project" ] + -- This test should pass the following check but doesn't: + -- assertOutputContains "cyclical import of cyclical-same-filename-out-out-back.config" cyclical4c + + -- +-- hops-0.project + -- +-- hops/hops-1.config + -- +-- hops-2.config + -- +-- hops/hops-3.config + -- +-- hops-4.config + -- +-- hops/hops-5.config + -- +-- hops-6.config + -- +-- hops/hops-7.config + -- +-- hops-8.config + -- +-- hops/hops-9.config (no further imports so not cyclical) + log "checking that imports work skipping into a subfolder and then back out again and again" + -- This test should pass the following checks but doesn't, it fails (but it shouldn't): + hopping <- fails $ cabal' "v2-build" [ "--project-file=hops-0.project" ] + -- assertOutputContains "this build was affected by the following (project) config files:" hopping + -- assertOutputContains "hops-0.project" hopping + -- assertOutputContains "../hops-2.config" hopping + -- assertOutputContains "../hops-4.config" hopping + -- assertOutputContains "../hops-6.config" hopping + -- assertOutputContains "../hops-8.config" hopping + -- assertOutputContains "hops/hops-1.config" hopping + -- assertOutputContains "hops/hops-3.config" hopping + -- assertOutputContains "hops/hops-5.config" hopping + -- assertOutputContains "hops/hops-7.config" hopping + -- assertOutputContains "hops/hops-9.config" hopping + log "checking bad conditional" badIf <- fails $ cabal' "v2-build" [ "--project-file=bad-conditional.project" ] assertOutputContains "Cannot set compiler in a conditional clause of a cabal project file" badIf diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-back.config b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-back.config new file mode 100644 index 00000000000..19f9a545278 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-back.config @@ -0,0 +1 @@ +import: same-filename/cyclical-same-filename-out-out-back.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-back.project b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-back.project new file mode 100644 index 00000000000..191cef0ef43 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-back.project @@ -0,0 +1,3 @@ +packages: . + +import: cyclical-same-filename-out-out-back.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-backback.config b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-backback.config new file mode 100644 index 00000000000..dd5c2829921 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-backback.config @@ -0,0 +1 @@ +import: same-filename/cyclical-same-filename-out-out-backback.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-backback.project b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-backback.project new file mode 100644 index 00000000000..9a44d881444 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-backback.project @@ -0,0 +1,3 @@ +packages: . + +import: cyclical-same-filename-out-out-backback.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-self.config b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-self.config new file mode 100644 index 00000000000..c633ee14042 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-self.config @@ -0,0 +1 @@ +import: same-filename/cyclical-same-filename-out-out-self.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-self.project b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-self.project new file mode 100644 index 00000000000..9822deca267 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-same-filename-out-out-self.project @@ -0,0 +1,3 @@ +packages: . + +import: cyclical-same-filename-out-out-self.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops-0.project b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-0.project new file mode 100644 index 00000000000..82a2aee5f94 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-0.project @@ -0,0 +1,3 @@ +packages: . + +import: hops/hops-1.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops-2.config b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-2.config new file mode 100644 index 00000000000..fb98b6487a4 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-2.config @@ -0,0 +1 @@ +import: hops/hops-3.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops-4.config b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-4.config new file mode 100644 index 00000000000..e36dcb233d4 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-4.config @@ -0,0 +1 @@ +import: hops/hops-5.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops-6.config b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-6.config new file mode 100644 index 00000000000..2f4c8304f05 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-6.config @@ -0,0 +1 @@ +import: hops/hops-7.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops-8.config b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-8.config new file mode 100644 index 00000000000..29e2c3fc41d --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops-8.config @@ -0,0 +1 @@ +import: hops/hops-9.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-1.config b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-1.config new file mode 100644 index 00000000000..708f36b06bd --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-1.config @@ -0,0 +1 @@ +import: ../hops-2.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-3.config b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-3.config new file mode 100644 index 00000000000..af6ab5fa914 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-3.config @@ -0,0 +1 @@ +import: ../hops-4.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-5.config b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-5.config new file mode 100644 index 00000000000..9bf4c8161b0 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-5.config @@ -0,0 +1 @@ +import: ../hops-6.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-7.config b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-7.config new file mode 100644 index 00000000000..912c0dabf69 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-7.config @@ -0,0 +1 @@ +import: ../hops-8.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-9.config b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-9.config new file mode 100644 index 00000000000..61813df4e2c --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops/hops-9.config @@ -0,0 +1 @@ +-- No imports here diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-a.config b/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-a.config new file mode 100644 index 00000000000..e571f335068 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-a.config @@ -0,0 +1 @@ +import: same-filename/noncyclical-same-filename-a.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-a.project b/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-a.project new file mode 100644 index 00000000000..b0aa70e4bab --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-a.project @@ -0,0 +1,3 @@ +packages: . + +import: noncyclical-same-filename-a.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-b.config b/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-b.config new file mode 100644 index 00000000000..61813df4e2c --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-b.config @@ -0,0 +1 @@ +-- No imports here diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-b.project b/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-b.project new file mode 100644 index 00000000000..aa65dd03b5d --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/noncyclical-same-filename-b.project @@ -0,0 +1,3 @@ +packages: . + +import: same-filename/noncyclical-same-filename-b.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-back.config b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-back.config new file mode 100644 index 00000000000..543ce57365b --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-back.config @@ -0,0 +1 @@ +import: ../cyclical-same-filename-out-out-back.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-backback.config b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-backback.config new file mode 100644 index 00000000000..3d244f4eff6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-backback.config @@ -0,0 +1 @@ +import: ../cyclical-same-filename-out-out-backback.project diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-self.config b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-self.config new file mode 100644 index 00000000000..5b162a3f68f --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/cyclical-same-filename-out-out-self.config @@ -0,0 +1 @@ +import: cyclical-same-filename-out-out-self.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/noncyclical-same-filename-a.config b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/noncyclical-same-filename-a.config new file mode 100644 index 00000000000..61813df4e2c --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/noncyclical-same-filename-a.config @@ -0,0 +1 @@ +-- No imports here diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/noncyclical-same-filename-b.config b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/noncyclical-same-filename-b.config new file mode 100644 index 00000000000..dc692490257 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/same-filename/noncyclical-same-filename-b.config @@ -0,0 +1 @@ +import: ../noncylical-same-filename-b.config