From 487a03a1586e478baaadada184836be98c609aa0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Dec 2009 23:54:42 +0100 Subject: testprogs: add win32 spoolss testsuite. Guenther --- testprogs/win32/spoolss/torture.c | 106 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 testprogs/win32/spoolss/torture.c (limited to 'testprogs/win32/spoolss/torture.c') diff --git a/testprogs/win32/spoolss/torture.c b/testprogs/win32/spoolss/torture.c new file mode 100644 index 0000000000..27872a6ccc --- /dev/null +++ b/testprogs/win32/spoolss/torture.c @@ -0,0 +1,106 @@ +/* + Unix SMB/CIFS implementation. + SMB torture UI functions + + Copyright (C) Jelmer Vernooij 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "spoolss.h" +#include "torture.h" + +/**************************************************************************** +****************************************************************************/ + +void torture_warning(struct torture_context *context, const char *comment, ...) +{ + va_list ap; + char tmp[1024]; + +#if 0 + if (!context->results->ui_ops->warning) + return; +#endif + + va_start(ap, comment); + if (vsprintf(tmp, comment, ap) == -1) { + return; + } + va_end(ap); + + fprintf(stderr, "WARNING: %s\n", tmp); +#if 0 + context->results->ui_ops->warning(context, tmp); + + free(tmp); +#endif +} + +/**************************************************************************** +****************************************************************************/ + +void torture_result(struct torture_context *context, + enum torture_result result, const char *fmt, ...) +{ + va_list ap; + char tmp[1024]; + + va_start(ap, fmt); + + if (context->last_reason) { + torture_warning(context, "%s", context->last_reason); + free(context->last_reason); + context->last_reason = NULL; + } + + context->last_result = result; + if (vsprintf(tmp, fmt, ap) == -1) { + return; + } + context->last_reason = malloc(sizeof(tmp)); + if (!context->last_reason) { + return; + } + memcpy(context->last_reason, tmp, sizeof(tmp)); + + va_end(ap); +} + +/**************************************************************************** +****************************************************************************/ + +void torture_comment(struct torture_context *context, const char *comment, ...) +{ + va_list ap; + char tmp[1024]; +#if 0 + if (!context->results->ui_ops->comment) + return; +#endif + va_start(ap, comment); + if (vsprintf(tmp, comment, ap) == -1) { + return; + } + va_end(ap); + +#if 0 + context->results->ui_ops->comment(context, tmp); +#endif + fprintf(stdout, "%s\n", tmp); + +#if 0 + free(tmp); +#endif +} -- cgit