Skip to content
Open
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ test-melange: $(BIN)
$(BIN) build @runtest-melange

test-all: $(BIN)
$(BIN) build @runtest @runtest-js @runtest-rocq @runtest-melange
DUNE_ROCQ_TEST=enable $(BIN) build @runtest @runtest-js @runtest-rocq @runtest-melange
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want this, right @Alizter?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think its fine. Otherwise the runtest-rocq alias will not build. We don't use test-all in CI anyway.


test-ox: $(BIN)
$(BIN) runtest test/blackbox-tests/test-cases/oxcaml
Expand Down
2 changes: 2 additions & 0 deletions doc/changes/fixed/14093.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix Rocq configuration detection to use `rocq c --config` subcommand
instead of `rocq --config` (#14093, fixes #13774, @Durbatuluk1701)
6 changes: 3 additions & 3 deletions src/dune_rules/rocq/rocq_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,15 @@ let impl_config bin =
~output_limit:Execution_parameters.Action_output_limit.default)
Return
bin
[ "--config" ]
[ "c"; "--config" ]
;;

let config_memo = Memo.create "rocq-config" ~input:(module Path) impl_config

let make ~(rocq : Action.Prog.t) =
let open Memo.O in
let+ config_output =
get_output_from_config_or_version ~rocq ~what:"--config" config_memo
get_output_from_config_or_version ~rocq ~what:"c --config" config_memo
in
let open Result.O in
let* config_output = config_output in
Expand All @@ -243,7 +243,7 @@ let make ~(rocq : Action.Prog.t) =
let rocq_native_compiler_default = Vars.get_opt vars "COQ_NATIVE_COMPILER_DEFAULT" in
Ok { rocqlib; rocq_native_compiler_default }
| Error msg ->
User_error.raise Pp.[ textf "Cannot parse output of rocq --config:"; msg ]
User_error.raise Pp.[ textf "Cannot parse output of 'rocq c --config':"; msg ]
;;

let by_name { rocqlib; rocq_native_compiler_default } name =
Expand Down
6 changes: 3 additions & 3 deletions src/dune_rules/rocq/rocq_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ end
(** Data of a Rocq configuration. *)
type t

(** [make ~rocq] runs rocq --config and returns the configuration data. Exceptionally, one
(** [make ~rocq] runs [rocq c --config] and returns the configuration data. Exceptionally, one
of the following will happen:

- Return [Error message] if rocq --config exits with a non-zero code.
- Throw a user error if rocq --config is not parsable.
- Return [Error message] if rocq c --config exits with a non-zero code.
- Throw a user error if rocq c --config is not parsable.
- Throw an [Action.Prog.Not_found] exception if the rocq binary is not found. *)
val make : rocq:Action.Prog.t -> (t, User_message.Style.t Pp.t) result Memo.t

Expand Down
8 changes: 4 additions & 4 deletions src/dune_rules/rocq/rocq_path.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ let config_path_exn rocq_config key =
(* This should never happen *)
Code_error.raise "key is not a path" [ key, Rocq_config.Value.to_dyn path ])
| None ->
(* This happens if the output of rocq --config doesn't include the key *)
(* This happens if the output of rocq c --config doesn't include the key *)
User_error.raise
[ Pp.concat
~sep:Pp.space
[ Pp.text "key not found from"; User_message.command "rocq --config" ]
[ Pp.text "key not found from"; User_message.command "rocq c --config" ]
|> Pp.hovbox
; Pp.text key
]
Expand Down Expand Up @@ -144,7 +144,7 @@ let of_rocq_install rocq =
[ Pp.concat
~sep:Pp.space
[ Pp.text "Skipping installed theories due to"
; User_message.command "rocq --config"
; User_message.command "rocq c --config"
; Pp.text "failure:"
]
|> Pp.hovbox
Expand All @@ -154,7 +154,7 @@ let of_rocq_install rocq =
[ Pp.concat
~sep:Pp.space
[ Pp.text "Try running"
; User_message.command "rocq --config"
; User_message.command "rocq c --config"
; Pp.text "manually to see the error."
]
|> Pp.hovbox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The flags passed to coqc:
{
"name": "rocq",
"args": [
"c",
"--config"
]
}
Expand Down
26 changes: 13 additions & 13 deletions test/blackbox-tests/test-cases/rocq/failed-config.t/run.t
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Here we test what happens when rocq --config or --print-version fails in an unexpected way
Here we test what happens when rocq c --config or --print-version fails in an unexpected way
and how dune reacts to this failure.

First we create a wrapper around coqc so we can make it fail. It should only fail on
--config and --print-version.
$ mkdir bin
$ cat > bin/rocq <<'EOF'
> #!/bin/sh
> if [ "$1" = --config ] && [ -n "$FAIL_CONFIG" ]; then
> echo "rocq --config has failed for some reason" >&2
> if [ "$1" = c ] && [ "$2" = --config ] && [ -n "$FAIL_CONFIG" ]; then
> echo "rocq c --config has failed for some reason" >&2
> exit 1
> elif [ "$1" = --print-version ] && [ -n "$FAIL_VERSION" ]; then
> echo "rocq --print-version has failed for some reason" >&2
Expand All @@ -23,13 +23,13 @@ To make sure these are working correctly we test them.

These should succeed.
$ rocq --print-version > /dev/null
$ rocq --config > /dev/null
$ rocq c --config > /dev/null
These should fail.
$ FAIL_VERSION=1 \
> rocq --print-version 2> /dev/null
[1]
$ FAIL_CONFIG=1 \
> rocq --config 2> /dev/null
> rocq c --config 2> /dev/null
[1]

Now we create a simple project that uses this coqc wrapper, should
Expand All @@ -52,9 +52,9 @@ Should fail: first warning that installed theories are being skipped due to the
failure, then, as the library requires the stdlib, it fails:
$ FAIL_CONFIG=1 \
> dune build
Warning: Skipping installed theories due to 'rocq --config' failure:
- $TESTCASE_ROOT/bin/rocq --config failed with exit code 1.
Hint: Try running 'rocq --config' manually to see the error.
Warning: Skipping installed theories due to 'rocq c --config' failure:
- $TESTCASE_ROOT/bin/rocq c --config failed with exit code 1.
Hint: Try running 'rocq c --config' manually to see the error.
Couldn't find Rocq standard library, and theory is not using (stdlib no)
-> required by _build/default/.foo.theory.d
-> required by alias all
Expand Down Expand Up @@ -82,9 +82,9 @@ Should succeed, warning that installed theories are being skipped due to the
failure (c.f. #8958):
$ FAIL_CONFIG=1 \
> dune build
Warning: Skipping installed theories due to 'rocq --config' failure:
- $TESTCASE_ROOT/bin/rocq --config failed with exit code 1.
Hint: Try running 'rocq --config' manually to see the error.
Warning: Skipping installed theories due to 'rocq c --config' failure:
- $TESTCASE_ROOT/bin/rocq c --config failed with exit code 1.
Hint: Try running 'rocq c --config' manually to see the error.

$ FAIL_VERSION=1 \
> dune build
Expand Down Expand Up @@ -127,14 +127,14 @@ however a failing --print-version will not.
> EOF

Should fail.
$ export coqlib="$(rocq --config | grep COQLIB | sed 's/COQLIB=//')"
$ export coqlib="$(rocq c --config | grep COQLIB | sed 's/COQLIB=//')"
$ FAIL_CONFIG=1 \
> dune build @config
File "dune", line 4, characters 8-23:
4 | (echo %{rocq:rocqlib})))
^^^^^^^^^^^^^^^
Error: Could not expand %{rocq:rocqlib} as running rocq failed.
$TESTCASE_ROOT/bin/rocq --config failed with exit code 1.
$TESTCASE_ROOT/bin/rocq c --config failed with exit code 1.
[1]

Should succeed.
Expand Down
18 changes: 9 additions & 9 deletions test/blackbox-tests/test-cases/rocq/flags.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Test case: default flags
> }

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-w","-deprecated-native-compiler-option","-w","-native-compiler-disabled","-native-compiler","ondemand","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -36,7 +36,7 @@ TC: :standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-w","-deprecated-native-compiler-option","-w","-native-compiler-disabled","-native-compiler","ondemand","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -49,7 +49,7 @@ TC: override :standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-w","-deprecated-native-compiler-option","-w","-native-compiler-disabled","-native-compiler","ondemand","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -62,7 +62,7 @@ TC: add to :standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-type-in-type","-w","-deprecated-native-compiler-option","-w","-native-compiler-disabled","-native-compiler","ondemand","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -80,7 +80,7 @@ TC: extend in workspace + override standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-type-in-type","-w","-deprecated-native-compiler-option","-w","-native-compiler-disabled","-native-compiler","ondemand","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -92,7 +92,7 @@ TC: extend in workspace + override standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-type-in-type","-w","-deprecated-native-compiler-option","-w","-native-compiler-disabled","-native-compiler","ondemand","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -105,7 +105,7 @@ TC: extend in dune (env) + override standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-type-in-type","-w","-deprecated-native-compiler-option","-w","-native-compiler-disabled","-native-compiler","ondemand","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -118,7 +118,7 @@ TC: extend in dune (env) + standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-type-in-type","-type-in-type","-w","-deprecated-native-compiler-option","-w","-native-compiler-disabled","-native-compiler","ondemand","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -136,6 +136,6 @@ TC: extend in dune (env) + workspace + standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-type-in-type","-bt","-w","-deprecated-native-compiler-option","-w","-native-compiler-disabled","-native-compiler","ondemand","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The flags passed to coqc:
{
"name": "rocq",
"args": [
"c",
"--config"
]
}
Expand Down
18 changes: 9 additions & 9 deletions test/blackbox-tests/test-cases/rocq/rocq-native/flags.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Test case: default flags
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -36,7 +36,7 @@ TC: :standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -49,7 +49,7 @@ TC: override :standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -62,7 +62,7 @@ TC: add to :standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -80,7 +80,7 @@ TC: extend in workspace + override standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -92,7 +92,7 @@ TC: extend in workspace + override standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -105,7 +105,7 @@ TC: extend in dune (env) + override standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -118,7 +118,7 @@ TC: extend in dune (env) + standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-type-in-type","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

Expand All @@ -136,6 +136,6 @@ TC: extend in dune (env) + workspace + standard
> EOF

$ runFlags
{"name":"rocq","args":["--config"]}
{"name":"rocq","args":["c","--config"]}
{"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
{"name":"rocq","args":["compile","-q","-type-in-type","-bt","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}
Loading