]> granicus.if.org Git - strace/commitdiff
tests: move /proc/ checks from scripts to executables
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 19 Apr 2017 02:16:31 +0000 (02:16 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 19 Apr 2017 02:16:31 +0000 (02:16 +0000)
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.

12 files changed:
tests/attach-f-p-cmd.c
tests/attach-f-p.test
tests/fstat.test
tests/net-y-unix.c
tests/net-y-unix.test
tests/net-yy-inet.c
tests/net-yy-inet.test
tests/net-yy-netlink.c
tests/net-yy-netlink.test
tests/net-yy-unix.c
tests/net-yy-unix.test
tests/xstatx.c

index 77594bebb21c45eae353b4d21acf8b141b8f7d32..db8e1a2e2514c55e7502f69076af6be845a96c97 100644 (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);
index d3aab34336a613976c3069dd81f9288b19bce1fe..b23a4521372a2823520c6b94ba54f4c984a8e17a 100755 (executable)
@@ -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
index c7dbc740f0044d2ed37a5cea4533ed952d41cb4f..38936320d7cfaa1a0f311e94be4573eaaf840139 100755 (executable)
@@ -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
index 98ea9563b3e727c2583f41ed194005ba5fd4d90b..df56ad640a54a0924280b06bdae65fcb4bade2ce 100644 (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
index ffa28780d8d6dd0fd89b0f08a0c6e40f26ce724d..fd3fd68615d3480e8a88234928cef07b3c8485ef 100755 (executable)
 
 . "${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.
index aa6e957eaaf2e956ba3fe1e3096705a0225398a7..452eb634076e7ae835a4aac1856d9fe79dbe8155 100644 (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)
index 08c4635166acf36f424107397efbe46edbef2663..17bc6f91fadaaa51c2bef875a311e1f8fe58bb7f 100755 (executable)
 
 . "${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.
index 1d7001ed405f1f17583f20726b1c2fa19df91d65..6539edabf619c6ed9ce685ff92467eced48f578d 100644 (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()
index 0723c3ede68f2f746c02c4d2bff827d953676811..4c6da22e22ad1ab58a83de2b9018640e0d5030af 100755 (executable)
 
 . "${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.
index d646f286af9eb213344446ee36cb11688b38d141..f27cdc0794255e40b1032c9dc02a863f4f92f817 100644 (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
index a660c5c158da7b0654c31f42dfc5d7ce883df777..59323a47b9258be780c427b3f3b0e7501956587a 100755 (executable)
 
 . "${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.
index f4e1a90f2fa8fb21f0079f175f916abac0ce438f..9b56deffeeb58e2357090da7584560ec44474982 100644 (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";