s4-smbtorture: simplify some torture_comments in RPC-LSA.
authorGünther Deschner <gd@samba.org>
Mon, 2 Nov 2009 18:59:47 +0000 (19:59 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 3 Nov 2009 21:10:31 +0000 (22:10 +0100)
Guenther

source4/torture/rpc/lsa.c

index 710f4c53d2f4b403ccaf071b0e100f5a72b9bb48..35a3b0a16b018f78e41aadde9853e54f72cef61e 100644 (file)
@@ -2498,21 +2498,16 @@ static bool test_QueryInfoPolicyCalls(  bool version2,
        NTSTATUS status;
        int i;
        bool ret = true;
        NTSTATUS status;
        int i;
        bool ret = true;
+       const char *call = talloc_asprintf(tctx, "QueryInfoPolicy%s", version2 ? "2":"");
 
 
-       if (version2)
-               torture_comment(tctx, "\nTesting QueryInfoPolicy2\n");
-       else
-               torture_comment(tctx, "\nTesting QueryInfoPolicy\n");
+       torture_comment(tctx, "\nTesting %s\n", call);
 
        for (i=1;i<=14;i++) {
                r.in.handle = handle;
                r.in.level = i;
                r.out.info = &info;
 
 
        for (i=1;i<=14;i++) {
                r.in.handle = handle;
                r.in.level = i;
                r.out.info = &info;
 
-               if (version2)
-                       torture_comment(tctx, "\nTrying QueryInfoPolicy2 level %d\n", i);
-               else
-                       torture_comment(tctx, "\nTrying QueryInfoPolicy level %d\n", i);
+               torture_comment(tctx, "\nTrying %s level %d\n", call, i);
 
                if (version2)
                        /* We can perform the cast, because both types are
 
                if (version2)
                        /* We can perform the cast, because both types are
@@ -2543,10 +2538,7 @@ static bool test_QueryInfoPolicyCalls(   bool version2,
                case LSA_POLICY_INFO_AUDIT_EVENTS:
                case LSA_POLICY_INFO_PD:
                        if (!NT_STATUS_IS_OK(status)) {
                case LSA_POLICY_INFO_AUDIT_EVENTS:
                case LSA_POLICY_INFO_PD:
                        if (!NT_STATUS_IS_OK(status)) {
-                               if (version2)
-                                       torture_comment(tctx, "QueryInfoPolicy2 failed - %s\n", nt_errstr(status));
-                               else
-                                       torture_comment(tctx, "QueryInfoPolicy failed - %s\n", nt_errstr(status));
+                               torture_comment(tctx, "%s failed - %s\n", call, nt_errstr(status));
                                ret = false;
                        }
                        break;
                                ret = false;
                        }
                        break;
@@ -2554,17 +2546,11 @@ static bool test_QueryInfoPolicyCalls(  bool version2,
                        if (torture_setting_bool(tctx, "samba4", false)) {
                                /* Other levels not implemented yet */
                                if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) {
                        if (torture_setting_bool(tctx, "samba4", false)) {
                                /* Other levels not implemented yet */
                                if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) {
-                                       if (version2)
-                                               torture_comment(tctx, "QueryInfoPolicy2 failed - %s\n", nt_errstr(status));
-                                       else
-                                               torture_comment(tctx, "QueryInfoPolicy failed - %s\n", nt_errstr(status));
+                                       torture_comment(tctx, "%s failed - %s\n", call, nt_errstr(status));
                                        ret = false;
                                }
                        } else if (!NT_STATUS_IS_OK(status)) {
                                        ret = false;
                                }
                        } else if (!NT_STATUS_IS_OK(status)) {
-                               if (version2)
-                                       torture_comment(tctx, "QueryInfoPolicy2 failed - %s\n", nt_errstr(status));
-                               else
-                                       torture_comment(tctx, "QueryInfoPolicy failed - %s\n", nt_errstr(status));
+                               torture_comment(tctx, "%s failed - %s\n", call, nt_errstr(status));
                                ret = false;
                        }
                        break;
                                ret = false;
                        }
                        break;