From b60b2a5aa3b0be18fc1ff2ee98ff77cfc2275bb1 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 15 Jul 2015 00:09:08 +0000 Subject: [PATCH] tests: add xattr.test * 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 | 1 + tests/Makefile.am | 5 ++++- tests/xattr.c | 27 +++++++++++++++++++++++++++ tests/xattr.expected | 2 ++ tests/xattr.test | 11 +++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tests/xattr.c create mode 100644 tests/xattr.expected create mode 100755 tests/xattr.test diff --git a/tests/.gitignore b/tests/.gitignore index fe19dd89..0cc3964b 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -33,6 +33,7 @@ uio umovestr umovestr2 unix-pair-send-recv +xattr *.log *.log.* *.o diff --git a/tests/Makefile.am b/tests/Makefile.am index 32e6e52e..2e298d6f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 00000000..073fd514 --- /dev/null +++ b/tests/xattr.c @@ -0,0 +1,27 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_SYS_XATTR_H +# include + +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 index 00000000..0179a17d --- /dev/null +++ b/tests/xattr.expected @@ -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 index 00000000..613352b6 --- /dev/null +++ b/tests/xattr.test @@ -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 -- 2.40.0