1454 Commits

Author SHA1 Message Date
2b786e0113 tests: really skip mips o32 scno tampering tests on mips n64
* tests/is_linux_mips_n64.c: New file.
* tests/Makefile.am (check_PROGRAMS): Add it.
* tests/scno_tampering.sh <$STRACE_ARCH == mips>:
In case of mips o32 abi, skip the test if is_linux_mips_n64 says
that the kernel is mips n64, even if "uname -m" claims it's mips.
2017-08-23 18:38:26 +00:00
JingPiao Chen
bc9fd5ffb9 tests: check decoding of ifaddrmsg netlink attributes
* tests/nlattr_ifaddrmsg.c: Include <arpa/inet.h>.
(IFA_FLAGS, SET_IFA_FAMILY): New macros.
(init_ifaddrmsg): Set ifaddrmsg.ifa_family field from ifa_family.
(print_ifaddrmsg): Print ifaddrmsg.ifa_family field using ifa_family_str.
(main): Check decoding of IFA_ADDRESS, IFA_CACHEINFO, and IFA_FLAGS.
2017-08-22 11:39:03 +00:00
1cd860cc6c tests: fix a few harmless -Woverflow compilation warnings
Fix the following compilation warnings on platforms where
sizeof(struct timeval.tv_usec) < sizeof(long):

xettimeofday.c: In function ‘main’:
xettimeofday.c:76:16: warning: overflow in implicit constant conversion [-Woverflow]
  tv->tv_usec = (long) 0xbadc0dedfacefeedLL;
xetitimer.c: In function ‘main’:
xetitimer.c:170:28: warning: overflow in implicit constant conversion [-Woverflow]
  p_new->it_value.tv_usec = (long) 0xbadc0dedfacefeedLL;
In file included from utimes.c:38:0:
xutimes.c: In function ‘main’:
xutimes.c:110:18: warning: overflow in implicit constant conversion [-Woverflow]
  tv[1].tv_usec = (long) 0xbadc0dedfacefeedLL;
futimesat.c: In function ‘main’:
futimesat.c:121:18: warning: overflow in implicit constant conversion [-Woverflow]
  tv[1].tv_usec = (long) 0xbadc0dedfacefeedLL;
In file included from _newselect.c:35:0:
xselect.c: In function ‘main’:
xselect.c:94:16: warning: overflow in implicit constant conversion [-Woverflow]
  tv->tv_usec = (long) 0xbadc0dedfacefeedLL;
                ^
* tests/futimesat.c (main): In initialization of struct timeval.tv_usec,
change explicit cast from (long) to (suseconds_t).
* tests/xetitimer.c: Likewise.
* tests/xettimeofday.c: Likewise.
* tests/xselect.c: Likewise.
* tests/xutimes.c: Likewise.

Reported-by: Anatoly Pugachev <matorola@gmail.com>
2017-08-16 17:50:25 +00:00
06c4151a49 tests: fix sigaction.test on sparc
On sparc, the first argument of old sigaction syscall has negated
semantics, compared to other architectures.  While sigaction.test
was aware about this arch-specific detail from the beginning, in one
of many sigaction syscall invocations a non-negative signal number
was erroneously passed on sparc.

* tests/sigaction.c (ADDR_INT, SIGNO_INT): New arch-specific macros.
(signo, addr): Use them.
2017-08-16 16:25:03 +00:00
239418b7f8 nlattr: fix printing of unrecognized attribute data
Do not print more than "nlattr.nla_len - NLA_HDRLEN" bytes
of unrecognized attribute data.

* nlattr.c (decode_nlattr_with_data): Specify "nla_len - NLA_HDRLEN"
instead of "len - NLA_HDRLEN" as the size of unrecognized attribute
data.
* tests/nlattr.c (test_nlattr): Check it.
2017-08-16 02:24:29 +00:00
JingPiao Chen
c7946d380f tests: check decoding of NETLINK_ROUTE rtgenmsg attributes
* tests/nlattr_rtgenmsg.c: New file.
* tests/gen_tests.in (nlattr_rtgenmsg): New entry.
* tests/pure_executables.list: Add nlattr_rtgenmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
4c1e85025f tests: check decoding of NETLINK_ROUTE br_port_msg attributes
* tests/nlattr_br_port_msg.c: New file.
* tests/gen_tests.in (nlattr_br_port_msg): New entry.
* tests/pure_executables.list: Add nlattr_br_port_msg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
ef4feccbad tests: check decoding of NETLINK_ROUTE netconfmsg attributes
* tests/nlattr_netconfmsg.c: New file.
* tests/gen_tests.in (nlattr_netconfmsg): New entry.
* tests/pure_executables.list: Add nlattr_netconfmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
3d27e43d82 tests: check decoding of NETLINK_ROUTE dcbmsg attributes
* tests/nlattr_dcbmsg.c: New file.
* tests/gen_tests.in (nlattr_dcbmsg): New entry.
* tests/pure_executables.list: Add nlattr_dcbmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
a93b5fa242 tests: check decoding of NETLINK_ROUTE ifaddrlblmsg attributes
* tests/nlattr_ifaddrlblmsg.c: New file.
* tests/gen_tests.in (nlattr_ifaddrlblmsg): New entry.
* tests/pure_executables.list: Add nlattr_ifaddrlblmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
2795dde450 tests: check decoding of NETLINK_ROUTE tcamsg attributes
* tests/nlattr_tcamsg.c: New file.
* tests/gen_tests.in (nlattr_tcamsg): New entry.
* tests/pure_executables.list: Add nlattr_tcamsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
7506c69c3a tests: check decoding of NETLINK_ROUTE tcmsg attributes
* tests/nlattr_tcmsg.c: New file.
* tests/gen_tests.in (nlattr_tcmsg): New entry.
* tests/pure_executables.list: Add nlattr_tcmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
72f13278be tests: check decoding of NETLINK_ROUTE ndtmsg attributes
* tests/nlattr_ndtmsg.c: New file.
* tests/gen_tests.in (nlattr_ndtmsg): New entry.
* tests/pure_executables.list: Add nlattr_ndtmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
daf21282d1 tests: check decoding of NETLINK_ROUTE ndmsg attributes
* tests/nlattr_ndmsg.c: New file.
* tests/gen_tests.in (nlattr_ndmsg): New entry.
* tests/pure_executables.list: Add nlattr_ndmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
848cbc422b tests: check decoding of NETLINK_ROUTE fib_rule_hdr attributes
* tests/nlattr_fib_rule_hdr.c: New file.
* tests/gen_tests.in (nlattr_fib_rule_hdr): New entry.
* tests/pure_executables.list: Add nlattr_fib_rule_hdr.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
747cdf790d tests: check decoding of NETLINK_ROUTE rtmsg attributes
* tests/nlattr_rtmsg.c: New file.
* tests/gen_tests.in (nlattr_rtmsg): New entry.
* tests/pure_executables.list: Add nlattr_rtmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
ea9d07f0bf tests: check decoding of NETLINK_ROUTE ifaddrmsg attributes
* tests/nlattr_ifaddrmsg.c: New file.
* tests/gen_tests.in (nlattr_ifaddrmsg): New entry.
* tests/pure_executables.list: Add nlattr_ifaddrmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
JingPiao Chen
cbe8ddd2db tests: check decoding of NETLINK_ROUTE ifinfomsg attributes
* tests/nlattr_ifinfomsg.c: New file.
* tests/gen_tests.in (nlattr_ifinfomsg): New entry.
* tests/pure_executables.list: Add nlattr_ifinfomsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
a10961a9e1 tests/test_nlattr.h: include <stdint.h>
* tests/test_nlattr.h: Include <stdint.h> for definition of uint16_t
used by init_nlattr.
2017-08-15 22:34:46 +00:00
77edc3a42e tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 20:08:39 +00:00
579d1c69da tests/net-sockaddr: use ifindex_lo and IFINDEX_LO_STR
* tests/net-sockaddr.c (if_nametoindex): Remove declaration.
(check_in6_linklocal, check_ll): Remove HAVE_IF_INDEXTONAME checks,
Use ifindex_lo instead of if_nametoindex, use IFINDEX_LO_STR instead
of hardcoded string.
2017-08-15 20:08:39 +00:00
e72d776a77 tests/msg_control: use ifindex_lo and IFINDEX_LO_STR
* tests/msg_control.c (test_ip_pktinfo): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
2017-08-15 20:08:39 +00:00
4e82a67f5f tests/inet-cmsg: use IFINDEX_LO_STR
* tests/inet-cmsg.c (print_pktinfo): Use IFINDEX_LO_STR instead
of hardcoded string.
2017-08-15 20:08:39 +00:00
0891e131c7 tests/ip_mreq: use ifindex_lo and IFINDEX_LO_STR
* tests/ip_mreq.c: Do not check for HAVE_IF_INDEXTONAME.
(main): Use ifindex_lo instead of if_nametoindex, use IFINDEX_LO_STR
instead of hardcoded string.
2017-08-15 20:08:39 +00:00
a9660f8eb1 tests/group_req: use ifindex_lo and IFINDEX_LO_STR
* tests/group_req.c: Do not check for HAVE_IF_INDEXTONAME.
(main): Use ifindex_lo instead of if_nametoindex, use IFINDEX_LO_STR
instead of hardcoded string.
2017-08-15 20:08:39 +00:00
23d470d3c0 tests: add ifindex_lo function and IFINDEX_LO_STR macro to libtests
* tests/ifindex.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (ifindex_lo): New prototype.
(IFINDEX_LO_STR): New macro.
2017-08-15 20:08:39 +00:00
JingPiao Chen
ca2e93ec05 configure.ac: remove redundant linux/dcbnl.h header check
* configure.ac (AC_CHECK_HEADERS): Remove linux/dcbnl.h.
* rtnl_dcb.c: Replace HAVE_LINUX_DCBNL_H with HAVE_STRUCT_DCBMSG.
* tests/netlink_route.c: Likewise.
2017-08-15 09:13:19 +00:00
JingPiao Chen
a95799f95d tests: check decoding of rtnetlink nsid messages
* tests/netlink_route.c (test_rtnl_nsid): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:10:33 +00:00
JingPiao Chen
bc8e89fbb8 tests: check decoding of rtnetlink mdb messages
* tests/netlink_route.c: Include <netinet/in.h>
and <linux/if_bridge.h>.
(test_rtnl_mdb): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:10:21 +00:00
JingPiao Chen
6d4f3fc075 tests: check decoding of rtnetlink netconf messages
* tests/netlink_route.c: Include <linux/netconf.h>.
(test_rtnl_netconf): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:59 +00:00
JingPiao Chen
9120212f66 tests: check decoding of rtnetlink dcb messages
* tests/netlink_route.c: Include <linux/dcbnl.h>.
(test_rtnl_dcb): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:51 +00:00
JingPiao Chen
32c12cbe03 tests: check decoding of rtnetlink addrlabel messages
* tests/netlink_route.c: Include <linux/if_addrlabel.h>.
(test_rtnl_addrlabel): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:44 +00:00
JingPiao Chen
e729e3f0d0 tests: check decoding of rtnetlink tc action messages
* tests/netlink_route.c (test_rtnl_tca): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:16 +00:00
JingPiao Chen
49e09c5cb9 tests: check decoding of rtnetlink tc messages
* tests/netlink_route.c (test_rtnl_tc): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:10 +00:00
JingPiao Chen
e87297d102 tests: check decoding of rtnetlink neightbl messages
* tests/netlink_route.c (test_rtnl_neightbl): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:02 +00:00
JingPiao Chen
9f22c62767 tests: check decoding of rtnetlink neigh messages
* tests/netlink_route.c: Include <linux/neighbour.h>.
(test_rtnl_neigh): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:07:59 +00:00
JingPiao Chen
50b2249877 tests: check decoding of rtnetlink rule messages
* tests/netlink_route.c: Include <linux/fib_rules.h>.
(test_rtnl_rule): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:07:07 +00:00
JingPiao Chen
a114dd92fe tests: check decoding of rtnetlink route messages
* tests/netlink_route.c: Include <linux/ip.h>.
(test_rtnl_route): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:06:59 +00:00
JingPiao Chen
0a3ebb0443 tests: check decoding of rtnetlink addr messages
* tests/netlink_route.c: Include <linux/if_addr.h>.
(test_rtnl_addr): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:06:38 +00:00
JingPiao Chen
7d216d508e tests: check decoding of NLMSG_DONE messages of NETLINK_ROUTE
* tests/netlink_route.c (test_nlmsg_done): New function.
(main): Use it.
2017-08-11 15:50:14 +00:00
JingPiao Chen
fc15305b9f tests: check decoding of rtnetlink link messages
* tests/netlink_route.c: Include <linux/if_arp.h>.
(TEST_NL_ROUTE): New macro.
(test_rtnl_link): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-09 00:43:49 +00:00
JingPiao Chen
7f95ee6017 tests: check netlink family specific decoder of NETLINK_ROUTE
* tests/netlink_route.c: Include <stdint.h>,
include "test_netlink.h" instead of "netlink.h".
(test_rtnl_unspec): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-09 08:43:34 +08:00
JingPiao Chen
474031e41b tests: check decoding of NETLINK_KOBJECT_UEVENT messages
* tests/netlink_kobject_uevent.c: New file.
* tests/gen_tests.in (netlink_kobject_uevent): New entry.
* tests/pure_executables.list: Add netlink_kobject_uevent.
* tests/.gitignore: Likewise.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-08 16:36:59 +00:00
15cc2f5364 Make sysent_shorthand_defs.h suitable for tests
* sysent_shorthand_defs.h [STRACE_TESTS_H]: Add shorthand notations from
tests/ksysent.c and tests/nsyscalls.c.
* tests/ksysent.c: Remove shorthand notations.
* tests/nsyscalls.c: Likewise.
2017-08-07 12:49:44 +00:00
Nikolay Marchuk
35c006d93c tests: move check_* functions from options-syntax.test to separate file
* tests/options-syntax.test: Move check_* functions to ...
* tests/syntax.sh: ... new file.
* tests/Makefile.am (EXTRA_DIST): Add syntax.sh.
2017-08-07 03:22:26 +00:00
255bc6fded Enhance fflush error diagnostics
* strace.c (flush_tcp_output): New function.
(line_ended, droptcb, print_event_exit): Use it to flush tcp->outf.
* tests/fflush.c: New file.
* tests/fflush.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
* tests/.gitignore: Add fflush.
* tests/pure_executables.list: Likewise.
2017-08-06 11:26:52 +00:00
a93e2de99e tests: check handling of CLONE_PARENT'ed and CLONE_PTRACE'ed processes
* tests/clone_parent.c: New file.
* tests/clone_ptrace.c: Likewise.
* tests/clone_parent.test: New test.
* tests/clone_ptrace.test: Likewise.
* tests/.gitignore: Add clone_parent and clone_ptrace.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add clone_parent.test and clone_ptrace.test.
2017-08-06 00:23:20 +00:00
d874bbf61e tests: export a path to the trace executable to check_PROGRAMS
* tests/init.sh (STRACE_EXE): Initialize from $STRACE and export.
2017-08-06 00:23:20 +00:00
17f095a945 tests: fix unaligned access in nlattr.test
* tests/nlattr.c (test_nlattr): Use SET_STRUCT
to initialize potentially unaligned struct nlattr.
2017-08-04 19:08:27 +00:00
8bf63c5ec7 tests: fix unaligned access in nlattr_packet_diag_msg.test
* tests/nlattr_packet_diag_msg.c (init_packet_diag_msg): Use SET_STRUCT
to initialize potentially unaligned struct packet_diag_msg.
2017-08-04 19:06:49 +00:00