17#ifdef USE_ASSERT_CHECKING
29 ok_impl(OK, TEST, #OK, __FILE__, __LINE__)
38 printf(
"# at %s:%d:\n", file, line);
55#define is(THIS, THAT, TEST) \
60 ok_impl(this_ == that_, TEST, #THIS " == " #THAT, __FILE__, __LINE__), \
61 this_, #THIS, that_, #THAT \
92 actx->debugging =
true;
108 if (
actx->timerfd >= 0)
190#define mux_is_ready(MUX, DEADLINE, TEST) \
192 int res_ = PQsocketPoll(MUX, 1, 0, DEADLINE); \
193 Assert(res_ != -1); \
194 ok(res_ > 0, "multiplexer is ready " TEST); \
200#define mux_is_not_ready(MUX, TEST) \
202 int res_ = PQsocketPoll(MUX, 1, 0, 0); \
203 Assert(res_ != -1); \
204 is(res_, 0, "multiplexer is not ready " TEST); \
220 printf(
"# test_set_timer\n");
251 is(
expired, 1,
"drain_timer_events() reports expiration");
257 is(
expired, 0,
"drain_timer_events() reports no expiration");
289 for (
int inout = 0; inout < 2; inout++)
296 printf(
"# test_register_socket %s\n", inout ?
"(INOUT)" :
"");
418 is(
expired, 1,
"drain_timer_events() reports expiration");
487main(
int argc,
char *argv[])
522 printf(
"1..0 # skip: cassert is not enabled\n");
#define Assert(condition)
int PQsocketPoll(int sock, int forRead, int forWrite, pg_usec_time_t end_time)
pg_usec_time_t PQgetCurrentTimeUSec(void)
static bool drain_timer_events(struct async_ctx *actx, bool *was_expired)
static bool setup_multiplexer(struct async_ctx *actx)
static int register_socket(CURL *curl, curl_socket_t socket, int what, void *ctx, void *socketp)
static bool set_timer(struct async_ctx *actx, long timeout)
static int timer_expired(struct async_ctx *actx)
static bool comb_multiplexer(struct async_ctx *actx)
static PgChecksumMode mode
void initPQExpBuffer(PQExpBuffer str)
void termPQExpBuffer(PQExpBuffer str)
static int fd(const char *x, int i)