summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-27 06:18:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:15 -0500
commit93e27bec159db33e77a7eae34249f6073993815a (patch)
tree26af0279823829e1dea03b75a9525f8db5105800 /source4
parent3dd17f128831e09c230a8d56e34495d3b31dbacb (diff)
downloadsamba-93e27bec159db33e77a7eae34249f6073993815a.tar.gz
samba-93e27bec159db33e77a7eae34249f6073993815a.tar.bz2
samba-93e27bec159db33e77a7eae34249f6073993815a.zip
r5035: fixed composite test to use --num-ops command line option
(This used to be commit f36e4cf6862c9cbcd36563007efa8dc59912d896)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/raw/composite.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c
index 5c09848f52..38941b8c56 100644
--- a/source4/torture/raw/composite.c
+++ b/source4/torture/raw/composite.c
@@ -121,9 +121,10 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
char *data;
int i;
size_t len = random() % 10000;
- const int num_ops = 10;
+ extern int torture_numops;
struct event_context *event_ctx;
int *count = talloc_zero(mem_ctx, int);
+ BOOL ret = True;
data = talloc_array(mem_ctx, uint8_t, len);
@@ -152,12 +153,12 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io2.in.password = lp_parm_string(-1, "torture", "password");
io2.in.filename = fname;
- printf("testing parallel fetchfile with %d ops\n", num_ops);
+ printf("testing parallel fetchfile with %d ops\n", torture_numops);
event_ctx = event_context_init(mem_ctx);
- c = talloc_array(mem_ctx, struct smbcli_composite *, num_ops);
+ c = talloc_array(mem_ctx, struct smbcli_composite *, torture_numops);
- for (i=0; i<num_ops; i++) {
+ for (i=0; i<torture_numops; i++) {
c[i] = smb_composite_fetchfile_send(&io2, event_ctx);
c[i]->async.fn = loadfile_complete;
c[i]->async.private = count;
@@ -165,45 +166,38 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("waiting for completion\n");
- while (*count != num_ops) {
+ while (*count != torture_numops) {
event_loop_once(event_ctx);
-#if 0
- /* Attempt to kill the event ... To fix -- vl */
- for (i=0; i<num_ops; i++) {
- if (!c[i]) continue;
- if (c[i]->state == SMBCLI_REQUEST_ERROR) {
- printf("error in %d\n", i); msleep(1000);
- talloc_free(c[i]); c[i]=NULL;
- }
- }
-#endif
printf("count=%d\r", *count);
fflush(stdout);
}
printf("count=%d\n", *count);
- for (i=0;i<num_ops;i++) {
+ for (i=0;i<torture_numops;i++) {
status = smb_composite_fetchfile_recv(c[i], mem_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("loadfile[%d] failed - %s\n", i,
nt_errstr(status));
- return False;
+ ret = False;
+ continue;
}
if (io2.out.size != len) {
printf("wrong length in returned data - %d "
"should be %d\n",
io2.out.size, len);
- return False;
+ ret = False;
+ continue;
}
if (memcmp(io2.out.data, data, len) != 0) {
printf("wrong data in loadfile!\n");
- return False;
+ ret = False;
+ continue;
}
}
- return NT_STATUS_IS_OK(status);
+ return ret;
}
/*