James Kanze
2010-02-15 10:42:28 UTC
How do you get a memory fault to simply return a bad return code
under Windows?
I'm interested in writing regression test programs which run in
batch mode. At present, if my code has an assertion failure, I
get a pop-up window with an offer to go to the debugger---this
will be worthless on the remote machine (and is a pain even on
my machine, if I happen to hit a sequence of tests which each
trigger the same error).
I'm current calling
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
as the first thing in main, as per
http://msdn.microsoft.com/en-us/library/5z4bw5h5.aspx, but this
has absolutely no effect on the program; I still get my pop-up
with "Debug Assertion Failed!", "Expression: ITERATOR LIST
CORRUPTED!" and "(Press Retry to debug the application)", with
three choices: Abort, Retry or Ignore. This is absolutely
useless for regression tests.
I've also tried converting the structured exception to a C++
exception, as per
http://msdn.microsoft.com/en-us/library/ms680621%28VS.85%29.aspx,
and catching the exception to return EXIT_FAILURE, with no
success either.
So how do you run a suite of regression tests under Windows?
--
James Kanze
under Windows?
I'm interested in writing regression test programs which run in
batch mode. At present, if my code has an assertion failure, I
get a pop-up window with an offer to go to the debugger---this
will be worthless on the remote machine (and is a pain even on
my machine, if I happen to hit a sequence of tests which each
trigger the same error).
I'm current calling
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
as the first thing in main, as per
http://msdn.microsoft.com/en-us/library/5z4bw5h5.aspx, but this
has absolutely no effect on the program; I still get my pop-up
with "Debug Assertion Failed!", "Expression: ITERATOR LIST
CORRUPTED!" and "(Press Retry to debug the application)", with
three choices: Abort, Retry or Ignore. This is absolutely
useless for regression tests.
I've also tried converting the structured exception to a C++
exception, as per
http://msdn.microsoft.com/en-us/library/ms680621%28VS.85%29.aspx,
and catching the exception to return EXIT_FAILURE, with no
success either.
So how do you run a suite of regression tests under Windows?
--
James Kanze