[3/5] widl: Add tests for encapsulated unions

Dan Hipschman dsh at linux.ucla.edu
Thu Jun 14 20:28:41 CDT 2007


This adds a test for encapsulated unions, but it crashes wine.  The exact
error message is:

fixme:ole:NdrEncapsulatedUnionBufferSize stub
fixme:ole:NdrEncapsulatedUnionMarshall stub
fixme:ole:NdrEncapsulatedUnionUnmarshall stub
err:rpc:I_RpcReceive we got fault packet with status 0x6be
wine: Unhandled exception 0x000006be at address 0x7b83fac0 (thread 000c), starting debugger...

So it seems that some necessary routines just aren't implemented yet.
The test passes on XP, so it conditionally runs on windows.  This at
least still tests the compilation of encapsulated unions with widl.

Also, note that none of the following patches in this series depend on
this one, so if this doesn't get accepted, all the others still can be.

---
 dlls/rpcrt4/tests/server.c         |   24 ++++++++++++++++++++++++
 dlls/rpcrt4/tests/server.idl       |    8 ++++++++
 dlls/rpcrt4/tests/server_defines.h |    5 +++++
 3 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c
index aa5f3fc..0a3eb9f 100644
--- a/dlls/rpcrt4/tests/server.c
+++ b/dlls/rpcrt4/tests/server.c
@@ -245,6 +245,18 @@ s_square_test_us(test_us_t *tus)
   return n * n;
 }
 
+double
+s_square_encu(encu_t *eu)
+{
+  switch (eu->t)
+  {
+  case ENCU_I: return eu->tagged_union.i * eu->tagged_union.i;
+  case ENCU_F: return eu->tagged_union.f * eu->tagged_union.f;
+  default:
+    return 0.0;
+  }
+}
+
 void
 s_stop(void)
 {
@@ -363,6 +375,7 @@ basic_tests(void)
 static void
 union_tests(void)
 {
+  encu_t eu;
   sun_t su;
   int i;
 
@@ -382,6 +395,17 @@ union_tests(void)
   su.u.pi = &i;
   i = 11;
   ok(square_sun(&su) == 121.0, "RPC square_sun\n");
+
+  if (strcmp(winetest_platform, "wine") != 0)	/* crashes wine */
+  {
+    eu.t = ENCU_I;
+    eu.tagged_union.i = 7;
+    ok(square_encu(&eu) == 49.0, "RPC square_encu\n");
+
+    eu.t = ENCU_F;
+    eu.tagged_union.f = 3.0;
+    ok(square_encu(&eu) == 9.0, "RPC square_encu\n");
+  }
 }
 
 static test_list_t *
diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl
index e3c3877..e7873f5 100644
--- a/dlls/rpcrt4/tests/server.idl
+++ b/dlls/rpcrt4/tests/server.idl
@@ -150,5 +150,13 @@ interface IServer
   } test_us_t;
 
   int square_test_us(test_us_t *tus);
+
+  typedef union encu switch (int t)
+  {
+  case ENCU_I: int i;
+  case ENCU_F: float f;
+  } encu_t;
+
+  double square_encu(encu_t *eu);
   void stop(void);
 }
diff --git a/dlls/rpcrt4/tests/server_defines.h b/dlls/rpcrt4/tests/server_defines.h
index 5794af2..5106e10 100644
--- a/dlls/rpcrt4/tests/server_defines.h
+++ b/dlls/rpcrt4/tests/server_defines.h
@@ -27,3 +27,8 @@
 /* test_list_t case values */
 #define TL_NULL 0
 #define TL_LIST 1
+
+/* encu_t case values */
+#define ENCU_I 27
+#define ENCU_F 0
+



More information about the wine-patches mailing list