summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/local/binding_string.c111
-rw-r--r--source4/torture/local/config.mk14
-rw-r--r--source4/torture/local/idtree.c104
-rw-r--r--source4/torture/local/registry.c93
-rw-r--r--source4/torture/local/socket.c191
-rw-r--r--source4/torture/local/tdr.c93
-rw-r--r--source4/torture/local/util_file.c95
-rw-r--r--source4/torture/local/util_strlist.c80
8 files changed, 7 insertions, 774 deletions
diff --git a/source4/torture/local/binding_string.c b/source4/torture/local/binding_string.c
deleted file mode 100644
index f6bf35671e..0000000000
--- a/source4/torture/local/binding_string.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- local testing of RPC binding string parsing
-
- Copyright (C) Jelmer Vernooij 2004
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-#include "librpc/gen_ndr/epmapper.h"
-#include "librpc/rpc/dcerpc.h"
-#include "torture/torture.h"
-
-static bool test_BindingString(struct torture_context *tctx,
- const void *test_data)
-{
- const char *binding = test_data;
- struct dcerpc_binding *b, *b2;
- const char *s, *s2;
- struct epm_tower tower;
- TALLOC_CTX *mem_ctx = tctx;
-
- /* Parse */
- torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(mem_ctx, binding, &b),
- "Error parsing binding string");
-
- s = dcerpc_binding_string(mem_ctx, b);
- torture_assert(tctx, s != NULL, "Error converting binding back to string");
-
- torture_assert_casestr_equal(tctx, binding, s,
- "Mismatch while comparing original and regenerated binding strings");
-
- /* Generate protocol towers */
- torture_assert_ntstatus_ok(tctx, dcerpc_binding_build_tower(mem_ctx, b, &tower),
- "Error generating protocol tower");
-
- /* Convert back to binding and then back to string and compare */
-
- torture_assert_ntstatus_ok(tctx, dcerpc_binding_from_tower(mem_ctx, &tower, &b2),
- "Error generating binding from tower for original binding");
-
- /* Compare to a stripped down version of the binding string because
- * the protocol tower doesn't contain the extra option data */
- b->options = NULL;
-
- b->flags = 0;
-
- s = dcerpc_binding_string(mem_ctx, b);
- torture_assert(tctx, s != NULL, "Error converting binding back to string for (stripped down)");
-
- s2 = dcerpc_binding_string(mem_ctx, b2);
- torture_assert(tctx, s != NULL, "Error converting binding back to string");
-
- if (is_ipaddress(b->host))
- torture_assert_casestr_equal(tctx, s, s2, "Mismatch while comparing original and from protocol tower generated binding strings");
-
- return true;
-}
-
-static const char *test_strings[] = {
- "ncacn_np:",
- "ncalrpc:",
- "ncalrpc:[,Security=Sane]",
- "ncacn_np:[rpcecho]",
- "ncacn_np:127.0.0.1[rpcecho]",
- "ncacn_ip_tcp:127.0.0.1",
- "ncacn_ip_tcp:127.0.0.1[20]",
- "ncacn_ip_tcp:127.0.0.1[20,sign]",
- "ncacn_ip_tcp:127.0.0.1[20,Security=Foobar,sign]",
- "ncacn_http:127.0.0.1",
- "ncacn_http:127.0.0.1[78]",
- "ncacn_http:127.0.0.1[78,ProxyServer=myproxy:3128]",
- "ncacn_np:localhost[rpcecho]",
- "ncacn_np:[/pipe/rpcecho]",
- "ncacn_np:localhost[/pipe/rpcecho,sign,seal]",
- "ncacn_np:[,sign]",
- "ncadg_ip_udp:",
- "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_np:localhost",
- "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_ip_tcp:127.0.0.1",
- "ncacn_unix_stream:[/tmp/epmapper]",
- "ncalrpc:[IDENTIFIER]",
- "ncacn_unix_stream:[/tmp/epmapper,sign]",
-};
-
-struct torture_suite *torture_local_binding_string(TALLOC_CTX *mem_ctx)
-{
- int i;
- struct torture_suite *suite = torture_suite_create(mem_ctx,
- "BINDING");
-
- for (i = 0; i < ARRAY_SIZE(test_strings); i++) {
- torture_suite_add_simple_tcase(suite, test_strings[i],
- test_BindingString, test_strings[i]);
- }
-
- return suite;
-}
diff --git a/source4/torture/local/config.mk b/source4/torture/local/config.mk
index 1397e8600a..b323e996e2 100644
--- a/source4/torture/local/config.mk
+++ b/source4/torture/local/config.mk
@@ -16,16 +16,16 @@ OBJ_FILES = \
../../lib/replace/test/os2_delete.o \
../../lib/replace/test/testsuite.o \
messaging.o \
- binding_string.o \
- idtree.o \
- socket.o \
+ ../../librpc/tests/binding_string.o \
+ ../../lib/util/tests/idtree.o \
+ ../../lib/socket/testsuite.o \
irpc.o \
- registry.o \
+ ../../lib/registry/tests/generic.o \
resolve.o \
- util_strlist.o \
- util_file.o \
+ ../../lib/util/tests/strlist.o \
+ ../../lib/util/tests/file.o \
sddl.o \
- tdr.o \
+ ../../lib/tdr/testsuite.o \
event.o \
local.o \
dbspeed.o \
diff --git a/source4/torture/local/idtree.c b/source4/torture/local/idtree.c
deleted file mode 100644
index dd8618d0db..0000000000
--- a/source4/torture/local/idtree.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- local testing of idtree routines.
-
- Copyright (C) Andrew Tridgell 2004
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-#include "torture/torture.h"
-
-static bool torture_local_idtree_simple(struct torture_context *tctx)
-{
- struct idr_context *idr;
- int i;
- int *ids;
- int *present;
- extern int torture_numops;
- int n = torture_numops;
- TALLOC_CTX *mem_ctx = tctx;
-
- idr = idr_init(mem_ctx);
-
- ids = talloc_zero_array(mem_ctx, int, n);
- present = talloc_zero_array(mem_ctx, int, n);
-
- for (i=0;i<n;i++) {
- ids[i] = -1;
- }
-
- for (i=0;i<n;i++) {
- int ii = random() % n;
- void *p = idr_find(idr, ids[ii]);
- if (present[ii]) {
- if (p != &ids[ii]) {
- torture_fail(tctx, talloc_asprintf(tctx,
- "wrong ptr at %d - %p should be %p",
- ii, p, &ids[ii]));
- }
- if (random() % 7 == 0) {
- if (idr_remove(idr, ids[ii]) != 0) {
- torture_fail(tctx, talloc_asprintf(tctx,
- "remove failed at %d (id=%d)",
- i, ids[ii]));
- }
- present[ii] = 0;
- ids[ii] = -1;
- }
- } else {
- if (p != NULL) {
- torture_fail(tctx, talloc_asprintf(tctx,
- "non-present at %d gave %p (would be %d)",
- ii, p,
- (int)(((char *)p) - (char *)(&ids[0])) / sizeof(int)));
- }
- if (random() % 5) {
- ids[ii] = idr_get_new(idr, &ids[ii], n);
- if (ids[ii] < 0) {
- torture_fail(tctx, talloc_asprintf(tctx,
- "alloc failure at %d (ret=%d)",
- ii, ids[ii]));
- } else {
- present[ii] = 1;
- }
- }
- }
- }
-
- torture_comment(tctx, "done %d random ops\n", i);
-
- for (i=0;i<n;i++) {
- if (present[i]) {
- if (idr_remove(idr, ids[i]) != 0) {
- torture_fail(tctx, talloc_asprintf(tctx,
- "delete failed on cleanup at %d (id=%d)",
- i, ids[i]));
- }
- }
- }
-
- torture_comment(tctx, "cleaned up\n");
- return true;
-}
-
-struct torture_suite *torture_local_idtree(TALLOC_CTX *mem_ctx)
-{
- struct torture_suite *suite = torture_suite_create(mem_ctx, "IDTREE");
- torture_suite_add_simple_test(suite, "idtree", torture_local_idtree_simple);
- return suite;
-}
diff --git a/source4/torture/local/registry.c b/source4/torture/local/registry.c
deleted file mode 100644
index d200ba6e1b..0000000000
--- a/source4/torture/local/registry.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- local testing of registry library
-
- Copyright (C) Jelmer Vernooij 2005
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-#include "lib/registry/registry.h"
-#include "lib/cmdline/popt_common.h"
-#include "torture/torture.h"
-
-const static struct test_backend_settings {
- const char *name;
- const char *location;
-} backends[] = {
- { "nt4", "TEST.DAT" },
- { "ldb", "test.ldb" },
- { "gconf", "." },
- { "dir", "." },
- { NULL, NULL }
-};
-
-static bool test_hive(struct torture_context *tctx,
- const void *test_data)
-{
- WERROR error;
- struct registry_key *root, *subkey;
- uint32_t count;
- const struct test_backend_settings *backend = test_data;
- TALLOC_CTX *mem_ctx = tctx;
-
- if (!reg_has_backend(backend->name)) {
- torture_skip(tctx, talloc_asprintf(tctx,
- "Backend '%s' support not compiled in", backend->name));
- }
-
- error = reg_open_hive(mem_ctx, backend->name,
- backend->location, NULL, cmdline_credentials, &root);
- torture_assert_werr_ok(tctx, error, "reg_open_hive()");
-
- /* This is a new backend. There should be no subkeys and no
- * values */
- error = reg_key_num_subkeys(root, &count);
- torture_assert_werr_ok(tctx, error, "reg_key_num_subkeys()");
-
- torture_assert(tctx, count != 0, "New key has non-zero subkey count");
-
- error = reg_key_num_values(root, &count);
- torture_assert_werr_ok(tctx, error, "reg_key_num_values");
-
- torture_assert(tctx, count != 0, "New key has non-zero value count");
-
- error = reg_key_add_name(mem_ctx, root, "Nested\\Key", SEC_MASK_GENERIC, NULL, &subkey);
- torture_assert_werr_ok(tctx, error, "reg_key_add_name");
-
- error = reg_key_del(root, "Nested\\Key");
- torture_assert_werr_ok(tctx, error, "reg_key_del");
-
- talloc_free(root);
- return true;
-}
-
-
-struct torture_suite *torture_registry(TALLOC_CTX *mem_ctx)
-{
- struct torture_suite *suite = torture_suite_create(mem_ctx,
- "REGISTRY");
- int i;
-
- registry_init();
-
- for (i = 0; backends[i].name; i++) {
- torture_suite_add_simple_tcase(suite, backends[i].name, test_hive, &backends[i]);
- }
-
- return suite;
-}
diff --git a/source4/torture/local/socket.c b/source4/torture/local/socket.c
deleted file mode 100644
index e2f9896b33..0000000000
--- a/source4/torture/local/socket.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- local testing of socket routines.
-
- Copyright (C) Andrew Tridgell 2005
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-#include "lib/socket/socket.h"
-#include "lib/events/events.h"
-#include "system/network.h"
-#include "lib/socket/netif.h"
-#include "torture/torture.h"
-
-/*
- basic testing of udp routines
-*/
-static bool test_udp(struct torture_context *tctx)
-{
- struct socket_context *sock1, *sock2;
- NTSTATUS status;
- struct socket_address *srv_addr, *from_addr, *localhost;
- size_t size = 100 + (random() % 100);
- DATA_BLOB blob, blob2;
- size_t sent, nread;
- TALLOC_CTX *mem_ctx = tctx;
-
- status = socket_create("ip", SOCKET_TYPE_DGRAM, &sock1, 0);
- torture_assert_ntstatus_ok(tctx, status, "creating DGRAM IP socket 1");
- talloc_steal(mem_ctx, sock1);
-
- status = socket_create("ip", SOCKET_TYPE_DGRAM, &sock2, 0);
- torture_assert_ntstatus_ok(tctx, status, "creating DGRAM IP socket 1");
- talloc_steal(mem_ctx, sock2);
-
- localhost = socket_address_from_strings(sock1, sock1->backend_name,
- iface_best_ip("127.0.0.1"), 0);
-
- torture_assert(tctx, localhost, "Localhost not found");
-
- status = socket_listen(sock1, localhost, 0, 0);
- torture_assert_ntstatus_ok(tctx, status, "listen on socket 1");
-
- srv_addr = socket_get_my_addr(sock1, mem_ctx);
- torture_assert(tctx, srv_addr != NULL && strcmp(srv_addr->addr, iface_best_ip("127.0.0.1")) == 0,
- talloc_asprintf(tctx,
- "Expected server address of %s but got %s",
- iface_best_ip("127.0.0.1"), srv_addr ? srv_addr->addr : NULL));
-
- torture_comment(tctx, "server port is %d\n", srv_addr->port);
-
- blob = data_blob_talloc(mem_ctx, NULL, size);
- blob2 = data_blob_talloc(mem_ctx, NULL, size);
- generate_random_buffer(blob.data, blob.length);
-
- sent = size;
- status = socket_sendto(sock2, &blob, &sent, srv_addr);
- torture_assert_ntstatus_ok(tctx, status, "sendto() on socket 2");
-
- status = socket_recvfrom(sock1, blob2.data, size, &nread,
- sock1, &from_addr);
- torture_assert_ntstatus_ok(tctx, status, "recvfrom() on socket 1");
-
- torture_assert_str_equal(tctx, from_addr->addr, srv_addr->addr,
- "different address");
-
- torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size");
-
- torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
- "Bad data in recvfrom");
-
- generate_random_buffer(blob.data, blob.length);
- status = socket_sendto(sock1, &blob, &sent, from_addr);
- torture_assert_ntstatus_ok(tctx, status, "sendto() on socket 1");
-
- status = socket_recvfrom(sock2, blob2.data, size, &nread,
- sock2, &from_addr);
- torture_assert_ntstatus_ok(tctx, status, "recvfrom() on socket 2");
- torture_assert_str_equal(tctx, from_addr->addr, srv_addr->addr,
- "Unexpected recvfrom addr");
-
- torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size");
-
- torture_assert_int_equal(tctx, from_addr->port, srv_addr->port,
- "Unexpected recvfrom port");
-
- torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
- "Bad data in recvfrom");
-
- talloc_free(sock1);
- talloc_free(sock2);
- return true;
-}
-
-/*
- basic testing of tcp routines
-*/
-static bool test_tcp(struct torture_context *tctx)
-{
- struct socket_context *sock1, *sock2, *sock3;
- NTSTATUS status;
- struct socket_address *srv_addr, *from_addr, *localhost;
- size_t size = 100 + (random() % 100);
- DATA_BLOB blob, blob2;
- size_t sent, nread;
- TALLOC_CTX *mem_ctx = tctx;
- struct event_context *ev = event_context_init(mem_ctx);
-
- status = socket_create("ip", SOCKET_TYPE_STREAM, &sock1, 0);
- torture_assert_ntstatus_ok(tctx, status, "creating IP stream socket 1");
- talloc_steal(mem_ctx, sock1);
-
- status = socket_create("ip", SOCKET_TYPE_STREAM, &sock2, 0);
- torture_assert_ntstatus_ok(tctx, status, "creating IP stream socket 1");
- talloc_steal(mem_ctx, sock2);
-
- localhost = socket_address_from_strings(sock1, sock1->backend_name,
- iface_best_ip("127.0.0.1"), 0);
- torture_assert(tctx, localhost, "Localhost not found");
-
- status = socket_listen(sock1, localhost, 0, 0);
- torture_assert_ntstatus_ok(tctx, status, "listen on socket 1");
-
- srv_addr = socket_get_my_addr(sock1, mem_ctx);
- torture_assert(tctx, srv_addr && srv_addr->addr,
- "Unexpected socket_get_my_addr NULL\n");
-
- torture_assert_str_equal(tctx, srv_addr->addr, iface_best_ip("127.0.0.1"),
- "Unexpected server address");
-
- torture_comment(tctx, "server port is %d\n", srv_addr->port);
-
- status = socket_connect_ev(sock2, NULL, srv_addr, 0, ev);
- torture_assert_ntstatus_ok(tctx, status, "connect() on socket 2");
-
- status = socket_accept(sock1, &sock3);
- torture_assert_ntstatus_ok(tctx, status, "accept() on socket 1");
- talloc_steal(mem_ctx, sock3);
- talloc_free(sock1);
-
- blob = data_blob_talloc(mem_ctx, NULL, size);
- blob2 = data_blob_talloc(mem_ctx, NULL, size);
- generate_random_buffer(blob.data, blob.length);
-
- sent = size;
- status = socket_send(sock2, &blob, &sent);
- torture_assert_ntstatus_ok(tctx, status, "send() on socket 2");
-
- status = socket_recv(sock3, blob2.data, size, &nread);
- torture_assert_ntstatus_ok(tctx, status, "recv() on socket 3");
-
- from_addr = socket_get_peer_addr(sock3, mem_ctx);
-
- torture_assert(tctx, from_addr && from_addr->addr,
- "Unexpected recvfrom addr NULL");
-
- torture_assert_str_equal(tctx, from_addr->addr, srv_addr->addr,
- "Unexpected recvfrom addr");
-
- torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size");
-
- torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
- "Bad data in recv");
- return true;
-}
-
-struct torture_suite *torture_local_socket(TALLOC_CTX *mem_ctx)
-{
- struct torture_suite *suite = torture_suite_create(mem_ctx,
- "SOCKET");
-
- torture_suite_add_simple_test(suite, "udp", test_udp);
- torture_suite_add_simple_test(suite, "tcp", test_tcp);
-
- return suite;
-}
diff --git a/source4/torture/local/tdr.c b/source4/torture/local/tdr.c
deleted file mode 100644
index 64d4ef84eb..0000000000
--- a/source4/torture/local/tdr.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- test suite for basic tdr functions
-
- Copyright (C) Jelmer Vernooij 2007
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-#include "torture/torture.h"
-#include "lib/tdr/tdr.h"
-
-static bool test_push_uint8(struct torture_context *tctx)
-{
- uint8_t v = 4;
- struct tdr_push *tdr = talloc_zero(tctx, struct tdr_push);
-
- torture_assert_ntstatus_ok(tctx, tdr_push_uint8(tdr, &v), "push failed");
- torture_assert_int_equal(tctx, tdr->data.length, 1, "length incorrect");
- torture_assert_int_equal(tctx, tdr->data.data[0], 4, "data incorrect");
- return true;
-}
-
-static bool test_pull_uint8(struct torture_context *tctx)
-{
- uint8_t d = 2;
- uint8_t l;
- struct tdr_pull tdr;
- tdr.data.data = &d;
- tdr.data.length = 1;
- tdr.offset = 0;
- tdr.flags = 0;
- torture_assert_ntstatus_ok(tctx, tdr_pull_uint8(&tdr, tctx, &l),
- "pull failed");
- torture_assert_int_equal(tctx, 1, tdr.offset,
- "offset invalid");
- return true;
-}
-
-static bool test_push_uint16(struct torture_context *tctx)
-{
- uint16_t v = 0xF32;
- struct tdr_push *tdr = talloc_zero(tctx, struct tdr_push);
-
- torture_assert_ntstatus_ok(tctx, tdr_push_uint16(tdr, &v), "push failed");
- torture_assert_int_equal(tctx, tdr->data.length, 2, "length incorrect");
- torture_assert_int_equal(tctx, tdr->data.data[0], 0x32, "data incorrect");
- torture_assert_int_equal(tctx, tdr->data.data[1], 0x0F, "data incorrect");
- return true;
-}
-
-static bool test_pull_uint16(struct torture_context *tctx)
-{
- uint16_t d = 782;
- uint16_t l;
- struct tdr_pull tdr;
- tdr.data.data = (uint8_t *)&d;
- tdr.data.length = 2;
- tdr.offset = 0;
- tdr.flags = 0;
- torture_assert_ntstatus_ok(tctx, tdr_pull_uint16(&tdr, tctx, &l),
- "pull failed");
- torture_assert_int_equal(tctx, 2, tdr.offset,
- "offset invalid");
- torture_assert_int_equal(tctx, 782, l, "right int read");
- return true;
-}
-
-struct torture_suite *torture_local_tdr(TALLOC_CTX *mem_ctx)
-{
- struct torture_suite *suite = torture_suite_create(mem_ctx, "TDR");
-
- torture_suite_add_simple_test(suite, "pull_uint8", test_pull_uint8);
- torture_suite_add_simple_test(suite, "push_uint8", test_push_uint8);
-
- torture_suite_add_simple_test(suite, "pull_uint16", test_pull_uint16);
- torture_suite_add_simple_test(suite, "push_uint16", test_push_uint16);
-
- return suite;
-}
diff --git a/source4/torture/local/util_file.c b/source4/torture/local/util_file.c
deleted file mode 100644
index 87d25b222e..0000000000
--- a/source4/torture/local/util_file.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- util_file testing
-
- Copyright (C) Jelmer Vernooij 2005
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-#include "system/filesys.h"
-#include "torture/torture.h"
-
-#define TEST_FILENAME "utilfile.test"
-#define TEST_LINE1 "This is list line 1..."
-#define TEST_LINE2 ".. and this is line 2"
-#define TEST_LINE3 "and end of the file"
-
-#define TEST_DATA TEST_LINE1 "\n" TEST_LINE2 "\n" TEST_LINE3
-
-static bool test_file_load_save(struct torture_context *tctx)
-{
- size_t len;
- char *data;
- TALLOC_CTX *mem_ctx = tctx;
-
- torture_assert(tctx, file_save(TEST_FILENAME, TEST_DATA, strlen(TEST_DATA)),
- "saving file");
-
- data = file_load(TEST_FILENAME, &len, mem_ctx);
- torture_assert(tctx, data, "loading file");
-
- torture_assert(tctx, len == strlen(TEST_DATA), "Length");
-
- torture_assert(tctx, memcmp(data, TEST_DATA, len) == 0, "Contents");
-
- unlink(TEST_FILENAME);
- return true;
-}
-
-
-static bool test_afdgets(struct torture_context *tctx)
-{
- int fd;
- char *line;
- TALLOC_CTX *mem_ctx = tctx;
-
- torture_assert(tctx, file_save(TEST_FILENAME, (const void *)TEST_DATA,
- strlen(TEST_DATA)),
- "saving file");
-
- fd = open(TEST_FILENAME, O_RDONLY);
-
- torture_assert(tctx, fd != -1, "opening file");
-
- line = afdgets(fd, mem_ctx, 8);
- torture_assert(tctx, strcmp(line, TEST_LINE1) == 0, "line 1 mismatch");
-
- line = afdgets(fd, mem_ctx, 8);
- torture_assert(tctx, strcmp(line, TEST_LINE2) == 0, "line 2 mismatch");
-
- line = afdgets(fd, mem_ctx, 8);
- torture_assert(tctx, strcmp(line, TEST_LINE3) == 0, "line 3 mismatch");
-
- close(fd);
-
- unlink(TEST_FILENAME);
- return true;
-}
-
-struct torture_suite *torture_local_util_file(TALLOC_CTX *mem_ctx)
-{
- struct torture_suite *suite = torture_suite_create(mem_ctx, "FILE");
-
- torture_suite_add_simple_test(suite, "file_load_save",
- test_file_load_save);
-
- torture_suite_add_simple_test(suite, "afdgets",
- test_afdgets);
-
- return suite;
-}
diff --git a/source4/torture/local/util_strlist.c b/source4/torture/local/util_strlist.c
deleted file mode 100644
index 7dbb5f8ce6..0000000000
--- a/source4/torture/local/util_strlist.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- util_strlist testing
-
- Copyright (C) Jelmer Vernooij 2005
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-#include "torture/torture.h"
-
-static const char *test_lists_shell_strings[] = {
- "",
- "foo",
- "foo bar",
- "foo bar \"bla \"",
- "foo \"\" bla",
- "bla \"\"\"\" blie",
- NULL
-};
-
-static bool test_lists_shell(struct torture_context *tctx,
- const void *test_data)
-{
- const char *data = test_data;
- const char **ret1, **ret2, *tmp;
- BOOL match = True;
- TALLOC_CTX *mem_ctx = tctx;
-
- ret1 = str_list_make_shell(mem_ctx, data, " ");
- tmp = str_list_join_shell(mem_ctx, ret1, ' ');
- ret2 = str_list_make_shell(mem_ctx, tmp, " ");
-
- if ((ret1 == NULL || ret2 == NULL) && ret2 != ret1) {
- match = False;
- } else {
- int j;
- for (j = 0; ret1[j] && ret2[j]; j++) {
- if (strcmp(ret1[j], ret2[j]) != 0) {
- match = False;
- break;
- }
- }
-
- if (ret1[j] || ret2[j])
- match = False;
- }
-
- torture_assert(tctx, match, talloc_asprintf(tctx,
- "str_list_{make,join}_shell: Error double parsing, first run:\n%s\nSecond run: \n%s", data, tmp));
- return true;
-}
-
-struct torture_suite *torture_local_util_strlist(TALLOC_CTX *mem_ctx)
-{
- struct torture_suite *suite = torture_suite_create(mem_ctx, "STRLIST");
- int i;
-
- for (i = 0; test_lists_shell_strings[i]; i++) {
- torture_suite_add_simple_tcase(suite,
- "lists_shell", test_lists_shell,
- &test_lists_shell_strings[i]);
- }
-
- return suite;
-}