Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/blackbox-tests/setup-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,9 @@ build () {
file_status() {
[ -e "$1" ] && echo "$1 exists" || echo "$1 missing"
}

strip_sandbox() {
# we want to substitute it to $SANDBOX
# shellcheck disable=SC2016
dune_cmd subst '[^ ]*.sandbox[/\\][^/\\]+' '$SANDBOX'
}
6 changes: 6 additions & 0 deletions test/blackbox-tests/test-cases/cram/dune
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
(cram
(applies_to hg-access)
(enabled_if %{bin-available:hg}))

(cram
(applies_to junction-cleanup)
(enabled_if
(= %{os_type} Win32))
(alias runtest-windows))
32 changes: 32 additions & 0 deletions test/blackbox-tests/test-cases/cram/junction-cleanup.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
On Windows, MSYS2 may create junctions (directory reparse points) instead of
proper symbolic links. OCaml's Unix.lstat returns ENOENT for junctions whose
targets are unreachable, which causes them to be invisible to directory cleanup.

This test verifies that the cram test runner can clean up after a test that
creates junctions.

This is currently not the case.

$ trap 'cmd /c "rmdir /s /q _build" 2>/dev/null' EXIT

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

Create a cram test that creates a junction inside its working directory:

$ cat > junction.t <<'EOF'
> $ echo hi > file
> $ cmd /c "mklink /j junction file" > /dev/null
> EOF

$ dune runtest 2>&1 | strip_sandbox
Error: failed to delete sandbox in
$SANDBOX
Reason:
$SANDBOX\default): Directory not empty
-> required by _build/default/.cram.junction.t/cram.out
-> required by alias junction
-> required by alias runtest
[1]
6 changes: 0 additions & 6 deletions test/blackbox-tests/test-cases/pkg/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ show_pkg() {
find "$prefix" | sort | dune_cmd subst "$prefix" ""
}

strip_sandbox() {
# we want to substitute it to $SANDBOX
# shellcheck disable=SC2016
dune_cmd subst '[^ ]*.sandbox/[^/]+' '$SANDBOX'
}

show_pkg_targets() {
local pkg=$1
local prefix
Expand Down
Loading