Hi guys,
A patch has been committed today saying "Make .. crashing like it does on native". I know we have to follow (genuine) Windows behavior but I'm wondering how to handle these cases.
For instance, how to add a test crashing on every Windows ? Is it useful ? I mean, none program can rely on it .. since it crashes.
Anyway, I've seen mainly two approaches - if(0) - /* comment the crashing ok() */
What's the difference ? And why not #if 0 ? 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
And what about a test crashing on a specific Windows ? I guess #ifdef CRASHES_ON_NT40 is not an elegant way (even if it's currently used).
Commenting such tests prevent us to check wine behavior on 'working' Windows. I attempted to use __TRY ... __EXCEPT_PAGE_FAULT in a test but it got rejected.
Any advice ? Thanks
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 matter much.
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 if-statement entirely.
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 to help.
Andrew
On 08/23/2010 11:47 PM, Andrew Eikum wrote:
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 to help.
I read again the test file and in my case, there are some broken() /* NT4 */ so I'll declare a BOOL isNT4 and add a win_skip when appropriate.
Many thanks !