Skip to content

cram tests: spurious error when transforming a single-file test into a directory test #4067

@gasche

Description

@gasche

Turning a single-file test into a directory test of the same name results in a spurious Error: rename error when running the test (when a correction is suggested). Running dune clean removes the error.

Reproduction log:

# setup a dune build with cram tests
mkdir /tmp/dune-repro
cd /tmp/dune-repro
echo -e '(lang dune 2.7)\n(cram enable)' > dune-project
echo '(cram)' > dune

# create a single-file cram test
echo '  $ echo foo' > foo.t
dune runtest
# observed output (expected):
#> Done: 1/3 (jobs: 1)File "foo.t", line 1, characters 0-0:
#>          git (internal) (exit 1)
#> (cd _build/.sandbox/53ba0b6890f632ed2825af17d98ea871/default && /usr/bin/git diff --no-index --color=always  -u ../../../default/foo.t foo.t.corrected)
#> diff --git a/../../../default/foo.t b/foo.t.corrected
#> index 23f0c93..44d18a4 100644
#> --- a/../../../default/foo.t
#> +++ b/foo.t.corrected
#> @@ -1 +1,2 @@
#>   $ echo foo
#> +  foo

# turn it into a directory test
mv foo.t run.t
mkdir foo.t
mv run.t foo.t/
dune runtest
# observed output: the last three lines are a bug
#> Done: 1/3 (jobs: 1)File "foo.t/run.t", line 1, characters 0-0:
#>          git (internal) (exit 1)
#> (cd _build/.sandbox/1287078d02428d94feb6d2a85cb090a0/default && /usr/bin/git diff --no-index --color=always -u ../../../default/foo.t/run.t foo.t/run.t.corrected)
#> diff --git a/../../../default/foo.t/run.t b/foo.t/run.t.corrected
#> index 23f0c93..44d18a4 100644
#> --- a/../../../default/foo.t/run.t
#> +++ b/foo.t/run.t.corrected
#> @@ -1 +1,2 @@
#>    $ echo foo
#> +  foo
#> Error: rename:     
#> _build/.sandbox/1287078d02428d94feb6d2a85cb090a0/default/foo.t/run.t.corrected:
#> Not a directory

# cleaning fixes the issue
dune clean
dune runtest
# observed output (expected):
#> Done: 1/3 (jobs: 1)File "foo.t/run.t", line 1, characters 0-0:
#>          git (internal) (exit 1)
#> (cd _build/.sandbox/1287078d02428d94feb6d2a85cb090a0/default && /usr/bin/git diff --no-index --color=always -u ../../../default/foo.t/run.t foo.t/run.t.corrected)
#> diff --git a/../../../default/foo.t/run.t b/foo.t/run.t.corrected
#> index 23f0c93..44d18a4 100644
#> --- a/../../../default/foo.t/run.t
#> +++ b/foo.t/run.t.corrected
#> @@ -1 +1,2 @@
#>    $ echo foo
#> +  foo
#> Done: 1/3 (jobs: 1)

Specifications

  • Version of dune: 2.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions