From 1e62b823e491e00d519e2bbcac1cdd434b8cdfc0 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 17 Jun 2022 15:48:32 -0400 Subject: [PATCH] Add test cases that reproduce #7241. - Move project sdist tests to cabal-testsuite - Add --ignore-project test - Duplicate tests but without cabal.project - Add a cabal.project one folder up - Add a package Z in the root - Rerun --accept with more immediate parent project - Add a readme for the tests - Fix problems with uv package, update expected output - Add U and V modules - Explain what is wrong with cabal.dot-uv.test.hs - Add a note on cabal.no-project.test.hs - Explain what is wrong with cabal.sub-pq.test.hs - Explain what is wrong with cabal.sub-rs.test.hs - Explain what is wrong with cabal.dot-uv.test.hs - Leave a note explaining cabal.no-project.test.hs - Leave a note explaining cabal.project.test.hs - Leave a note explaining cabal.sub-pq.test.hs - Explain what is wrong with cabal.sub-rs.test.hs - Patches for project respecting behaviour - Explain root ignore-project and no-project tests - Add *.v2.test.hs variants exercising v2-sdist - Add v2 patches, test out not using --- .../Projects-Default-No/U.hs | 0 .../Projects-Default-No/V.hs | 0 .../Projects-Default-No/cabal.dot-uv.out | 2 + .../Projects-Default-No/cabal.dot-uv.patch | 8 ++ .../Projects-Default-No/cabal.dot-uv.project | 1 + .../Projects-Default-No/cabal.dot-uv.test.hs | 12 +++ .../Projects-Default-No/cabal.dot-uv.v2.out | 2 + .../cabal.dot-uv.v2.test.hs | 6 ++ .../cabal.ignore-project.out | 2 + .../cabal.ignore-project.test.hs | 5 ++ .../cabal.ignore-project.v2.out | 2 + .../cabal.ignore-project.v2.test.hs | 8 ++ .../Projects-Default-No/cabal.no-project.out | 2 + .../cabal.no-project.test.hs | 9 ++ .../cabal.no-project.v2.out | 2 + .../cabal.no-project.v2.test.hs | 9 ++ .../Projects-Default-No/cabal.sub-pq.out | 2 + .../Projects-Default-No/cabal.sub-pq.patch | 8 ++ .../Projects-Default-No/cabal.sub-pq.project | 1 + .../Projects-Default-No/cabal.sub-pq.test.hs | 12 +++ .../Projects-Default-No/cabal.sub-pq.v2.out | 3 + .../cabal.sub-pq.v2.test.hs | 6 ++ .../Projects-Default-No/cabal.sub-rs.out | 2 + .../Projects-Default-No/cabal.sub-rs.patch | 9 ++ .../Projects-Default-No/cabal.sub-rs.project | 1 + .../Projects-Default-No/cabal.sub-rs.test.hs | 12 +++ .../Projects-Default-No/cabal.sub-rs.v2.out | 3 + .../cabal.sub-rs.v2.test.hs | 6 ++ .../Projects-Default-No/p/P.hs | 0 .../Projects-Default-No/p/p.cabal | 8 ++ .../Projects-Default-No/q/Q.hs | 0 .../Projects-Default-No/q/q.cabal | 8 ++ .../Projects-Default-No/r/R.hs | 0 .../Projects-Default-No/r/r.cabal | 8 ++ .../Projects-Default-No/s/S.hs | 0 .../Projects-Default-No/s/s.cabal | 8 ++ .../Projects-Default-No/uv.cabal | 14 +++ .../Projects-Default-Yes/U.hs | 0 .../Projects-Default-Yes/V.hs | 0 .../Projects-Default-Yes/cabal.dot-uv.out | 3 + .../Projects-Default-Yes/cabal.dot-uv.patch | 9 ++ .../Projects-Default-Yes/cabal.dot-uv.project | 1 + .../Projects-Default-Yes/cabal.dot-uv.test.hs | 12 +++ .../Projects-Default-Yes/cabal.dot-uv.v2.out | 2 + .../cabal.dot-uv.v2.test.hs | 6 ++ .../cabal.ignore-project.out | 2 + .../cabal.ignore-project.test.hs | 5 ++ .../cabal.ignore-project.v2.out | 3 + .../cabal.ignore-project.v2.patch | 0 .../cabal.ignore-project.v2.test.hs | 7 ++ .../Projects-Default-Yes/cabal.no-project.out | 3 + .../cabal.no-project.test.hs | 10 +++ .../cabal.no-project.v2.out | 3 + .../cabal.no-project.v2.patch | 0 .../cabal.no-project.v2.test.hs | 7 ++ .../Projects-Default-Yes/cabal.project | 1 + .../Projects-Default-Yes/cabal.project.out | 3 + .../cabal.project.test.hs | 7 ++ .../Projects-Default-Yes/cabal.project.v2.out | 3 + .../cabal.project.v2.test.hs | 6 ++ .../Projects-Default-Yes/cabal.sub-pq.out | 3 + .../Projects-Default-Yes/cabal.sub-pq.project | 1 + .../Projects-Default-Yes/cabal.sub-pq.test.hs | 6 ++ .../Projects-Default-Yes/cabal.sub-pq.v2.out | 3 + .../cabal.sub-pq.v2.test.hs | 6 ++ .../Projects-Default-Yes/cabal.sub-rs.out | 3 + .../Projects-Default-Yes/cabal.sub-rs.patch | 10 +++ .../Projects-Default-Yes/cabal.sub-rs.project | 1 + .../Projects-Default-Yes/cabal.sub-rs.test.hs | 12 +++ .../Projects-Default-Yes/cabal.sub-rs.v2.out | 3 + .../cabal.sub-rs.v2.test.hs | 6 ++ .../Projects-Default-Yes/p/P.hs | 0 .../Projects-Default-Yes/p/p.cabal | 8 ++ .../Projects-Default-Yes/q/Q.hs | 0 .../Projects-Default-Yes/q/q.cabal | 8 ++ .../Projects-Default-Yes/r/R.hs | 0 .../Projects-Default-Yes/r/r.cabal | 8 ++ .../Projects-Default-Yes/s/S.hs | 0 .../Projects-Default-Yes/s/s.cabal | 8 ++ .../Projects-Default-Yes/uv.cabal | 14 +++ .../SDist/Respect-Project-File/README.md | 85 +++++++++++++++++++ .../SDist/Respect-Project-File/Z.hs | 0 .../cabal.ignore-project.out | 2 + .../cabal.ignore-project.test.hs | 5 ++ .../cabal.ignore-project.v2.out | 2 + .../cabal.ignore-project.v2.test.hs | 5 ++ .../Respect-Project-File/cabal.no-project.out | 2 + .../cabal.no-project.test.hs | 7 ++ .../cabal.no-project.v2.out | 2 + .../cabal.no-project.v2.test.hs | 7 ++ .../SDist/Respect-Project-File/cabal.project | 1 + .../SDist/Respect-Project-File/z.cabal | 8 ++ 92 files changed, 500 insertions(+) create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/U.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/V.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.patch create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.project create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.v2.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.v2.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.v2.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.patch create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.project create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.v2.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.patch create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.project create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.v2.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/p/P.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/p/p.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/q/Q.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/q/q.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/r/R.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/r/r.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/s/S.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/s/s.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/uv.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/U.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/V.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.patch create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.project create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.v2.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.patch create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.patch create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.v2.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.project create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.v2.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.patch create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.project create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.v2.out create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/p/P.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/p/p.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/q/Q.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/q/q.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/r/R.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/r/r.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/s/S.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/s/s.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/uv.cabal create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/README.md create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/Z.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.v2.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.v2.out create mode 100755 cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.v2.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.project create mode 100644 cabal-testsuite/PackageTests/SDist/Respect-Project-File/z.cabal diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/U.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/U.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/V.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/V.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.out new file mode 100644 index 00000000000..3d6859f996b --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.out @@ -0,0 +1,2 @@ +# cabal sdist +Wrote tarball sdist to /cabal.dot-uv.dist/work/./dist/sdist/p-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.patch b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.patch new file mode 100644 index 00000000000..d16b271c934 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.patch @@ -0,0 +1,8 @@ +diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.out +index 3d6859f99..a7ffc109e 100644 +--- a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.out ++++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.out +@@ -1,2 +1,2 @@ + # cabal sdist +-Wrote tarball sdist to /cabal.dot-uv.dist/work/./dist/sdist/p-0.1.tar.gz ++Wrote tarball sdist to /cabal.dot-uv.dist/work/./dist/sdist/uv-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.project b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.test.hs new file mode 100644 index 00000000000..03f2535de4a --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.test.hs @@ -0,0 +1,12 @@ +import Test.Cabal.Prelude + +-- cabal.dot-uv.project has "packages: .". That package is uv.cabal but "cabal +-- sdist" writes sdist/p-0.1.tar.gz instead of the expected sdist/uv-0.1.tar.gz. +-- That is wrong, "cabal sdist" should respect the "--project-file" option but +-- instead probes the parent directory and picks up "../cabal.project" that has +-- "packages: Projects-Default-No/p". +-- +-- TODO: Fix this behaviour and apply the patch cabal.dot-uv.patch to update the +-- expected output to what we'd expect if "cabal sdist" respected the project. +main = cabalTest . withProjectFile "cabal.dot-uv.project" $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.v2.out new file mode 100644 index 00000000000..67bd3824161 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.v2.out @@ -0,0 +1,2 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/uv-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.v2.test.hs new file mode 100644 index 00000000000..5f6c3ba1a83 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.dot-uv.v2.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +-- cabal.dot-uv.project has "packages: .". That package is uv.cabal and "cabal +-- v2-sdist" writes sdist/uv-0.1.tar.gz. This is correct. +main = cabalTest . withProjectFile "cabal.dot-uv.project" $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.out new file mode 100644 index 00000000000..c4b60109a98 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.out @@ -0,0 +1,2 @@ +# cabal sdist +Wrote tarball sdist to /cabal.ignore-project.dist/work/./dist/sdist/uv-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.test.hs new file mode 100755 index 00000000000..6b77d12d2fe --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +-- This test correctly writes sdist/uv-0.1.tar.gz for the uv.cabal package. +main = cabalTest $ do + cabal "sdist" ["all", "--ignore-project"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.v2.out new file mode 100644 index 00000000000..e6f04ba9970 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.v2.out @@ -0,0 +1,2 @@ +# cabal v2-sdist +Wrote tarball sdist to /home/philderbeast/dev/src/cabalism/cabal/cabal-testsuite/PackageTests/SDist/Respect-Project-File/dist-newstyle/sdist/p-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.v2.test.hs new file mode 100755 index 00000000000..a159257eb68 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.ignore-project.v2.test.hs @@ -0,0 +1,8 @@ +import Test.Cabal.Prelude + +-- This test should have written sdist/uv-0.1.tar.gz for the uv.cabal package +-- but instead it probed up the directory tree, found a default cabal.project +-- and wrote sdist/p-0.1.tar.gz. That is incorrect. It didn't ignore the +-- project. +main = cabalTest $ do + cabal "v2-sdist" ["all", "--ignore-project"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.out new file mode 100644 index 00000000000..da8d99d249f --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.out @@ -0,0 +1,2 @@ +# cabal sdist +Wrote tarball sdist to /cabal.no-project.dist/work/./dist/sdist/p-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.test.hs new file mode 100755 index 00000000000..0002f9f4004 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.test.hs @@ -0,0 +1,9 @@ +import Test.Cabal.Prelude + +-- When no project is given, "cabal sdist" probes up the directory tree, finds a +-- default cabal.project and writes sdist/p-0.1.tar.gz. That is acceptable. An +-- alternative and reasonable expectation (but not the behaviour seen) is that +-- project probing would not occur and "cabal sdist" would work on the local +-- uv.cabal package. +main = cabalTest $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.v2.out new file mode 100644 index 00000000000..e6f04ba9970 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.v2.out @@ -0,0 +1,2 @@ +# cabal v2-sdist +Wrote tarball sdist to /home/philderbeast/dev/src/cabalism/cabal/cabal-testsuite/PackageTests/SDist/Respect-Project-File/dist-newstyle/sdist/p-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.v2.test.hs new file mode 100755 index 00000000000..5030fff5141 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.no-project.v2.test.hs @@ -0,0 +1,9 @@ +import Test.Cabal.Prelude + +-- When no project is given, "cabal v2-sdist" probes up the directory tree, +-- finds a default cabal.project and writes sdist/p-0.1.tar.gz. That is +-- acceptable. An alternative and reasonable expectation (but not the behaviour +-- seen) is that project probing would not occur and "cabal v2-sdist" would work +-- on the local uv.cabal package. +main = cabalTest $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.out new file mode 100644 index 00000000000..c96d15ee6bb --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.out @@ -0,0 +1,2 @@ +# cabal sdist +Wrote tarball sdist to /cabal.sub-pq.dist/work/./dist/sdist/p-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.patch b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.patch new file mode 100644 index 00000000000..a81b0f0099d --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.patch @@ -0,0 +1,8 @@ +diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.out +index c96d15ee6..12dcc1217 100644 +--- a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.out ++++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.out +@@ -1,2 +1,3 @@ + # cabal sdist + Wrote tarball sdist to /cabal.sub-pq.dist/work/./dist/sdist/p-0.1.tar.gz ++Wrote tarball sdist to /cabal.sub-pq.dist/work/./dist/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.project b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.project new file mode 100644 index 00000000000..36c6791d8c2 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.project @@ -0,0 +1 @@ +packages: p/ q/ diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.test.hs new file mode 100644 index 00000000000..19447044121 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.test.hs @@ -0,0 +1,12 @@ +import Test.Cabal.Prelude + +-- cabal.sub-pq.project has "packages: p/ q/" but "cabal sdist" only writes +-- sdist/p-0.1.tar.gz instead of the expected sdist/p-0.1.tar.gz and +-- sdist/q-0.1.tar.gz. That is wrong, "cabal sdist" should respect the +-- "--project-file" option but instead probes the parent directory and picks up +-- "../cabal.project" that has "packages: Projects-Default-No/p". +-- +-- TODO: Fix this behaviour and apply the patch cabal.sub-pq.patch to update the +-- expected output to what we'd expect if "cabal sdist" respected the project. +main = cabalTest . withProjectFile "cabal.sub-pq.project" $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.v2.out new file mode 100644 index 00000000000..f44e24e9567 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.v2.out @@ -0,0 +1,3 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/p-0.1.tar.gz +Wrote tarball sdist to /dist-newstyle/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.v2.test.hs new file mode 100644 index 00000000000..aec07983845 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-pq.v2.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +-- cabal.sub-pq.project has "packages: p/ q/" and "cabal v2-sdist" writes +-- sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz. This is correct. +main = cabalTest . withProjectFile "cabal.sub-pq.project" $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out new file mode 100644 index 00000000000..3a0a8e5f403 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out @@ -0,0 +1,2 @@ +# cabal sdist +Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/p-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.patch b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.patch new file mode 100644 index 00000000000..56dbbae23d5 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.patch @@ -0,0 +1,9 @@ +diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out +index 3a0a8e5f4..b4cced990 100644 +--- a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out ++++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out +@@ -1,2 +1,3 @@ + # cabal sdist +-Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/p-0.1.tar.gz ++Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/r-0.1.tar.gz ++Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/s-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.project b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.project new file mode 100644 index 00000000000..6a0bc8f2249 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.project @@ -0,0 +1 @@ +packages: r/ s/ diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.test.hs new file mode 100644 index 00000000000..3dd58bf6b97 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.test.hs @@ -0,0 +1,12 @@ +import Test.Cabal.Prelude + +-- cabal.sub-rs.project has "packages: r/ s/" but "cabal sdist" writes +-- sdist/p-0.1.tar.gz instead of the expected sdist/r-0.1.tar.gz and +-- sdist/s-0.1.tar.gz. That is wrong, "cabal sdist" should respect the +-- "--project-file" option but instead probes the parent directory and picks up +-- "../cabal.project" that has "packages: Projects-Default-No/p". +-- +-- TODO: Fix this behaviour and apply the patch cabal.sub-rs.patch to update the +-- expected output to what we'd expect if "cabal sdist" respected the project. +main = cabalTest . withProjectFile "cabal.sub-rs.project" $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.v2.out new file mode 100644 index 00000000000..f6ee642cc69 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.v2.out @@ -0,0 +1,3 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/r-0.1.tar.gz +Wrote tarball sdist to /dist-newstyle/sdist/s-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.v2.test.hs new file mode 100644 index 00000000000..66b8378a1cd --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.v2.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +-- cabal.sub-rs.project has "packages: r/ s/" and "cabal v2-sdist" writes +-- sdist/r-0.1.tar.gz and sdist/s-0.1.tar.gz. This is correct. +main = cabalTest . withProjectFile "cabal.sub-rs.project" $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/p/P.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/p/P.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/p/p.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/p/p.cabal new file mode 100644 index 00000000000..6a10e9f9985 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/p/p.cabal @@ -0,0 +1,8 @@ +name: p +version: 0.1 +build-type: Simple +cabal-version: >= 1.2 + +library + exposed-modules: P + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/q/Q.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/q/Q.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/q/q.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/q/q.cabal new file mode 100644 index 00000000000..30331517425 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/q/q.cabal @@ -0,0 +1,8 @@ +name: q +version: 0.1 +build-type: Simple +cabal-version: >= 1.2 + +library + exposed-modules: Q + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/r/R.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/r/R.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/r/r.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/r/r.cabal new file mode 100644 index 00000000000..8143b51865f --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/r/r.cabal @@ -0,0 +1,8 @@ +name: r +version: 0.1 +build-type: Simple +cabal-version: >= 1.2 + +library + exposed-modules: R + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/s/S.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/s/S.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/s/s.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/s/s.cabal new file mode 100644 index 00000000000..e30a1595f81 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/s/s.cabal @@ -0,0 +1,8 @@ +name: s +version: 0.1 +build-type: Simple +cabal-version: >= 1.2 + +library + exposed-modules: S + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/uv.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/uv.cabal new file mode 100644 index 00000000000..3205e54e0ba --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/uv.cabal @@ -0,0 +1,14 @@ +cabal-version: 3.0 +name: uv +version: 0.1 +build-type: Simple + +library U + visibility: public + exposed-modules: U + build-depends: base + +library V + visibility: public + exposed-modules: V + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/U.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/U.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/V.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/V.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.out new file mode 100644 index 00000000000..231e0d306b4 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.out @@ -0,0 +1,3 @@ +# cabal sdist +Wrote tarball sdist to /cabal.dot-uv.dist/work/./dist/sdist/p-0.1.tar.gz +Wrote tarball sdist to /cabal.dot-uv.dist/work/./dist/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.patch b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.patch new file mode 100644 index 00000000000..440c2fabf4c --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.patch @@ -0,0 +1,9 @@ +diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.out +index 231e0d306..a7ffc109e 100644 +--- a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.out ++++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.out +@@ -1,3 +1,2 @@ + # cabal sdist +-Wrote tarball sdist to /cabal.dot-uv.dist/work/./dist/sdist/p-0.1.tar.gz +-Wrote tarball sdist to /cabal.dot-uv.dist/work/./dist/sdist/q-0.1.tar.gz ++Wrote tarball sdist to /cabal.dot-uv.dist/work/./dist/sdist/uv-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.project b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.test.hs new file mode 100644 index 00000000000..7ca9d1fa282 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.test.hs @@ -0,0 +1,12 @@ +import Test.Cabal.Prelude + +-- cabal.dot-uv.project has "packages: .". That package is uv.cabal but "cabal +-- sdist" writes sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz instead of the +-- expected sdist/uv-0.1.tar.gz. That is wrong, "cabal sdist" should respect +-- the "--project-file" option but instead picks up the default "cabal.project" +-- that has "packages: p/ q/". +-- +-- TODO: Fix this behaviour and apply the patch cabal.dot-uv.patch to update the +-- expected output to what we'd expect if "cabal sdist" respected the project. +main = cabalTest . withProjectFile "cabal.dot-uv.project" $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.v2.out new file mode 100644 index 00000000000..67bd3824161 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.v2.out @@ -0,0 +1,2 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/uv-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.v2.test.hs new file mode 100644 index 00000000000..2df773c5510 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.dot-uv.v2.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +-- cabal.dot-uv.project has "packages: .". That package is uv.cabal and "cabal +-- v2-sdist" writes sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz. That is correct. +main = cabalTest . withProjectFile "cabal.dot-uv.project" $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.out new file mode 100644 index 00000000000..c4b60109a98 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.out @@ -0,0 +1,2 @@ +# cabal sdist +Wrote tarball sdist to /cabal.ignore-project.dist/work/./dist/sdist/uv-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.test.hs new file mode 100755 index 00000000000..6b77d12d2fe --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +-- This test correctly writes sdist/uv-0.1.tar.gz for the uv.cabal package. +main = cabalTest $ do + cabal "sdist" ["all", "--ignore-project"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.out new file mode 100644 index 00000000000..f44e24e9567 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.out @@ -0,0 +1,3 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/p-0.1.tar.gz +Wrote tarball sdist to /dist-newstyle/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.patch b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.patch new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.test.hs new file mode 100755 index 00000000000..e98c7717e4d --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.ignore-project.v2.test.hs @@ -0,0 +1,7 @@ +import Test.Cabal.Prelude + +-- This test doesn't ignore the project. It should have written +-- sdist/uv-0.1.tar.gz for the uv.cabal package but instead it wrote +-- sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz. +main = cabalTest $ do + cabal "v2-sdist" ["all", "--ignore-project"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.out new file mode 100644 index 00000000000..83f4cf0c160 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.out @@ -0,0 +1,3 @@ +# cabal sdist +Wrote tarball sdist to /cabal.no-project.dist/work/./dist/sdist/p-0.1.tar.gz +Wrote tarball sdist to /cabal.no-project.dist/work/./dist/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.test.hs new file mode 100755 index 00000000000..1699b269a2c --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.test.hs @@ -0,0 +1,10 @@ +import Test.Cabal.Prelude + +-- When no project is given, "cabal sdist" finds a default cabal.project that +-- has "packages: p/ q/" and writes sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz. +-- This is correct. +-- +-- TODO: Check that the code is behaving the same as it would have if +-- "--project-file=cabal.project" was given or if it is using project probing. +main = cabalTest $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.out new file mode 100644 index 00000000000..f44e24e9567 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.out @@ -0,0 +1,3 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/p-0.1.tar.gz +Wrote tarball sdist to /dist-newstyle/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.patch b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.patch new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.test.hs new file mode 100755 index 00000000000..10ffa0c5a4d --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.no-project.v2.test.hs @@ -0,0 +1,7 @@ +import Test.Cabal.Prelude + +-- When no project is given, "cabal v2-sdist" finds a default cabal.project that +-- has "packages: p/ q/" and writes sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz. +-- This is correct. +main = cabalTest $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project new file mode 100644 index 00000000000..36c6791d8c2 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project @@ -0,0 +1 @@ +packages: p/ q/ diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.out new file mode 100644 index 00000000000..b699a53c853 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.out @@ -0,0 +1,3 @@ +# cabal sdist +Wrote tarball sdist to /cabal.project.dist/work/./dist/sdist/p-0.1.tar.gz +Wrote tarball sdist to /cabal.project.dist/work/./dist/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.test.hs new file mode 100644 index 00000000000..6be41cfc24f --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.test.hs @@ -0,0 +1,7 @@ +import Test.Cabal.Prelude + +-- The given cabal.project has has "packages: p/ q/" and "cabal sdist" writes +-- sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz. This is correct but likely +-- accidental as the default cabal.project has the same packages. +main = cabalTest . withProjectFile "cabal.project" $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.v2.out new file mode 100644 index 00000000000..f44e24e9567 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.v2.out @@ -0,0 +1,3 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/p-0.1.tar.gz +Wrote tarball sdist to /dist-newstyle/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.v2.test.hs new file mode 100644 index 00000000000..f94f478f6ae --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.project.v2.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +-- The given cabal.project has has "packages: p/ q/" and "cabal v2-sdist" writes +-- sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz. This is correct. +main = cabalTest . withProjectFile "cabal.project" $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.out new file mode 100644 index 00000000000..12dcc1217e0 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.out @@ -0,0 +1,3 @@ +# cabal sdist +Wrote tarball sdist to /cabal.sub-pq.dist/work/./dist/sdist/p-0.1.tar.gz +Wrote tarball sdist to /cabal.sub-pq.dist/work/./dist/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.project b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.project new file mode 100644 index 00000000000..36c6791d8c2 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.project @@ -0,0 +1 @@ +packages: p/ q/ diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.test.hs new file mode 100644 index 00000000000..92995d4994b --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +-- cabal.sub-pq.project has "packages: p/ q/" and "cabal sdist" writes +-- sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz. This is correct. +main = cabalTest . withProjectFile "cabal.sub-pq.project" $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.v2.out new file mode 100644 index 00000000000..f44e24e9567 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.v2.out @@ -0,0 +1,3 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/p-0.1.tar.gz +Wrote tarball sdist to /dist-newstyle/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.v2.test.hs new file mode 100644 index 00000000000..aec07983845 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-pq.v2.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +-- cabal.sub-pq.project has "packages: p/ q/" and "cabal v2-sdist" writes +-- sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz. This is correct. +main = cabalTest . withProjectFile "cabal.sub-pq.project" $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.out new file mode 100644 index 00000000000..264d9e001ee --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.out @@ -0,0 +1,3 @@ +# cabal sdist +Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/p-0.1.tar.gz +Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/q-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.patch b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.patch new file mode 100644 index 00000000000..de09911d55a --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.patch @@ -0,0 +1,10 @@ +diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.out +index 264d9e001..b4cced990 100644 +--- a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.out ++++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.out +@@ -1,3 +1,3 @@ + # cabal sdist +-Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/p-0.1.tar.gz +-Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/q-0.1.tar.gz ++Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/r-0.1.tar.gz ++Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/s-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.project b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.project new file mode 100644 index 00000000000..6a0bc8f2249 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.project @@ -0,0 +1 @@ +packages: r/ s/ diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.test.hs new file mode 100644 index 00000000000..e20c7337d49 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.test.hs @@ -0,0 +1,12 @@ +import Test.Cabal.Prelude + +-- cabal.sub-rs.project has "packages: r/ s/" but "cabal sdist" writes +-- sdist/p-0.1.tar.gz and sdist/q-0.1.tar.gz instead of the expected +-- sdist/r-0.1.tar.gz and sdist/s-0.1.tar.gz. That is wrong, "cabal sdist" +-- should respect the "--project-file" option but instead picks up the default +-- "cabal.project" that has "packages: p/ q/". +-- +-- TODO: Fix this behaviour and apply the patch cabal.sub-rs.patch to update the +-- expected output to what we'd expect if "cabal sdist" respected the project. +main = cabalTest . withProjectFile "cabal.sub-rs.project" $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.v2.out new file mode 100644 index 00000000000..f6ee642cc69 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.v2.out @@ -0,0 +1,3 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/r-0.1.tar.gz +Wrote tarball sdist to /dist-newstyle/sdist/s-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.v2.test.hs new file mode 100644 index 00000000000..239f91b1e28 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/cabal.sub-rs.v2.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +-- cabal.sub-rs.project has "packages: r/ s/" and "cabal v2-sdist" writes +-- sdist/r-0.1.tar.gz and sdist/s-0.1.tar.gz. That is correct. +main = cabalTest . withProjectFile "cabal.sub-rs.project" $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/p/P.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/p/P.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/p/p.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/p/p.cabal new file mode 100644 index 00000000000..6a10e9f9985 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/p/p.cabal @@ -0,0 +1,8 @@ +name: p +version: 0.1 +build-type: Simple +cabal-version: >= 1.2 + +library + exposed-modules: P + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/q/Q.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/q/Q.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/q/q.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/q/q.cabal new file mode 100644 index 00000000000..30331517425 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/q/q.cabal @@ -0,0 +1,8 @@ +name: q +version: 0.1 +build-type: Simple +cabal-version: >= 1.2 + +library + exposed-modules: Q + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/r/R.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/r/R.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/r/r.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/r/r.cabal new file mode 100644 index 00000000000..8143b51865f --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/r/r.cabal @@ -0,0 +1,8 @@ +name: r +version: 0.1 +build-type: Simple +cabal-version: >= 1.2 + +library + exposed-modules: R + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/s/S.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/s/S.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/s/s.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/s/s.cabal new file mode 100644 index 00000000000..e30a1595f81 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/s/s.cabal @@ -0,0 +1,8 @@ +name: s +version: 0.1 +build-type: Simple +cabal-version: >= 1.2 + +library + exposed-modules: S + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/uv.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/uv.cabal new file mode 100644 index 00000000000..3205e54e0ba --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-Yes/uv.cabal @@ -0,0 +1,14 @@ +cabal-version: 3.0 +name: uv +version: 0.1 +build-type: Simple + +library U + visibility: public + exposed-modules: U + build-depends: base + +library V + visibility: public + exposed-modules: V + build-depends: base diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/README.md b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/README.md new file mode 100644 index 00000000000..0b3da4f9090 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/README.md @@ -0,0 +1,85 @@ +# Tests of sdist with `--project-file` + +``` +$ tree -P '*.project|*.test.hs' --prune +. +├── cabal.ignore-project.test.hs +├── cabal.ignore-project.v2.test.hs +├── cabal.no-project.test.hs +├── cabal.no-project.v2.test.hs +├── cabal.project +├── Projects-Default-No +│   ├── cabal.dot-uv.project +│   ├── cabal.dot-uv.test.hs +│   ├── cabal.dot-uv.v2.test.hs +│   ├── cabal.ignore-project.test.hs +│   ├── cabal.ignore-project.v2.test.hs +│   ├── cabal.no-project.test.hs +│   ├── cabal.no-project.v2.test.hs +│   ├── cabal.sub-pq.project +│   ├── cabal.sub-pq.test.hs +│   ├── cabal.sub-pq.v2.test.hs +│   ├── cabal.sub-rs.project +│   ├── cabal.sub-rs.test.hs +│   └── cabal.sub-rs.v2.test.hs +└── Projects-Default-Yes + ├── cabal.dot-uv.project + ├── cabal.dot-uv.test.hs + ├── cabal.dot-uv.v2.test.hs + ├── cabal.ignore-project.test.hs + ├── cabal.ignore-project.v2.test.hs + ├── cabal.no-project.test.hs + ├── cabal.no-project.v2.test.hs + ├── cabal.project + ├── cabal.project.test.hs + ├── cabal.project.v2.test.hs + ├── cabal.sub-pq.project + ├── cabal.sub-pq.test.hs + ├── cabal.sub-pq.v2.test.hs + ├── cabal.sub-rs.project + ├── cabal.sub-rs.test.hs + └── cabal.sub-rs.v2.test.hs + +3 directories, 34 files +``` + +There are of the two subdirectories, one has a `cabal.project` and the other +doesn't. This is the default project. There are three important things to notice +with these tests. + +1. All the tests with a supplied `--project-file` option pick up a default + `cabal.project` instead; either the one one in the current directory or the + one from the parent directory, one level up. I think this behaviour is wrong + and the supplied `--project-file` option should be respected. + + Before I'd put a project there, one level up, the project probing had gone + all the way up to Cabal's own `cabal.project` as can be seen by this diff + after that change: + + ```diff + $ git diff + ... + --- a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out + +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Projects-Default-No/cabal.sub-rs.out + @@ -1,12 +1,2 @@ + # cabal sdist + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/Cabal-3.11.0.0.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/cabal-testsuite-3.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/Cabal-syntax-3.11.0.0.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/cabal-install-3.11.0.0.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/cabal-install-solver-3.11.0.0.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/solver-benchmarks-3.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/Cabal-QuickCheck-3.11.0.0.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/Cabal-tree-diff-3.11.0.0.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/Cabal-described-3.11.0.0.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/Cabal-tests-3.tar.gz + -Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/cabal-benchmarks-3.tar.gz + +Wrote tarball sdist to /cabal.sub-rs.dist/work/./dist/sdist/p-0.1.tar.gz + ``` + +2. The `--ignore-project` option works, as witnessed by each + `cabal.ignore-project.test.hs` when the package in the same directory as the + test is used. + +3. The `*.v2.test.hs` are the same as their `*.test.hs` sibling tests but they + exercise the `v2-sdist` command instead of the `sdist` command. diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Z.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/Z.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.out new file mode 100644 index 00000000000..bba241f8f36 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.out @@ -0,0 +1,2 @@ +# cabal sdist +Wrote tarball sdist to /cabal.ignore-project.dist/work/./dist/sdist/z-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.test.hs new file mode 100755 index 00000000000..7d3628c2b43 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +-- This test correctly writes sdist/z-0.1.tar.gz for the z.cabal package. +main = cabalTest $ do + cabal "sdist" ["all", "--ignore-project"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.v2.out new file mode 100644 index 00000000000..dc7f939f86b --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.v2.out @@ -0,0 +1,2 @@ +# cabal sdist +Wrote tarball sdist to /cabal.ignore-project.v2.dist/work/./dist/sdist/z-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.v2.test.hs new file mode 100755 index 00000000000..7d3628c2b43 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.ignore-project.v2.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +-- This test correctly writes sdist/z-0.1.tar.gz for the z.cabal package. +main = cabalTest $ do + cabal "sdist" ["all", "--ignore-project"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.out new file mode 100644 index 00000000000..da8d99d249f --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.out @@ -0,0 +1,2 @@ +# cabal sdist +Wrote tarball sdist to /cabal.no-project.dist/work/./dist/sdist/p-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.test.hs new file mode 100755 index 00000000000..defb9406c3c --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.test.hs @@ -0,0 +1,7 @@ +import Test.Cabal.Prelude + +-- When no project is given, "cabal sdist" finds a default cabal.project that +-- has "packages: Projects-Default-No/p" and writes sdist/p-0.1.tar.gz. This is +-- correct. +main = cabalTest $ do + cabal "sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.v2.out b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.v2.out new file mode 100644 index 00000000000..63c0f0c36f1 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.v2.out @@ -0,0 +1,2 @@ +# cabal v2-sdist +Wrote tarball sdist to /dist-newstyle/sdist/p-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.v2.test.hs b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.v2.test.hs new file mode 100755 index 00000000000..d86a6792458 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.v2.test.hs @@ -0,0 +1,7 @@ +import Test.Cabal.Prelude + +-- When no project is given, "cabal v2-sdist" finds a default cabal.project that +-- has "packages: Projects-Default-No/p" and writes sdist/p-0.1.tar.gz. This is +-- correct. +main = cabalTest $ do + cabal "v2-sdist" ["all"] \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.project b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.project new file mode 100644 index 00000000000..c46fad9d90b --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.project @@ -0,0 +1 @@ +packages: Projects-Default-No/p \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/z.cabal b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/z.cabal new file mode 100644 index 00000000000..9a0cada3b71 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/z.cabal @@ -0,0 +1,8 @@ +name: z +version: 0.1 +build-type: Simple +cabal-version: >= 1.2 + +library + exposed-modules: Z + build-depends: base