]> granicus.if.org Git - strace/commitdiff
tests: fix TEST_NLATTR_OBJECT and TEST_NLATTR_ARRAY for large objects
authorJingPiao Chen <chenjingpiao@gmail.com>
Wed, 5 Jul 2017 01:39:34 +0000 (09:39 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 9 Jul 2017 00:14:20 +0000 (00:14 +0000)
commit v4.17-161-gdbd0605 that adjusted TEST_NLATTR_OBJECT and
TEST_NLATTR_ARRAY for large objects, only changed the pattern
print length, large length still can be specified as nla_data_len,
resulting to output mismatch.

* tests/test_nlattr.h (TEST_NLATTR_OBJECT): Pass "plen"
both as nla_data_len and slen arguments of TEST_NLATTR_
in len < sizeof(object) case.
(TEST_NLATTR_ARRAY): Likewise, Pass "plen" both as nla_data_len
and slen arguments of TEST_NLATTR_ in len < sizeof(object[0]) case.

tests/test_nlattr.h

index fd8e036ccef2956602df888b676fdffea032af44..4585893da1e3ef7bf74173c648a833802ebcad42 100644 (file)
@@ -107,8 +107,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_),                 \
@@ -138,8 +137,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_),                 \