]> granicus.if.org Git - strace/commitdiff
tests: add oldselect.test
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 30 Jul 2015 08:24:32 +0000 (08:24 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 30 Jul 2015 22:03:07 +0000 (22:03 +0000)
* tests/oldselect.c: New file.
* tests/oldselect.expected: Likewise.
* tests/oldselect.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add oldselect.
(TESTS): Add oldselect.test.
(EXTRA_DIST): Add oldselect.expected.
* tests/.gitignore: Add oldselect.

tests/.gitignore
tests/Makefile.am
tests/oldselect.c [new file with mode: 0644]
tests/oldselect.expected [new file with mode: 0644]
tests/oldselect.test [new file with mode: 0755]

index 51d8dd2ae8578bd84902986ff5e873810cf15d0d..801acee6f93ef45348e6cb349199640194289f4e 100644 (file)
@@ -18,6 +18,7 @@ mmsg
 net-accept-connect
 netlink_inet_diag
 netlink_unix_diag
+oldselect
 pc
 pipe
 sched_xetattr
index 2eb31330a8db252281fe85f68cba42bf8930cf5a..4a51a4d4dce3a7b95d8029f373a6061c58267737 100644 (file)
@@ -29,6 +29,7 @@ check_PROGRAMS = \
        net-accept-connect \
        netlink_inet_diag \
        netlink_unix_diag \
+       oldselect \
        pc \
        pipe \
        sched_xetattr \
@@ -98,6 +99,7 @@ TESTS = \
        net.test \
        net-fd.test \
        net-yy.test \
+       oldselect.test \
        pipe.test \
        pc.test \
        sun_path.test \
@@ -143,6 +145,7 @@ EXTRA_DIST = init.sh run.sh match.awk \
             net-fd.expected \
             net-yy-accept.awk \
             net-yy-connect.awk \
+            oldselect.expected \
             pipe.expected \
             restart_syscall.expected \
             restart_syscall_unknown.expected \
diff --git a/tests/oldselect.c b/tests/oldselect.c
new file mode 100644 (file)
index 0000000..3204ef5
--- /dev/null
@@ -0,0 +1,45 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <unistd.h>
+#include <sys/select.h>
+#include <sys/syscall.h>
+
+#if defined __NR_select && defined __NR__newselect \
+ && __NR_select != __NR__newselect \
+ && !defined SPARC
+
+int
+main(void)
+{
+       int fds[2];
+       fd_set r = {}, w = {};
+       struct timeval timeout = { .tv_sec = 0, .tv_usec = 42 };
+       long args[] = {
+               2, (long) &r, (long) &w, 0, (long) &timeout,
+               0xdeadbeef, 0xbadc0ded, 0xdeadbeef, 0xbadc0ded, 0xdeadbeef
+       };
+
+       (void) close(0);
+       (void) close(1);
+       if (pipe(fds))
+               return 77;
+
+       FD_SET(0, &w);
+       FD_SET(1, &r);
+       if (syscall(__NR_select, args))
+               return 77;
+
+       return 0;
+}
+
+#else
+
+int
+main(void)
+{
+       return 77;
+}
+
+#endif
diff --git a/tests/oldselect.expected b/tests/oldselect.expected
new file mode 100644 (file)
index 0000000..14049ab
--- /dev/null
@@ -0,0 +1 @@
+oldselect\(2, \[1\], \[0\], NULL, \{0, 42\}\) += 0 \(Timeout\)
diff --git a/tests/oldselect.test b/tests/oldselect.test
new file mode 100755 (executable)
index 0000000..edd3693
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Check oldselect syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog
+run_strace -e oldselect $args
+match_grep
+
+exit 0