tests: test for correct ellipsis with -s in xattr
* 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 <gabriel@lse.epita.fr>
This commit is contained in:
parent
dd3548a691
commit
2aa03c2af6
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -358,6 +358,7 @@ waitid
|
||||
waitid-v
|
||||
waitpid
|
||||
xattr
|
||||
xattr-strings
|
||||
xet_robust_list
|
||||
xetitimer
|
||||
xetpgid
|
||||
|
@ -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 \
|
||||
|
30
tests/xattr-strings.c
Normal file
30
tests/xattr-strings.c
Normal file
@ -0,0 +1,30 @@
|
||||
#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
|
7
tests/xattr-strings.test
Executable file
7
tests/xattr-strings.test
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user