]> granicus.if.org Git - strace/commitdiff
tests: add xattr.test
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 15 Jul 2015 00:09:08 +0000 (00:09 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 15 Jul 2015 00:09:08 +0000 (00:09 +0000)
* tests/xattr.c: New file.
* tests/xattr.expected: Likewise.
* tests/xattr.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xattr.
(TESTS): Add xattr.test.
(EXTRA_DIST): Add xattr.expected.
* tests/.gitignore: Add xattr.

tests/.gitignore
tests/Makefile.am
tests/xattr.c [new file with mode: 0644]
tests/xattr.expected [new file with mode: 0644]
tests/xattr.test [new file with mode: 0755]

index fe19dd8953872e29db8bd73102be6394bf72a720..0cc3964b94c516a43072e8b1797c4c41b3305c92 100644 (file)
@@ -33,6 +33,7 @@ uio
 umovestr
 umovestr2
 unix-pair-send-recv
+xattr
 *.log
 *.log.*
 *.o
index 32e6e52e97017e916f0fbd574623f15b7eaa119d..2e298d6f501442cac1ee61e31afaa8232d54dd73 100644 (file)
@@ -43,7 +43,8 @@ check_PROGRAMS = \
        uio \
        umovestr \
        umovestr2 \
-       unix-pair-send-recv
+       unix-pair-send-recv \
+       xattr
 
 filter_unavailable_LDFLAGS = -pthread
 mmap64_CFLAGS = $(AM_CFLAGS) -D_FILE_OFFSET_BITS=64
@@ -94,6 +95,7 @@ TESTS = \
        uid16.test \
        uid32.test \
        uio.test \
+       xattr.test \
        count.test \
        detach-sleeping.test \
        detach-stopped.test \
@@ -134,6 +136,7 @@ EXTRA_DIST = init.sh run.sh match.awk \
             umovestr.expected \
             unix-yy-accept.awk \
             unix-yy-connect.awk \
+            xattr.expected \
             $(TESTS)
 
 CLEANFILES = $(TESTS:=.tmp)
diff --git a/tests/xattr.c b/tests/xattr.c
new file mode 100644 (file)
index 0000000..073fd51
--- /dev/null
@@ -0,0 +1,27 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_SYS_XATTR_H
+# include <sys/xattr.h>
+
+int
+main(void)
+{
+#define NAME "strace.test"
+#define VALUE "foo\0bar"
+       if (!removexattr(".", NAME) ||
+           !setxattr(".", NAME, VALUE, sizeof(VALUE), XATTR_CREATE))
+               return 77;
+       return 0;
+}
+
+#else
+
+int
+main(void)
+{
+       return 77;
+}
+
+#endif
diff --git a/tests/xattr.expected b/tests/xattr.expected
new file mode 100644 (file)
index 0000000..0179a17
--- /dev/null
@@ -0,0 +1,2 @@
+removexattr\("\.", "strace\.test"\) += -1 .*
+setxattr\("\.", "strace\.test", "foo\\0bar", 8, XATTR_CREATE\) += -1 .*
diff --git a/tests/xattr.test b/tests/xattr.test
new file mode 100755 (executable)
index 0000000..613352b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Check *xattr syscalls decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog
+run_strace -e removexattr,setxattr $args
+match_grep
+
+exit 0