File tree Expand file tree Collapse file tree 3 files changed +70
-1
lines changed
test-cases/directory-targets Expand file tree Collapse file tree 3 files changed +70
-1
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,6 @@ module Produced = struct
203203 ; Pp. verbatim (Unix. error_message unix_error)
204204 ]
205205 | Unsupported_file (file , kind ) ->
206- (* CR-soon amokhov: This case is untested. *)
207206 [ Pp. textf
208207 " Rule produced file %S with unrecognised kind %S"
209208 (Path.Build. drop_build_context_maybe_sandboxed_exn file
Original file line number Diff line number Diff line change 1+ Test that dune produces a clear error when a rule creates special files
2+ in its output .
3+
4+ FIFO :
5+
6+ $ cat > dune-project <<EOF
7+ > (lang dune 3.22 )
8+ > (using directory-targets 0.1 )
9+ > EOF
10+
11+ $ cat > dune <<EOF
12+ > (rule
13+ > (targets (dir output))
14+ > (action
15+ > (progn
16+ > (run mkdir -p output)
17+ > (run mkfifo output/ myfifo))))
18+ > EOF
19+
20+ $ dune build output
21+ File "dune ", lines 1-6 , characters 0-110 :
22+ 1 | (rule
23+ 2 | (targets (dir output))
24+ 3 | (action
25+ 4 | (progn
26+ 5 | (run mkdir -p output)
27+ 6 | (run mkfifo output/ myfifo))))
28+ Error : Rule produced file "output /myfifo " with unrecognised kind "S_FIFO "
29+ [1 ]
30+
31+ $ rm -rf _build
32+
33+ Socket :
34+
35+ $ cat > dune <<EOF
36+ > (rule
37+ > (targets (dir output))
38+ > (action
39+ > (progn
40+ > (run mkdir -p output)
41+ > (run dune_cmd mksocket output/ mysocket))))
42+ > EOF
43+
44+ $ dune build output
45+ File "dune ", lines 1-6 , characters 0-123 :
46+ 1 | (rule
47+ 2 | (targets (dir output))
48+ 3 | (action
49+ 4 | (progn
50+ 5 | (run mkdir -p output)
51+ 6 | (run dune_cmd mksocket output/ mysocket))))
52+ Error : Rule produced file "output /mysocket " with unrecognised kind "S_SOCK "
53+ [1 ]
Original file line number Diff line number Diff line change @@ -334,6 +334,23 @@ module Wait_for_file_to_appear = struct
334334 let () = register name of_args run
335335end
336336
337+ module Mksocket = struct
338+ let name = " mksocket"
339+
340+ let of_args = function
341+ | [ path ] -> path
342+ | _ -> raise (Arg. Bad " Usage: dune_cmd mksocket <path>" )
343+ ;;
344+
345+ let run path =
346+ let sock = Unix. socket Unix. PF_UNIX Unix. SOCK_STREAM 0 in
347+ Unix. bind sock (Unix. ADDR_UNIX path);
348+ Unix. close sock
349+ ;;
350+
351+ let () = register name of_args run
352+ end
353+
337354(* implements `exec -a` in a portable way *)
338355module Exec_a = struct
339356 type t =
You can’t perform that action at this time.
0 commit comments