summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/config.mk35
-rw-r--r--source4/torture/ldap/cldapbench.c2
-rw-r--r--source4/torture/ldap/schema.c2
-rw-r--r--source4/torture/ldap/uptodatevector.c2
-rw-r--r--source4/torture/libnet/domain.c4
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c4
-rw-r--r--source4/torture/local/dbspeed.c2
-rw-r--r--source4/torture/nbt/dgram.c6
-rw-r--r--source4/torture/raw/lockbench.c9
-rw-r--r--source4/torture/raw/offline.c13
-rw-r--r--source4/torture/raw/open.c10
-rw-r--r--source4/torture/raw/openbench.c9
-rw-r--r--source4/torture/raw/oplock.c3
-rw-r--r--source4/torture/rpc/async_bind.c7
-rw-r--r--source4/torture/rpc/schannel.c6
-rw-r--r--source4/torture/smb2/scan.c4
-rw-r--r--source4/torture/smb2/util.c2
-rw-r--r--source4/torture/smbtorture.c2
-rw-r--r--source4/torture/ui.c3
19 files changed, 57 insertions, 68 deletions
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 6e1bacf199..2f3fa38863 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -313,28 +313,33 @@ locktest_OBJ_FILES = torture/locktest.o
MANPAGES += torture/man/locktest.1
-COV_TARGET = test
+GCOV=0
+
+ifeq ($(MAKECMDGOALS),gcov)
+GCOV=1
+endif
+
+ifeq ($(MAKECMDGOALS),lcov)
+GCOV=1
+endif
+
+ifeq ($(MAKECMDGOALS),testcov-html)
+GCOV=1
+endif
-COV_VARS = \
- CFLAGS="$(CFLAGS) --coverage" \
- LDFLAGS="$(LDFLAGS) --coverage"
+ifeq ($(GCOV),1)
+CFLAGS += --coverage
+LDFLAGS += --coverage
+endif
-test_cov:
- -$(MAKE) $(COV_TARGET) $(COV_VARS)
+COV_TARGET = test
-gcov: test_cov
+gcov: test
for I in $(sort $(dir $(ALL_OBJS))); \
do $(GCOV) -p -o $$I $$I/*.c; \
done
-lcov-split:
- rm -f samba.info
- @$(MAKE) $(COV_TARGET) $(COV_VARS) \
- TEST_OPTIONS="--analyse-cmd=\"lcov --base-directory `pwd` --directory . --capture --output-file samba.info -t\""
- -rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
- genhtml -o coverage samba.info
-
-lcov: test_cov
+lcov: test
-rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
lcov --base-directory `pwd` --directory . --capture --output-file samba.info
genhtml -o coverage samba.info
diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c
index 83e505e164..51586ac733 100644
--- a/source4/torture/ldap/cldapbench.c
+++ b/source4/torture/ldap/cldapbench.c
@@ -116,7 +116,7 @@ bool torture_bench_cldap(struct torture_context *torture)
make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
/* do an initial name resolution to find its IP */
- status = resolve_name(lp_resolve_context(torture->lp_ctx), &name, torture, &address, event_context_find(torture));
+ status = resolve_name(lp_resolve_context(torture->lp_ctx), &name, torture, &address, torture->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to resolve %s - %s\n",
name.name, nt_errstr(status));
diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c
index 4cfce11eb5..8437e7f79d 100644
--- a/source4/torture/ldap/schema.c
+++ b/source4/torture/ldap/schema.c
@@ -376,7 +376,7 @@ bool torture_ldap_schema(struct torture_context *torture)
url = talloc_asprintf(torture, "ldap://%s/", host);
- ldb = ldb_wrap_connect(torture, torture->lp_ctx, url,
+ ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url,
NULL,
cmdline_credentials,
0, NULL);
diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c
index cec330b2f6..87b7e09e13 100644
--- a/source4/torture/ldap/uptodatevector.c
+++ b/source4/torture/ldap/uptodatevector.c
@@ -162,7 +162,7 @@ bool torture_ldap_uptodatevector(struct torture_context *torture)
url = talloc_asprintf(torture, "ldap://%s/", host);
if (!url) goto failed;
- ldb = ldb_wrap_connect(torture, torture->lp_ctx, url,
+ ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url,
NULL,
cmdline_credentials,
0, NULL);
diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c
index ff1fbcab78..ab7846e5e1 100644
--- a/source4/torture/libnet/domain.c
+++ b/source4/torture/libnet/domain.c
@@ -74,7 +74,6 @@ bool torture_domainopen(struct torture_context *torture)
{
NTSTATUS status;
struct libnet_context *net_ctx;
- struct event_context *evt_ctx;
TALLOC_CTX *mem_ctx;
bool ret = true;
struct policy_handle h;
@@ -82,8 +81,7 @@ bool torture_domainopen(struct torture_context *torture)
mem_ctx = talloc_init("test_domain_open");
- evt_ctx = event_context_find(torture);
- net_ctx = libnet_context_init(evt_ctx, torture->lp_ctx);
+ net_ctx = libnet_context_init(torture->ev, torture->lp_ctx);
status = torture_rpc_connection(torture,
&net_ctx->samr.pipe,
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index 4d57a84582..bc92b4ebc2 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -322,7 +322,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb");
DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema: %s\n", sam_ldb_path));
- s->ldb = ldb_wrap_connect(s, s->tctx->lp_ctx, sam_ldb_path,
+ s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->tctx->lp_ctx, sam_ldb_path,
system_session(s, s->tctx->lp_ctx),
NULL, 0, NULL);
if (!s->ldb) {
@@ -654,7 +654,7 @@ bool torture_net_become_dc(struct torture_context *torture)
sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb");
DEBUG(0,("Reopen the SAM LDB with system credentials and all replicated data: %s\n", sam_ldb_path));
- s->ldb = ldb_wrap_connect(s, s->lp_ctx, sam_ldb_path,
+ s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->lp_ctx, sam_ldb_path,
system_session(s, s->lp_ctx),
NULL, 0, NULL);
if (!s->ldb) {
diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index 34083cd204..bf88c00e35 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -176,7 +176,7 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
torture_comment(torture, "Testing ldb speed for sidmap\n");
- ldb = ldb_wrap_connect(tmp_ctx, torture->lp_ctx, "tdb://test.ldb",
+ ldb = ldb_wrap_connect(tmp_ctx, torture->ev, torture->lp_ctx, "tdb://test.ldb",
NULL, NULL, LDB_FLG_NOSYNC, NULL);
if (!ldb) {
unlink("./test.ldb");
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index e1680877e8..a4c8be888c 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -87,7 +87,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
@@ -170,7 +170,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
@@ -283,7 +283,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index 86030c538a..21541d003b 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -316,7 +316,6 @@ bool torture_bench_lock(struct torture_context *torture)
int i;
int timelimit = torture_setting_int(torture, "timelimit", 10);
struct timeval tv;
- struct event_context *ev = event_context_find(mem_ctx);
struct benchlock_state *state;
int total = 0, minops=0;
struct smbcli_state *cli;
@@ -333,8 +332,8 @@ bool torture_bench_lock(struct torture_context *torture)
state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
state[i].client_num = i;
- state[i].ev = ev;
- if (!torture_open_connection_ev(&cli, i, torture, ev)) {
+ state[i].ev = torture->ev;
+ if (!torture_open_connection_ev(&cli, i, torture, torture->ev)) {
return false;
}
talloc_steal(mem_ctx, state);
@@ -375,12 +374,12 @@ bool torture_bench_lock(struct torture_context *torture)
tv = timeval_current();
if (progress) {
- event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state);
+ event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state);
}
printf("Running for %d seconds\n", timelimit);
while (timeval_elapsed(&tv) < timelimit) {
- event_loop_once(ev);
+ event_loop_once(torture->ev);
if (lock_failed) {
DEBUG(0,("locking failed\n"));
diff --git a/source4/torture/raw/offline.c b/source4/torture/raw/offline.c
index 1340692faa..9c66c3be9c 100644
--- a/source4/torture/raw/offline.c
+++ b/source4/torture/raw/offline.c
@@ -389,7 +389,6 @@ bool torture_test_offline(struct torture_context *torture)
int i;
int timelimit = torture_setting_int(torture, "timelimit", 10);
struct timeval tv;
- struct event_context *ev = event_context_find(mem_ctx);
struct offline_state *state;
struct smbcli_state *cli;
bool progress;
@@ -404,8 +403,8 @@ bool torture_test_offline(struct torture_context *torture)
for (i=0;i<nconnections;i++) {
state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
- state[i].ev = ev;
- if (!torture_open_connection_ev(&cli, i, torture, ev)) {
+ state[i].ev = torture->ev;
+ if (!torture_open_connection_ev(&cli, i, torture, torture->ev)) {
return false;
}
state[i].tree = cli->tree;
@@ -418,7 +417,7 @@ bool torture_test_offline(struct torture_context *torture)
for (i=nconnections;i<numstates;i++) {
state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
- state[i].ev = ev;
+ state[i].ev = torture->ev;
state[i].tree = state[i % nconnections].tree;
state[i].client = i;
}
@@ -468,12 +467,12 @@ bool torture_test_offline(struct torture_context *torture)
tv = timeval_current();
if (progress) {
- event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state);
+ event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state);
}
printf("Running for %d seconds\n", timelimit);
while (timeval_elapsed(&tv) < timelimit) {
- event_loop_once(ev);
+ event_loop_once(torture->ev);
if (test_failed) {
DEBUG(0,("test failed\n"));
@@ -487,7 +486,7 @@ bool torture_test_offline(struct torture_context *torture)
while (state[i].loadfile ||
state[i].savefile ||
state[i].req) {
- event_loop_once(ev);
+ event_loop_once(torture->ev);
}
}
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index d28a8bd14e..c6ba0d2571 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -1350,21 +1350,19 @@ static bool test_raw_open_multi(struct torture_context *tctx)
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
int i, num_files = 3;
- struct event_context *ev;
int num_ok = 0;
int num_collision = 0;
- ev = cli_credentials_get_event_context(cmdline_credentials);
clients = talloc_array(mem_ctx, struct smbcli_state *, num_files);
requests = talloc_array(mem_ctx, struct smbcli_request *, num_files);
ios = talloc_array(mem_ctx, union smb_open, num_files);
- if ((ev == NULL) || (clients == NULL) || (requests == NULL) ||
+ if ((tctx->ev == NULL) || (clients == NULL) || (requests == NULL) ||
(ios == NULL)) {
DEBUG(0, ("talloc failed\n"));
return false;
}
- if (!torture_open_connection_share(mem_ctx, &cli, tctx, host, share, ev)) {
+ if (!torture_open_connection_share(mem_ctx, &cli, tctx, host, share, tctx->ev)) {
return false;
}
@@ -1372,7 +1370,7 @@ static bool test_raw_open_multi(struct torture_context *tctx)
for (i=0; i<num_files; i++) {
if (!torture_open_connection_share(mem_ctx, &(clients[i]),
- tctx, host, share, ev)) {
+ tctx, host, share, tctx->ev)) {
DEBUG(0, ("Could not open %d'th connection\n", i));
return false;
}
@@ -1441,7 +1439,7 @@ static bool test_raw_open_multi(struct torture_context *tctx)
break;
}
- if (event_loop_once(ev) != 0) {
+ if (event_loop_once(tctx->ev) != 0) {
DEBUG(0, ("event_loop_once failed\n"));
return false;
}
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index a5b1434a47..26b862c33f 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -369,7 +369,6 @@ bool torture_bench_open(struct torture_context *torture)
int i;
int timelimit = torture_setting_int(torture, "timelimit", 10);
struct timeval tv;
- struct event_context *ev = event_context_find(mem_ctx);
struct benchopen_state *state;
int total = 0;
int total_retries = 0;
@@ -387,8 +386,8 @@ bool torture_bench_open(struct torture_context *torture)
state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
state[i].client_num = i;
- state[i].ev = ev;
- if (!torture_open_connection_ev(&state[i].cli, i, torture, ev)) {
+ state[i].ev = torture->ev;
+ if (!torture_open_connection_ev(&state[i].cli, i, torture, torture->ev)) {
return false;
}
talloc_steal(mem_ctx, state);
@@ -428,13 +427,13 @@ bool torture_bench_open(struct torture_context *torture)
tv = timeval_current();
if (progress) {
- report_te = event_add_timed(ev, state, timeval_current_ofs(1, 0),
+ report_te = event_add_timed(torture->ev, state, timeval_current_ofs(1, 0),
report_rate, state);
}
printf("Running for %d seconds\n", timelimit);
while (timeval_elapsed(&tv) < timelimit) {
- event_loop_once(ev);
+ event_loop_once(torture->ev);
if (open_failed) {
DEBUG(0,("open failed\n"));
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 1927a0f027..fd8d292980 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -2841,13 +2841,12 @@ bool torture_bench_oplock(struct torture_context *torture)
int timelimit = torture_setting_int(torture, "timelimit", 10);
union smb_open io;
struct timeval tv;
- struct event_context *ev = event_context_find(mem_ctx);
cli = talloc_array(mem_ctx, struct smbcli_state *, torture_nprocs);
torture_comment(torture, "Opening %d connections\n", torture_nprocs);
for (i=0;i<torture_nprocs;i++) {
- if (!torture_open_connection_ev(&cli[i], i, torture, ev)) {
+ if (!torture_open_connection_ev(&cli[i], i, torture, torture->ev)) {
return false;
}
talloc_steal(mem_ctx, cli[i]);
diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c
index 1ca3c62df0..0ebbef1ce6 100644
--- a/source4/torture/rpc/async_bind.c
+++ b/source4/torture/rpc/async_bind.c
@@ -39,7 +39,6 @@ bool torture_async_bind(struct torture_context *torture)
{
NTSTATUS status;
TALLOC_CTX *mem_ctx;
- struct event_context *evt_ctx;
int i;
const char *binding_string;
struct cli_credentials *creds;
@@ -70,15 +69,11 @@ bool torture_async_bind(struct torture_context *torture)
/* credentials */
creds = cmdline_credentials;
- /* event context */
- evt_ctx = cli_credentials_get_event_context(creds);
- if (evt_ctx == NULL) return false;
-
/* send bind requests */
for (i = 0; i < torture_numasync; i++) {
table[i] = &ndr_table_lsarpc;
bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string,
- table[i], creds, evt_ctx, torture->lp_ctx);
+ table[i], creds, torture->ev, torture->lp_ctx);
}
/* recv bind requests */
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 19b871f9c0..46605e53e6 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -270,7 +270,7 @@ static bool test_schannel(struct torture_context *tctx,
* the second */
/* Swap the binding details from SAMR to NETLOGON */
- status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx);
+ status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "epm map");
status = dcerpc_secondary_connection(p, &p_netlogon,
@@ -296,7 +296,7 @@ static bool test_schannel(struct torture_context *tctx,
"Failed to process schannel secured NETLOGON EX ops");
/* Swap the binding details from SAMR to LSARPC */
- status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, NULL, tctx->lp_ctx);
+ status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "epm map");
status = dcerpc_secondary_connection(p, &p_lsa,
@@ -337,7 +337,7 @@ static bool test_schannel(struct torture_context *tctx,
"Failed to process schannel secured SAMR ops (on fresh connection)");
/* Swap the binding details from SAMR to NETLOGON */
- status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx);
+ status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "epm");
status = dcerpc_secondary_connection(p_samr2, &p_netlogon2,
diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c
index 0f4c9fefdf..889d343a49 100644
--- a/source4/torture/smb2/scan.c
+++ b/source4/torture/smb2/scan.c
@@ -207,7 +207,7 @@ bool torture_smb2_scan(struct torture_context *torture)
status = smb2_connect(mem_ctx, host, share,
lp_resolve_context(torture->lp_ctx),
credentials, &tree,
- event_context_find(mem_ctx));
+ torture->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Connection failed - %s\n", nt_errstr(status));
return false;
@@ -224,7 +224,7 @@ bool torture_smb2_scan(struct torture_context *torture)
status = smb2_connect(mem_ctx, host, share,
lp_resolve_context(torture->lp_ctx),
credentials, &tree,
- event_context_find(mem_ctx));
+ torture->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Connection failed - %s\n", nt_errstr(status));
return false;
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index f85b1c42ff..6ac3926c98 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -314,7 +314,7 @@ bool torture_smb2_connection(struct torture_context *tctx, struct smb2_tree **tr
status = smb2_connect(tctx, host, share,
lp_resolve_context(tctx->lp_ctx),
credentials, tree,
- event_context_find(tctx));
+ tctx->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n",
host, share, nt_errstr(status));
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index faae784e4b..01a55a67f6 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -675,7 +675,7 @@ int main(int argc,char *argv[])
exit(1);
}
- torture = torture_context_init(cli_credentials_get_event_context(cmdline_credentials), ui_ops);
+ torture = torture_context_init(event_context_init(NULL), ui_ops);
if (basedir != NULL) {
if (basedir[0] != '/') {
fprintf(stderr, "Please specify an absolute path to --basedir\n");
diff --git a/source4/torture/ui.c b/source4/torture/ui.c
index efa584ebea..abbd814747 100644
--- a/source4/torture/ui.c
+++ b/source4/torture/ui.c
@@ -578,6 +578,3 @@ struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase,
return test;
}
-
-
-