r24872: Use torture API a bit more
[kai/samba.git] / source4 / torture / rpc / echo.c
index 21f8eed00d0eb37692c3896e31215170f8b691a1..52f6d76d0e6c07d759d89939a4139ac682ab217e 100644 (file)
@@ -8,7 +8,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -17,8 +17,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -241,7 +240,7 @@ 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;
@@ -265,7 +264,7 @@ static bool test_sleep(struct torture_context *tctx,
                                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,
@@ -288,6 +287,7 @@ static bool test_sleep(struct torture_context *tctx,
                        }
                }
        }
+       torture_comment(tctx, "\n");
        return true;
 }
 
@@ -427,14 +427,14 @@ 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", 
-                                                 &dcerpc_table_rpcecho);
+                                                 &ndr_table_rpcecho);
 
        torture_rpc_tcase_add_test(tcase, "addone", test_addone);
        torture_rpc_tcase_add_test(tcase, "sinkdata", test_sinkdata);