r25554: Convert last instances of BOOL, True and False to the standard types.
[jra/samba/.git] / source4 / torture / rpc / echo.c
index 3608f82686c98b2c10549b14a5fec6d240428930..5c027d32990debd5cb5ba0b817973fd2ee091536 100644 (file)
@@ -78,8 +78,8 @@ static bool test_echodata(struct torture_context *tctx,
                len = 1 + (random() % 5000);
        }
 
-       data_in = talloc_size(tctx, len);
-       data_out = talloc_size(tctx, len);
+       data_in = talloc_array(tctx, uint8_t, len);
+       data_out = talloc_array(tctx, uint8_t, len);
        for (i=0;i<len;i++) {
                data_in[i] = i;
        }
@@ -159,7 +159,7 @@ static bool test_sinkdata(struct torture_context *tctx,
                len = 200000 + (random() % 5000);
        }
 
-       data_in = talloc_size(tctx, len);
+       data_in = talloc_array(tctx, uint8_t, len);
        for (i=0;i<len;i++) {
                data_in[i] = i+1;
        }
@@ -230,7 +230,7 @@ static bool test_sleep(struct torture_context *tctx,
 #define ASYNC_COUNT 3
        struct rpc_request *req[ASYNC_COUNT];
        struct echo_TestSleep r[ASYNC_COUNT];
-       BOOL done[ASYNC_COUNT];
+       bool done[ASYNC_COUNT];
        struct timeval snd[ASYNC_COUNT];
        struct timeval rcv[ASYNC_COUNT];
        struct timeval diff[ASYNC_COUNT];
@@ -240,10 +240,10 @@ static bool test_sleep(struct torture_context *tctx,
        if (torture_setting_bool(tctx, "quick", false)) {
                torture_skip(tctx, "TestSleep disabled - use \"torture:quick=no\" to enable\n");
        }
-       torture_comment(tctx, "Testing TestSleep - use \"torture:quick=no\" to disable\n");
+       torture_comment(tctx, "Testing TestSleep - use \"torture:quick=yes\" to disable\n");
 
        for (i=0;i<ASYNC_COUNT;i++) {
-               done[i]         = False;
+               done[i]         = false;
                snd[i]          = timeval_current();
                rcv[i]          = timeval_zero();
                r[i].in.seconds = ASYNC_COUNT-i;
@@ -256,15 +256,15 @@ static bool test_sleep(struct torture_context *tctx,
                torture_assert(tctx, event_loop_once(ctx) == 0, 
                                           "Event context loop failed");
                for (i=0;i<ASYNC_COUNT;i++) {
-                       if (done[i] == False && req[i]->state == RPC_REQUEST_DONE) {
+                       if (done[i] == false && req[i]->state == RPC_REQUEST_DONE) {
                                int rounded_tdiff;
                                total_done++;
-                               done[i] = True;
+                               done[i] = true;
                                rcv[i]  = timeval_current();
                                diff[i] = timeval_until(&snd[i], &rcv[i]);
                                rounded_tdiff = (int)(0.5 + diff[i].tv_sec + (1.0e-6*diff[i].tv_usec));
                                status  = dcerpc_ndr_request_recv(req[i]);
-                               printf("rounded_tdiff=%d\n", rounded_tdiff);
+                               torture_comment(tctx, "rounded_tdiff=%d\n", rounded_tdiff);
                                torture_assert_ntstatus_ok(tctx, status, 
                                                        talloc_asprintf(tctx, "TestSleep(%d) failed", i));
                                torture_assert(tctx, r[i].out.result == r[i].in.seconds,
@@ -287,6 +287,7 @@ static bool test_sleep(struct torture_context *tctx,
                        }
                }
        }
+       torture_comment(tctx, "\n");
        return true;
 }
 
@@ -392,7 +393,7 @@ static bool test_timeout(struct torture_context *tctx,
                torture_comment(tctx, "Failed to send async sleep request\n");
                goto failed;
        }
-       req->ignore_timeout = True;
+       req->ignore_timeout = true;
 
        status  = dcerpc_ndr_request_recv(req);
        torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT, 
@@ -411,7 +412,7 @@ static bool test_timeout(struct torture_context *tctx,
                torture_comment(tctx, "Failed to send async sleep request\n");
                goto failed;
        }
-       req->ignore_timeout = True;
+       req->ignore_timeout = true;
        status  = dcerpc_ndr_request_recv(req);
        torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT, 
                "request should have timed out");
@@ -426,11 +427,11 @@ failed:
 }
 
 
-struct torture_suite *torture_rpc_echo(void)
+struct torture_suite *torture_rpc_echo(TALLOC_CTX *mem_ctx)
 {
        struct torture_suite *suite = torture_suite_create(
-               talloc_autofree_context(), "ECHO");
-       struct torture_tcase *tcase;
+               mem_ctx, "ECHO");
+       struct torture_rpc_tcase *tcase;
 
        tcase = torture_suite_add_rpc_iface_tcase(suite, "echo", 
                                                  &ndr_table_rpcecho);