Commit Graph

12 Commits

Author SHA1 Message Date
c6782f144a tests: change the license to GPL-2.0-or-later
strace test suite is now provided under the terms of the GNU General
Public License version 2 or later, see tests/COPYING for more details.
2018-12-10 00:00:00 +00:00
c1154d21a6 Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-08-12 22:22:32 +00:00
Zhibin Li
1b5b5b76b5 tests: check decoding of successful quotactl
* tests/quotactl-success.c: New file.
* tests/quotactl-success-v.c: Likewise.
* tests/quotactl-xfs-success.c: Likewise.
* tests/quotactl-xfs-success-v.c: Likewise.
* tests/quotactl-success.test: New test.
* tests/quotactl-success-v.test: Likewise.
* tests/quotactl-xfs-success.test: Likewise.
* tests/quotactl-xfs-success-v.test: Likewise.
* tests/.gitignore: Add quotactl-success, quotactl-success-v,
quotactl-xfs-success and quotactl-xfs-success-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add four new tests listed above.
* tests/quotactl.h: [INJECT_RETVAL] (check_quota): Use errstr instead of
sprintrc; check that returned value is equivalent to the injected one;
append "(INJECTED)" string to errstr.
* tests/quotactl.c: Changed condition rc != 0 to rc < 0 in callback
functions and value of opaque pointer addr_cb_arg in order to check
successful injection.
* tests/quotactl-xfs.c: Likewise.
2018-07-20 16:18:17 +00:00
Zhibin Li
7a4582e357 tests: use check_quota for invalid quotactl commands
Use check_quota function for invalid commands instead of manual quotactl
syscall invocations. In this way successful injection can also be checked
for these commands in the next commit.

* tests/quotactl.c (main): Add invalid_cmd_str and invalid_id_str local
variables, remove unused variable rc, use check_quota instead of manual
quotactl syscall invocations.
* tests/quotaclt.c (main): Add invalid_cmd_str variable, remove unused
variable rc, use check_quota instead of manual quotactl syscall invocations.
2018-07-15 18:51:09 +00:00
Zhibin Li
f23ff6cebf tests: enhance test coverage of quotactl syscall parser
* tests/quotactl.c (print_dqfmt): New function.
(main): Use print_dqfmt to print flags of quota format, improve existing
tests and add more tests for Q_GETFMT.
* tests/quotactl-xfs.c: Improve existing tests and add more tests for
Q_XGETQSTAT and Q_XGETQSTATV.
2018-07-15 18:51:09 +00:00
26954f7753 Unify different generic PRINT_FIELD_* implementations
Create a new header print_fields.h and move generic PRINT_FIELD_*
macros there.

* print_fields.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_sock_diag.c: Include "print_fields.h".
(PRINT_FIELD_U, PRINT_FIELD_X, PRINT_FIELD_COOKIE, PRINT_FIELD_FLAGS,
PRINT_FIELD_XVAL): Move to print_fields.h file.
* quota.c: Include "print_fields.h".
(PRINT_FIELD_D): Move to print_fields.h file.
(PRINT_FIELD_U, PRINT_FIELD_X): Remove.
* statx.c: Include "print_fields.h".
(PRINT_FIELD_U): Remove.
(SYS_FUNC(statx)): Update PRINT_FIELD_U callers.
* tests/quotactl.h: Include "print_fields.h".
* tests/quotactl-xfs.c: Update callers of PRINT_FIELD_* macros.
* tests/quotactl.c: Likewise.
(PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): Remove.
* tests/test_nlattr.h: Include "print_fields.h".
(PRINT_FIELD_U, PRINT_FIELD_X): Remove.
* tests/xstatx.c: Include "print_fields.h".
(PRINT_FIELD_U): Remove.
(print_stat): Update PRINT_FIELD_U callers.
* tests/tests.h [!STRACE_PRINTF] (STRACE_PRINTF): Define to printf.
2017-07-01 13:14:49 +00:00
Eugene Syromyatnikov
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
eabace12c4 tests: use TAIL_ALLOC_OBJECT_CONST_PTR
Automatically convert tests to use TAIL_ALLOC_OBJECT_CONST_PTR macro
with the following sed expression:

sed -ri \
's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*( *const )?([^ =]+) = tail_alloc\(sizeof\((\2|\*\6)\)\);/\1TAIL_ALLOC_OBJECT_CONST_PTR(\2, \6);/' \
tests/*.c
2017-03-16 13:46:36 +00:00
84e3de2018 tests: remove redundant casts in fill_memory{,_ex} invocations
* tests/ioctl_loop.c (main): Remove redundant casts of fill_memory
first argument.
* tests/kexec_load.c (main): Likewise.
* tests/perf_event_open.c (main): Likewise.
* tests/quotactl.c (main): Likewise.
* tests/mq_sendrecv.c (main): Remove redundant casts of fill_memory_ex
first argument.
* tests/quotactl-xfs.c (main): Likewise.
2017-01-04 22:17:26 +00:00
Eugene Syromyatnikov
fd992caa81 tests: fix name spelling 2016-10-30 22:54:27 +00:00
Eugene Syromyatnikov
5ca0852f5f tests: fix invalid pointer checks in quotactl test
* tests/quotactl.h (bogus_special, bogus_addr): Move it...
* tests/quotactl.c (main): ... here; remove static and const qualifiers,
use memory after tail_alloc instead of magic numbers.
* tests/quotactl-xfs.c (main): Likewise.
2016-10-31 00:49:29 +03:00
Eugene Syromyatnikov
81b63834dd tests: check decoding of quotactl syscall
* configure.ac (AC_CHECK_HEADERS): Add linux/dqblk_xfs.h, linux/quota.h,
and sys/quota.h.
* tests/.gitignore: Add quotactl, quotactl-v, quotactl-xfs,
and quotactl-xfs-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add quotactl.test, quotactl-v.test,
quotactl-xfs.test, and quotactl-xfs-v.test.
(EXTRA_DIST): Add quotactl.h
* quotactl.h: New file.
* quotactl.c: Likewise.
* quotactl-v.c: Likewise.
* quotactl-xfs.c: Likewise.
* quotactl-xfs-v.c: Likewise.
* quotactl.test: New test.
* quotactl-v.test: Likewise.
* quotactl-xfs.test: Likewise.
* quotactl-xfs-v.test: Likewise.
2016-09-27 08:11:06 +00:00