s4: torture: CHECK ret value and fail if false
authorNoel Power <noel.power@suse.com>
Thu, 19 Aug 2021 11:13:27 +0000 (12:13 +0100)
committerJule Anger <janger@samba.org>
Wed, 25 Aug 2021 13:01:09 +0000 (13:01 +0000)
If we reach 'done' with ret == false without setting
the torture result we get unexpected results e.g.

Exception: Exception: Unknown error/failure. Missing torture_fail() or torture_assert_*() call?

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14760

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 161cee6f36b1642e2096a64a4eec22a1ebf82aa2)

source4/torture/smb2/streams.c

index 814ed1666c70b71cab4b83e047a9fd3cb1a7462c..c5ece0d9bcbc403e6ea2a7384a47a15b0f01edfe 100644 (file)
@@ -957,7 +957,7 @@ static bool test_stream_names(struct torture_context *tctx,
        CHECK_STATUS(status, NT_STATUS_OK);
        ret &= check_stream_list(tree, tctx, fname, 4, four,
                                 io.smb2.out.file.handle);
-
+       CHECK_VALUE(ret, true);
        smb2_util_close(tree, h1);
        smb2_util_close(tree, h2);
        smb2_util_close(tree, h3);
@@ -973,6 +973,7 @@ static bool test_stream_names(struct torture_context *tctx,
        ret &= check_stream_list(tree, tctx, fname, 4, four,
                                 io.smb2.out.file.handle);
 
+       CHECK_VALUE(ret, true);
        for (i=0; i < 4; i++) {
                NTTIME write_time;
                uint64_t stream_size;
@@ -1114,6 +1115,7 @@ static bool test_stream_names(struct torture_context *tctx,
        ret &= check_stream_list(tree,tctx, fname, 5, five2,
                                 io.smb2.out.file.handle);
 
+       CHECK_VALUE(ret, true);
        ZERO_STRUCT(sinfo);
        sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
        sinfo.rename_information.in.file.handle = h1;
@@ -1138,6 +1140,7 @@ static bool test_stream_names(struct torture_context *tctx,
        ret &= check_stream_list(tree,tctx, fname, 5, five2,
                                 io.smb2.out.file.handle);
 
+       CHECK_VALUE(ret, true);
        /* TODO: we need to test more rename combinations */
 
 done:
@@ -2062,6 +2065,5 @@ struct torture_suite *torture_smb2_streams_init(TALLOC_CTX *ctx)
                                        test_basefile_rename_with_open_stream);
 
        suite->description = talloc_strdup(suite, "SMB2-STREAM tests");
-
        return suite;
 }