From: Dmitry V. Levin Date: Thu, 22 Dec 2016 22:34:23 +0000 (+0000) Subject: tests: fix xattr.test for the case when listxattr returns a long list X-Git-Tag: v4.16~292 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9d92cf220d99ba4354f564f2edb46445f4da91b;p=strace tests: fix xattr.test for the case when listxattr returns a long list * tests/xattr.c (DEFAULT_STRLEN): New macro. (main): Use it to limit the length passed to print_quoted_memory. Print ellipsis when the list returned by listxattr is too long. --- diff --git a/tests/xattr.c b/tests/xattr.c index 877552fe..a772eced 100644 --- a/tests/xattr.c +++ b/tests/xattr.c @@ -36,6 +36,8 @@ # define XATTR_SIZE_MAX 65536 # endif +#define DEFAULT_STRLEN 32 + int main(void) { @@ -110,9 +112,13 @@ main(void) if (rc < 0) printf("%p", big); else { + const int ellipsis = rc > DEFAULT_STRLEN; + putchar('"'); - print_quoted_memory(big, rc); + print_quoted_memory(big, ellipsis ? DEFAULT_STRLEN : rc); putchar('"'); + if (ellipsis) + fputs("...", stdout); } printf(", %u) = %s\n", XATTR_SIZE_MAX + 1, errstr);