[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Mon Mar 1 13:15:56 MST 2010


The branch, master has been updated
       via  cf12d45... testprogs: better usage text.
       via  36d3aa6... testprogs: add very basic PrinterData test for printers.
       via  0d0d778... testprogs: rename test_PrinterData to test_PrinterData_Server.
       via  d44dd10... testprogs: add SetPrinterDataEx test.
       via  b797481... testprogs: add DeletePrinterKey test.
       via  1b6f1e8... testprogs: add DeletePrinterDataEx test.
       via  61568cf... testprogs: allow to test a single printer when given on the cmdline.
       via  32371e9... testprogs: add RPC_X_NULL_REF_POINTER error code
      from  522e4f3... s4:RPC-ECHO: don't ignore errors in the Sleep test now that we support async rpc over ncacn_np

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit cf12d4556a12edb032eaef51a60bfc815f38be61
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 1 21:12:49 2010 +0100

    testprogs: better usage text.
    
    Guenther

commit 36d3aa69f1a090ac4054f06883a2fae85070f202
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 1 21:00:20 2010 +0100

    testprogs: add very basic PrinterData test for printers.
    
    This very basically tests SetPrinterDataEx, GetPrinterDataEx and
    DeletePrinterDataEx.
    
    Guenther

commit 0d0d778b212a5409a2632745c842b4270341c8b8
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 1 20:58:41 2010 +0100

    testprogs: rename test_PrinterData to test_PrinterData_Server.
    
    Guenther

commit d44dd1005bad8e95ea3c35376488083ebe9261d7
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 1 20:57:52 2010 +0100

    testprogs: add SetPrinterDataEx test.
    
    Guenther

commit b797481b8dd99a6e67c69ea5ce4b1c6739c45666
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 1 20:56:36 2010 +0100

    testprogs: add DeletePrinterKey test.
    
    Guenther

commit 1b6f1e8c30808c50485b8fecf47e12b45a3ac31f
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 1 17:42:19 2010 +0100

    testprogs: add DeletePrinterDataEx test.
    
    Guenther

commit 61568cf4c8f12148390435cba7845acf0b00e941
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 1 20:15:51 2010 +0100

    testprogs: allow to test a single printer when given on the cmdline.

commit 32371e9ba6b93e6a235054a2db7a34838443e86c
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 1 18:01:42 2010 +0100

    testprogs: add RPC_X_NULL_REF_POINTER error code

-----------------------------------------------------------------------

Summary of changes:
 testprogs/win32/spoolss/error.c   |    2 +
 testprogs/win32/spoolss/spoolss.c |  142 +++++++++++++++++++++++++++++++++++--
 2 files changed, 138 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/testprogs/win32/spoolss/error.c b/testprogs/win32/spoolss/error.c
index 2665856..a74312a 100644
--- a/testprogs/win32/spoolss/error.c
+++ b/testprogs/win32/spoolss/error.c
@@ -115,6 +115,8 @@ const char *errstr(DWORD error)
 		return "ERROR_CANCELLED";
 	case ERROR_NOACCESS:
 		return "ERROR_NOACCESS";
+	case RPC_X_NULL_REF_POINTER:
+		return "RPC_X_NULL_REF_POINTER";
 	case RPC_S_PROCNUM_OUT_OF_RANGE:
 		return "RPC_S_PROCNUM_OUT_OF_RANGE";
 	case RPC_S_SERVER_UNAVAILABLE:
diff --git a/testprogs/win32/spoolss/spoolss.c b/testprogs/win32/spoolss/spoolss.c
index 38eb7ed..acdbb13 100644
--- a/testprogs/win32/spoolss/spoolss.c
+++ b/testprogs/win32/spoolss/spoolss.c
@@ -984,6 +984,7 @@ static BOOL test_OnePrinter(struct torture_context *tctx,
 	ret &= test_EnumPrinterKey(tctx, printername, handle, "PrinterDriverData");
 	ret &= test_EnumPrinterDataEx(tctx, printername, "PrinterDriverData", handle, NULL, NULL);
 	ret &= test_DeviceModes(tctx, printername, handle);
+	ret &= test_PrinterData(tctx, printername, handle);
 	ret &= test_ClosePrinter(tctx, handle);
 
 	return ret;
@@ -1243,9 +1244,83 @@ static BOOL test_GetPrinterDataEx(struct torture_context *tctx,
 /****************************************************************************
 ****************************************************************************/
 
-static BOOL test_PrinterData(struct torture_context *tctx,
-			     LPSTR servername,
-			     HANDLE handle)
+static BOOL test_DeletePrinterDataEx(struct torture_context *tctx,
+				     LPSTR servername,
+				     LPSTR keyname,
+				     LPSTR valuename,
+				     HANDLE handle)
+{
+	DWORD err = 0;
+	char tmp[1024];
+
+	torture_comment(tctx, "Testing DeletePrinterDataEx(%s - %s)", keyname, valuename);
+
+	err = DeletePrinterDataEx(handle, keyname, valuename);
+	if (err) {
+		sprintf(tmp, "DeletePrinterDataEx(%s - %s) failed on [%s], error: %s\n",
+			keyname, valuename, servername, errstr(err));
+		torture_fail(tctx, tmp);
+	}
+
+	return TRUE;
+}
+
+/****************************************************************************
+****************************************************************************/
+
+static BOOL test_DeletePrinterKey(struct torture_context *tctx,
+				  LPSTR servername,
+				  LPSTR keyname,
+				  HANDLE handle)
+{
+	DWORD err = 0;
+	char tmp[1024];
+
+	torture_comment(tctx, "Testing DeletePrinterKey(%s)", keyname);
+
+	err = DeletePrinterKey(handle, keyname);
+	if (err) {
+		sprintf(tmp, "DeletePrinterKey(%s) failed on [%s], error: %s\n",
+			keyname, servername, errstr(err));
+		torture_fail(tctx, tmp);
+	}
+
+	return TRUE;
+}
+
+/****************************************************************************
+****************************************************************************/
+
+static BOOL test_SetPrinterDataEx(struct torture_context *tctx,
+				  LPSTR servername,
+				  LPSTR keyname,
+				  LPSTR valuename,
+				  HANDLE handle,
+				  DWORD type,
+				  LPBYTE buffer,
+				  DWORD offered)
+{
+	DWORD err = 0;
+	char tmp[1024];
+
+	torture_comment(tctx, "Testing SetPrinterDataEx(%s - %s)", keyname, valuename);
+
+	err = SetPrinterDataEx(handle, keyname, valuename, type, buffer, offered);
+	if (err) {
+		sprintf(tmp, "SetPrinterDataEx(%s) failed on [%s] (buffer size = %d), error: %s\n",
+			valuename, servername, offered, errstr(err));
+		torture_fail(tctx, tmp);
+	}
+
+	return TRUE;
+}
+
+/****************************************************************************
+****************************************************************************/
+
+static BOOL test_PrinterData_Server(struct torture_context *tctx,
+				    LPSTR servername,
+				    HANDLE handle)
 {
 	BOOL ret = TRUE;
 	DWORD i;
@@ -1278,6 +1353,43 @@ static BOOL test_PrinterData(struct torture_context *tctx,
 /****************************************************************************
 ****************************************************************************/
 
+static BOOL test_PrinterData(struct torture_context *tctx,
+			     LPSTR printername,
+			     HANDLE handle)
+{
+	LPSTR keyname = "torture_key";
+	LPSTR valuename = "torture_value";
+	DWORD type = REG_NONE;
+	LPBYTE buffer = NULL;
+	DWORD offered = 0;
+	BOOL ret = TRUE;
+
+	torture_comment(tctx, "Testing PrinterData");
+
+	type = REG_SZ;
+	offered = 4;
+	buffer = malloc(offered);
+	if (!buffer) {
+		return FALSE;
+	}
+	buffer[0] = 'c';
+	buffer[1] = 'r';
+	buffer[2] = 'a';
+	buffer[3] = 'p';
+
+	ret &= test_SetPrinterDataEx(tctx, printername, keyname, valuename, handle, type, buffer, offered);
+	ret &= test_GetPrinterDataEx(tctx, printername, keyname, valuename, handle, NULL, NULL, NULL);
+	ret &= test_DeletePrinterDataEx(tctx, printername, keyname, valuename, handle);
+	ret &= test_DeletePrinterKey(tctx, printername, keyname, handle);
+
+	free(buffer);
+
+	return TRUE;
+}
+
+/****************************************************************************
+****************************************************************************/
+
 const char *get_string_param(const char *str)
 {
 	const char *p;
@@ -1304,7 +1416,15 @@ int main(int argc, char *argv[])
 	int i;
 
 	if (argc < 2) {
-		fprintf(stderr, "usage: %s <servername> [print] [samba3] [architecture=ARCHITECTURE]\n", argv[0]);
+		fprintf(stderr, "usage: %s <name> [print] [samba3] [architecture=ARCHITECTURE]\n\n", argv[0]);
+		fprintf(stderr, "\t<name>           can be a server or printer name URI\n");
+		fprintf(stderr, "\t[print]          will print all data that has been retrieved\n");
+		fprintf(stderr, "\t                 from the printserver\n");
+		fprintf(stderr, "\t[samba3]         will skip some tests samba servers are known\n");
+		fprintf(stderr, "\t                 not to have implemented\n");
+		fprintf(stderr, "\t[architecture=X] allows to define a specific\n");
+		fprintf(stderr, "\t                 architecture to test with. choose between:\n");
+		fprintf(stderr, "\t                 \"Windows NT x86\" or \"Windows x64\"\n");
 		exit(-1);
 	}
 
@@ -1339,11 +1459,20 @@ int main(int argc, char *argv[])
 	defaults_use.pDevMode = NULL;
 	defaults_use.DesiredAccess = PRINTER_ACCESS_USE;
 
+	if ((servername[0] == '\\') && (servername[1] == '\\')) {
+		LPSTR p = servername+2;
+		LPSTR p2;
+		if ((p2 = strchr(p, '\\')) != NULL) {
+			ret = test_OnePrinter(tctx, servername, architecture, &defaults_admin);
+			goto done;
+		}
+	}
+
 	ret &= test_EnumPrinters(tctx, servername);
 	ret &= test_EnumDrivers(tctx, servername, architecture);
 	ret &= test_OpenPrinter(tctx, servername, NULL, &server_handle);
 /*	ret &= test_EnumPrinterKey(tctx, servername, server_handle, ""); */
-	ret &= test_PrinterData(tctx, servername, server_handle);
+	ret &= test_PrinterData_Server(tctx, servername, server_handle);
 	ret &= test_EnumForms(tctx, servername, server_handle);
 	ret &= test_ClosePrinter(tctx, server_handle);
 	ret &= test_EnumPorts(tctx, servername);
@@ -1352,8 +1481,9 @@ int main(int argc, char *argv[])
 	ret &= test_EnumPrintProcessorDatatypes(tctx, servername);
 	ret &= test_GetPrintProcessorDirectory(tctx, servername, architecture);
 	ret &= test_GetPrinterDriverDirectory(tctx, servername, architecture);
-	ret &= test_EachPrinter(tctx, servername, architecture, NULL);
+	ret &= test_EachPrinter(tctx, servername, architecture, &defaults_admin);
 
+ done:
 	if (!ret) {
 		if (tctx->last_reason) {
 			fprintf(stderr, "failed: %s\n", tctx->last_reason);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list