summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/basic/misc.c2
-rw-r--r--source4/torture/ldap/cldapbench.c24
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c4
-rw-r--r--source4/torture/libnet/libnet_domain.c3
-rw-r--r--source4/torture/nbench/nbench.c4
-rw-r--r--source4/torture/nbt/browse.c2
-rw-r--r--source4/torture/raw/close.c4
-rw-r--r--source4/torture/raw/openbench.c2
-rw-r--r--source4/torture/raw/samba3misc.c4
-rw-r--r--source4/torture/rpc/handles.c4
-rw-r--r--source4/torture/rpc/join.c2
-rw-r--r--source4/torture/rpc/samsync.c2
-rw-r--r--source4/torture/rpc/schannel.c2
-rw-r--r--source4/torture/smbtorture.c39
-rw-r--r--source4/torture/ui.c6
-rw-r--r--source4/torture/ui.h4
-rw-r--r--source4/torture/unix/unix_info2.c10
17 files changed, 43 insertions, 75 deletions
diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c
index b4584fcf58..d72e3ca1cd 100644
--- a/source4/torture/basic/misc.c
+++ b/source4/torture/basic/misc.c
@@ -556,7 +556,7 @@ static NTSTATUS benchrw_readwrite(struct torture_context *tctx,
union smb_write wr;
/* randomize between writes and reads*/
- if ( random() % state->lp_params->writeratio == 0) {
+ if (random() % state->lp_params->writeratio == 0) {
torture_comment(tctx, "Callback WRITE file:%d (%d/%d)\n",
state->nr,state->completed,torture_numops);
wr.generic.level = RAW_WRITE_WRITEX ;
diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c
index 751f484cec..52d8689927 100644
--- a/source4/torture/ldap/cldapbench.c
+++ b/source4/torture/ldap/cldapbench.c
@@ -48,17 +48,17 @@ static void request_handler(struct cldap_request *req)
/*
benchmark cldap calls
*/
-static BOOL bench_cldap(TALLOC_CTX *mem_ctx, const char *address)
+static bool bench_cldap(struct torture_context *tctx, const char *address)
{
- struct cldap_socket *cldap = cldap_socket_init(mem_ctx, NULL);
+ struct cldap_socket *cldap = cldap_socket_init(tctx, NULL);
int num_sent=0;
struct timeval tv = timeval_current();
BOOL ret = True;
- int timelimit = lp_parm_int(-1, "torture", "timelimit", 10);
+ int timelimit = torture_setting_int(tctx, "timelimit", 10);
struct cldap_netlogon search;
struct bench_state *state;
- state = talloc_zero(mem_ctx, struct bench_state);
+ state = talloc_zero(tctx, struct bench_state);
ZERO_STRUCT(search);
search.in.dest_address = address;
@@ -75,7 +75,7 @@ static BOOL bench_cldap(TALLOC_CTX *mem_ctx, const char *address)
req->async.fn = request_handler;
num_sent++;
if (num_sent % 50 == 0) {
- if (lp_parm_bool(-1, "torture", "progress", true)) {
+ if (torture_setting_bool(tctx, "progress", true)) {
printf("%.1f queries per second (%d failures) \r",
state->pass_count / timeval_elapsed(&tv),
state->fail_count);
@@ -104,28 +104,24 @@ static BOOL bench_cldap(TALLOC_CTX *mem_ctx, const char *address)
benchmark how fast a CLDAP server can respond to a series of parallel
requests
*/
-BOOL torture_bench_cldap(struct torture_context *torture)
+bool torture_bench_cldap(struct torture_context *torture)
{
const char *address;
struct nbt_name name;
- TALLOC_CTX *mem_ctx = talloc_new(NULL);
NTSTATUS status;
- BOOL ret = True;
+ bool ret = true;
make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
/* do an initial name resolution to find its IP */
- status = resolve_name(&name, mem_ctx, &address, event_context_find(mem_ctx));
+ status = resolve_name(&name, torture, &address, event_context_find(torture));
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to resolve %s - %s\n",
name.name, nt_errstr(status));
- talloc_free(mem_ctx);
- return False;
+ return false;
}
- ret &= bench_cldap(mem_ctx, address);
-
- talloc_free(mem_ctx);
+ ret &= bench_cldap(torture, address);
return ret;
}
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index ab50f91c1d..9d67e093b1 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -763,7 +763,7 @@ BOOL torture_net_become_dc(struct torture_context *torture)
b.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
b.in.domain_netbios_name = torture_join_dom_netbios_name(s->tj);
b.in.domain_sid = torture_join_sid(s->tj);
- b.in.source_dsa_address = lp_parm_string(-1, "torture", "host");
+ b.in.source_dsa_address = torture_setting_string(torture, "host", NULL);
b.in.dest_dsa_netbios_name = s->netbios_name;
b.in.callbacks.private_data = s;
@@ -843,7 +843,7 @@ cleanup:
ZERO_STRUCT(u);
u.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
u.in.domain_netbios_name = torture_join_dom_netbios_name(s->tj);
- u.in.source_dsa_address = lp_parm_string(-1, "torture", "host");
+ u.in.source_dsa_address = torture_setting_string(torture, "host", NULL);
u.in.dest_dsa_netbios_name = s->netbios_name;
status = libnet_UnbecomeDC(s->ctx, s, &u);
diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c
index 2ececa690a..915054bf50 100644
--- a/source4/torture/libnet/libnet_domain.c
+++ b/source4/torture/libnet/libnet_domain.c
@@ -120,8 +120,7 @@ static BOOL test_opendomain_lsa(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
-
-BOOL torture_domain_open_lsa(struct torture_context *torture)
+bool torture_domain_open_lsa(struct torture_context *torture)
{
NTSTATUS status;
BOOL ret = True;
diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c
index 79c5226fb1..d01c5a7ecd 100644
--- a/source4/torture/nbench/nbench.c
+++ b/source4/torture/nbench/nbench.c
@@ -64,7 +64,7 @@ static BOOL run_netbench(struct torture_context *tctx, struct smbcli_state *cli,
char *cname;
FILE *f;
BOOL correct = True;
- double target_rate = lp_parm_double(-1, "torture", "targetrate", 0);
+ double target_rate = torture_setting_double(tctx, "targetrate", 0);
int n;
if (target_rate != 0 && client == 0) {
@@ -229,7 +229,7 @@ BOOL torture_nbench(struct torture_context *torture)
read_only = torture_setting_bool(torture, "readonly", False);
- nb_max_retries = lp_parm_int(-1, "torture", "nretries", 1);
+ nb_max_retries = torture_setting_int(torture, "nretries", 1);
p = torture_setting_string(torture, "timelimit", NULL);
if (p && *p) {
diff --git a/source4/torture/nbt/browse.c b/source4/torture/nbt/browse.c
index dd9c623b41..a9aac79469 100644
--- a/source4/torture/nbt/browse.c
+++ b/source4/torture/nbt/browse.c
@@ -27,7 +27,7 @@
/*
test nbt dgram operations
*/
-BOOL torture_nbt_browse(struct torture_context *torture)
+bool torture_nbt_browse(struct torture_context *torture)
{
const char *address;
struct nbt_name name;
diff --git a/source4/torture/raw/close.c b/source4/torture/raw/close.c
index 0e2543cfcf..6af234e4b4 100644
--- a/source4/torture/raw/close.c
+++ b/source4/torture/raw/close.c
@@ -101,13 +101,13 @@ BOOL torture_raw_close(struct torture_context *torture)
printf("Incorrect times after close - only write time should be set\n");
dump_all_info(mem_ctx, &finfo);
- if (!lp_parm_bool(-1, "torture", "samba3", False)) {
+ if (!torture_setting_bool(torture, "samba3", false)) {
/*
* In Samba3 as of 3.0.23d we don't yet support all
* file times, so don't mark this as a critical
* failure
*/
- ret = False;
+ ret = false;
}
}
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index e5b47cebe1..fffb572d50 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -351,7 +351,7 @@ BOOL torture_bench_open(struct torture_context *torture)
progress = torture_setting_bool(torture, "progress", true);
- nprocs = lp_parm_int(-1, "torture", "nprocs", 4);
+ nprocs = torture_setting_int(torture, "nprocs", 4);
state = talloc_zero_array(mem_ctx, struct benchopen_state, nprocs);
diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c
index c019c4e2ee..52ace05314 100644
--- a/source4/torture/raw/samba3misc.c
+++ b/source4/torture/raw/samba3misc.c
@@ -538,13 +538,13 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
status = raw_smbcli_t2open(cli_nt->tree, fpath, O_RDONLY | O_CREAT| O_EXCL, DENY_NONE, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)
- || !lp_parm_bool(-1, "torture", "samba3", False)) {
+ || !torture_setting_bool(torture, "samba3", false)) {
/* Against samba3, treat EAS_NOT_SUPPORTED as acceptable */
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
}
status = raw_smbcli_t2open(cli_dos->tree, fpath, O_RDONLY | O_CREAT| O_EXCL, DENY_NONE, NULL);
if (!NT_STATUS_EQUAL(status, NT_STATUS_DOS(ERRDOS,ERReasnotsupported))
- || !lp_parm_bool(-1, "torture", "samba3", False)) {
+ || !torture_setting_bool(torture, "samba3", false)) {
/* Against samba3, treat EAS_NOT_SUPPORTED as acceptable */
CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRfilexists));
}
diff --git a/source4/torture/rpc/handles.c b/source4/torture/rpc/handles.c
index 83462d3328..f8cd1cd488 100644
--- a/source4/torture/rpc/handles.c
+++ b/source4/torture/rpc/handles.c
@@ -116,7 +116,7 @@ static bool test_handles_lsa_shared(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-LSARPC-SHARED\n");
- if (lp_parm_bool(-1, "torture", "samba4", False)) {
+ if (torture_setting_bool(torture, "samba4", false)) {
torture_comment(torture, "LSA shared-policy-handle test against Samba4 - skipping\n");
return true;
}
@@ -399,7 +399,7 @@ static bool test_handles_mixed_shared(struct torture_context *torture)
torture_comment(torture, "RPC-HANDLE-MIXED-SHARED\n");
- if (lp_parm_bool(-1, "torture", "samba4", False)) {
+ if (torture_setting_bool(torture, "samba4", false)) {
torture_comment(torture, "Mixed shared-policy-handle test against Samba4 - skipping\n");
return true;
}
diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c
index a2a30e285a..23c43c525e 100644
--- a/source4/torture/rpc/join.c
+++ b/source4/torture/rpc/join.c
@@ -14,7 +14,7 @@ BOOL torture_rpc_join(struct torture_context *torture)
struct test_join *tj;
struct cli_credentials *machine_account;
struct smbcli_state *cli;
- const char *host = lp_parm_string(-1, "torture", "host");
+ const char *host = torture_setting_string(torture, "host", NULL);
/* Join domain as a member server. */
tj = torture_join_domain(TORTURE_NETBIOS_NAME,
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index cf08e857de..6a40cc5e46 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -1409,7 +1409,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture)
struct test_join *user_ctx;
const char *machine_password;
const char *wksta_machine_password;
- const char *binding = lp_parm_string(-1, "torture", "binding");
+ const char *binding = torture_setting_string(torture, "binding", NULL);
struct dcerpc_binding *b;
struct dcerpc_binding *b_netlogon_wksta;
struct samr_Connect c;
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 416a469fc4..e072e592d1 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -497,7 +497,7 @@ BOOL torture_rpc_schannel2(struct torture_context *torture)
TALLOC_CTX *mem_ctx = talloc_new(torture);
struct test_join *join_ctx;
NTSTATUS status;
- const char *binding = lp_parm_string(-1, "torture", "binding");
+ const char *binding = torture_setting_string(torture, "binding", NULL);
struct dcerpc_binding *b;
struct dcerpc_pipe *p1 = NULL, *p2 = NULL;
struct cli_credentials *credentials1, *credentials2;
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 3525f0d137..43f6b67f1c 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -382,41 +382,6 @@ const static struct torture_ui_ops subunit_ui_ops = {
.suite_start = subunit_suite_start
};
-static void harness_test_start (struct torture_context *ctx,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
-}
-
-static void harness_test_result (struct torture_context *context,
- enum torture_result res, const char *reason)
-{
- switch (res) {
- case TORTURE_OK:
- printf("ok %s - %s\n", context->active_test->name, reason);
- break;
- case TORTURE_FAIL:
- case TORTURE_ERROR:
- printf("not ok %s - %s\n", context->active_test->name, reason);
- break;
- case TORTURE_SKIP:
- printf("skip %s - %s\n", context->active_test->name, reason);
- break;
- }
-}
-
-static void harness_comment (struct torture_context *test,
- const char *comment)
-{
- printf("# %s\n", comment);
-}
-
-const static struct torture_ui_ops harness_ui_ops = {
- .comment = harness_comment,
- .test_start = harness_test_start,
- .test_result = harness_test_result
-};
-
static void quiet_suite_start(struct torture_context *ctx,
struct torture_suite *suite)
{
@@ -520,7 +485,7 @@ int main(int argc,char *argv[])
struct poptOption long_options[] = {
POPT_AUTOHELP
- {"format", 0, POPT_ARG_STRING, &ui_ops_name, 0, "Output format (one of: simple, subunit, harness)", NULL },
+ {"format", 0, POPT_ARG_STRING, &ui_ops_name, 0, "Output format (one of: simple, subunit)", NULL },
{"smb-ports", 'p', POPT_ARG_STRING, NULL, OPT_SMB_PORTS, "SMB ports", NULL},
{"basedir", 0, POPT_ARG_STRING, NULL, OPT_BASEDIR, "base directory", "BSAEDIR" },
{"seed", 0, POPT_ARG_INT, &torture_seed, 0, "seed", NULL},
@@ -662,8 +627,6 @@ int main(int argc,char *argv[])
ui_ops = &std_ui_ops;
} else if (!strcmp(ui_ops_name, "subunit")) {
ui_ops = &subunit_ui_ops;
- } else if (!strcmp(ui_ops_name, "harness")) {
- ui_ops = &harness_ui_ops;
} else if (!strcmp(ui_ops_name, "quiet")) {
ui_ops = &quiet_ui_ops;
} else {
diff --git a/source4/torture/ui.c b/source4/torture/ui.c
index 683b0f114b..23e761e5dc 100644
--- a/source4/torture/ui.c
+++ b/source4/torture/ui.c
@@ -320,6 +320,12 @@ int torture_setting_int(struct torture_context *test, const char *name,
return lp_parm_int(-1, "torture", name, default_value);
}
+double torture_setting_double(struct torture_context *test, const char *name,
+ double default_value)
+{
+ return lp_parm_double(-1, "torture", name, default_value);
+}
+
bool torture_setting_bool(struct torture_context *test, const char *name,
bool default_value)
{
diff --git a/source4/torture/ui.h b/source4/torture/ui.h
index c3b0092d48..289fad5930 100644
--- a/source4/torture/ui.h
+++ b/source4/torture/ui.h
@@ -343,6 +343,10 @@ int torture_setting_int(struct torture_context *test,
const char *name,
int default_value);
+double torture_setting_double(struct torture_context *test,
+ const char *name,
+ double default_value);
+
bool torture_setting_bool(struct torture_context *test,
const char *name,
bool default_value);
diff --git a/source4/torture/unix/unix_info2.c b/source4/torture/unix/unix_info2.c
index 4c47179099..1e063fbe8f 100644
--- a/source4/torture/unix/unix_info2.c
+++ b/source4/torture/unix/unix_info2.c
@@ -46,15 +46,15 @@ struct unix_info2 {
uint32_t flags_mask;
};
-static struct smbcli_state *connect_to_server(void *mem_ctx)
+static struct smbcli_state *connect_to_server(struct torture_context *tctx)
{
NTSTATUS status;
struct smbcli_state *cli;
- const char *host = lp_parm_string(-1, "torture", "host");
- const char *share = lp_parm_string(-1, "torture", "share");
+ const char *host = torture_setting_string(tctx, "host", NULL);
+ const char *share = torture_setting_string(tctx, "share", NULL);
- status = smbcli_full_connection(mem_ctx, &cli,
+ status = smbcli_full_connection(tctx, &cli,
host, share, NULL,
cmdline_credentials, NULL);
@@ -399,7 +399,7 @@ BOOL unix_torture_unix_info2(struct torture_context *torture)
mem_ctx = talloc_init("smb_query_unix_info2");
torture_assert(torture, mem_ctx != NULL, "out of memory");
- if (!(cli = connect_to_server(mem_ctx))) {
+ if (!(cli = connect_to_server(torture))) {
talloc_free(mem_ctx);
return False;
}