tests: move /proc/ checks from scripts to executables

Move most of /proc/self/task/ and /proc/self/fd/ checks from scripts
to xecutables.

* tests/attach-f-p.test: Move /proc/self/task/ check ...
* tests/attach-f-p-cmd.c (main): ... here.
* tests/fstat.test: Move /proc/self/fd/ check ...
* tests/xstatx.c (main): ... here.
* tests/net-y-unix.test: Move /proc/self/fd/ check ...
* tests/net-y-unix.c (main): ... here.
* tests/net-yy-inet.test: Move /proc/self/fd/ check ...
* tests/net-yy-inet.c (main): ... here.
* tests/net-yy-netlink.test: Move /proc/self/fd/ check ...
* tests/net-yy-netlink.c (main): ... here.
* tests/net-yy-unix.test: Move /proc/self/fd/ check ...
* tests/net-yy-unix.c (main): ... here.
This commit is contained in:
Дмитрий Левин 2017-04-19 02:16:31 +00:00
parent db1f9c58e1
commit c79792293b
12 changed files with 17 additions and 28 deletions

View File

@ -34,6 +34,8 @@
int
main(void)
{
skip_if_unavailable("/proc/self/task/");
static const char dir[] = "attach-f-p.test cmd";
pid_t pid = getpid();
int rc = chdir(dir);

View File

@ -29,9 +29,6 @@
. "${srcdir=.}/init.sh"
# strace -f -p is implemented using /proc/$pid/task/
[ -d /proc/self/task/ ] ||
framework_skip_ '/proc/self/task/ is not available'
run_prog_skip_if_failed \
kill -0 $$
run_prog ../attach-f-p-cmd > /dev/null

View File

@ -4,10 +4,6 @@
. "${srcdir=.}/init.sh"
# strace -P is implemented using /proc/self/fd
[ -d /proc/self/fd/ ] ||
framework_skip_ '/proc/self/fd/ is not available'
syscall=$NAME
run_prog > /dev/null
sample=$syscall.sample

View File

@ -43,6 +43,8 @@
int
main(void)
{
skip_if_unavailable("/proc/self/fd/");
static const struct sockaddr_un addr = {
.sun_family = AF_UNIX,
.sun_path = TEST_SOCKET

View File

@ -29,13 +29,9 @@
. "${srcdir=.}/init.sh"
# strace -y is implemented using /proc/self/fd
[ -d /proc/self/fd/ ] ||
framework_skip_ '/proc/self/fd/ is not available'
check_prog sed
run_prog "../$NAME" > /dev/null
run_prog > /dev/null
run_strace -a20 -y -eclose,network $args > "$EXP"
# Filter out close() calls made by ld.so and libc.

View File

@ -41,6 +41,8 @@
int
main(void)
{
skip_if_unavailable("/proc/self/fd/");
const struct sockaddr_in addr = {
.sin_family = AF_INET,
.sin_addr.s_addr = htonl(INADDR_LOOPBACK)

View File

@ -29,14 +29,10 @@
. "${srcdir=.}/init.sh"
# strace -yy is implemented using /proc/self/fd
[ -d /proc/self/fd/ ] ||
framework_skip_ '/proc/self/fd/ is not available'
check_prog sed
run_prog ../netlink_inet_diag
run_prog "../$NAME" > /dev/null
run_prog > /dev/null
run_strace -a22 -yy -eclose,network $args > "$EXP"
# Filter out close() calls made by ld.so and libc.

View File

@ -47,6 +47,8 @@
int
main(void)
{
skip_if_unavailable("/proc/self/fd/");
struct sockaddr_nl addr = {
.nl_family = AF_NETLINK,
.nl_pid = getpid()

View File

@ -32,14 +32,10 @@
. "${srcdir=.}/init.sh"
# strace -yy is implemented using /proc/self/fd
[ -d /proc/self/fd/ ] ||
framework_skip_ '/proc/self/fd/ is not available'
check_prog sed
run_prog ../netlink_netlink_diag
run_prog "../$NAME" > /dev/null
run_prog > /dev/null
run_strace -a22 -yy -eclose,network $args > "$EXP"
# Filter out close() calls made by ld.so and libc.

View File

@ -43,6 +43,8 @@
int
main(void)
{
skip_if_unavailable("/proc/self/fd/");
struct sockaddr_un addr = {
.sun_family = AF_UNIX,
.sun_path = TEST_SOCKET

View File

@ -31,14 +31,10 @@
. "${srcdir=.}/init.sh"
# strace -yy is implemented using /proc/self/fd
[ -d /proc/self/fd/ ] ||
framework_skip_ '/proc/self/fd/ is not available'
check_prog sed
run_prog ../netlink_unix_diag
run_prog "../$NAME" > /dev/null
run_prog > /dev/null
run_strace -a22 -yy -eclose,network $args > "$EXP"
# Filter out close() calls made by ld.so and libc.

View File

@ -267,7 +267,9 @@ create_sample(const char *fname, const libc_off_t size)
int
main(void)
{
# if !IS_FSTAT
# if IS_FSTAT
skip_if_unavailable("/proc/self/fd/");
# else
static const char full[] = "/dev/full";
# endif
static const char sample[] = TEST_SYSCALL_STR ".sample";