Some checks may be written before they pass successfully in Wine.
Without some mechanism, such checks would potentially generate
hundred of known failures for months each time the tests are being run.
This would make it hard to detect new failures caused by a regression.
or to detect that a patch fixed a long standing issue.
Thus the Wine testing framework has the concept of platforms and
groups of checks can be declared as expected to fail on some of them.
In the most common case, one would declare a group of tests as
expected to fail in Wine. To do so, use the following construct:
todo_wine {
SetLastError( 0xdeadbeef );
ok( GlobalAddAtomA(0) == 0 && GetLastError() == 0xdeadbeef, "failed to add atom 0\n" );
}
On Windows the above check would be performed normally, but on Wine it
would be expected to fail, and not cause the failure of the whole
test. However. If that check were to succeed in Wine, it would
cause the test to fail, thus making it easy to detect when something
has changed that fixes a bug. Also note that todo checks are accounted
separately from regular checks so that the testing statistics remain
meaningful. Finally, note that todo sections can be nested so that if
a test only fails on the cygwin and reactos platforms, one would
write:
todo("cygwin") {
todo("reactos") {
...
}
}
But specific platforms should not be nested inside a todo_wine section
since that would be redundant.
When writing tests you will also encounter differences between Windows
9x and Windows NT platforms. Such differences should be treated
differently from the platform issues mentioned above. In particular
you should remember that the goal of Wine is not to be a clone of any
specific Windows version but to run Windows applications on Unix.
So, if an API returns a different error code on Windows 9x and
Windows NT, your check should just verify that Wine returns one or
the other:
ok ( GetLastError() == WIN9X_ERROR || GetLastError() == NT_ERROR, ...);
If an API is only present on some Windows platforms, then use
LoadLibrary and GetProcAddress to check if it is implemented and
invoke it. Remember, tests must run on all Windows platforms.
Similarly, conformance tests should nor try to correlate the Windows
version returned by GetVersion with whether given APIs are
implemented or not. Again, the goal of Wine is to run Windows
applications (which do not do such checks), and not be a clone of a
specific Windows version.