]> granicus.if.org Git - libevent/commitdiff
Make unit tests for epoll-with-changelist pass
authorNick Mathewson <nickm@torproject.org>
Mon, 22 Nov 2010 19:10:01 +0000 (14:10 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 22 Nov 2010 20:51:45 +0000 (15:51 -0500)
The only changes needed were to handle the fact that the methodname
"epoll (with changelist)" matches the environment variable
EVENT_NOEPOLL rather than the imaginary "EVENT_EPOLL (WITH CHANGELIST)".

test/regress.c
test/regress_et.c
test/test.sh

index 01adaa337ccd0b44c918df63ca109f5998506fc5..698cb506c4278c5a5e7d1c3820c034cff8459d86 100644 (file)
@@ -1900,9 +1900,9 @@ test_base_environ(void *arg)
 
 #if defined(SETENV_OK) && defined(UNSETENV_OK)
        const char **basenames;
-       char varbuf[128];
        int i, n_methods=0;
-       const char *defaultname;
+       char varbuf[128];
+       const char *defaultname, *ignoreenvname;
 
        /* See if unsetenv works before we rely on it. */
        setenv("EVENT_NOWAFFLES", "1", 1);
@@ -1932,8 +1932,14 @@ test_base_environ(void *arg)
        base = NULL;
 
        /* Can we disable the method with EVENT_NOfoo ? */
-       methodname_to_envvar(defaultname, varbuf, sizeof(varbuf));
-       setenv(varbuf, "1", 1);
+       if (!strcmp(defaultname, "epoll (with changelist)")) {
+               setenv("EVENT_NOEPOLL", "1", 1);
+               ignoreenvname = "epoll";
+       } else {
+               methodname_to_envvar(defaultname, varbuf, sizeof(varbuf));
+               setenv(varbuf, "1", 1);
+               ignoreenvname = defaultname;
+       }
 
        /* Use an empty cfg rather than NULL so a failure doesn't exit() */
        cfg = event_config_new();
@@ -1954,7 +1960,7 @@ test_base_environ(void *arg)
        event_config_set_flag(cfg, EVENT_BASE_FLAG_IGNORE_ENV);
        base = event_base_new_with_config(cfg);
        tt_assert(base);
-       tt_str_op(defaultname, ==, event_base_get_method(base));
+       tt_str_op(ignoreenvname, ==, event_base_get_method(base));
 #else
        tt_skip();
 #endif
index 1ab92313d0f9a0875c4b17d3fe7ff1f8110c93d8..736446c1df516febdfe052862bbd2e4a972b091c 100644 (file)
@@ -104,7 +104,8 @@ test_edgetriggered(void *et)
        base = event_base_new();
 
        if (!strcmp(event_base_get_method(base), "epoll") ||
-               !strcmp(event_base_get_method(base), "kqueue"))
+           !strcmp(event_base_get_method(base), "epoll (with changelist)") ||
+           !strcmp(event_base_get_method(base), "kqueue"))
                supports_et = 1;
        else
                supports_et = 0;
index d0c594bbc4c1adb8e5a476c1eb3c3dabc14a3cfe..b45908c03fdc6ea2836011c41d6b2e0c9d349e27 100755 (executable)
@@ -34,18 +34,19 @@ setup () {
        EVENT_NOPOLL=yes; export EVENT_NOPOLL
        EVENT_NOSELECT=yes; export EVENT_NOSELECT
        EVENT_NOEPOLL=yes; export EVENT_NOEPOLL
+       unset EVENT_EPOLL_USE_CHANGELIST
        EVENT_NOEVPORT=yes; export EVENT_NOEVPORT
        EVENT_NOWIN32=yes; export EVENT_NOWIN32
 }
 
 announce () {
-       echo $@
-       echo $@ >>"$TEST_OUTPUT_FILE"
+       echo "$@"
+       echo "$@" >>"$TEST_OUTPUT_FILE"
 }
 
 announce_n () {
-       $ECHO -n $@
-       echo $@ >>"$TEST_OUTPUT_FILE"
+       $ECHO -n "$@"
+       echo "$@" >>"$TEST_OUTPUT_FILE"
 }
 
 
@@ -134,6 +135,12 @@ unset EVENT_NOEPOLL
 announce "EPOLL"
 run_tests
 
+setup
+unset EVENT_NOEPOLL
+EVENT_EPOLL_USE_CHANGELIST=yes; export EVENT_EPOLL_USE_CHANGELIST
+announce "EPOLL (changelist)"
+run_tests
+
 setup
 unset EVENT_NOEVPORT
 announce "EVPORT"