Commit Graph

8 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
Eugene Syromyatnikov
9c8ec0a80f Print microseconds/nanoseconds as non-negative
Negative micro/nanoseconds values are treated as invalid by kernel
anyway, and in one case (timespec_valid in include/linux/time.h)
it is even checked by conversion to unsigned long.

* print_timespec.c (timespec_fmt): Change tv_sec format to %lld and
tv_nsec format to %llu.
(print_timespec_t): Cast tv_sec to long long and process tv_nsec with
zero_extend_signed_to_ull.
(sprint_timespec): Likewise.
* print_timeval.c (timeval_fmt): Change tv_sec format to %lld and
tv_usec format to %llu.
(print_timeval_t): Cast tv_sec to long long and process tv_nsec with
zero_extend_signed_to_ull.
(sprint_timeval, print_timeval32_t, sprint_timeval32): Likewise.
* defs.h (TIMESPEC_TEXT_BUFSIZE): Update.
* tests/adjtimex.c (main): Change tv_sec printing format to %lld, cast
it to long long; change tv_usec printing format to %llu, process it with
zero_extend_signed_to_ull.
* tests/clock_nanosleep.c (main): Change tv_sec printing format to %lld,
cast it to long long; change tv_nsec printing format to %llu, process it
with zero_extend_signed_to_ull.
* tests/clock_xettime.c (main): Likewise.
* tests/futex.c (main): Likewise.
* tests/futimesat.c (print_tv): Likewise.
* tests/getrusage.c (invoke_print): Likewise.
* tests/mq_sendrecv.c (do_send, do_recv, main): Likewise.
* tests/nanosleep.c (main): Likewise.
* tests/pselect6.c (main): Likewise.
* tests/restart_syscall.c (main): Likewise.
* tests/rt_sigtimedwait.c (iterate, main): Likewise.
* tests/sched_rr_get_interval.c (main): Likewise.
* tests/semop.c (main): Likewise.
* tests/timer_xettime.c (main): Likewise.
* tests/timerfd_xettime.c (main): Likewise.
* tests/waitid.c (main): Likewise.
* tests/xetitimer.c (main): Likewise.
* tests/xettimeofday.c (main): Likewise.
* tests/xselect.c (main): Likewise.
* tests/xutimes.c (print_tv): Likewise.
* tests/wait4.c (sprint_rusage): Likewise.
* tests/waitid.c (sprint_rusage): Likewise.
* tests/utimensat.c (print_ts): Likewise.
(main): Add check for higher bits of tv_sec/tv_nsec.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-04-24 23:14:57 +00:00
Eugene Syromyatnikov
acdb08613e Fix omission of field names in printers of timespec structure
* print_time.c (timespec_fmt): New constant.
(print_timespec_t, sprint_timespec): Use it instead of time_fmt.
* tests/aio.c: Add field names to expected output.
* tests/clock_nanosleep.c (main): Likewise.
* tests/clock_xettime.c (main): Likewise.
* tests/futex.c (main): Likewise.
* tests/mq_sendrecv.c (do_send, do_recv): Likewise.
* tests/nanosleep.c (main): Likewise.
* tests/ppoll-v.expected: Likewise.
* tests/ppoll.expected: Likewise.
* tests/pselect6.c (main): Likewise.
* tests/recvmmsg-timeout.c (main): Likewise.
* tests/restart_syscall.c (main): Likewise.
* tests/rt_sigtimedwait.c (iterate, main): Likewise.
* tests/sched_rr_get_interval.c (main): Likewise.
* tests/semop.c (main): Likewise.
* tests/strace-T.expected: Likewise.
* tests/timer_xettime.c (main): Likewise.
* tests/timerfd_xettime.c (main): Likewise.
* tests/utimensat.c (print_ts): Likewise.
2016-11-26 00:40:53 +00:00
fa63468f55 tests/restart_syscall.c: use libtests
* tests/restart_syscall.c (main): Use assert, perror_msg_and_fail,
and perror_msg_and_skip.
2016-01-05 23:14:25 +00:00
0c8853c3c3 tests: include tests.h instead of config.h
Automatically edit tests/*.c files using the following perl one-liner:

perl -0777 -pi -e \
's/#ifdef HAVE_CONFIG_H\n# include "config\.h"\n#endif\n*/#include "tests.h"\n/' \
tests/*.c
2016-01-05 23:17:11 +00:00
703a7166ae tests/restart_syscall: add a workaround for old arm kernels
As arm kernels used to overwrite ARM_r0 with -EINTR after
ERESTART_RESTARTBLOCK, update regexp to workaround this.

* tests/restart_syscall.c (main) [__arm__]: Add 0xfffffffc as a valid
alternative value for the first argument of restarted nanosleep syscall.
2015-12-13 01:12:55 +00:00
5421855219 tests: skip restart_syscall.test on x32
The syscall number of restart_syscall returned by the kernel in case
of ERESTART_RESTARTBLOCK is broken on x32 from the beginning, see
https://lkml.org/lkml/2015/11/30/790

Until that improves, skip the test on x32.

* tests/restart_syscall.c (main) [__x86_64__ && __ILP32__]: Return 77.
2015-12-04 16:57:23 +00:00
640623c41e tests: rewrite restart_syscall in C
* tests/restart_syscall.c: New file.
* tests/restart_syscall.expected: Remove.
* tests/restart_syscall_unknown.expected: Remove.
* tests/restart_syscall.test: Update to use restart_syscall.
* tests/Makefile.am (check_PROGRAMS): Add restart_syscall.
(EXTRA_DIST): Remove restart_syscall.expected
and restart_syscall_unknown.expected.
* tests/.gitignore: Add restart_syscall.
2015-09-19 04:04:48 +03:00