Detlef Riekenberg : winspool/tests: Fix failures when the spooler service is not running.
Alexandre Julliard
julliard at winehq.org
Thu Jun 21 15:03:38 CDT 2012
Module: wine
Branch: master
Commit: 1034ae37e23824eb88ee43169c91e860a3dcc53a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1034ae37e23824eb88ee43169c91e860a3dcc53a
Author: Detlef Riekenberg <wine.dev at web.de>
Date: Wed Jun 20 22:24:11 2012 +0200
winspool/tests: Fix failures when the spooler service is not running.
---
dlls/winspool.drv/tests/info.c | 53 +++++++++++++++++++++++++--------------
1 files changed, 34 insertions(+), 19 deletions(-)
diff --git a/dlls/winspool.drv/tests/info.c b/dlls/winspool.drv/tests/info.c
index 3aab0e2..1cbb07d 100644
--- a/dlls/winspool.drv/tests/info.c
+++ b/dlls/winspool.drv/tests/info.c
@@ -1534,18 +1534,22 @@ static void test_GetPrinterDriverDirectory(void)
SetLastError(MAGIC_DEAD);
res = GetPrinterDriverDirectoryA( NULL, NULL, 1, buffer, cbBuf, NULL);
- ok( (!res && RPC_X_NULL_REF_POINTER == GetLastError()) || res,
- "expected either result == 0 and "
- "last error == RPC_X_NULL_REF_POINTER or result != 0 "
- "got result %d and last error == %d\n", res, GetLastError());
+ /* w7 with deactivated spooler: ERROR_INVALID_PARAMETER,
+ NT: RPC_X_NULL_REF_POINTER */
+ ok( res || (GetLastError() == RPC_X_NULL_REF_POINTER) ||
+ (GetLastError() == ERROR_INVALID_PARAMETER),
+ "returned %d with %d (expected '!=0' or '0' with RPC_X_NULL_REF_POINTER "
+ "or '0' with ERROR_INVALID_PARAMETER)\n", res, GetLastError());
SetLastError(MAGIC_DEAD);
res = GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, cbBuf, NULL);
- ok(res || (GetLastError() == RPC_X_NULL_REF_POINTER),
- "returned %d with %d (expected '!=0' or '0' with "
- "RPC_X_NULL_REF_POINTER)\n", res, GetLastError());
-
-
+ /* w7 with deactivated spooler: ERROR_INVALID_PARAMETER,
+ NT: RPC_X_NULL_REF_POINTER */
+ ok( res || (GetLastError() == RPC_X_NULL_REF_POINTER) ||
+ (GetLastError() == ERROR_INVALID_PARAMETER),
+ "returned %d with %d (expected '!=0' or '0' with RPC_X_NULL_REF_POINTER "
+ "or '0' with ERROR_INVALID_PARAMETER)\n", res, GetLastError());
+
/* with a valid buffer, but level is too large */
buffer[0] = '\0';
SetLastError(MAGIC_DEAD);
@@ -1679,20 +1683,22 @@ static void test_GetPrintProcessorDirectory(void)
buffer[0] = '\0';
SetLastError(0xdeadbeef);
res = GetPrintProcessorDirectoryA( NULL, NULL, 1, buffer, cbBuf, NULL);
- /* NT: RPC_X_NULL_REF_POINTER, 9x: res != 0 */
- ok( (!res && (GetLastError() == RPC_X_NULL_REF_POINTER)) ||
- broken(res),
- "returned %d with %d (expected '0' with RPC_X_NULL_REF_POINTER)\n",
- res, GetLastError());
+ /* w7 with deactivated spooler: ERROR_INVALID_PARAMETER,
+ NT: RPC_X_NULL_REF_POINTER, 9x: res != 0 */
+ ok( !res && ((GetLastError() == RPC_X_NULL_REF_POINTER) ||
+ (GetLastError() == ERROR_INVALID_PARAMETER)),
+ "returned %d with %d (expected '0' with RPC_X_NULL_REF_POINTER "
+ "or with ERROR_INVALID_PARAMETER)\n", res, GetLastError());
buffer[0] = '\0';
SetLastError(0xdeadbeef);
res = GetPrintProcessorDirectoryA( NULL, NULL, 1, NULL, cbBuf, NULL);
- /* NT: RPC_X_NULL_REF_POINTER, 9x: res != 0 */
- ok( (!res && (GetLastError() == RPC_X_NULL_REF_POINTER)) ||
- broken(res),
- "returned %d with %d (expected '0' with RPC_X_NULL_REF_POINTER)\n",
- res, GetLastError());
+ /* w7 with deactivated spooler: ERROR_INVALID_PARAMETER,
+ NT: RPC_X_NULL_REF_POINTER, 9x: res != 0 */
+ ok( !res && ((GetLastError() == RPC_X_NULL_REF_POINTER) ||
+ (GetLastError() == ERROR_INVALID_PARAMETER)),
+ "returned %d with %d (expected '0' with RPC_X_NULL_REF_POINTER "
+ "or with ERROR_INVALID_PARAMETER)\n", res, GetLastError());
/* with a valid buffer, but level is invalid */
buffer[0] = '\0';
@@ -1992,6 +1998,14 @@ static void test_SetDefaultPrinter(void)
WriteProfileStringA("windows", "device", NULL);
SetLastError(MAGIC_DEAD);
res = pSetDefaultPrinterA("");
+ if ((res == 0) && (GetLastError() == RPC_S_SERVER_UNAVAILABLE)) {
+ if (!deactivated_spooler_reported) {
+ deactivated_spooler_reported++;
+ skip("The Service 'Spooler' is required for many test\n");
+ }
+ goto restore_old_printer;
+ }
+
/* we get ERROR_INVALID_PRINTER_NAME when no printer is installed */
ok(res || (!res && (GetLastError() == ERROR_INVALID_PRINTER_NAME)),
"returned %d with %d (expected '!=0' or '0' with "
@@ -2013,6 +2027,7 @@ static void test_SetDefaultPrinter(void)
"ERROR_INVALID_PRINTER_NAME)\n", res, GetLastError());
/* restore the original value */
+restore_old_printer:
res = pSetDefaultPrinterA(default_printer); /* the nice way */
ok(res, "SetDefaultPrinter error %d\n", GetLastError());
WriteProfileStringA("windows", "device", org_value); /* the old way */
More information about the wine-cvs
mailing list