summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-01-15 16:25:20 +0100
committerGünther Deschner <gd@samba.org>2010-01-18 13:41:02 +0100
commitecd35d7ea6ca1e22cfffd9fc7f7e24ab4aad5cff (patch)
tree25b3df0d1b01a4fa83f892db9c103ffd96a5ed48
parentca646a82f872a9e65fe4d5bdc60125e39b49319f (diff)
downloadsamba-ecd35d7ea6ca1e22cfffd9fc7f7e24ab4aad5cff.tar.gz
samba-ecd35d7ea6ca1e22cfffd9fc7f7e24ab4aad5cff.tar.bz2
samba-ecd35d7ea6ca1e22cfffd9fc7f7e24ab4aad5cff.zip
testprogs: add tests for GetForm.
Guenther
-rw-r--r--testprogs/win32/spoolss/spoolss.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/testprogs/win32/spoolss/spoolss.c b/testprogs/win32/spoolss/spoolss.c
index 939f0e65b1..85a746d46f 100644
--- a/testprogs/win32/spoolss/spoolss.c
+++ b/testprogs/win32/spoolss/spoolss.c
@@ -167,6 +167,54 @@ static BOOL test_EnumDrivers(struct torture_context *tctx,
/****************************************************************************
****************************************************************************/
+static BOOL test_GetForm(struct torture_context *tctx,
+ LPSTR servername,
+ HANDLE handle,
+ LPSTR formname)
+{
+ DWORD levels[] = { 1, 2 };
+ DWORD success[] = { 1, 0 };
+ DWORD i;
+ LPBYTE buffer = NULL;
+
+ for (i=0; i < ARRAY_SIZE(levels); i++) {
+
+ DWORD needed = 0;
+ DWORD err = 0;
+ char tmp[1024];
+
+ torture_comment(tctx, "Testing GetForm(%s) level %d", formname, levels[i]);
+
+ GetForm(handle, formname, levels[i], NULL, 0, &needed);
+ err = GetLastError();
+ if (err == ERROR_INSUFFICIENT_BUFFER) {
+ err = 0;
+ buffer = malloc(needed);
+ torture_assert(tctx, buffer, "malloc failed");
+ if (!GetForm(handle, formname, levels[i], buffer, needed, &needed)) {
+ err = GetLastError();
+ }
+ }
+ if (err) {
+ sprintf(tmp, "GetForm failed level %d on [%s] (buffer size = %d), error: %s\n",
+ levels[i], servername, needed, errstr(err));
+ if (success[i]) {
+ torture_fail(tctx, tmp);
+ } else {
+ torture_warning(tctx, tmp);
+ }
+ }
+
+ free(buffer);
+ buffer = NULL;
+ }
+
+ return TRUE;
+}
+
+/****************************************************************************
+****************************************************************************/
+
static BOOL test_EnumForms(struct torture_context *tctx,
LPSTR servername,
HANDLE handle)