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.
This commit is contained in:
Дмитрий Левин 2015-07-15 00:09:08 +00:00
parent 6156d81cef
commit b60b2a5aa3
5 changed files with 45 additions and 1 deletions

1
tests/.gitignore vendored
View File

@ -33,6 +33,7 @@ uio
umovestr
umovestr2
unix-pair-send-recv
xattr
*.log
*.log.*
*.o

View 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)

27
tests/xattr.c Normal file
View File

@ -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

2
tests/xattr.expected Normal file
View File

@ -0,0 +1,2 @@
removexattr\("\.", "strace\.test"\) += -1 .*
setxattr\("\.", "strace\.test", "foo\\0bar", 8, XATTR_CREATE\) += -1 .*

11
tests/xattr.test Executable file
View File

@ -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