The branch, master has been updated
via 9f54b94b52d s4:torture: Produce more output to help debug
smb2.multichannel.bugs.bug_15346
via 46f0c269658 lib/torture: Add torture_assert_size_*() macros
via e933fd2dadf lib/torture: Use portable format specifiers
from f83d6c53cce clang-format: sort alphabetically
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9f54b94b52db2935affc6b1cb09b71c2907f2289
Author: Joseph Sutton <[email protected]>
Date: Thu Oct 19 13:25:03 2023 +1300
s4:torture: Produce more output to help debug
smb2.multichannel.bugs.bug_15346
Print the time (as reckoned by tevent) at which each ‘negprot done’ and
‘echo done’ message is produced, and print another message if one of the
requests times out.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15498
Signed-off-by: Joseph Sutton <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
Autobuild-User(master): Andreas Schneider <[email protected]>
Autobuild-Date(master): Tue Oct 24 15:51:40 UTC 2023 on atb-devel-224
commit 46f0c2696582ab6561808dcfadcfc5cf9bc67a3a
Author: Joseph Sutton <[email protected]>
Date: Thu Oct 19 12:34:53 2023 +1300
lib/torture: Add torture_assert_size_*() macros
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15498
Signed-off-by: Joseph Sutton <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
commit e933fd2dadfabc04add3caed9f9496761fadba8c
Author: Joseph Sutton <[email protected]>
Date: Thu Oct 19 12:34:30 2023 +1300
lib/torture: Use portable format specifiers
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15498
Signed-off-by: Joseph Sutton <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
lib/torture/torture.h | 88 ++++++++++++++++++++++++++++---------
source4/torture/smb2/multichannel.c | 50 +++++++++++++++++++--
2 files changed, 115 insertions(+), 23 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index 6818084ea96..ad343cb030b 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -561,9 +561,9 @@ static inline void torture_dump_data_str_cb(const char
*buf, void *private_data)
do { uint32_t __got = (got), __expected = (expected); \
if (__got != __expected) { \
torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %ju (0x%jX), expected %ju
(0x%jX): %s", \
- (uintmax_t)__got, (uintmax_t)__got, \
- (uintmax_t)__expected, (uintmax_t)__expected, \
+ __location__": "#got" was %"PRIu32" (0x%"PRIX32"),
expected %"PRIu32" (0x%"PRIX32"): %s", \
+ __got, __got, \
+ __expected, __expected, \
cmt); \
return false; \
} \
@@ -573,9 +573,9 @@ static inline void torture_dump_data_str_cb(const char
*buf, void *private_data)
do { uint32_t __got = (got), __expected = (expected); \
if (__got != __expected) { \
torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %ju (0x%jX), expected %ju
(0x%jX): %s", \
- (uintmax_t)__got, (uintmax_t)__got, \
- (uintmax_t)__expected, (uintmax_t)__expected, \
+ __location__": "#got" was %"PRIu32" (0x%"PRIX32"),
expected %"PRIu32" (0x%"PRIX32"): %s", \
+ __got, __got, \
+ __expected, __expected, \
cmt); \
ret = false; \
goto label; \
@@ -586,8 +586,8 @@ static inline void torture_dump_data_str_cb(const char
*buf, void *private_data)
do { uint32_t __got = (got), __not_expected = (not_expected); \
if (__got == __not_expected) { \
torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %ju (0x%jX), expected a
different number: %s", \
- (uintmax_t)__got, (uintmax_t)__got, \
+ __location__": "#got" was %"PRIu32" (0x%"PRIX32"),
expected a different number: %s", \
+ __got, __got, \
cmt); \
return false; \
} \
@@ -597,8 +597,8 @@ static inline void torture_dump_data_str_cb(const char
*buf, void *private_data)
do { uint32_t __got = (got), __not_expected = (not_expected); \
if (__got == __not_expected) { \
torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %ju (0x%jX), expected a
different number: %s", \
- (uintmax_t)__got, (uintmax_t)__got, \
+ __location__": "#got" was %"PRIu32" (0x%"PRIX32"),
expected a different number: %s", \
+ __got, __got, \
cmt); \
ret = false; \
goto label; \
@@ -609,9 +609,9 @@ static inline void torture_dump_data_str_cb(const char
*buf, void *private_data)
do { uint64_t __got = (got), __expected = (expected); \
if (__got != __expected) { \
torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %llu (0x%llX), expected %llu
(0x%llX): %s", \
- (unsigned long long)__got, (unsigned long long)__got, \
- (unsigned long long)__expected, (unsigned long
long)__expected, \
+ __location__": "#got" was %"PRIu64" (0x%"PRIX64"),
expected %"PRIu64" (0x%"PRIX64"): %s", \
+ __got, __got, \
+ __expected, __expected, \
cmt); \
return false; \
} \
@@ -621,9 +621,9 @@ static inline void torture_dump_data_str_cb(const char
*buf, void *private_data)
do { uint64_t __got = (got), __expected = (expected); \
if (__got != __expected) { \
torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %llu (0x%llX), expected %llu
(0x%llX): %s", \
- (unsigned long long)__got, (unsigned long long)__got, \
- (unsigned long long)__expected, (unsigned long
long)__expected, \
+ __location__": "#got" was %"PRIu64" (0x%"PRIX64"),
expected %"PRIu64" (0x%"PRIX64"): %s", \
+ __got, __got, \
+ __expected, __expected, \
cmt); \
ret = false; \
goto label; \
@@ -634,8 +634,8 @@ static inline void torture_dump_data_str_cb(const char
*buf, void *private_data)
do { uint64_t __got = (got), __not_expected = (not_expected); \
if (__got == __not_expected) { \
torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %llu (0x%llX), expected a
different number: %s", \
- (unsigned long long)__got, (unsigned long long)__got, \
+ __location__": "#got" was %"PRIu64" (0x%"PRIX64"),
expected a different number: %s", \
+ __got, __got, \
cmt); \
return false; \
} \
@@ -645,8 +645,56 @@ static inline void torture_dump_data_str_cb(const char
*buf, void *private_data)
do { uint64_t __got = (got), __not_expected = (not_expected); \
if (__got == __not_expected) { \
torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %llu (0x%llX), expected a
different number: %s", \
- (unsigned long long)__got, (unsigned long long)__got, \
+ __location__": "#got" was %"PRIu64" (0x%"PRIX64"),
expected a different number: %s", \
+ __got, __got, \
+ cmt); \
+ ret = false; \
+ goto label; \
+ } \
+ } while(0)
+
+#define torture_assert_size_equal(torture_ctx,got,expected,cmt)\
+ do { size_t __got = (got), __expected = (expected); \
+ if (__got != __expected) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got" was %zu (0x%zX), expected %zu
(0x%zX): %s", \
+ __got, __got, \
+ __expected, __expected, \
+ cmt); \
+ return false; \
+ } \
+ } while(0)
+
+#define torture_assert_size_equal_goto(torture_ctx,got,expected,ret,label,cmt)\
+ do { size_t __got = (got), __expected = (expected); \
+ if (__got != __expected) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got" was %zu (0x%zX), expected %zu
(0x%zX): %s", \
+ __got, __got, \
+ __expected, __expected, \
+ cmt); \
+ ret = false; \
+ goto label; \
+ } \
+ } while(0)
+
+#define torture_assert_size_not_equal(torture_ctx,got,not_expected,cmt)\
+ do { size_t __got = (got), __not_expected = (not_expected); \
+ if (__got == __not_expected) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got" was %zu (0x%zX), expected a
different number: %s", \
+ __got, __got, \
+ cmt); \
+ return false; \
+ } \
+ } while(0)
+
+#define
torture_assert_size_not_equal_goto(torture_ctx,got,not_expected,ret,label,cmt)\
+ do { size_t __got = (got), __not_expected = (not_expected); \
+ if (__got == __not_expected) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got" was %zu (0x%zX), expected a
different number: %s", \
+ __got, __got, \
cmt); \
ret = false; \
goto label; \
diff --git a/source4/torture/smb2/multichannel.c
b/source4/torture/smb2/multichannel.c
index cc1b5365164..a3616aea52d 100644
--- a/source4/torture/smb2/multichannel.c
+++ b/source4/torture/smb2/multichannel.c
@@ -2378,6 +2378,11 @@ static void test_multichannel_bug_15346_ndone(struct
tevent_req *subreq)
tevent_req_callback_data_void(subreq);
struct test_multichannel_bug_15346_state *state = conn->state;
struct torture_context *tctx = state->tctx;
+ struct timeval current_time;
+ struct tm tm_buf;
+ struct tm *current_tm = NULL;
+ char time_str[sizeof "10000-01-01T00:00:00"];
+ size_t time_str_len;
NTSTATUS status;
bool ok = false;
@@ -2389,7 +2394,20 @@ static void test_multichannel_bug_15346_ndone(struct
tevent_req *subreq)
torture_assert_ntstatus_ok_goto(tctx, status, ok, asserted,
"smbXcli_negprot_recv failed");
- torture_comment(tctx, "conn[%zu]: negprot done\n", conn->idx);
+ current_time = tevent_timeval_current();
+ current_tm = gmtime_r(¤t_time.tv_sec, &tm_buf);
+ torture_assert_not_null_goto(tctx, current_tm, ok, asserted,
+ "gmtime_r failed");
+
+ time_str_len = strftime(time_str, sizeof time_str, "%FT%T", current_tm);
+ torture_assert_size_not_equal_goto(tctx, time_str_len, 0, ok, asserted,
+ "strftime failed");
+
+ torture_comment(tctx,
+ "%s.%ldZ: conn[%zu]: negprot done\n",
+ time_str,
+ (long)current_time.tv_usec,
+ conn->idx);
conn->ereq = smb2cli_echo_send(conn->smbXcli,
tctx->ev,
@@ -2417,19 +2435,45 @@ static void test_multichannel_bug_15346_edone(struct
tevent_req *subreq)
tevent_req_callback_data_void(subreq);
struct test_multichannel_bug_15346_state *state = conn->state;
struct torture_context *tctx = state->tctx;
+ struct timeval current_time;
+ struct tm tm_buf;
+ struct tm *current_tm = NULL;
+ char time_str[sizeof "10000-01-01T00:00:00"];
+ size_t time_str_len;
+ const char *outcome = NULL;
NTSTATUS status;
bool ok = false;
SMB_ASSERT(conn->ereq == subreq);
conn->ereq = NULL;
+ current_time = tevent_timeval_current();
+ current_tm = gmtime_r(¤t_time.tv_sec, &tm_buf);
+ torture_assert_not_null_goto(tctx, current_tm, ok, asserted,
+ "gmtime_r failed");
+
+ time_str_len = strftime(time_str, sizeof time_str, "%FT%T", current_tm);
+ torture_assert_size_not_equal_goto(tctx, time_str_len, 0, ok, asserted,
+ "strftime failed");
+
status = smb2cli_echo_recv(subreq);
TALLOC_FREE(subreq);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+ outcome = "timed out";
+ } else if (!NT_STATUS_IS_OK(status)) {
+ outcome = "failed";
+ } else {
+ outcome = "done";
+ }
+ torture_comment(tctx,
+ "%s.%ldZ: conn[%zu]: echo %s\n",
+ time_str,
+ (long)current_time.tv_usec,
+ conn->idx,
+ outcome);
torture_assert_ntstatus_ok_goto(tctx, status, ok, asserted,
"smb2cli_echo_recv failed");
- torture_comment(tctx, "conn[%zu]: echo done\n", conn->idx);
-
state->num_ready += 1;
if (state->num_ready < state->num_conns) {
return;
--
Samba Shared Repository