From e886e948b7b2c1bbd2c06ca6576b4b6362c4faa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Dimino?= Date: Fri, 29 Jun 2018 12:44:51 +0100 Subject: [PATCH] Add a test where an action modify one of its dependency (#923) Signed-off-by: Jeremie Dimino --- test/blackbox-tests/dune.inc | 10 +++++++++ .../action-modifying-a-dependency/data | 1 + .../action-modifying-a-dependency/dune | 5 +++++ .../dune-project | 1 + .../action-modifying-a-dependency/run.t | 22 +++++++++++++++++++ 5 files changed, 39 insertions(+) create mode 100644 test/blackbox-tests/test-cases/action-modifying-a-dependency/data create mode 100644 test/blackbox-tests/test-cases/action-modifying-a-dependency/dune create mode 100644 test/blackbox-tests/test-cases/action-modifying-a-dependency/dune-project create mode 100644 test/blackbox-tests/test-cases/action-modifying-a-dependency/run.t diff --git a/test/blackbox-tests/dune.inc b/test/blackbox-tests/dune.inc index d1f402ab..6908f857 100644 --- a/test/blackbox-tests/dune.inc +++ b/test/blackbox-tests/dune.inc @@ -1,3 +1,11 @@ +(alias + (name action-modifying-a-dependency) + (deps (package dune) (source_tree test-cases/action-modifying-a-dependency)) + (action + (chdir + test-cases/action-modifying-a-dependency + (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) + (alias (name aliases) (deps (package dune) (source_tree test-cases/aliases)) @@ -566,6 +574,7 @@ (alias (name runtest) (deps + (alias action-modifying-a-dependency) (alias aliases) (alias bad-alias-error) (alias block-strings) @@ -635,6 +644,7 @@ (alias (name runtest-no-deps) (deps + (alias action-modifying-a-dependency) (alias aliases) (alias bad-alias-error) (alias block-strings) diff --git a/test/blackbox-tests/test-cases/action-modifying-a-dependency/data b/test/blackbox-tests/test-cases/action-modifying-a-dependency/data new file mode 100644 index 00000000..ce013625 --- /dev/null +++ b/test/blackbox-tests/test-cases/action-modifying-a-dependency/data @@ -0,0 +1 @@ +hello diff --git a/test/blackbox-tests/test-cases/action-modifying-a-dependency/dune b/test/blackbox-tests/test-cases/action-modifying-a-dependency/dune new file mode 100644 index 00000000..a329100d --- /dev/null +++ b/test/blackbox-tests/test-cases/action-modifying-a-dependency/dune @@ -0,0 +1,5 @@ +;; This test erroneously modify one of its dependencies +(alias + (name x) + (deps data (universe)) + (action (system "echo hello >> data"))) diff --git a/test/blackbox-tests/test-cases/action-modifying-a-dependency/dune-project b/test/blackbox-tests/test-cases/action-modifying-a-dependency/dune-project new file mode 100644 index 00000000..de4fc209 --- /dev/null +++ b/test/blackbox-tests/test-cases/action-modifying-a-dependency/dune-project @@ -0,0 +1 @@ +(lang dune 1.0) diff --git a/test/blackbox-tests/test-cases/action-modifying-a-dependency/run.t b/test/blackbox-tests/test-cases/action-modifying-a-dependency/run.t new file mode 100644 index 00000000..a7bd13ee --- /dev/null +++ b/test/blackbox-tests/test-cases/action-modifying-a-dependency/run.t @@ -0,0 +1,22 @@ +In this test the "x" alias depends on the file "data" but the action +associated to "x" appends a line to "data". The current behavior is +that the file in _build just keeps growing. The expected behavior is +an error from Dune telling the user that this is not allowed. + + $ dune build @x + $ cat _build/default/data + hello + hello + + $ dune build @x + $ cat _build/default/data + hello + hello + hello + + $ dune build @x + $ cat _build/default/data + hello + hello + hello + hello