Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
80a5248
cram_exec - add shell_spec to action spec
haochenx Jul 6, 2023
506ff24
cram - add (shell ..) option to the (cram) stanza
haochenx Jul 6, 2023
7273d46
cram - shell-opt.t - add one test case
haochenx Jul 6, 2023
8d34734
fix tests: test/blackbox-tests/test-cases/cram/shell-opt.t
haochenx Jul 6, 2023
5850f0c
add test/blackbox-tests/test-cases/cram/shell-opt-zsh.t
haochenx Jul 6, 2023
96e8204
make fmt
haochenx Jul 6, 2023
60de1af
move Cram_stanza.shell_spec to Dune_lang.Shell_spec.t
haochenx Jul 7, 2023
c5724de
cram - add (shell ..) option to the (cram) user action
haochenx Jul 7, 2023
6aa7773
restrict (shell ..) option on (cram ..) to (lang dune 3.10) or later
haochenx Jul 7, 2023
dae85d8
cram - small fix of document
haochenx Jul 7, 2023
6b8218a
cram - add document describing (shell ..) option
haochenx Jul 7, 2023
d05b7c0
Merge branch 'main' into cram-shell-spec
haochenx Jul 7, 2023
3350047
add change log entry for #8134
haochenx Jul 7, 2023
2a23c30
address review comments: CHANGES
haochenx Jul 8, 2023
716b5fc
address review comments: Dune_lang.Action.Cram arg: record => tuple
haochenx Jul 8, 2023
f3abb2f
address review comments: Dune_lang.Shell_spec: +map and some comments
haochenx Jul 8, 2023
e557e4f
address review comments: format cram-action-shell-opt.t
haochenx Jul 8, 2023
1669115
address review comments: fix encoder bug in dune_lang/action.ml
haochenx Jul 8, 2023
071f56c
address review comments: replace Cram_exec.Shell_spec.t with Path.t
haochenx Jul 8, 2023
2363502
attempt fix bug
haochenx Jul 8, 2023
1721f66
Apply suggestions from code review - doc wording
haochenx Jul 11, 2023
5dfe145
Merge branch 'main' into cram-shell-spec
haochenx Jul 11, 2023
78a5ab8
Merge branch 'main' into cram-shell-spec
haochenx Jul 11, 2023
e291312
Merge branch 'main' into cram-shell-spec
haochenx Jul 11, 2023
c686868
Merge remote-tracking branch 'up/main' into cram-shell-spec
haochenx Sep 25, 2023
fbc7b4f
reflect review comments
haochenx Sep 25, 2023
9dbb040
fix CHANGES.md
haochenx Sep 25, 2023
25c1cc0
bump to 3.12
haochenx Sep 25, 2023
c3a06f5
correct dune language version
haochenx Sep 25, 2023
1993b95
fix tests and doc
haochenx Sep 25, 2023
544d9f2
no optional encoded action
haochenx Sep 25, 2023
5a8f2de
fix hint text in Cram_stanza.system_shell_prog
haochenx Sep 25, 2023
35fb63d
remove extra space
christinerose Oct 2, 2023
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
Prev Previous commit
Next Next commit
correct dune language version
Signed-off-by: Haochen M. Kotoi-Xie <hx@kxc.inc>
  • Loading branch information
haochenx committed Sep 25, 2023
commit c3a06f5e29cfc0960048c402e07af51770dc7fa7
7 changes: 2 additions & 5 deletions doc/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -674,17 +674,14 @@ The ``cram`` stanza accepts the following fields:
- ``deps`` - dependencies of the test
- ``(package <package-name>)`` - attach the tests selected by this stanza to the
specified package
- ``(shell <shell-spec>)`` - (available since Dune 3.10) specify the shell to be
used when executing the commands in Cram test files. ``<shell-spec>`` can now
- ``(shell <shell-prog> <args>..)`` - (available since Dune 3.12) specify the shell to be
used when executing the commands in Cram test files. ``<shell-prog>`` can now
be one of the following values:

- ``:system`` - this stipulates that the system shell (that is, what you get
with ``/usr/bin/env sh``) should be used. This is the default when this
field does not present.

- ``:bash`` - this stipulates that the Bourne Again shell (that is, what you
get with ``/usr/bin/env bash``) should be used.

- ``<dep>`` - ``<dep>`` should specify the path to an executable, which will
be used as the shell program. :doc:`concepts/variables` will be expanded.

Expand Down
2 changes: 1 addition & 1 deletion src/dune_lang/action.ml
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ let cstrs_dune_file t =
fields
(field
"shell"
(Syntax.since Stanza.syntax (3, 10) >>> Shell_spec.decode)
(Syntax.since Stanza.syntax (3, 12) >>> Shell_spec.decode)
~default:Shell_spec.default)
in
Cram (script, shell_spec) )
Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/cram/cram_stanza.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let decode =
and+ shell =
field
"shell"
Dune_lang.Decoder.(Syntax.since Stanza.syntax (3, 10) >>> Shell_spec.decode)
Dune_lang.Decoder.(Syntax.since Stanza.syntax (3, 12) >>> Shell_spec.decode)
~default:Shell_spec.default
and+ enabled_if = Enabled_if.decode ~allowed_vars:Any ~since:None ()
and+ locks = Locks.field ~check:(Dune_lang.Syntax.since Stanza.syntax (2, 9)) ()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Check that Cram tests run without shell option specified

$ echo '(lang dune 3.10)' > dune-project
$ echo '(lang dune 3.12)' > dune-project

$ cat > dune <<EOF
> (rule
Expand Down
20 changes: 10 additions & 10 deletions test/blackbox-tests/test-cases/cram/shell-opt-dune-lang-version.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Check that `(shell ..)` option on `(cram ..)` stanza fail before `(lang dune 3.10)`
Check that `(shell ..)` option on `(cram ..)` stanza fail before `(lang dune 3.12)`

$ echo '(lang dune 3.9)' > dune-project
$ echo '(lang dune 3.11)' > dune-project

$ cat > dune <<EOF
> (cram (shell :system))
Expand All @@ -14,13 +14,13 @@ Check that `(shell ..)` option on `(cram ..)` stanza fail before `(lang dune 3.1
File "dune", line 1, characters 6-21:
1 | (cram (shell :system))
^^^^^^^^^^^^^^^
Error: 'shell' is only available since version 3.10 of the dune language.
Please update your dune-project file to have (lang dune 3.10).
Error: 'shell' is only available since version 3.12 of the dune language.
Please update your dune-project file to have (lang dune 3.12).
[1]

Check that `(shell ..)` option on `(cram ..)` user action fail before `(lang dune 3.10)`
Check that `(shell ..)` option on `(cram ..)` user action fail before `(lang dune 3.12)`

$ echo '(lang dune 3.9)' > dune-project
$ echo '(lang dune 3.11)' > dune-project

$ cat > dune <<EOF
> (rule
Expand All @@ -34,9 +34,9 @@ Check that `(shell ..)` option on `(cram ..)` user action fail before `(lang dun
> EOF

$ dune runtest -f
File "dune", line 3, characters 25-38:
File "dune", line 3, characters 25-37:
3 | (action (cram foo.cram (shell bash)))
^^^^^^^^^^^^^
Error: 'shell' is only available since version 3.10 of the dune language.
Please update your dune-project file to have (lang dune 3.10).
^^^^^^^^^^^^
Error: 'shell' is only available since version 3.12 of the dune language.
Please update your dune-project file to have (lang dune 3.12).
[1]
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/cram/shell-opt-zsh.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Check that shell = %{bin:zsh} uses zsh

$ echo '(lang dune 3.10)' > dune-project
$ echo '(lang dune 3.12)' > dune-project
$ cat > dune <<EOF
> (cram (shell %{bin:zsh}))
> EOF
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/cram/shell-opt.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Check that Cram tests run without shell option specified

$ echo '(lang dune 3.10)' > dune-project
$ echo '(lang dune 3.12)' > dune-project

$ cat > foo.t <<EOF
> $ echo "foo from foo.t"
Expand Down