[PATCH 2/3] torture/spoolss: test EnumJobs with an invalid level

Stefan (metze) Metzmacher metze at samba.org
Wed Oct 29 02:11:24 MDT 2014


Hi David,

this seems to have introduced a new flaky test:

https://git.samba.org/autobuild.flakey/2014-10-28-1603/samba.stdout
https://git.samba.org/autobuild.flakey/2014-10-29-0703/samba.stdout

Can you please have a look at this?

Thanks!
metze

Am 27.10.2014 um 20:13 schrieb David Disseldorp:
> This test confirms that EnumJobs WERR_INVALID_LEVEL responses remain
> consistent with and without the presence of outstanding print jobs.
> 
> Signed-off-by: David Disseldorp <ddiss at samba.org>
> ---
>  source4/torture/rpc/spoolss.c | 71 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 71 insertions(+)
> 
> diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
> index b7689ba..dea5549 100644
> --- a/source4/torture/rpc/spoolss.c
> +++ b/source4/torture/rpc/spoolss.c
> @@ -8849,6 +8849,76 @@ static bool test_driver_info_winreg(struct torture_context *tctx,
>  	return true;
>  }
>  
> +static bool test_print_job_enum(struct torture_context *tctx,
> +				void *private_data)
> +{
> +	struct torture_printer_context *t =
> +		(struct torture_printer_context *)talloc_get_type_abort(private_data, struct torture_printer_context);
> +	struct dcerpc_pipe *p = t->spoolss_pipe;
> +	struct dcerpc_binding_handle *b = p->binding_handle;
> +	bool ret = true;
> +	uint32_t num_jobs = 8;
> +	uint32_t *job_ids;
> +	int i;
> +	union spoolss_JobInfo *info = NULL;
> +	uint32_t count;
> +
> +	torture_assert(tctx,
> +		test_PausePrinter(tctx, b, &t->handle),
> +		"failed to pause printer");
> +
> +	/* enum before jobs, valid level */
> +	torture_assert(tctx,
> +		       test_EnumJobs_args(tctx, b, &t->handle, 1, WERR_OK,
> +					  &count, &info),
> +		       "EnumJobs with valid level");
> +	torture_assert_int_equal(tctx, count, 0, "EnumJobs count");
> +	torture_assert(tctx,
> +		       test_EnumJobs_args(tctx, b, &t->handle, 2, WERR_OK,
> +					  &count, &info),
> +		       "EnumJobs with valid level");
> +	torture_assert_int_equal(tctx, count, 0, "EnumJobs count");
> +	/* enum before jobs, invalid level - expect failure */
> +	torture_assert(tctx,
> +		       test_EnumJobs_args(tctx, b, &t->handle, 100,
> +					  WERR_INVALID_LEVEL,
> +					  &count, &info),
> +		       "EnumJobs with invalid level");
> +
> +	job_ids = talloc_zero_array(tctx, uint32_t, num_jobs);
> +
> +	for (i = 0; i < num_jobs; i++) {
> +		ret = test_DoPrintTest_add_one_job(tctx, b, &t->handle,
> +						    "TorturePrintJob",
> +						    &job_ids[i]);
> +		torture_assert(tctx, ret, "failed to add print job");
> +	}
> +
> +	/* enum after jobs, valid level */
> +	torture_assert(tctx,
> +		       test_EnumJobs_args(tctx, b, &t->handle, 1, WERR_OK,
> +					  &count, &info),
> +		       "EnumJobs with valid level");
> +	torture_assert_int_equal(tctx, count, num_jobs, "EnumJobs count");
> +	torture_assert(tctx,
> +		       test_EnumJobs_args(tctx, b, &t->handle, 2, WERR_OK,
> +					  &count, &info),
> +		       "EnumJobs with valid level");
> +	torture_assert_int_equal(tctx, count, num_jobs, "EnumJobs count");
> +	/* enum after jobs, invalid level - expect failure */
> +	torture_assert(tctx,
> +		       test_EnumJobs_args(tctx, b, &t->handle, 100,
> +					  WERR_INVALID_LEVEL,
> +					  &count, &info),
> +		       "EnumJobs with invalid level");
> +
> +	torture_assert(tctx,
> +		test_ResumePrinter(tctx, b, &t->handle),
> +		"failed to resume printer");
> +
> +	return true;
> +}
> +
>  void torture_tcase_printer(struct torture_tcase *tcase)
>  {
>  	torture_tcase_add_simple_test(tcase, "openprinter", test_openprinter_wrap);
> @@ -8876,6 +8946,7 @@ void torture_tcase_printer(struct torture_tcase *tcase)
>  	torture_tcase_add_simple_test(tcase, "bidi", test_printer_bidi);
>  	torture_tcase_add_simple_test(tcase, "publish_toggle",
>  				      test_printer_publish_toggle);
> +	torture_tcase_add_simple_test(tcase, "print_job_enum", test_print_job_enum);
>  }
>  
>  struct torture_suite *torture_rpc_spoolss_printer(TALLOC_CTX *mem_ctx)
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141029/2d00e1d0/attachment.pgp>


More information about the samba-technical mailing list