[PATCH v4 05/11] tests: fix TEST_NLATTR_OBJECT and TEST_NLATTR_ARRAY use for large objects

JingPiao Chen chenjingpiao at gmail.com
Thu Jul 6 01:57:31 UTC 2017


commit v4.17-161-gdbd0605 adjust TEST_NLATTR_OBJECT and
TEST_NLATTR_ARRAY for large objects, only change the pattern
print length, still pass a big length for nla_data_len, do not
change strace output, still output '"STR"...'.

* tests/test_nlattr.h (TEST_NLATTR_OBJECT, TEST_NLATTR_ARRAY):
In case of len < sizeof(object), pass plen as nla_data_len and slen.
---
 tests/test_nlattr.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/test_nlattr.h b/tests/test_nlattr.h
index 9c15c33..4a2af02 100644
--- a/tests/test_nlattr.h
+++ b/tests/test_nlattr.h
@@ -108,8 +108,7 @@ print_nlattr(const unsigned int nla_len, const char *const nla_type)
 		TEST_NLATTR_((fd_), (nlh0_), (hdrlen_),			\
 			(init_msg_), (print_msg_),			\
 			(nla_type_), #nla_type_,			\
-			sizeof(obj_) - 1,				\
-			(pattern_), sizeof(obj_) - 1,			\
+			plen, (pattern_), plen,				\
 			print_quoted_hex((pattern_), plen));		\
 		/* short read of sizeof(obj_) */			\
 		TEST_NLATTR_((fd_), (nlh0_), (hdrlen_),			\
@@ -139,8 +138,7 @@ print_nlattr(const unsigned int nla_len, const char *const nla_type)
 		TEST_NLATTR_((fd_), (nlh0_), (hdrlen_),			\
 			(init_msg_), (print_msg_),			\
 			(nla_type_), #nla_type_,			\
-			sizeof((obj_)[0]) - 1,				\
-			(pattern_), sizeof((obj_)[0]) - 1,		\
+			plen, (pattern_), plen,				\
 			print_quoted_hex((pattern_), plen));		\
 		/* sizeof((obj_)[0]) < len < sizeof(obj_) */		\
 		TEST_NLATTR_((fd_), (nlh0_), (hdrlen_),			\
-- 
2.7.4





More information about the Strace-devel mailing list