testprogs/midltests: add some example IDL files and there midltests.exe output
authorStefan Metzmacher <metze@samba.org>
Thu, 12 Aug 2010 07:31:38 +0000 (09:31 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 12 Aug 2010 12:31:15 +0000 (14:31 +0200)
metze

testprogs/win32/midltests/invalid/README.txt [new file with mode: 0644]
testprogs/win32/midltests/midltests.idl
testprogs/win32/midltests/valid/README.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_strings_array_01.err.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_strings_array_01.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_strings_array_02.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_strings_array_02.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_01.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_01.txt [new file with mode: 0644]

diff --git a/testprogs/win32/midltests/invalid/README.txt b/testprogs/win32/midltests/invalid/README.txt
new file mode 100644 (file)
index 0000000..f10cc15
--- /dev/null
@@ -0,0 +1,3 @@
+This directory contains IDL files which give errors,
+when they're compiled as midltests.idl.
+
index 1932549c565cd39625e15ac052a10323d9da6be5..b3276574969eb645fe2b674471320d64fccc2ff0 100644 (file)
@@ -24,4 +24,4 @@ long srv_midltests_fn(void)
        return 0x65757254;
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/testprogs/win32/midltests/valid/README.txt b/testprogs/win32/midltests/valid/README.txt
new file mode 100644 (file)
index 0000000..9208fae
--- /dev/null
@@ -0,0 +1,6 @@
+This directory contains IDL files which demonstrate
+the relationship between IDL definitions and NDR representation.
+
+In order to test them, you can compile them as midltests.idl.
+
+Note: some examples trigger runtime errors.
diff --git a/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.idl b/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.idl
new file mode 100644 (file)
index 0000000..170b147
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef MIDLTESTS_C_CODE
+
+[
+  uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+  pointer_default(unique)
+]
+interface midltests
+{
+       long midltests_fn(
+               [in] long a[2]
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       long a[2] = { 1, 2 };
+       cli_midltests_fn(a);
+}
+
+long srv_midltests_fn(long a[2])
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.txt b/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.txt
new file mode 100644 (file)
index 0000000..8903c4c
--- /dev/null
@@ -0,0 +1,6 @@
+[in] Buffer[8/24]\r
+[000] 01 00 00 00 02 00 00 00                           ........ \r
+srv_midltests_fn: Start\r
+srv_midltests_fn: End\r
+[out] Buffer[4]\r
+[000] 54 72 75 65                                       True \r
diff --git a/testprogs/win32/midltests/valid/midltests_strings_array_01.err.txt b/testprogs/win32/midltests/valid/midltests_strings_array_01.err.txt
new file mode 100644 (file)
index 0000000..dbbc89a
--- /dev/null
@@ -0,0 +1,13 @@
+[in] Buffer[53/53]\r
+[000] 03 00 00 00 03 00 00 00  00 00 02 00 04 00 02 00  ........ ........\r
+[010] 00 00 00 00 04 00 00 00  00 00 00 00 04 00 00 00  ........ ........\r
+[020] 66 6F 6F 00 05 00 00 00  00 00 00 00 05 00 00 00  foo..... ........\r
+[030] 62 61 72 32 00                                    bar2. \r
+srv_midltests_fn: Start\r
+srv_midltests_fn: End\r
+[out] Buffer[60]\r
+[000] 03 00 00 00 03 00 00 00  00 00 02 00 04 00 02 00  ........ ........\r
+[010] 00 00 00 00 04 00 00 00  00 00 00 00 04 00 00 00  ........ ........\r
+[020] 66 6F 6F 00 05 00 00 00  00 00 00 00 05 00 00 00  foo..... ........\r
+[030] 62 61 72 32 00 00 00 00  54 72 75 65              bar2.... True\r
+Runtime error 0x6f7\r
diff --git a/testprogs/win32/midltests/valid/midltests_strings_array_01.idl b/testprogs/win32/midltests/valid/midltests_strings_array_01.idl
new file mode 100644 (file)
index 0000000..db05bb2
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef MIDLTESTS_C_CODE
+
+[
+  uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+  pointer_default(unique)
+]
+interface midltests
+{
+       struct strings {
+               long count;
+               [size_is(count),string] char *val[];
+       };
+
+       long midltests_fn(
+               [in,out,ref] struct strings *s
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       const char *s1 = "foo";
+       const char *s2 = "bar";
+       char *a[] = { "foo", "bar2", NULL };
+       char buffer[1024];
+       struct strings *s = buffer;
+
+       s->count = 3;
+       s->val[0] = "foo";
+       s->val[1] = "bar2";
+       s->val[2] = NULL;
+
+       cli_midltests_fn(s);
+}
+
+long srv_midltests_fn(struct strings *a)
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_strings_array_02.idl b/testprogs/win32/midltests/valid/midltests_strings_array_02.idl
new file mode 100644 (file)
index 0000000..46154c9
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef MIDLTESTS_C_CODE
+
+[
+  uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+  pointer_default(unique)
+]
+interface midltests
+{
+       struct strings {
+               long count;
+               [size_is(count),string] char *val[];
+       };
+
+       long midltests_fn(
+               [in,ref] struct strings *s
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       const char *s1 = "foo";
+       const char *s2 = "bar";
+       char *a[] = { "foo", "bar2", NULL };
+       char buffer[1024];
+       struct strings *s = buffer;
+
+       s->count = 3;
+       s->val[0] = "foo";
+       s->val[1] = "bar2";
+       s->val[2] = NULL;
+
+       cli_midltests_fn(s);
+}
+
+long srv_midltests_fn(struct strings *a)
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_strings_array_02.txt b/testprogs/win32/midltests/valid/midltests_strings_array_02.txt
new file mode 100644 (file)
index 0000000..2bec6a0
--- /dev/null
@@ -0,0 +1,9 @@
+[in] Buffer[53/53]\r
+[000] 03 00 00 00 03 00 00 00  00 00 02 00 04 00 02 00  ........ ........\r
+[010] 00 00 00 00 04 00 00 00  00 00 00 00 04 00 00 00  ........ ........\r
+[020] 66 6F 6F 00 05 00 00 00  00 00 00 00 05 00 00 00  foo..... ........\r
+[030] 62 61 72 32 00                                    bar2. \r
+srv_midltests_fn: Start\r
+srv_midltests_fn: End\r
+[out] Buffer[4]\r
+[000] 54 72 75 65                                       True \r
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_01.idl b/testprogs/win32/midltests/valid/midltests_union_align_01.idl
new file mode 100644 (file)
index 0000000..fcea072
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef MIDLTESTS_C_CODE
+
+[
+  uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+  pointer_default(unique)
+]
+interface midltests
+{
+       [switch_type(short)] union u {
+               [case(0)];
+               [case(2)] short s;
+               [case(4)] long l;
+               [case(8)] hyper h;
+       };
+
+       long midltests_fn(
+               [in] short level,
+               [in,switch_is(level)] union u u
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       union u u;
+       u.h = 0xFFFFFFFFFFFFFFFFLL;
+
+       cli_midltests_fn(0, u);
+       cli_midltests_fn(2, u);
+       cli_midltests_fn(4, u);
+       cli_midltests_fn(8, u);
+}
+
+long srv_midltests_fn(short level, union u u)
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_01.txt b/testprogs/win32/midltests/valid/midltests_union_align_01.txt
new file mode 100644 (file)
index 0000000..a7f737c
--- /dev/null
@@ -0,0 +1,24 @@
+[in] Buffer[4/8]\r
+[000] 00 00 00 00                                       .... \r
+srv_midltests_fn: Start\r
+srv_midltests_fn: End\r
+[out] Buffer[4]\r
+[000] 54 72 75 65                                       True \r
+[in] Buffer[6/10]\r
+[000] 02 00 02 00 FF FF                                 ...... \r
+srv_midltests_fn: Start\r
+srv_midltests_fn: End\r
+[out] Buffer[4]\r
+[000] 54 72 75 65                                       True \r
+[in] Buffer[8/12]\r
+[000] 04 00 04 00 FF FF FF FF                           ........ \r
+srv_midltests_fn: Start\r
+srv_midltests_fn: End\r
+[out] Buffer[4]\r
+[000] 54 72 75 65                                       True \r
+[in] Buffer[16/16]\r
+[000] 08 00 08 00 00 00 00 00  FF FF FF FF FF FF FF FF  ........ ........\r
+srv_midltests_fn: Start\r
+srv_midltests_fn: End\r
+[out] Buffer[4]\r
+[000] 54 72 75 65                                       True \r