[PATCH] torture/spoolss: cleanup print_job_enum test jobs
David Disseldorp
ddiss at samba.org
Wed Oct 29 04:54:19 MDT 2014
Purge print queue on startup to ensure that the test is not affected by
jobs queued for prior tests. Also, empty the queue at the end of the
test to play nice with others.
Signed-off-by: David Disseldorp <ddiss at samba.org>
---
source4/torture/rpc/spoolss.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index dea5549..20e86fc 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -8867,6 +8867,11 @@ static bool test_print_job_enum(struct torture_context *tctx,
test_PausePrinter(tctx, b, &t->handle),
"failed to pause printer");
+ /* purge in case of any jobs from previous tests */
+ torture_assert(tctx,
+ test_printer_purge(tctx, b, &t->handle),
+ "failed to purge printer");
+
/* enum before jobs, valid level */
torture_assert(tctx,
test_EnumJobs_args(tctx, b, &t->handle, 1, WERR_OK,
@@ -8912,6 +8917,11 @@ static bool test_print_job_enum(struct torture_context *tctx,
&count, &info),
"EnumJobs with invalid level");
+ for (i = 0; i < num_jobs; i++) {
+ test_SetJob(tctx, b, &t->handle, job_ids[i], NULL,
+ SPOOLSS_JOB_CONTROL_DELETE);
+ }
+
torture_assert(tctx,
test_ResumePrinter(tctx, b, &t->handle),
"failed to resume printer");
--
1.8.4.5
More information about the samba-technical
mailing list