]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture/raw: better error handling in streams.c
authorStefan Metzmacher <metze@samba.org>
Thu, 25 Jul 2024 09:06:18 +0000 (11:06 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 29 Aug 2024 18:25:28 +0000 (18:25 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15656

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source4/torture/raw/streams.c

index 0eb5bdd6390966c5a98f8a2a4d79b81ac35acc23..90531499df3283519c89d5b2562608a6122afcfe 100644 (file)
 #define CHECK_NTTIME(v, correct) \
        torture_assert_u64_equal(tctx,v,correct,"CHECK_NTTIME")
 
-#define CHECK_STR(v, correct) do { \
-       bool ok; \
-       if ((v) && !(correct)) { \
-               ok = false; \
-       } else if (!(v) && (correct)) { \
-               ok = false; \
-       } else if (!(v) && !(correct)) { \
-               ok = true; \
-       } else if (strcmp((v), (correct)) == 0) { \
-               ok = true; \
-       } else { \
-               ok = false; \
-       } \
-       torture_assert(tctx,ok,\
-                      talloc_asprintf(tctx, "got '%s', expected '%s'",\
-                      (v)?(v):"NULL", (correct)?(correct):"NULL")); \
-} while (0)
+#define CHECK_STR(v, correct) \
+       torture_assert_str_equal(tctx,v,correct,"CHECK_STR")
 
 /*
   check that a stream has the right contents
@@ -1092,18 +1077,12 @@ done:
         sfinfo.generic.level = RAW_SFILEINFO_ ## call; \
         sfinfo.generic.in.file.fnum = fnum; \
         status = smb_raw_setfileinfo(cli->tree, &sfinfo); \
-        if (!NT_STATUS_EQUAL(status, rightstatus)) { \
-                printf("(%s) %s - %s (should be %s)\n", __location__, #call, \
-                        nt_errstr(status), nt_errstr(rightstatus)); \
-                ret = false; \
-        } \
+        torture_assert_ntstatus_equal_goto(tctx, status, rightstatus, ret, done, #call); \
         finfo1.generic.level = RAW_FILEINFO_ALL_INFO; \
         finfo1.generic.in.file.fnum = fnum; \
         status2 = smb_raw_fileinfo(cli->tree, tctx, &finfo1); \
-        if (!NT_STATUS_IS_OK(status2)) { \
-                printf("(%s) %s pathinfo - %s\n", __location__, #call, nt_errstr(status)); \
-                ret = false; \
-        }} while (0)
+        torture_assert_ntstatus_ok_goto(tctx, status2, ret, done, "ALL_INFO"); \
+} while (0)
 
 /*
   test stream renames