diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2018-01-23 01:06:09 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2018-01-23 23:17:02 +0000 |
commit | 5ac1e8e11b46dbe272545621420123c306c683cd (patch) | |
tree | 2a564354e02e6df54cc0e6ff8a955abdafb82683 /tests/oldselect.c | |
parent | 959e82d13d55e7368a6f8c73e88a1d9ef8c68533 (diff) | |
download | strace-5ac1e8e11b46dbe272545621420123c306c683cd.tar.gz |
tests: check path tracing of old select syscall
* tests/xselect.c [xselect] (xselect): Turn into prototype.
* tests/oldselect-P.c: New file.
* tests/oldselect-efault-P.c: Likewise.
* tests/oldselect-efault.c: Likewise.
* tests/oldselect.c: Use xselect.c
* tests/pure_executables.list: Add oldselect-efault.
* tests/gen_tests.in (oldselect, oldselect-P, oldselect-efault,
oldselect-efault-P): New entries.
* tests/oldselect.expected: Remove.
* tests/oldselect.test: Remove.
* tests/Makefile.am (check_PROGRAMS): Add oldselect-P
and oldselect-efault-P.
(DECODER_TESTS): Remove oldselect.test.
(EXTRA_DIST): Remove oldselect.expected.
* tests/.gitignore: Add oldselect-P, oldselect-efault,
and oldselect-efault-P.
Diffstat (limited to 'tests/oldselect.c')
-rw-r--r-- | tests/oldselect.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/tests/oldselect.c b/tests/oldselect.c index 7413fc336..7f548f812 100644 --- a/tests/oldselect.c +++ b/tests/oldselect.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org> + * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,37 +30,38 @@ #if defined __NR_select && defined __NR__newselect \ && __NR_select != __NR__newselect \ - && !defined SPARC + && !defined __sparc__ -# include <unistd.h> -# include <sys/select.h> +# define TEST_SYSCALL_NR __NR_select +# define TEST_SYSCALL_STR "select" +# define xselect xselect +# include "xselect.c" -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)) - perror_msg_and_fail("pipe"); +static uint32_t *args; - FD_SET(0, &w); - FD_SET(1, &r); - if (syscall(__NR_select, args)) - perror_msg_and_skip("select"); - - return 0; +static long +xselect(const kernel_ulong_t nfds, + const kernel_ulong_t rs, + const kernel_ulong_t ws, + const kernel_ulong_t es, + const kernel_ulong_t tv) +{ + if (!args) + args = tail_alloc(sizeof(*args) * 5); + args[0] = nfds; + args[1] = rs; + args[2] = ws; + args[3] = es; + args[4] = tv; + long rc = syscall(TEST_SYSCALL_NR, args); + errstr = sprintrc(rc); + return rc; } #else -SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect") +SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect" + " && __NR_select != __NR__newselect" + " && !defined __sparc__") #endif |