libuv/test
Trevor Norris 6600954906
win,unix: change execution order of timers (#3927)
The maximum number of times timers should run when uv_run() is called
with UV_RUN_ONCE and UV_RUN_NOWAIT is 1. Do that by conditionally
calling timers before entering the while loop when called with
UV_RUN_DEFAULT.

The reason to always run timers at the end of the while loop, instead of
at the beginning, is to help enforce the conceptual event loop model.
Which starts when entering the event provider (e.g. calling poll).

Other than only allowing timers to be processed once per uv_run()
execution, the only other noticeable change this will show is if all the
following are true:
* uv_run() is called with UV_RUN_NOWAIT or UV_RUN_ONCE.
* An event is waiting to be received when poll is called.
* Execution time between the call to uv_timer_start() and entering the
  while loop is longer than the timeout.

If all these are true, then timers that would have executed before
entering the event provider will now be executed afterward.

Fixes: https://github.com/libuv/libuv/issues/3686
Co-authored-by: Momtchil Momtchev <momtchil@momtchev.com>
2023-03-20 10:04:57 -06:00
..
fixtures unix,win: fix memory leak in uv_fs_scandir() (#3760) 2022-09-22 09:25:55 +02:00
benchmark-async-pummel.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-async.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-fs-stat.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-getaddrinfo.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-list.h test: fix benchmark-ping-udp (#2817) 2022-02-13 01:04:41 -05:00
benchmark-loop-count.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-million-async.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-million-timers.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-multi-accept.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-ping-pongs.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-ping-udp.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-pound.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-pump.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-queue-work.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-sizes.c test: remove LOG and LOGF variadic macros 2015-04-12 18:44:34 +02:00
benchmark-spawn.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-tcp-write-batch.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
benchmark-thread.c Make the thread_create benchmark not time out 2012-03-09 17:53:48 +01:00
benchmark-udp-pummel.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
blackhole-server.c test: move to ASSERT_NULL and ASSERT_NOT_NULL test macros 2021-02-14 10:05:46 +01:00
echo-server.c unix,stream: fix loop hang after uv_shutdown 2021-07-13 10:54:02 -04:00
run-benchmarks.c benchmark: remove unreachable code 2021-04-04 17:47:37 +02:00
run-tests.c test: fix some unreachable code warnings (#3851) 2022-12-10 19:36:46 +01:00
runner-unix.c build: add MemorySanitizer (MSAN) support (#3788) 2022-10-18 23:21:42 +02:00
runner-unix.h Add copyright headers, license file. 2011-04-18 11:11:30 -07:00
runner-win.c test: simplify platform_init() 2020-03-27 23:51:32 +01:00
runner-win.h warnings: fix code that emits compiler warnings 2018-11-29 11:21:44 -05:00
runner.c test: fix -Wunused-but-set-variable warnings (#3829) 2022-11-26 22:30:04 +01:00
runner.h test: simplify platform_init() 2020-03-27 23:51:32 +01:00
task.h test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-active.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-async-null-cb.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-async.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-barrier.c barrier: wait for prior out before next in (#3905) 2023-03-06 17:57:25 -05:00
test-callback-stack.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-close-fd.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-close-order.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-condvar.c test: remove timing-sensitive check (#3899) 2023-02-07 11:15:59 -05:00
test-connect-unspecified.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-connection-fail.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-cwd-and-chdir.c test: canonicalize argv[0] in exepath test 2020-03-27 23:51:22 +01:00
test-default-loop-close.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-delayed-accept.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-dlerror.c test: fix musl libc.a dlerror() test expectation (#3735) 2022-09-07 11:21:24 -04:00
test-eintr-handling.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-embed.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-emfile.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-env-vars.c test: fix -Wunused-but-set-variable warnings (#3829) 2022-11-26 22:30:04 +01:00
test-error.c test: move to ASSERT_NULL and ASSERT_NOT_NULL test macros 2021-02-14 10:05:46 +01:00
test-fail-always.c Benchmark runner 2011-04-19 04:47:21 +02:00
test-fork.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-fs-copyfile.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-fs-event.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-fs-fd-hash.c win: add UV_FS_O_FILEMAP 2019-07-16 18:20:10 +02:00
test-fs-open-flags.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-fs-poll.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-fs-readdir.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-fs.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-get-currentexe.c build: add CI for OpenBSD and FreeBSD (#3548) 2023-01-21 13:52:36 +01:00
test-get-loadavg.c test: fix -Wtautological-pointer-compare warnings 2015-11-18 22:37:16 +01:00
test-get-memory.c unix,win: add uv_get_available_memory() (#3754) 2022-11-24 22:09:32 +01:00
test-get-passwd.c misc: extend getpw to take uid as an argument (#3523) 2023-01-17 21:51:28 -06:00
test-getaddrinfo.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-gethostname.c build: add CI for OpenBSD and FreeBSD (#3548) 2023-01-21 13:52:36 +01:00
test-getnameinfo.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-getsockname.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-getters-setters.c test: move to ASSERT_NULL and ASSERT_NOT_NULL test macros 2021-02-14 10:05:46 +01:00
test-gettimeofday.c unix,win: introduce uv_timeval64_t 2019-04-11 14:08:17 -04:00
test-handle-fileno.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-homedir.c test: canonicalize argv[0] in exepath test 2020-03-27 23:51:22 +01:00
test-hrtime.c test: relax uv_hrtime() test assumptions 2019-02-21 13:02:44 +01:00
test-idle.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-idna.c test: fix some warnings when compiling tests (#3816) 2023-01-19 10:48:13 -06:00
test-ip4-addr.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-ip6-addr.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-ip-name.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-ipc-heavy-traffic-deadlock-bug.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-ipc-send-recv.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-ipc.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-list.h win,unix: change execution order of timers (#3927) 2023-03-20 10:04:57 -06:00
test-loop-alive.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-loop-close.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-loop-configure.c linux: fix epoll_pwait() sigmask size calculation 2014-12-25 14:37:02 +01:00
test-loop-handles.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-loop-stop.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-loop-time.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-metrics.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-multiple-listen.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-mutexes.c unix,win: add uv_mutex_init_recursive() 2017-10-02 10:01:09 -04:00
test-not-readable-nor-writable-on-read-error.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-not-writable-after-shutdown.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-osx-select.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pass-always.c Benchmark runner 2011-04-19 04:47:21 +02:00
test-ping-pong.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-bind-error.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-close-stdout-read-stdin.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-connect-error.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-connect-multiple.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-connect-prepare.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-getsockname.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-pending-instances.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-sendmsg.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-server-close.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-set-fchmod.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-set-non-blocking.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-pipe-try-write.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-platform-output.c misc: extend getpw to take uid as an argument (#3523) 2023-01-17 21:51:28 -06:00
test-poll-close-doesnt-corrupt-stack.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-poll-close.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-poll-closesocket.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-poll-multiple-handles.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-poll-oob.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-poll.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-process-priority.c test: handle uv_os_setpriority() windows edge case 2018-09-25 20:56:37 -04:00
test-process-title-threadsafe.c test: fix thread race in process_title_threadsafe 2020-08-06 10:18:29 +02:00
test-process-title.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-queue-foreach-delete.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-random.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-readable-on-eof.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-ref.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-run-nowait.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-run-once.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-semaphore.c unix, windows: return error codes directly 2013-07-07 09:51:00 +02:00
test-shutdown-close.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-shutdown-eof.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-shutdown-simultaneous.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-shutdown-twice.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-signal-multiple-loops.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-signal-pending-on-close.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-signal.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-socket-buffer-size.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-spawn.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-stdio-over-pipes.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-strscpy.c unix: harden string copying, introduce strscpy() 2018-12-04 17:08:09 +01:00
test-strtok.c core: add thread-safe strtok implementation (#3553) 2022-03-22 15:15:00 -04:00
test-tcp-alloc-cb-fail.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-bind6-error.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-bind-error.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-close-accept.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-close-after-read-timeout.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-close-reset.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-close-while-connecting.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-close.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-connect6-error.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-connect-error-after-write.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-connect-error.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-connect-timeout.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-create-socket-early.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-flags.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-oob.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-open.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-read-stop-start.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-read-stop.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-rst.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-shutdown-after-write.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-try-write-error.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-try-write.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-unexpected-read.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-write-after-connect.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-write-fail.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-write-in-a-row.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-write-queue-order.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-write-to-half-open-connection.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tcp-writealot.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-test-macros.c test: avoid double evaluation in ASSERT_BASE macro 2020-08-12 13:13:02 -04:00
test-thread-affinity.c thread: add uv_thread_getcpu() (#3803) 2022-11-15 18:01:29 +01:00
test-thread-equal.c thread: initialize uv_thread_self for all threads (#3357) 2021-11-24 19:34:57 -05:00
test-thread.c unix: don't allow too small thread stack size (#3423) 2022-01-17 09:36:26 +01:00
test-threadpool-cancel.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-threadpool.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-timer-again.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-timer-from-check.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-timer.c win,unix: change execution order of timers (#3927) 2023-03-20 10:04:57 -06:00
test-tmpdir.c test: canonicalize argv[0] in exepath test 2020-03-27 23:51:22 +01:00
test-tty-duplicate-key.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tty-escape-sequence-processing.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-tty.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-alloc-cb-fail.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-bind.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-connect6.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-connect.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-create-socket-early.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-dgram-too-big.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-ipv6.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-mmsg.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-multicast-interface6.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-multicast-interface.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-multicast-join6.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-multicast-join.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-multicast-ttl.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-open.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-options.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-recv-in-a-row.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-send-and-recv.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-send-hang-loop.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-send-immediate.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-send-unreachable.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-sendmmsg-error.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-udp-try-send.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-uname.c unix,win: add uv_os_uname() 2019-01-14 10:47:20 -05:00
test-walk-handles.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00
test-watcher-cross-stop.c test: silence more valgrind warnings (#3917) 2023-03-12 14:59:00 +01:00