diff --git a/source4/torture/smb2/streams.c b/source4/torture/smb2/streams.c index f18048f7762..640976d490f 100644 --- a/source4/torture/smb2/streams.c +++ b/source4/torture/smb2/streams.c @@ -33,54 +33,17 @@ #define DNAME "teststreams" -#define CHECK_STATUS(status, correct) do { \ - if (!NT_STATUS_EQUAL(status, correct)) { \ - torture_result(tctx, TORTURE_FAIL, \ - "(%s) Incorrect status %s - should be %s\n", \ - __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = false; \ - goto done; \ - }} while (0) +#define CHECK_STATUS(status, correct) \ + torture_assert_ntstatus_equal_goto(tctx, status, correct, ret, done, "CHECK_STATUS") -#define CHECK_VALUE(v, correct) do { \ - if ((v) != (correct)) { \ - torture_result(tctx, TORTURE_FAIL, \ - "(%s) Incorrect value %s=%d - should be %d\n", \ - __location__, #v, (int)v, (int)correct); \ - ret = false; \ - }} while (0) +#define CHECK_VALUE(v, correct) \ + torture_assert_u64_equal_goto(tctx, v, correct, ret, done, "CHECK_VALUE") -#define CHECK_NTTIME(v, correct) do { \ - if ((v) != (correct)) { \ - torture_result(tctx, TORTURE_FAIL, \ - "(%s) Incorrect value %s=%llu - should be %llu\n", \ - __location__, #v, (unsigned long long)v, \ - (unsigned long long)correct); \ - ret = false; \ - }} while (0) - -#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; \ - } \ - if (!ok) { \ - torture_result(tctx, TORTURE_FAIL, \ - "(%s) Incorrect value %s='%s' - " \ - "should be '%s'\n", \ - __location__, #v, (v)?(v):"NULL", \ - (correct)?(correct):"NULL"); \ - ret = false; \ - }} while (0) +#define CHECK_NTTIME(v, correct) \ + torture_assert_nttime_equal_goto(tctx, v, correct, ret, done, "CHECK_NTTIME") +#define CHECK_STR(v, correct) \ + torture_assert_str_equal_goto(tctx, v, correct, ret, done, "CHECK_STR") static int qsort_string(char * const *s1, char * const *s2) { @@ -1349,22 +1312,12 @@ done: sfinfo.generic.level = RAW_SFILEINFO_ ## call; \ sfinfo.generic.in.file.handle = h1; \ status = smb2_setinfo_file(tree, &sfinfo); \ - if (!NT_STATUS_EQUAL(status, rightstatus)) { \ - torture_result(tctx, TORTURE_FAIL, \ - "(%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_INFORMATION; \ finfo1.generic.in.file.handle = h1; \ status2 = smb2_getinfo_file(tree, tctx, &finfo1); \ - if (!NT_STATUS_IS_OK(status2)) { \ - torture_result(tctx, TORTURE_FAIL, \ - "(%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