* tests/xattr-strings.c: New file.
* tests/xattr-strings.test: New test.
* tests/.gitignore: Add xattr-string.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add xattr-string.test.

Signed-off-by: Gabriel Laskar <gabr...@lse.epita.fr>
---
 tests/.gitignore         |  1 +
 tests/Makefile.am        |  2 ++
 tests/xattr-strings.c    | 31 +++++++++++++++++++++++++++++++
 tests/xattr-strings.test |  7 +++++++
 4 files changed, 41 insertions(+)
 create mode 100644 tests/xattr-strings.c
 create mode 100755 tests/xattr-strings.test

diff --git a/tests/.gitignore b/tests/.gitignore
index 7dee9fd9..3b04590a 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -358,6 +358,7 @@ waitid
 waitid-v
 waitpid
 xattr
+xattr-strings
 xet_robust_list
 xetitimer
 xetpgid
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1c32b1c6..7a8b411c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -418,6 +418,7 @@ check_PROGRAMS = \
        waitid-v \
        waitpid \
        xattr \
+       xattr-strings \
        xet_robust_list \
        xetitimer \
        xetpgid \
@@ -793,6 +794,7 @@ DECODER_TESTS = \
        waitid-v.test \
        waitpid.test \
        xattr.test \
+       xattr-strings.test \
        xet_robust_list.test \
        xetitimer.test \
        xetpgid.test \
diff --git a/tests/xattr-strings.c b/tests/xattr-strings.c
new file mode 100644
index 00000000..282bb77e
--- /dev/null
+++ b/tests/xattr-strings.c
@@ -0,0 +1,31 @@
+#include "tests.h"
+
+#ifdef HAVE_SYS_XATTR_H
+
+# include <stdio.h>
+# include <sys/xattr.h>
+
+int
+main(void)
+{
+       static const char name[] = "strace.test";
+       static const char c_value[] = "foobar";
+
+       const char *const z_value = tail_memdup(c_value, sizeof(c_value));
+       long rc;
+
+       rc = fsetxattr(-1, name, z_value, sizeof(c_value), XATTR_REPLACE);
+       printf("fsetxattr(-1, \"%.*s\"..., \"%.*s\"..., %u, XATTR_REPLACE) = 
%s\n",
+              4, name, 4, c_value, (unsigned) sizeof(c_value), sprintrc(rc));
+
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("HAVE_SYS_XATTR_H")
+
+#endif
+
diff --git a/tests/xattr-strings.test b/tests/xattr-strings.test
new file mode 100755
index 00000000..25ef360b
--- /dev/null
+++ b/tests/xattr-strings.test
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Check *xattr syscalls decoding when limiting string size.
+
+. "${srcdir=.}/init.sh"
+
+run_strace_match_diff -a22 -s 4 -e trace=fsetxattr
-- 
2.11.0


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to