2 Unix SMB/CIFS implementation.
3 test suite for SMB printing operations
5 Copyright (C) Guenther Deschner 2010
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "libcli/raw/libcliraw.h"
23 #include "libcli/libcli.h"
24 #include "torture/torture.h"
25 #include "torture/util.h"
26 #include "system/filesys.h"
28 #include "torture/smbtorture.h"
29 #include "torture/util.h"
30 #include "../librpc/gen_ndr/rap.h"
31 #include "torture/rap/proto.h"
32 #include "param/param.h"
35 #define TORTURE_PRINT_FILE "torture_print_file"
37 static bool test_raw_print(struct torture_context *tctx,
38 struct smbcli_state *cli)
45 fnum = smbcli_open(cli->tree, TORTURE_PRINT_FILE, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
47 torture_fail(tctx, "failed to open file");
50 str = talloc_asprintf(tctx, "TortureTestPage: %d\nData\n",0);
52 data = data_blob_string_const(str);
54 size_written = smbcli_write(cli->tree, fnum, 0, data.data, 0, data.length);
55 if (size_written != data.length) {
56 torture_fail(tctx, "failed to write file");
59 torture_assert_ntstatus_ok(tctx,
60 smbcli_close(cli->tree, fnum),
61 "failed to close file");
66 static bool test_rap_print(struct torture_context *tctx,
67 struct smbcli_state *cli)
80 struct torture_suite *torture_rap_printing(TALLOC_CTX *mem_ctx)
82 struct torture_suite *suite = torture_suite_create(mem_ctx, "PRINTING");
84 torture_suite_add_1smb_test(suite, "raw_print", test_raw_print);
85 torture_suite_add_1smb_test(suite, "rap_print", test_rap_print);