2 Unix SMB/CIFS implementation.
4 libcli composite function testing
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "libcli/raw/libcliraw.h"
25 #include "libcli/composite/composite.h"
27 #define BASEDIR "\\composite"
29 static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
31 const char *fname = BASEDIR "\\test.txt";
34 struct smb_composite_loadfile io;
36 fnum = create_complex_file(cli, mem_ctx, fname);
37 smbcli_close(cli->tree, fnum);
41 status = smb_composite_loadfile(cli->tree, mem_ctx, &io);
42 if (!NT_STATUS_IS_OK(status)) {
43 printf("Loadfile failed: %s\n", nt_errstr(status));
51 basic testing of libcli composite calls
53 BOOL torture_raw_composite(void)
55 struct smbcli_state *cli;
59 if (!torture_open_connection(&cli)) {
63 mem_ctx = talloc_init("torture_raw_composite");
65 if (!torture_setup_dir(cli, BASEDIR)) {
69 ret &= test_loadfile(cli, mem_ctx);
71 smb_raw_exit(cli->session);
72 smbcli_deltree(cli->tree, BASEDIR);
74 torture_close_connection(cli);
75 talloc_destroy(mem_ctx);