From 9231583ba95d7d6f6fd98db9bf4877a107bce86a Mon Sep 17 00:00:00 2001 From: Rodolphe Lepigre Date: Thu, 16 Mar 2023 09:15:17 +0100 Subject: [PATCH] Add repro for #7335. Signed-off-by: Rodolphe Lepigre Signed-off-by: Ali Caglayan --- .../root-detection.t/dep/dune-project | 1 + .../root-detection.t/dep/test2.opam | 0 .../workspaces/root-detection.t/dune-project | 1 + .../root-detection.t/dune-workspace | 1 + .../workspaces/root-detection.t/run.t | 53 +++++++++++++++++++ .../workspaces/root-detection.t/test1.opam | 0 6 files changed, 56 insertions(+) create mode 100644 test/blackbox-tests/test-cases/workspaces/root-detection.t/dep/dune-project create mode 100644 test/blackbox-tests/test-cases/workspaces/root-detection.t/dep/test2.opam create mode 100644 test/blackbox-tests/test-cases/workspaces/root-detection.t/dune-project create mode 100644 test/blackbox-tests/test-cases/workspaces/root-detection.t/dune-workspace create mode 100644 test/blackbox-tests/test-cases/workspaces/root-detection.t/run.t create mode 100644 test/blackbox-tests/test-cases/workspaces/root-detection.t/test1.opam diff --git a/test/blackbox-tests/test-cases/workspaces/root-detection.t/dep/dune-project b/test/blackbox-tests/test-cases/workspaces/root-detection.t/dep/dune-project new file mode 100644 index 00000000000..0ececa7d7ff --- /dev/null +++ b/test/blackbox-tests/test-cases/workspaces/root-detection.t/dep/dune-project @@ -0,0 +1 @@ +(lang dune 3.8) diff --git a/test/blackbox-tests/test-cases/workspaces/root-detection.t/dep/test2.opam b/test/blackbox-tests/test-cases/workspaces/root-detection.t/dep/test2.opam new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/blackbox-tests/test-cases/workspaces/root-detection.t/dune-project b/test/blackbox-tests/test-cases/workspaces/root-detection.t/dune-project new file mode 100644 index 00000000000..0ececa7d7ff --- /dev/null +++ b/test/blackbox-tests/test-cases/workspaces/root-detection.t/dune-project @@ -0,0 +1 @@ +(lang dune 3.8) diff --git a/test/blackbox-tests/test-cases/workspaces/root-detection.t/dune-workspace b/test/blackbox-tests/test-cases/workspaces/root-detection.t/dune-workspace new file mode 100644 index 00000000000..0ececa7d7ff --- /dev/null +++ b/test/blackbox-tests/test-cases/workspaces/root-detection.t/dune-workspace @@ -0,0 +1 @@ +(lang dune 3.8) diff --git a/test/blackbox-tests/test-cases/workspaces/root-detection.t/run.t b/test/blackbox-tests/test-cases/workspaces/root-detection.t/run.t new file mode 100644 index 00000000000..be4bedd4564 --- /dev/null +++ b/test/blackbox-tests/test-cases/workspaces/root-detection.t/run.t @@ -0,0 +1,53 @@ +This test checks the + + $ unset INSIDE_DUNE + + $ ls . dep + .: + dep + dune-project + dune-workspace + test1.opam + + dep: + dune-project + test2.opam + +Testing the root detection for: + +- dune build -p packages +- dune build +- dune clean + +First we test in the workspace root. We expect the root to be the same directory +since that is where the dune-workspace file lives. + + $ dune build -p test2 --verbose |& grep -A 1 'Workspace root:' + Workspace root: + $TESTCASE_ROOT + $ dune build -p test1 --verbose |& grep -A 1 'Workspace root:' + Workspace root: + $TESTCASE_ROOT + $ dune build --verbose |& grep -A 1 'Workspace root:' + Workspace root: + $TESTCASE_ROOT + $ dune clean --verbose |& grep -A 1 'Workspace root:' + Workspace root: + $TESTCASE_ROOT + +Next we try inside the dep directory. We expect the root to be the parent +directory since that is where the dune-workspace file lives. However strangely +for -p this doesn't appear to be the case. + + $ (cd dep && dune build -p test2 --verbose |& grep -A 1 'Workspace root:') + Workspace root: + $TESTCASE_ROOT/dep + $ (cd dep && dune build -p test1 --verbose |& grep -A 1 'Workspace root:') + Workspace root: + $TESTCASE_ROOT/dep + $ (cd dep && dune build --verbose |& grep -A 1 'Workspace root:') + Workspace root: + $TESTCASE_ROOT + $ (cd dep && dune clean --verbose |& grep -A 1 'Workspace root:') + Workspace root: + $TESTCASE_ROOT diff --git a/test/blackbox-tests/test-cases/workspaces/root-detection.t/test1.opam b/test/blackbox-tests/test-cases/workspaces/root-detection.t/test1.opam new file mode 100644 index 00000000000..e69de29bb2d