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