summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-01-04 22:48:23 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-01-04 22:48:23 +0100
commitaf744e0954bbe9ddfa2e3da173e79de65e640a4c (patch)
tree78b98c28e6d54c5339c12f2f942883d5088fda84 /source3/torture
parentce47b69d8e318bbb3642d27aa0451e2914c92be7 (diff)
parent2c0faaf5d921fe57a88d3b999067458e8774c6f6 (diff)
downloadsamba-af744e0954bbe9ddfa2e3da173e79de65e640a4c.tar.gz
samba-af744e0954bbe9ddfa2e3da173e79de65e640a4c.tar.bz2
samba-af744e0954bbe9ddfa2e3da173e79de65e640a4c.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/nbio.c19
-rw-r--r--source3/torture/torture.c83
-rw-r--r--source3/torture/utable.c6
3 files changed, 99 insertions, 9 deletions
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index 81d0eb816b..a010c80985 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -111,7 +111,9 @@ static void sigsegv(int sig)
printf("segv at line %d\n", line_count);
slprintf(line, sizeof(line), "/usr/X11R6/bin/xterm -e gdb /proc/%d/exe %d",
(int)getpid(), (int)getpid());
- system(line);
+ if (system(line) == -1) {
+ printf("system() failed\n");
+ }
exit(1);
}
@@ -280,10 +282,16 @@ static void delete_fn(const char *mnt, file_info *finfo, const char *name, void
n = SMB_STRDUP(name);
n[strlen(n)-1] = 0;
- asprintf(&s, "%s%s", n, finfo->name);
+ if (asprintf(&s, "%s%s", n, finfo->name) == -1) {
+ printf("asprintf failed\n");
+ return;
+ }
if (finfo->mode & aDIR) {
char *s2;
- asprintf(&s2, "%s\\*", s);
+ if (asprintf(&s2, "%s\\*", s) == -1) {
+ printf("asprintf failed\n");
+ return;
+ }
cli_list(c, s2, aDIR, delete_fn, NULL);
nb_rmdir(s);
} else {
@@ -297,7 +305,10 @@ static void delete_fn(const char *mnt, file_info *finfo, const char *name, void
void nb_deltree(const char *dname)
{
char *mask;
- asprintf(&mask, "%s\\*", dname);
+ if (asprintf(&mask, "%s\\*", dname) == -1) {
+ printf("asprintf failed\n");
+ return;
+ }
total_deleted = 0;
cli_list(c, mask, aDIR, delete_fn, NULL);
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 63942da2e5..8a1a61e79a 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -1213,7 +1213,9 @@ static bool run_tcon2_test(int dummy)
printf("starting tcon2 test\n");
- asprintf(&service, "\\\\%s\\%s", host, share);
+ if (asprintf(&service, "\\\\%s\\%s", host, share) == -1) {
+ return false;
+ }
status = cli_raw_tcon(cli, service, password, "?????", &max_xmit, &cnum);
@@ -5280,8 +5282,13 @@ static bool run_local_rbtree(int dummy)
for (i=0; i<1000; i++) {
char *key, *value;
- asprintf(&key, "key%ld", random());
- asprintf(&value, "value%ld", random());
+ if (asprintf(&key, "key%ld", random()) == -1) {
+ goto done;
+ }
+ if (asprintf(&value, "value%ld", random()) == -1) {
+ SAFE_FREE(key);
+ goto done;
+ }
if (!rbt_testval(db, key, value)) {
SAFE_FREE(key);
@@ -5290,7 +5297,10 @@ static bool run_local_rbtree(int dummy)
}
SAFE_FREE(value);
- asprintf(&value, "value%ld", random());
+ if (asprintf(&value, "value%ld", random()) == -1) {
+ SAFE_FREE(key);
+ goto done;
+ }
if (!rbt_testval(db, key, value)) {
SAFE_FREE(key);
@@ -5483,6 +5493,70 @@ static bool run_local_memcache(int dummy)
return ret;
}
+static void wbclient_done(struct async_req *req)
+{
+ NTSTATUS status;
+ struct winbindd_response *wb_resp;
+ int *i = (int *)req->async.priv;
+
+ status = wb_trans_recv(req, req, &wb_resp);
+ TALLOC_FREE(req);
+ *i += 1;
+ d_printf("wb_trans_recv %d returned %s\n", *i, nt_errstr(status));
+}
+
+static bool run_local_wbclient(int dummy)
+{
+ struct event_context *ev;
+ struct wb_context **wb_ctx;
+ struct winbindd_request wb_req;
+ bool result = false;
+ int i, j;
+
+ BlockSignals(True, SIGPIPE);
+
+ ev = event_context_init(talloc_tos());
+ if (ev == NULL) {
+ goto fail;
+ }
+
+ wb_ctx = TALLOC_ARRAY(ev, struct wb_context *, torture_numops);
+ if (wb_ctx == NULL) {
+ goto fail;
+ }
+
+ ZERO_STRUCT(wb_req);
+ wb_req.cmd = WINBINDD_PING;
+
+ for (i=0; i<torture_numops; i++) {
+ wb_ctx[i] = wb_context_init(ev);
+ if (wb_ctx[i] == NULL) {
+ goto fail;
+ }
+ for (j=0; j<5; j++) {
+ struct async_req *req;
+ req = wb_trans_send(ev, ev, wb_ctx[i],
+ (j % 2) == 0, &wb_req);
+ if (req == NULL) {
+ goto fail;
+ }
+ req->async.fn = wbclient_done;
+ req->async.priv = &i;
+ }
+ }
+
+ i = 0;
+
+ while (i < 5 * torture_numops) {
+ event_loop_once(ev);
+ }
+
+ result = true;
+ fail:
+ TALLOC_FREE(ev);
+ return result;
+}
+
static double create_procs(bool (*fn)(int), bool *result)
{
int i, status;
@@ -5642,6 +5716,7 @@ static struct {
{ "LOCAL-RBTREE", run_local_rbtree, 0},
{ "LOCAL-MEMCACHE", run_local_memcache, 0},
{ "LOCAL-STREAM-NAME", run_local_stream_name, 0},
+ { "LOCAL-WBCLIENT", run_local_wbclient, 0},
{NULL, NULL, 0}};
diff --git a/source3/torture/utable.c b/source3/torture/utable.c
index 7032cea99b..e36b0388c4 100644
--- a/source3/torture/utable.c
+++ b/source3/torture/utable.c
@@ -84,7 +84,11 @@ bool torture_utable(int dummy)
d_printf("Failed to create valid.dat - %s", strerror(errno));
return False;
}
- write(fd, valid, 0x10000);
+ if (write(fd, valid, 0x10000) != 0x10000) {
+ d_printf("Failed to create valid.dat - %s", strerror(errno));
+ close(fd);
+ return false;
+ }
close(fd);
d_printf("wrote valid.dat\n");