r24885: Convert to new torture API.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Sep 2007 03:14:32 +0000 (03:14 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:03:28 +0000 (15:03 -0500)
(This used to be commit 2918a056787467186a491574da95ea38c9aea1ee)

source4/torture/rpc/dssetup.c
source4/torture/rpc/rpc.c

index c80e37eb7d612ce596cb909882118daab1ab0460..006d69acaf72cb3cf9b12c224862f828f51b37d6 100644 (file)
 #include "torture/rpc/rpc.h"
 
 
-BOOL test_DsRoleGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+bool test_DsRoleGetPrimaryDomainInformation(struct torture_context *tctx, 
+                                           struct dcerpc_pipe *p)
 {
        struct dssetup_DsRoleGetPrimaryDomainInformation r;
        NTSTATUS status;
-       BOOL ret = True;
        int i;
 
-       printf("\ntesting DsRoleGetPrimaryDomainInformation\n");
-
        for (i=DS_ROLE_BASIC_INFORMATION; i <= DS_ROLE_OP_STATUS; i++) {
                r.in.level = i;
+               torture_comment(tctx, "dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d\n", i);
 
-               status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(p, mem_ctx, &r);
-               if (!NT_STATUS_IS_OK(status)) {
-                       const char *errstr = nt_errstr(status);
-                       if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
-                               errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
-                       }
-                       printf("dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d failed - %s\n",
-                               i, errstr);
-                       ret = False;
-               } else if (!W_ERROR_IS_OK(r.out.result)) {
-                       printf("DsRoleGetPrimaryDomainInformation level %d failed - %s\n",
-                               i, win_errstr(r.out.result));
-                       ret = False;
-               }
+               status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(p, tctx, &r);
+               torture_assert_ntstatus_ok(tctx, status, "DsRoleGetPrimaryDomainInformation failed");
+               torture_assert_werr_ok(tctx, r.out.result, "DsRoleGetPrimaryDomainInformation failed");
        }
 
-       return ret;
+       return true;
 }
 
-BOOL torture_rpc_dssetup(struct torture_context *torture)
+struct torture_suite *torture_rpc_dssetup(TALLOC_CTX *mem_ctx)
 {
-        NTSTATUS status;
-        struct dcerpc_pipe *p;
-       TALLOC_CTX *mem_ctx;
-       BOOL ret = True;
-
-       mem_ctx = talloc_init("torture_rpc_dssetup");
-
-       status = torture_rpc_connection(torture, &p, &ndr_table_dssetup);
-       if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(mem_ctx);
-
-               return False;
-       }
-
-       ret &= test_DsRoleGetPrimaryDomainInformation(p, mem_ctx);
+       struct torture_suite *suite = torture_suite_create(mem_ctx, "DSSETUP");
+       struct torture_rpc_tcase *tcase = torture_suite_add_rpc_iface_tcase(suite, "dssetup", &ndr_table_dssetup);
 
-       talloc_free(mem_ctx);
+       torture_rpc_tcase_add_test(tcase, "DsRoleGetPrimaryDomainInformation", test_DsRoleGetPrimaryDomainInformation);
 
-       return ret;
+       return suite;
 }
index 915853b83133e261d4d10307e65b2dc577f0d8cb..9505b732b8603133f97323e747bae8cd303605b9 100644 (file)
@@ -422,7 +422,7 @@ NTSTATUS torture_rpc_init(void)
        torture_suite_add_simple_test(suite, "SAMBA3-WINREG", torture_samba3_rpc_winreg);
        torture_suite_add_suite(suite, torture_rpc_drsuapi(suite));
        torture_suite_add_suite(suite, torture_rpc_drsuapi_cracknames(suite));
-       torture_suite_add_simple_test(suite, "DSSETUP", torture_rpc_dssetup);
+       torture_suite_add_suite(suite, torture_rpc_dssetup(suite));
        torture_suite_add_simple_test(suite, "ALTERCONTEXT", torture_rpc_alter_context);
        torture_suite_add_simple_test(suite, "JOIN", torture_rpc_join);
        torture_suite_add_simple_test(suite, "DSSYNC", torture_rpc_dssync);