Hi wine-devel I have problems with tests I written last time. The problem is connected with privileges levels under Windows.
The method I'm testing is IGameExplorer::AddGame, which registers given game in Windows Game Explorer. One of it's parameters (installScope) defines if game should be registered for all users or only currently logged one. The problem is that routine's behaviour depends on if application was started with administrative privileges or not.
If I call method with GIS_ALL_USERS parameter, it succeeds only with administrative privileges (fails if I run it as normal user). If I call it with GIS_CURRENT_USER parameter, it succeeds under normal user level, and fails (sic!) under administrative.
My question is, how I should write tests to support both of these cases. Both seems to be exclusive, and I prefer first to ask, rather than trying implement it in some odd (and probably wrong) way. I also want to make it available to run under Wine project's test machines, but I don't know how they're configured and will them allow me to test administrative case.
2010/7/16 Mariusz Pluciński vshader@gmail.com:
Hi wine-devel I have problems with tests I written last time. The problem is connected with privileges levels under Windows.
The method I'm testing is IGameExplorer::AddGame, which registers given game in Windows Game Explorer. One of it's parameters (installScope) defines if game should be registered for all users or only currently logged one. The problem is that routine's behaviour depends on if application was started with administrative privileges or not.
If I call method with GIS_ALL_USERS parameter, it succeeds only with administrative privileges (fails if I run it as normal user). If I call it with GIS_CURRENT_USER parameter, it succeeds under normal user level, and fails (sic!) under administrative.
My question is, how I should write tests to support both of these cases. Both seems to be exclusive, and I prefer first to ask, rather than trying implement it in some odd (and probably wrong) way. I also want to make it available to run under Wine project's test machines, but I don't know how they're configured and will them allow me to test administrative case.
Use broken() to denote the administrator case --
ok(hr == S_OK || broken(hr == E_ACCESSDENIED) /* non-Admin user */, IGameExplorer_AddGame(...));
This means that E_ACCESSDENIED is a valid case on Windows, but not on Wine.
- Reece
W dniu 16.07.2010 19:59, Reece Dunn pisze:
Use broken() to denote the administrator case --
ok(hr == S_OK || broken(hr == E_ACCESSDENIED) /* non-Admin user
*/, IGameExplorer_AddGame(...));
This means that E_ACCESSDENIED is a valid case on Windows, but not on Wine.
- Reece
Yes, I know how broken() works, but there are two problems with it:
First problem, is that this is not what I want to do. I did not wrote about it in previous mail, but I do a little more than only calling this procedure. In details, this routine writes some data into registry and after call I check these data. These data depends on the parameter I described before (installScope). The problem is that I can run these tests on Windows, manually selecting permission level (and they behave as I described before), and they behave as I expected (I described how this routine behaves on several cases). I hope that making it able to run on Windows will let me to be sure that data produced by my library are identical like this created by Windows' one.
Second problem is that I cannot simply compare result with some ACCESSDENIED error code, cause this routine simply does not return it. Instead, when the "access denied" occurs, it returns E_FAIL, as in almost every other problem. And I cannot do broken(hr==E_FAIL), because then test will be always passed on Windows, even if completely other problem occurs. So, even if I give up with checking data, broken() won't work here.