How managing crashing tests ?
andrew at brightnightgames.com
Mon Aug 23 16:47:43 CDT 2010
On 08/23/2010 12:59 PM, GOUJON Alexandre wrote:
> Anyway, I've seen mainly two approaches
> - if(0)
> - /* comment
> the crashing ok()
> What's the difference ? And why not #if 0 ?
Using if(0) means the code in the body of the if-statement still has to
compile. This can check against errors while modifying headers, help
protect against misplaced braces in some cases, etc. Commenting the
code out loses that verification, to no advantage. Really, it doesn't
> I maybe lack some basic C knowledges but I think that /**/ and #if 0 are
> not added to the executable (from preprocessing stage).
> If it's right, it means we can then 'enable' these blocks maybe with
> (gdb) edit something
Likely not, since the optimizer probably just removes the body of the
> And what about a test crashing on a specific Windows ?
Just don't execute the code on that platforms that don't support it.
How to check if the platform supports that codepath can be tricky, and
there are a lot of ways to do it. Some examples are to use
GetProcAddress; use a different function (if it's not the one being
tested, obviously); or call the function in a certain way that can tip
you off to platform differences.
If you have a specific problem in mind, people on the list might be able
More information about the wine-devel