You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that on Windows (but not linux), coverage data isn't written to disk when the process is terminated with std::process::exit. The documentation on which says
Note that because this function never returns, and that it terminates the process, no destructors on the current stack or any other thread's stack will be run.
I presume that the profiling data is written to disk in the destructor for some type, and that isn't run when you terminate abruptly with std::process::terminate. I have no idea why this only affects Windows.
To work around this problem, in datatest-stable the maintainer used libtest_mimic::Conclusion::has_failed to return a std::process::ExitCode from the generated main function (see nextest-rs/datatest-stable@33d4725).
When ExitCode is returned from main, threads are cleaned up and coverage data is generated properly.
As discussed in nextest-rs/datatest-stable#20 (comment)libtest-mimic may want to deprecate libtest_mimic::Conclusion::exit in favour of a method that returns an ExitCode.
The text was updated successfully, but these errors were encountered:
Thanks for the report. Fixed in the linked commit and released as 0.7.1.
I added exit_code but decided against a full deprecation of the exit methods. I did add a warning to the docs though and moved them to the very bottom.
In nextest-rs/datatest-stable#20 I discovered that coverage data was not being generated for some of my tests. I came to the conclusion (at nextest-rs/datatest-stable#20 (comment)) that the problem was the use of
std::process::exit
from withinlibtest_mimic
.It seems that on Windows (but not linux), coverage data isn't written to disk when the process is terminated with
std::process::exit
. The documentation on which saysI presume that the profiling data is written to disk in the destructor for some type, and that isn't run when you terminate abruptly with
std::process::terminate
. I have no idea why this only affects Windows.To work around this problem, in
datatest-stable
the maintainer usedlibtest_mimic::Conclusion::has_failed
to return astd::process::ExitCode
from the generatedmain
function (see nextest-rs/datatest-stable@33d4725).When
ExitCode
is returned frommain
, threads are cleaned up and coverage data is generated properly.As discussed in nextest-rs/datatest-stable#20 (comment)
libtest-mimic
may want to deprecatelibtest_mimic::Conclusion::exit
in favour of a method that returns anExitCode
.The text was updated successfully, but these errors were encountered: