1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s4:torture/smb2: make use of torture_assert_*_equal_goto() in streams.c

We should fail immediately...

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>
This commit is contained in:
Stefan Metzmacher 2024-07-08 09:05:49 +02:00 committed by Volker Lendecke
parent e2a9cd1d02
commit 28fd1ea4a1

View File

@ -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