Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
7ad38dc4
Commit
7ad38dc4
authored
Nov 17, 2021
by
michael-grunder
Browse files
Small tweaks of the async tests
parent
4021726a
Changes
1
Show whitespace changes
Inline
Side-by-side
test.c
View file @
7ad38dc4
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#endif
#endif
#ifdef HIREDIS_TEST_ASYNC
#ifdef HIREDIS_TEST_ASYNC
#include "adapters/libevent.h"
#include "adapters/libevent.h"
#include <event.h>
#include <
event2/
event.h>
#endif
#endif
#include "net.h"
#include "net.h"
#include "win32.h"
#include "win32.h"
...
@@ -1521,10 +1521,12 @@ static void test_pubsub_handling(struct config config) {
...
@@ -1521,10 +1521,12 @@ static void test_pubsub_handling(struct config config) {
test
(
"Subscribe, handle published message and unsubscribe: "
);
test
(
"Subscribe, handle published message and unsubscribe: "
);
/* Setup event dispatcher with a testcase timeout */
/* Setup event dispatcher with a testcase timeout */
base
=
event_base_new
();
base
=
event_base_new
();
struct
event
timeout
;
struct
event
*
timeout
=
evtimer_new
(
base
,
timeout_cb
,
NULL
);
evtimer_assign
(
&
timeout
,
base
,
timeout_cb
,
NULL
);
assert
(
timeout
!=
NULL
);
evtimer_assign
(
timeout
,
base
,
timeout_cb
,
NULL
);
struct
timeval
timeout_tv
=
{.
tv_sec
=
10
};
struct
timeval
timeout_tv
=
{.
tv_sec
=
10
};
evtimer_add
(
&
timeout
,
&
timeout_tv
);
evtimer_add
(
timeout
,
&
timeout_tv
);
/* Connect */
/* Connect */
redisOptions
options
=
get_redis_tcp_options
(
config
);
redisOptions
options
=
get_redis_tcp_options
(
config
);
...
@@ -1538,6 +1540,7 @@ static void test_pubsub_handling(struct config config) {
...
@@ -1538,6 +1540,7 @@ static void test_pubsub_handling(struct config config) {
/* Start event dispatching loop */
/* Start event dispatching loop */
test_cond
(
event_base_dispatch
(
base
)
==
0
);
test_cond
(
event_base_dispatch
(
base
)
==
0
);
event_free
(
timeout
);
event_base_free
(
base
);
event_base_free
(
base
);
/* Verify test checkpoints */
/* Verify test checkpoints */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment