Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch Io's Sys_error too when retrieving files from cache. #3628

Merged
merged 3 commits into from
Jul 17, 2020
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
3 changes: 3 additions & 0 deletions src/dune/build_system.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,9 @@ end = struct
f
];
false
| exception Sys_error m ->
Log.info [ Pp.textf "error retrieving data file: %s" m ];
rgrinberg marked this conversation as resolved.
Show resolved Hide resolved
false
| () -> true )
| _ -> false
in
Expand Down
13 changes: 13 additions & 0 deletions test/blackbox-tests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,17 @@
test-cases/dune-cache/dedup-direct-copy.t
(progn (run dune-cram run run.t) (diff? run.t run.t.corrected)))))

(rule
(alias dune-cache-missing-data)
(deps
(package dune)
(source_tree test-cases/dune-cache/missing-data)
(alias test-deps))
(action
(chdir
test-cases/dune-cache/missing-data
(progn (run dune-cram run run.t) (diff? run.t run.t.corrected)))))

(rule
(alias dune-cache-promote)
(deps
Expand Down Expand Up @@ -3209,6 +3220,7 @@
(alias dune-cache-dedup)
(alias dune-cache-dedup-direct)
(alias dune-cache-dedup-direct-copy)
(alias dune-cache-missing-data)
(alias dune-cache-promote)
(alias dune-cache-promote-copy)
(alias dune-cache-promote-direct)
Expand Down Expand Up @@ -3514,6 +3526,7 @@
(alias dune-cache-dedup)
(alias dune-cache-dedup-direct)
(alias dune-cache-dedup-direct-copy)
(alias dune-cache-missing-data)
(alias dune-cache-promote)
(alias dune-cache-promote-copy)
(alias dune-cache-promote-direct)
Expand Down
23 changes: 23 additions & 0 deletions test/blackbox-tests/test-cases/dune-cache/missing-data/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Check that missing data files simply make the cached rule invalid.

$ cat > config <<EOF
> (lang dune 2.1)
> (cache enabled)
> (cache-duplication copy)
> (cache-transport direct)
> EOF
$ cat > dune-project <<EOF
> (lang dune 2.1)
> EOF
$ cat > dune <<EOF
> (rule
> (deps source)
> (targets target)
> (action (bash "cat source source > target")))
> EOF
$ cat > source <<EOF
> \_o< COIN
> EOF
$ env XDG_RUNTIME_DIR=$PWD/.xdg-runtime XDG_CACHE_HOME=$PWD/.xdg-cache dune build --config-file=config target
$ rm -rf _build $PWD/.xdg-cache/dune/db/files/v3/
$ env XDG_RUNTIME_DIR=$PWD/.xdg-runtime XDG_CACHE_HOME=$PWD/.xdg-cache dune build --config-file=config target