Skip to content

runtest in tests behave badly when using dune lang 3.0 #4776

@voodoos

Description

@voodoos

On main, when in a test using dune lang 3.0, calling dune runtest from inside the test triggers an unexpected diff with the run.t file itself, as if the sandbox was breached.

Here is a test illustrating the issue:

  $ cat >dune-project <<EOF
  > (lang dune 2.8)
  > EOF

  $ cat >dune <<EOF
  > (rule
  >  (alias runtest)
  >  (action (diff hello.expected hello.output)))
  > EOF

  $ echo 'foo' > hello.expected 
  $ echo 'foo' > hello.output 

  $ dune runtest

  $ cat >dune-project <<EOF
  > (lang dune 3.0)
  > EOF

  $ dune runtest
  File "run.t", line 1, characters 0-0:
  Error: Files _build/default/run.t and _build/default/run.t.corrected differ.
  [1]

I discovered this while writing tests for the new mds stanza. It sometimes led me to an infinite nesting of sandbox folders:

_build/.sandbox/40844c15a584a31fa740640e0eb87c89/default/test/blackbox-tests/test-cases/mdx-stanza/new-deps-field.t
/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9
/default/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build/.sandbox
/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build
/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default
/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9
/default/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build/.sandbox
/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build
/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default
/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/default/_build/.sandbox/4d7d3316b70f5fc71abfb2d8c509c0d9/

However I am not sure yet what triggers the infinite nesting.

If i add another $ dune runtest at the end of the test it just hangs with 100% cpu.

Metadata

Metadata

Assignees

Labels

cramRelated to the cram test execution in Dune

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions