*/
#include "includes.h"
+#include "librpc/gen_ndr/ndr_echo.h"
/*
printf("\nTesting AddOne\n");
for (i=0;i<10;i++) {
- uint32 n = i;
+ uint32_t n = i;
struct echo_AddOne r;
r.in.v = &n;
r.out.v = &n;
{
int i;
NTSTATUS status;
- char *data_in, *data_out;
+ uint8_t *data_in, *data_out;
int len = 1 + (random() % 5000);
struct echo_EchoData r;
int i;
NTSTATUS status;
int len = 200000 + (random() % 5000);
- char *data_out;
+ uint8_t *data_out;
struct echo_SourceData r;
printf("\nTesting SourceData\n");
}
for (i=0;i<len;i++) {
- unsigned char *v = (unsigned char *)data_out;
+ uint8_t *v = (uint8_t *)data_out;
if (v[i] != (i & 0xFF)) {
- printf("bad data 0x%x at %d\n", (unsigned char)data_out[i], i);
+ printf("bad data 0x%x at %d\n", (uint8_t)data_out[i], i);
return False;
}
}
{
int i;
NTSTATUS status;
- char *data_in;
+ uint8_t *data_in;
int len = 200000 + (random() % 5000);
struct echo_SinkData r;
return ret;
}
-BOOL torture_rpc_echo(int dummy)
+#if 0
+/*
+ test the TestSleep interface
+*/
+static BOOL test_sleep(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ int i;
+ NTSTATUS status;
+#define ASYNC_COUNT 5
+ struct rpc_request *req[ASYNC_COUNT];
+ struct echo_TestSleep r[ASYNC_COUNT];
+ int done[ASYNC_COUNT];
+ struct event_context *ctx;
+ int total_done = 0;
+ BOOL ret = True;
+
+ printf("\nTesting TestSleep\n");
+
+ for (i=0;i<ASYNC_COUNT;i++) {
+ done[i] = 0;
+ r[i].in.seconds = ASYNC_COUNT-i;
+ req[i] = dcerpc_echo_TestSleep_send(p, mem_ctx, &r[i]);
+ if (!req[i]) {
+ printf("Failed to send async sleep request\n");
+ return False;
+ }
+ }
+
+ ctx = dcerpc_event_context(p);
+ while (total_done < ASYNC_COUNT) {
+ if (event_loop_once(ctx) != 0) {
+ return False;
+ }
+ for (i=0;i<ASYNC_COUNT;i++) {
+ if (done[i] == 0 && req[i]->state == RPC_REQUEST_DONE) {
+ total_done++;
+ done[i] = 1;
+ status = dcerpc_ndr_request_recv(req[i]);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TestSleep(%d) failed - %s\n",
+ i, nt_errstr(status));
+ ret = False;
+ } else {
+ printf("Sleep for %d seconds\n",
+ r[i].out.result);
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+#endif
+
+BOOL torture_rpc_echo(void)
{
NTSTATUS status;
struct dcerpc_pipe *p;
return False;
}
-#if 1
if (!test_addone(p, mem_ctx)) {
ret = False;
}
- if (!test_echodata(p, mem_ctx)) {
+ if (!test_sinkdata(p, mem_ctx)) {
ret = False;
}
- if (!test_sourcedata(p, mem_ctx)) {
+ if (!test_echodata(p, mem_ctx)) {
ret = False;
}
- if (!test_sinkdata(p, mem_ctx)) {
+ if (!test_sourcedata(p, mem_ctx)) {
ret = False;
}
-#endif
-
- p->flags |= DCERPC_DEBUG_PRINT_BOTH;
if (!test_testcall(p, mem_ctx)) {
ret = False;
ret = False;
}
+/*
+ if (!test_sleep(p, mem_ctx)) {
+ ret = False;
+ }
+*/
printf("\n");
- talloc_destroy(mem_ctx);
+ talloc_free(mem_ctx);
torture_rpc_close(p);
return ret;