2 Unix SMB/CIFS implementation.
4 anonymous_shared testing
6 Copyright (C) Stefan Metzmacher 2011
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 3 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, see <http://www.gnu.org/licenses/>.
23 #include "torture/torture.h"
24 #include "torture/local/proto.h"
26 static bool test_anonymous_shared_simple(struct torture_context *tctx)
31 torture_comment(tctx, "anonymous_shared_free(NULL)\n");
32 anonymous_shared_free(NULL);
35 torture_comment(tctx, "anonymous_shared_allocate(%llu)\n",
36 (unsigned long long)len);
37 ptr = anonymous_shared_allocate(len);
38 torture_assert(tctx, ptr, "valid pointer");
39 memset(ptr, 0xfe, len);
40 torture_comment(tctx, "anonymous_shared_free(ptr)\n");
41 anonymous_shared_free(ptr);
44 torture_comment(tctx, "anonymous_shared_allocate(%llu)\n",
45 (unsigned long long)len);
46 ptr = anonymous_shared_allocate(len);
47 torture_assert(tctx, ptr, "valid pointer");
48 memset(ptr, 0xfe, len);
49 torture_comment(tctx, "anonymous_shared_free(ptr)\n");
50 anonymous_shared_free(ptr);
52 memset(&len, 0xFF, sizeof(len));
53 torture_comment(tctx, "anonymous_shared_allocate(%llu)\n",
54 (unsigned long long)len);
55 ptr = anonymous_shared_allocate(len);
56 torture_assert(tctx, ptr == NULL, "null pointer");
61 /* local.anonymous_shared test suite creation */
62 struct torture_suite *torture_local_util_anonymous_shared(TALLOC_CTX *mem_ctx)
64 struct torture_suite *suite = torture_suite_create(mem_ctx, "anonymous_shared");
66 torture_suite_add_simple_test(suite, "simple",
67 test_anonymous_shared_simple);