From: Thomas Faber Date: Wed, 12 Oct 2011 11:02:41 +0000 (+0000) Subject: [RPCRT4_WINETEST] X-Git-Tag: backups/iut-netsh@54410~298 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=bab9f940a114c975ff0ef8fe6567097f267524ee [RPCRT4_WINETEST] - Sync to Wine 1.3.30. Fixes crash in rpcrt4:rpc test See issue #5778 for more details. svn path=/trunk/; revision=54089 --- diff --git a/rostests/winetests/rpcrt4/rpc.c b/rostests/winetests/rpcrt4/rpc.c index fdf91d18c8b..8e965e594ca 100644 --- a/rostests/winetests/rpcrt4/rpc.c +++ b/rostests/winetests/rpcrt4/rpc.c @@ -284,8 +284,7 @@ todo_wine { ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "expected RPC_C_AUTHN_LEVEL_PKT_PRIVACY, got %d\n", level); ok(authnsvc == RPC_C_AUTHN_WINNT, "expected RPC_C_AUTHN_WINNT, got %d\n", authnsvc); todo_wine ok(authzsvc == RPC_C_AUTHZ_NAME, "expected RPC_C_AUTHZ_NAME, got %d\n", authzsvc); - - RpcStringFree(&principal); + if (status == RPC_S_OK) RpcStringFree(&principal); status = RpcMgmtStopServerListening(NULL); ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%u)\n", @@ -596,8 +595,10 @@ static void test_RpcStringBindingParseA(void) ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq); ok(!strcmp((char *)network_addr, "."), "network_addr should have been . instead of %s\n", network_addr); ok(!strcmp((char *)endpoint, "pipetest"), "endpoint should have been pipetest instead of %s\n", endpoint); - todo_wine - ok(options && !strcmp((char *)options, ""), "options should have been \"\" of \"%s\"\n", options); + if (options) + ok(!strcmp((char *)options, ""), "options should have been \"\" of \"%s\"\n", options); + else + todo_wine ok(FALSE, "options is NULL\n"); RpcStringFreeA(&uuid); RpcStringFreeA(&protseq); RpcStringFreeA(&network_addr); @@ -611,8 +612,10 @@ static void test_RpcStringBindingParseA(void) ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq); ok(!strcmp((char *)network_addr, "."), "network_addr should have been . instead of %s\n", network_addr); ok(!strcmp((char *)endpoint, "pipetest"), "endpoint should have been pipetest instead of %s\n", endpoint); - todo_wine - ok(options && !strcmp((char *)options, ""), "options should have been \"\" of \"%s\"\n", options); + if (options) + ok(!strcmp((char *)options, ""), "options should have been \"\" of \"%s\"\n", options); + else + todo_wine ok(FALSE, "options is NULL\n"); RpcStringFreeA(&uuid); RpcStringFreeA(&protseq); RpcStringFreeA(&network_addr); @@ -848,7 +851,7 @@ static void test_RpcBindingFree(void) status = RpcBindingFree(&binding); ok(status == RPC_S_INVALID_BINDING, - "RpcBindingFree should have retured RPC_S_INVALID_BINDING instead of %d\n", + "RpcBindingFree should have returned RPC_S_INVALID_BINDING instead of %d\n", status); } diff --git a/rostests/winetests/rpcrt4/server.c b/rostests/winetests/rpcrt4/server.c index ccf995623ba..a822b317cc3 100644 --- a/rostests/winetests/rpcrt4/server.c +++ b/rostests/winetests/rpcrt4/server.c @@ -340,6 +340,19 @@ int __cdecl s_sum_cpsc(cpsc_t *cpsc) return sum; } +int __cdecl s_get_cpsc(int n, cpsc_t *cpsc) +{ + int i, ret; + + cpsc->a = 2 * n; + cpsc->b = 2; + cpsc->c = 1; + cpsc->ca = MIDL_user_allocate( cpsc->a * sizeof(int) ); + for (i = ret = 0; i < cpsc->a; i++) cpsc->ca[i] = i; + for (i = ret = 0; i < cpsc->a; i++) ret += cpsc->ca[i]; + return ret; +} + int __cdecl s_square_puint(puint_t p) { int n = atoi(p); @@ -586,9 +599,14 @@ str_t __cdecl s_get_filename(void) return (char *)__FILE__; } -int __cdecl s_echo_ranged_int(int n) +int __cdecl s_echo_ranged_int(int i, int j, int k) { - return n; + return min( 100, i + j + k ); +} + +int __cdecl s_echo_ranged_int2(int i) +{ + return i; } void __cdecl s_get_ranged_enum(renum_t *re) @@ -921,10 +939,12 @@ basic_tests(void) ok(!strcmp(str, __FILE__), "get_filename() returned %s instead of %s\n", str, __FILE__); midl_user_free(str); - x = echo_ranged_int(0); + x = echo_ranged_int(0,0,0); ok(x == 0, "echo_ranged_int() returned %d instead of 0\n", x); - x = echo_ranged_int(100); + x = echo_ranged_int(10,20,100); ok(x == 100, "echo_ranged_int() returned %d instead of 100\n", x); + x = echo_ranged_int2(40); + ok(x == 40, "echo_ranged_int() returned %d instead of 40\n", x); if (!old_windows_version) { @@ -1226,6 +1246,7 @@ array_tests(void) cs_t *cs; int n; int ca[5] = {1, -2, 3, -4, 5}; + int tmp[10]; doub_carr_t *dc; int *pi; pints_t api[5]; @@ -1293,6 +1314,18 @@ array_tests(void) cpsc.ca = c; ok(sum_cpsc(&cpsc) == 10, "RPC sum_cpsc\n"); + cpsc.ca = NULL; + ok(get_cpsc(5, &cpsc) == 45, "RPC sum_cpsc\n"); + ok( cpsc.a == 10, "RPC get_cpsc %u\n", cpsc.a ); + for (n = 0; n < 10; n++) ok( cpsc.ca[n] == n, "RPC get_cpsc[%d] = %d\n", n, cpsc.ca[n] ); + + memset( tmp, 0x33, sizeof(tmp) ); + cpsc.ca = tmp; + ok(get_cpsc(4, &cpsc) == 28, "RPC sum_cpsc\n"); + ok( cpsc.a == 8, "RPC get_cpsc %u\n", cpsc.a ); + ok( cpsc.ca == tmp, "RPC get_cpsc %p/%p\n", cpsc.ca, tmp ); + for (n = 0; n < 8; n++) ok( cpsc.ca[n] == n, "RPC get_cpsc[%d] = %d\n", n, cpsc.ca[n] ); + ok(sum_toplev_conf_2n(c, 3) == 15, "RPC sum_toplev_conf_2n\n"); ok(sum_toplev_conf_cond(c, 5, 6, 1) == 10, "RPC sum_toplev_conf_cond\n"); ok(sum_toplev_conf_cond(c, 5, 6, 0) == 15, "RPC sum_toplev_conf_cond\n"); diff --git a/rostests/winetests/rpcrt4/server.idl b/rostests/winetests/rpcrt4/server.idl index 3be3f33e4d4..2e305c16232 100644 --- a/rostests/winetests/rpcrt4/server.idl +++ b/rostests/winetests/rpcrt4/server.idl @@ -162,6 +162,7 @@ cpp_quote("#endif") int sum_cs(cs_t *cs); int sum_cps(cps_t *cps); int sum_cpsc(cpsc_t *cpsc); + int get_cpsc(int n, [out] cpsc_t *cpsc ); int sum_complex_array(int n, [size_is(n)] refpint_t pi[]); typedef [wire_marshal(int)] void *puint_t; @@ -362,7 +363,8 @@ cpp_quote("#endif") const int RE_MAX = RE3; typedef [range(RE_MIN, RE_MAX)] enum renum renum_t; typedef [range(0, 100)] int rint_t; - rint_t echo_ranged_int([range(0, 100)] int n); + rint_t echo_ranged_int([range(0, 10)] int i, [range(0, 20)] int j, [range(0, 100)] int k); + rint_t echo_ranged_int2([range(0, 40)] int i); void get_ranged_enum([out] renum_t *re); void context_handle_test(void); diff --git a/rostests/winetests/rpcrt4/testlist.c b/rostests/winetests/rpcrt4/testlist.c index 8983d699dff..71ed0c9e831 100644 --- a/rostests/winetests/rpcrt4/testlist.c +++ b/rostests/winetests/rpcrt4/testlist.c @@ -11,6 +11,7 @@ extern void func_generated(void); extern void func_ndr_marshall(void); extern void func_rpc(void); extern void func_rpc_async(void); +extern void func_rpc_protseq(void); extern void func_server(void); const struct test winetest_testlist[] = @@ -20,6 +21,7 @@ const struct test winetest_testlist[] = { "ndr_marshall", func_ndr_marshall }, { "rpc", func_rpc }, { "rpc_async", func_rpc_async }, + { "rpc_protseq", func_rpc_protseq }, { "server", func_server }, { 0, 0 } };