s3: Add a dummy test to prove the maxfd calculation
authorVolker Lendecke <vl@samba.org>
Thu, 10 Jun 2010 07:50:32 +0000 (09:50 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 10 Jun 2010 09:24:00 +0000 (11:24 +0200)
To be run in a debugger, there's no way to inspect the internal tevent_select.c
maxfd calculation

source3/torture/torture.c

index 72b22969b8da09eb14d814ebe91a1350c2f83e01..696aaa3769e0af578037927da6e2ad7f2b0ec22d 100644 (file)
@@ -7335,6 +7335,48 @@ static bool run_local_dbtrans(int dummy)
        return true;
 }
 
        return true;
 }
 
+/*
+ * Just a dummy test to be run under a debugger. There's no real way
+ * to inspect the tevent_select specific function from outside of
+ * tevent_select.c.
+ */
+
+static bool run_local_tevent_select(int dummy)
+{
+       struct tevent_context *ev;
+       struct tevent_fd *fd1, *fd2;
+       bool result = false;
+
+       ev = tevent_context_init_byname(NULL, "select");
+       if (ev == NULL) {
+               d_fprintf(stderr, "tevent_context_init_byname failed\n");
+               goto fail;
+       }
+
+       fd1 = tevent_add_fd(ev, ev, 2, 0, NULL, NULL);
+       if (fd1 == NULL) {
+               d_fprintf(stderr, "tevent_add_fd failed\n");
+               goto fail;
+       }
+       fd2 = tevent_add_fd(ev, ev, 3, 0, NULL, NULL);
+       if (fd2 == NULL) {
+               d_fprintf(stderr, "tevent_add_fd failed\n");
+               goto fail;
+       }
+       TALLOC_FREE(fd2);
+
+       fd2 = tevent_add_fd(ev, ev, 1, 0, NULL, NULL);
+       if (fd2 == NULL) {
+               d_fprintf(stderr, "tevent_add_fd failed\n");
+               goto fail;
+       }
+
+       result = true;
+fail:
+       TALLOC_FREE(ev);
+       return result;
+}
+
 static double create_procs(bool (*fn)(int), bool *result)
 {
        int i, status;
 static double create_procs(bool (*fn)(int), bool *result)
 {
        int i, status;
@@ -7513,6 +7555,7 @@ static struct {
        { "LOCAL-WBCLIENT", run_local_wbclient, 0},
        { "LOCAL-string_to_sid", run_local_string_to_sid, 0},
        { "LOCAL-DBTRANS", run_local_dbtrans, 0},
        { "LOCAL-WBCLIENT", run_local_wbclient, 0},
        { "LOCAL-string_to_sid", run_local_string_to_sid, 0},
        { "LOCAL-DBTRANS", run_local_dbtrans, 0},
+       { "LOCAL-TEVENT-SELECT", run_local_tevent_select, 0},
        {NULL, NULL, 0}};
 
 
        {NULL, NULL, 0}};