1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s4: torture: Change torture_register_suite() to add a TALLOC_CTX *.

Change callers to use the passed in TALLOC_CTX *
instead of talloc_autofree_context().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2017-04-24 14:41:26 -07:00
parent 1d6667381c
commit e7e56bcc72
25 changed files with 53 additions and 56 deletions

View File

@ -85,13 +85,13 @@ NTSTATUS torture_libcli_echo_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite;
suite = torture_suite_create(talloc_autofree_context(), "echo");
suite = torture_suite_create(ctx, "echo");
NT_STATUS_HAVE_NO_MEMORY(suite);
torture_suite_add_simple_test(suite, "udp", torture_echo_udp);
suite->description = talloc_strdup(suite, "libcli/echo interface tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -1937,7 +1937,7 @@ static bool run_birthtimetest(struct torture_context *tctx,
NTSTATUS torture_base_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "base");
struct torture_suite *suite = torture_suite_create(ctx, "base");
torture_suite_add_2smb_test(suite, "fdpass", run_fdpasstest);
torture_suite_add_suite(suite, torture_base_locktest(suite));
@ -1996,7 +1996,7 @@ NTSTATUS torture_base_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite,
"Basic SMB tests (imported from the original smbtorture)");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -503,7 +503,7 @@ static bool test_low_referral_level(struct torture_context *tctx,
NTSTATUS torture_dfs_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "dfs");
struct torture_suite *suite = torture_suite_create(ctx, "dfs");
struct torture_suite *suite_basic = torture_suite_create(suite, "domain");
torture_suite_add_suite(suite, suite_basic);
@ -534,7 +534,7 @@ NTSTATUS torture_dfs_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "DFS referrals calls");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -1084,12 +1084,11 @@ NTSTATUS torture_bind_dns_init(TALLOC_CTX *);
NTSTATUS torture_bind_dns_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite;
TALLOC_CTX *mem_ctx = talloc_autofree_context();
/* register DNS related test cases */
suite = dlz_bind9_suite(mem_ctx);
suite = dlz_bind9_suite(ctx);
if (!suite) return NT_STATUS_NO_MEMORY;
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -179,12 +179,11 @@ NTSTATUS torture_internal_dns_init(TALLOC_CTX *);
NTSTATUS torture_internal_dns_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite;
TALLOC_CTX *mem_ctx = talloc_autofree_context();
/* register internal DNS torture test cases */
suite = internal_dns_suite(mem_ctx);
suite = internal_dns_suite(ctx);
if (!suite) return NT_STATUS_NO_MEMORY;
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -65,17 +65,16 @@ static struct torture_suite * torture_drs_unit_suite(TALLOC_CTX *mem_ctx,
NTSTATUS torture_drs_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite;
TALLOC_CTX *mem_ctx = talloc_autofree_context();
/* register RPC related test cases */
suite = torture_drs_rpc_suite(mem_ctx, "drs.rpc");
suite = torture_drs_rpc_suite(ctx, "drs.rpc");
if (!suite) return NT_STATUS_NO_MEMORY;
torture_register_suite(suite);
torture_register_suite(ctx, suite);
/* register DRS Unit test cases */
suite = torture_drs_unit_suite(mem_ctx, "drs.unit");
suite = torture_drs_unit_suite(ctx, "drs.unit");
if (!suite) return NT_STATUS_NO_MEMORY;
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -687,7 +687,7 @@ static bool torture_krb5_as_req_aes_rc4(struct torture_context *tctx)
NTSTATUS torture_krb5_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "krb5");
struct torture_suite *suite = torture_suite_create(ctx, "krb5");
struct torture_suite *kdc_suite = torture_suite_create(suite, "kdc");
suite->description = talloc_strdup(suite, "Kerberos tests");
kdc_suite->description = talloc_strdup(kdc_suite, "Kerberos KDC tests");
@ -719,6 +719,6 @@ NTSTATUS torture_krb5_init(TALLOC_CTX *ctx)
torture_suite_add_suite(kdc_suite, torture_krb5_canon(kdc_suite));
torture_suite_add_suite(suite, kdc_suite);
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -749,7 +749,7 @@ static bool torture_krb5_as_req_aes_rc4(struct torture_context *tctx)
NTSTATUS torture_krb5_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite =
torture_suite_create(talloc_autofree_context(), "krb5");
torture_suite_create(ctx, "krb5");
struct torture_suite *kdc_suite = torture_suite_create(suite, "kdc");
suite->description = talloc_strdup(suite, "Kerberos tests");
kdc_suite->description = talloc_strdup(kdc_suite, "Kerberos KDC tests");
@ -788,7 +788,7 @@ NTSTATUS torture_krb5_init(TALLOC_CTX *ctx)
torture_suite_add_suite(suite, kdc_suite);
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -131,7 +131,7 @@ NTSTATUS torture_ldap_close(struct ldap_connection *conn)
NTSTATUS torture_ldap_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "ldap");
struct torture_suite *suite = torture_suite_create(ctx, "ldap");
torture_suite_add_simple_test(suite, "bench-cldap", torture_bench_cldap);
torture_suite_add_simple_test(suite, "basic", torture_ldap_basic);
torture_suite_add_simple_test(suite, "sort", torture_ldap_sort);
@ -144,7 +144,7 @@ NTSTATUS torture_ldap_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "LDAP and CLDAP tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -27,7 +27,7 @@
NTSTATUS torture_net_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(
talloc_autofree_context(), "net");
ctx, "net");
torture_suite_add_simple_test(suite, "userinfo", torture_userinfo);
torture_suite_add_simple_test(suite, "useradd", torture_useradd);
@ -64,7 +64,7 @@ NTSTATUS torture_net_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "libnet convenience interface tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -84,7 +84,7 @@ NTSTATUS torture_libnetapi_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite;
suite = torture_suite_create(talloc_autofree_context(), "netapi");
suite = torture_suite_create(ctx, "netapi");
torture_suite_add_simple_test(suite, "server", torture_libnetapi_server);
torture_suite_add_simple_test(suite, "group", torture_libnetapi_group);
@ -93,7 +93,7 @@ NTSTATUS torture_libnetapi_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "libnetapi convenience interface tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -205,7 +205,7 @@ NTSTATUS torture_libsmbclient_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite;
suite = torture_suite_create(talloc_autofree_context(), "libsmbclient");
suite = torture_suite_create(ctx, "libsmbclient");
torture_suite_add_simple_test(suite, "version", torture_libsmbclient_version);
torture_suite_add_simple_test(suite, "initialize", torture_libsmbclient_initialize);
@ -215,7 +215,7 @@ NTSTATUS torture_libsmbclient_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "libsmbclient interface tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -83,7 +83,7 @@ NTSTATUS torture_local_init(TALLOC_CTX *ctx)
{
int i;
struct torture_suite *suite = torture_suite_create(
talloc_autofree_context(), "local");
ctx, "local");
torture_suite_add_simple_test(suite, "talloc", torture_local_talloc);
torture_suite_add_simple_test(suite, "replace", torture_local_replace);
@ -103,12 +103,12 @@ NTSTATUS torture_local_init(TALLOC_CTX *ctx)
for (i = 0; suite_generators[i]; i++)
torture_suite_add_suite(suite,
suite_generators[i](talloc_autofree_context()));
suite_generators[i](ctx));
suite->description = talloc_strdup(suite,
"Local, Samba-specific tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -287,12 +287,12 @@ bool torture_nbench(struct torture_context *torture)
NTSTATUS torture_nbench_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(
talloc_autofree_context(), "bench");
ctx, "bench");
torture_suite_add_simple_test(suite, "nbench", torture_nbench);
suite->description = talloc_strdup(suite, "Benchmarks");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -51,7 +51,7 @@ bool torture_nbt_get_name(struct torture_context *tctx,
NTSTATUS torture_nbt_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(
talloc_autofree_context(), "nbt");
ctx, "nbt");
/* nbt tests */
torture_suite_add_suite(suite, torture_nbt_register(suite));
torture_suite_add_suite(suite, torture_nbt_wins(suite));
@ -63,7 +63,7 @@ NTSTATUS torture_nbt_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite,
"NetBIOS over TCP/IP and WINS tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -286,7 +286,7 @@ static bool test_ntp_signd(struct torture_context *tctx,
NTSTATUS torture_ntp_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "ntp");
struct torture_suite *suite = torture_suite_create(ctx, "ntp");
struct torture_rpc_tcase *tcase;
tcase = torture_suite_add_machine_workstation_rpc_iface_tcase(suite,
@ -296,7 +296,7 @@ NTSTATUS torture_ntp_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "NTP tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -243,7 +243,7 @@ bool torture_rap_scan(struct torture_context *torture, struct smbcli_state *cli)
NTSTATUS torture_rap_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "rap");
struct torture_suite *suite = torture_suite_create(ctx, "rap");
struct torture_suite *suite_basic = torture_suite_create(suite, "basic");
torture_suite_add_suite(suite, suite_basic);
@ -269,7 +269,7 @@ NTSTATUS torture_rap_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite,
"Remote Administration Protocol tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -26,7 +26,7 @@
NTSTATUS torture_raw_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(
talloc_autofree_context(), "raw");
ctx, "raw");
/* RAW smb tests */
torture_suite_add_simple_test(suite, "bench-oplock", torture_bench_oplock);
torture_suite_add_simple_test(suite, "ping-pong", torture_ping_pong);
@ -79,7 +79,7 @@ NTSTATUS torture_raw_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "Tests for the raw SMB interface");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -484,7 +484,7 @@ _PUBLIC_ struct torture_test *torture_rpc_tcase_add_test_ex(
NTSTATUS torture_rpc_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "rpc");
struct torture_suite *suite = torture_suite_create(ctx, "rpc");
ndr_table_init();
@ -570,7 +570,7 @@ NTSTATUS torture_rpc_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "DCE/RPC protocol and interface tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -145,7 +145,7 @@ struct torture_test *torture_suite_add_2smb2_test(struct torture_suite *suite,
NTSTATUS torture_smb2_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "smb2");
struct torture_suite *suite = torture_suite_create(ctx, "smb2");
torture_suite_add_simple_test(suite, "connect", torture_smb2_connect);
torture_suite_add_suite(suite, torture_smb2_scan_init());
torture_suite_add_suite(suite, torture_smb2_getinfo_init());
@ -180,7 +180,7 @@ NTSTATUS torture_smb2_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "SMB2-specific tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -35,7 +35,7 @@ extern int torture_numasync;
struct torture_test;
int torture_init(TALLOC_CTX *);
bool torture_register_suite(struct torture_suite *suite);
bool torture_register_suite(TALLOC_CTX *, struct torture_suite *suite);
void torture_shell(struct torture_context *tctx);
void torture_print_testsuites(bool structured);
bool torture_run_named_tests(struct torture_context *torture, const char *name,

View File

@ -33,13 +33,13 @@ _PUBLIC_ int torture_numasync=100;
struct torture_suite *torture_root = NULL;
bool torture_register_suite(struct torture_suite *suite)
bool torture_register_suite(TALLOC_CTX *mem_ctx, struct torture_suite *suite)
{
if (!suite)
return true;
if (torture_root == NULL)
torture_root = talloc_zero(talloc_autofree_context(), struct torture_suite);
torture_root = talloc_zero(mem_ctx, struct torture_suite);
return torture_suite_add_suite(torture_root, suite);
}

View File

@ -24,7 +24,7 @@
NTSTATUS torture_unix_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite =
torture_suite_create(talloc_autofree_context(), "unix");
torture_suite_create(ctx, "unix");
suite->description =
talloc_strdup(suite, "CIFS UNIX extensions tests");
@ -34,7 +34,7 @@ NTSTATUS torture_unix_init(TALLOC_CTX *ctx)
torture_suite_add_simple_test(suite,
"info2", unix_torture_unix_info2);
return (torture_register_suite(suite)) ? NT_STATUS_OK
return (torture_register_suite(ctx, suite)) ? NT_STATUS_OK
: NT_STATUS_UNSUCCESSFUL;
}

View File

@ -104,7 +104,7 @@ struct torture_test *torture_suite_add_2ns_smb2_test(struct torture_suite *suite
NTSTATUS torture_vfs_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(
talloc_autofree_context(), "vfs");
ctx, "vfs");
suite->description = talloc_strdup(suite, "VFS modules tests");
@ -113,7 +113,7 @@ NTSTATUS torture_vfs_init(TALLOC_CTX *ctx)
torture_suite_add_suite(suite, torture_acl_xattr());
torture_suite_add_suite(suite, torture_vfs_fruit_file_id());
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}

View File

@ -292,12 +292,12 @@ static bool torture_winbind_pac_krb5(struct torture_context *tctx)
NTSTATUS torture_winbind_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "winbind");
struct torture_suite *suite = torture_suite_create(ctx, "winbind");
struct torture_suite *pac_suite;
torture_suite_add_suite(suite, torture_winbind_struct_init());
torture_suite_add_suite(suite, torture_wbclient());
pac_suite = torture_suite_create(talloc_autofree_context(), "pac");
pac_suite = torture_suite_create(ctx, "pac");
torture_suite_add_simple_test(pac_suite,
"GSSAPI", torture_winbind_pac_gssapi);
torture_suite_add_simple_test(pac_suite,
@ -311,7 +311,7 @@ NTSTATUS torture_winbind_init(TALLOC_CTX *ctx)
suite->description = talloc_strdup(suite, "WINBIND tests");
torture_register_suite(suite);
torture_register_suite(ctx, suite);
return NT_STATUS_OK;
}