Skip to content

Alcotest.run: ensure and_exit and record_backtrace can be overriden f…#439

Open
edwintorok wants to merge 1 commit into
mirage:mainfrom
edwintorok:master
Open

Alcotest.run: ensure and_exit and record_backtrace can be overriden f…#439
edwintorok wants to merge 1 commit into
mirage:mainfrom
edwintorok:master

Conversation

@edwintorok
Copy link
Copy Markdown
Contributor

…or the test sub-command too

default_cmd handles this correctly, but test_cmd always set and_exit and record_backtrace to true.

Due to Config.User.(cli_config || config) this meant that and_exit couldn't be set to false by the caller.
The main program may want to set and_exit to false if it has some wrappers using Fun.protect for example, with and_exit set to true these wouldn't run.

For backwards compatibility with old versions of alcotest one workaround is to use at_exit instead of Fun.protect to register cleanup handlers.

Fixes #438

…or the test sub-command too

`default_cmd` handles this correctly, but `test_cmd` always set
`and_exit` and `record_backtrace` to `true`.

Due to `Config.User.(cli_config || config)` this meant that `and_exit`
couldn't be set to `false` by the caller.
The main program may want to set `and_exit` to false if it has some
wrappers using `Fun.protect` for example, with `and_exit` set to true
these wouldn't run.

For backwards compatibility with old versions of alcotest one workaround
is to use `at_exit` instead of `Fun.protect` to register cleanup
handlers.

Fixes mirage#438

Signed-off-by: Edwin Török <edwin@tarides.com>
@edwintorok
Copy link
Copy Markdown
Contributor Author

The CI needs some maintenance due to the removal of <4.11 from opam-repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

and_exit cannot be overriden when using test subcommand

1 participant