Test the serialization done by libtirpc, so that when we later
switch to our own code, we can prove wire compatibility.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
build-aux/syntax-check.mk | 11 +-
scripts/rpcgen/tests/demo.x | 1 -
scripts/rpcgen/tests/meson.build | 15 +
scripts/rpcgen/tests/test_demo.c | 789 ++++++++++++++++++
scripts/rpcgen/tests/test_demo_enum.bin | Bin 0 -> 4 bytes
.../tests/test_demo_enum_fixed_array.bin | Bin 0 -> 52 bytes
.../tests/test_demo_enum_pointer_null.bin | Bin 0 -> 4 bytes
.../tests/test_demo_enum_pointer_set.bin | Bin 0 -> 8 bytes
.../rpcgen/tests/test_demo_enum_scalar.bin | Bin 0 -> 4 bytes
.../test_demo_enum_variable_array_empty.bin | Bin 0 -> 4 bytes
.../test_demo_enum_variable_array_set.bin | Bin 0 -> 16 bytes
.../tests/test_demo_int_fixed_array.bin | Bin 0 -> 12 bytes
.../tests/test_demo_int_pointer_null.bin | Bin 0 -> 4 bytes
.../tests/test_demo_int_pointer_set.bin | Bin 0 -> 8 bytes
scripts/rpcgen/tests/test_demo_int_scalar.bin | Bin 0 -> 4 bytes
.../test_demo_int_variable_array_empty.bin | Bin 0 -> 4 bytes
.../test_demo_int_variable_array_set.bin | Bin 0 -> 16 bytes
.../tests/test_demo_opaque_fixed_array.bin | Bin 0 -> 12 bytes
.../test_demo_opaque_variable_array_empty.bin | Bin 0 -> 4 bytes
.../test_demo_opaque_variable_array_set.bin | Bin 0 -> 8 bytes
.../test_demo_string_variable_array_empty.bin | Bin 0 -> 4 bytes
.../test_demo_string_variable_array_set.bin | Bin 0 -> 12 bytes
scripts/rpcgen/tests/test_demo_struct.bin | Bin 0 -> 8 bytes
.../tests/test_demo_struct_fixed_array.bin | Bin 0 -> 136 bytes
.../tests/test_demo_struct_pointer_null.bin | Bin 0 -> 4 bytes
.../tests/test_demo_struct_pointer_set.bin | Bin 0 -> 12 bytes
.../rpcgen/tests/test_demo_struct_scalar.bin | 1 +
.../test_demo_struct_variable_array_empty.bin | Bin 0 -> 4 bytes
.../test_demo_struct_variable_array_set.bin | Bin 0 -> 28 bytes
.../tests/test_demo_test_struct_all_types.bin | Bin 0 -> 1752 bytes
scripts/rpcgen/tests/test_demo_union_case.bin | Bin 0 -> 8 bytes
.../rpcgen/tests/test_demo_union_default.bin | Bin 0 -> 8 bytes
.../tests/test_demo_union_fixed_array.bin | Bin 0 -> 168 bytes
.../tests/test_demo_union_no_default_case.bin | Bin 0 -> 8 bytes
.../tests/test_demo_union_pointer_null.bin | Bin 0 -> 4 bytes
.../tests/test_demo_union_pointer_set.bin | Bin 0 -> 12 bytes
.../rpcgen/tests/test_demo_union_scalar.bin | Bin 0 -> 8 bytes
.../test_demo_union_variable_array_empty.bin | Bin 0 -> 4 bytes
.../test_demo_union_variable_array_set.bin | Bin 0 -> 28 bytes
.../test_demo_union_void_default_case.bin | Bin 0 -> 8 bytes
.../test_demo_union_void_default_default.bin | 1 +
41 files changed, 813 insertions(+), 5 deletions(-)
create mode 100644 scripts/rpcgen/tests/test_demo.c
create mode 100644 scripts/rpcgen/tests/test_demo_enum.bin
create mode 100644 scripts/rpcgen/tests/test_demo_enum_fixed_array.bin
create mode 100644 scripts/rpcgen/tests/test_demo_enum_pointer_null.bin
create mode 100644 scripts/rpcgen/tests/test_demo_enum_pointer_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_enum_scalar.bin
create mode 100644 scripts/rpcgen/tests/test_demo_enum_variable_array_empty.bin
create mode 100644 scripts/rpcgen/tests/test_demo_enum_variable_array_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_int_fixed_array.bin
create mode 100644 scripts/rpcgen/tests/test_demo_int_pointer_null.bin
create mode 100644 scripts/rpcgen/tests/test_demo_int_pointer_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_int_scalar.bin
create mode 100644 scripts/rpcgen/tests/test_demo_int_variable_array_empty.bin
create mode 100644 scripts/rpcgen/tests/test_demo_int_variable_array_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_opaque_fixed_array.bin
create mode 100644 scripts/rpcgen/tests/test_demo_opaque_variable_array_empty.bin
create mode 100644 scripts/rpcgen/tests/test_demo_opaque_variable_array_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_string_variable_array_empty.bin
create mode 100644 scripts/rpcgen/tests/test_demo_string_variable_array_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_struct.bin
create mode 100644 scripts/rpcgen/tests/test_demo_struct_fixed_array.bin
create mode 100644 scripts/rpcgen/tests/test_demo_struct_pointer_null.bin
create mode 100644 scripts/rpcgen/tests/test_demo_struct_pointer_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_struct_scalar.bin
create mode 100644 scripts/rpcgen/tests/test_demo_struct_variable_array_empty.bin
create mode 100644 scripts/rpcgen/tests/test_demo_struct_variable_array_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_test_struct_all_types.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_case.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_default.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_fixed_array.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_no_default_case.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_pointer_null.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_pointer_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_scalar.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_variable_array_empty.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_variable_array_set.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_void_default_case.bin
create mode 100644 scripts/rpcgen/tests/test_demo_union_void_default_default.bin
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 375fad188b..2599ba688f 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -1358,7 +1358,7 @@ exclude_file_name_regexp--sc_avoid_strcase =
^tools/(vsh\.h|nss/libvirt_nss_(lea
exclude_file_name_regexp--sc_avoid_write = ^src/libvirt-stream\.c$$
exclude_file_name_regexp--sc_gettext_init = \
- ^((tests|examples)/|tools/virt-login-shell.c)
+ ^((tests|examples)/|tools/virt-login-shell\.c$$|scripts/rpcgen/tests/test_demo\.c$$)
exclude_file_name_regexp--sc_copyright_usage = \
^COPYING(|\.LESSER)$$
@@ -1387,7 +1387,7 @@ exclude_file_name_regexp--sc_prohibit_close = \
(\.p[yl]$$|\.spec\.in$$|^docs/|^(src/util/vir(file|event)\.c|src/libvirt-stream\.c|tests/(vir.+mock\.c|commandhelper\.c|qemusecuritymock\.c)|tools/nss/libvirt_nss_(leases|macs)\.c)|tools/virt-qemu-qmp-proxy$$)
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
-
(^tests/(nodedevmdevctl|virhostcpu|virpcitest|virstoragetest)data/|docs/js/.*\.js|docs/fonts/.*\.woff|\.diff|tests/virconfdata/no-newline\.conf$$)
+
(^tests/(nodedevmdevctl|virhostcpu|virpcitest|virstoragetest)data/|docs/js/.*\.js|docs/fonts/.*\.woff|\.diff|tests/virconfdata/no-newline\.conf$$|\.bin)
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
(^(src/(util/(vircommand|virdaemon)|lxc/lxc_controller)|tests/testutils)\.c$$)
@@ -1429,10 +1429,10 @@ exclude_file_name_regexp--sc_prohibit_xmlURI =
^src/util/viruri\.c$$
exclude_file_name_regexp--sc_prohibit_return_as_function = \.py$$
exclude_file_name_regexp--sc_require_config_h = \
- ^(examples/c/.*/.*\.c|tools/virsh-edit\.c|tests/virmockstathelpers\.c|scripts/rpcgen/tests/demo\.c)$$
+ ^(examples/c/.*/.*\.c|tools/virsh-edit\.c|tests/virmockstathelpers\.c|scripts/rpcgen/tests/(test_)?demo\.c)$$
exclude_file_name_regexp--sc_require_config_h_first = \
- ^(examples/|tools/virsh-edit\.c$$|tests/virmockstathelpers.c)
+ ^(examples/|tools/virsh-edit\.c$$|tests/virmockstathelpers\.c$$|scripts/rpcgen/tests/test_demo\.c$$)
exclude_file_name_regexp--sc_trailing_blank = \
/sysinfodata/.*\.data|/virhostcpudata/.*\.cpuinfo$$
@@ -1499,6 +1499,9 @@ exclude_file_name_regexp--sc_header-ifdef = \
exclude_file_name_regexp--sc_black = \
^tools/|src/|tests/|ci/|run\.in|scripts/[^/]*\.py
+exclude_file_name_regexp--sc_spacing-check = \
+ ^scripts/rpcgen/tests/test_demo\.[ch]$$
+
## -------------- ##
## Implementation ##
## -------------- ##
diff --git a/scripts/rpcgen/tests/demo.x b/scripts/rpcgen/tests/demo.x
index ec69913f3d..7260ad08df 100644
--- a/scripts/rpcgen/tests/demo.x
+++ b/scripts/rpcgen/tests/demo.x
@@ -74,7 +74,6 @@ struct TestStructAllTypes {
bool sb;
float sf;
double sd;
-/* quadruple sq; */
int *ip;
int ifa[TestConstDec];
diff --git a/scripts/rpcgen/tests/meson.build b/scripts/rpcgen/tests/meson.build
index 953a3dbede..b504684394 100644
--- a/scripts/rpcgen/tests/meson.build
+++ b/scripts/rpcgen/tests/meson.build
@@ -3,3 +3,18 @@ rpcgen_tests = files([
'test_lexer.py',
'test_parser.py',
])
+
+
+test_demo = executable(
+ 'test_demo',
+ [ 'test_demo.c' ],
+ dependencies: [
+ xdr_dep, glib_dep
+ ],
+)
+
+test(
+ 'test_demo',
+ test_demo,
+ workdir: meson.current_source_dir(),
+)
diff --git a/scripts/rpcgen/tests/test_demo.c b/scripts/rpcgen/tests/test_demo.c
new file mode 100644
index 0000000000..54f48e5637
--- /dev/null
+++ b/scripts/rpcgen/tests/test_demo.c
@@ -0,0 +1,789 @@
+#include <glib.h>
+#include <rpc/xdr.h>
+#include <stdbool.h>
+
+#include "demo.h"
+#include "demo.c"
+
+static void test_xdr(xdrproc_t proc, void *vorig, void *vnew, const char *testname, bool
fail)
+{
+ XDR xdr;
+ /* 128kb is big enough for any of our test data */
+ size_t buflen = 128 * 1000;
+ g_autofree char *buf = g_new0(char, buflen);
+ g_autofree char *expfile = g_strdup_printf("test_demo_%s.bin", testname);
+ g_autofree char *expected = NULL;
+ size_t explen;
+ size_t actlen;
+ g_autoptr(GError) err = NULL;
+ bool_t ret;
+
+ /* Step 1: serialize the vorig and compare to the data in test .bin files */
+ xdrmem_create(&xdr, buf, buflen, XDR_ENCODE);
+
+ ret = !!proc(&xdr, vorig);
+ g_assert_cmpint(ret, ==, !fail);
+
+ if (fail)
+ goto cleanup;
+
+ actlen = xdr_getpos(&xdr);
+
+ if (getenv("VIR_TEST_REGENERATE_OUTPUT")) {
+ g_file_set_contents(expfile, buf, actlen, NULL);
+ }
+
+ g_file_get_contents(expfile, &expected, &explen, &err);
+ if (err != NULL) {
+ g_printerr("%s\n", err->message);
+ abort();
+ }
+
+ g_assert_cmpint(explen, ==, actlen);
+
+ g_assert_cmpint(memcmp(buf, expected, actlen), ==, 0);
+
+ xdr_destroy(&xdr);
+
+ /* Step 2: de-serialize the state to create a new object */
+ xdrmem_create(&xdr, buf, buflen, XDR_DECODE);
+
+ ret = !!proc(&xdr, vnew);
+ g_assert_cmpint(ret, ==, true);
+
+ actlen = xdr_getpos(&xdr);
+ g_assert_cmpint(explen, ==, actlen);
+
+ xdr_destroy(&xdr);
+
+ /* Step 3: serialize the new object again to prove we
+ * round-tripped the original object */
+ memset(buf, 0, buflen);
+
+ xdrmem_create(&xdr, buf, buflen, XDR_ENCODE);
+
+ ret = !!proc(&xdr, vnew);
+ g_assert_cmpint(ret, ==, true);
+
+ actlen = xdr_getpos(&xdr);
+
+ g_assert_cmpint(explen, ==, actlen);
+
+ g_assert_cmpint(memcmp(buf, expected, actlen), ==, 0);
+ xdr_destroy(&xdr);
+
+ /* Step 4: free mem from the new object only; the orig
+ * was on the stack so leave untouched */
+ xdrmem_create(&xdr, buf, buflen, XDR_FREE);
+
+ ret = !!proc(&xdr, vnew);
+ g_assert_cmpint(ret, ==, true);
+
+ cleanup:
+ xdr_destroy(&xdr);
+}
+
+static void test_enum(void)
+{
+ TestEnum vorig = TEST_ENUM_TWO;
+ TestEnum vnew = 0;
+
+ test_xdr((xdrproc_t)xdr_TestEnum, &vorig, &vnew, "enum", false);
+}
+
+static void test_struct(void)
+{
+ TestStruct vorig = {
+ .c1 = 'a', .c2 = 'b',
+ };
+ TestStruct vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestStruct, &vorig, &vnew, "struct",
false);
+}
+
+static void test_union_case(void)
+{
+ TestUnion vorig = {
+ .type = 20, .TestUnion_u = { .i1 = 1729 },
+ };
+ TestUnion vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnion, &vorig, &vnew, "union_case",
false);
+}
+
+static void test_union_default(void)
+{
+ TestUnion vorig = {
+ .type = 87539319, .TestUnion_u = { .i3 = 1729 },
+ };
+ TestUnion vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnion, &vorig, &vnew, "union_default",
false);
+}
+
+static void test_union_void_default_case(void)
+{
+ TestUnionVoidDefault vorig = {
+ .type = 21, .TestUnionVoidDefault_u = { .i1 = 1729 },
+ };
+ TestUnionVoidDefault vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnionVoidDefault, &vorig, &vnew,
"union_void_default_case", false);
+}
+
+static void test_union_void_default_default(void)
+{
+ TestUnionVoidDefault vorig = {
+ .type = 87539319
+ };
+ TestUnionVoidDefault vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnionVoidDefault, &vorig, &vnew,
"union_void_default_default", false);
+}
+
+static void test_union_no_default_case(void)
+{
+ TestUnionNoDefault vorig = {
+ .type = 22, .TestUnionNoDefault_u = { .i1 = 1729 },
+ };
+ TestUnionNoDefault vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnionNoDefault, &vorig, &vnew,
"union_no_default_case", false);
+}
+
+static void test_union_no_default_default(void)
+{
+ TestUnionNoDefault vorig = {
+ .type = 87539319,
+ };
+ TestUnionNoDefault vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnionNoDefault, &vorig, &vnew,
"union_no_default_default", true);
+}
+
+static void test_int_scalar(void)
+{
+ TestIntScalar vorig = 1729;
+ TestIntScalar vnew = 0;
+
+ test_xdr((xdrproc_t)xdr_TestIntScalar, &vorig, &vnew, "int_scalar",
false);
+}
+
+static void test_int_pointer_set(void)
+{
+ int vorigp = 1729;
+ TestIntPointer vorig = &vorigp;
+ TestIntPointer vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestIntPointer, &vorig, &vnew,
"int_pointer_set", false);
+}
+
+static void test_int_pointer_null(void)
+{
+ TestIntPointer vorig = NULL;
+ TestIntPointer vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestIntPointer, &vorig, &vnew,
"int_pointer_null", false);
+}
+
+static void test_int_fixed_array(void)
+{
+ TestIntFixedArray vorig = { 1729, 0, 87539319 };
+ TestIntFixedArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestIntFixedArray,
+ vorig, vnew, "int_fixed_array", false);
+}
+
+static void test_int_variable_array_set(void)
+{
+ TestIntVariableArray vorig = {
+ .TestIntVariableArray_len = 3,
+ .TestIntVariableArray_val = (int[]) { 1729, 0, 87539319 }
+ };
+ TestIntVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestIntVariableArray,
+ &vorig, &vnew, "int_variable_array_set", false);
+}
+
+static void test_int_variable_array_overflow(void)
+{
+ TestIntVariableArray vorig = {
+ .TestIntVariableArray_len = 6,
+ .TestIntVariableArray_val = (int[]) { 1729, 0, 87539319, 0, 1729 }
+ };
+ TestIntVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestIntVariableArray,
+ &vorig, &vnew, "int_variable_array_overflow", true);
+}
+
+static void test_int_variable_array_empty(void)
+{
+ TestIntVariableArray vorig = {
+ .TestIntVariableArray_len = 0,
+ .TestIntVariableArray_val = (int[]) {0},
+ };
+ TestIntVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestIntVariableArray,
+ &vorig, &vnew, "int_variable_array_empty", false);
+}
+
+static void test_string_variable_array_set(void)
+{
+ TestStringVariableArray vorig = (TestStringVariableArray) "taxis";
+ TestStringVariableArray vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestStringVariableArray,
+ &vorig, &vnew, "string_variable_array_set", false);
+}
+
+static void test_string_variable_array_empty(void)
+{
+ TestStringVariableArray vorig = (TestStringVariableArray)"";
+ TestStringVariableArray vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestStringVariableArray,
+ &vorig, &vnew, "string_variable_array_empty", false);
+}
+
+static void test_opaque_fixed_array(void)
+{
+ TestOpaqueFixedArray vorig = { 0xca, 0xfe, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78
};
+ TestOpaqueFixedArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestOpaqueFixedArray, vorig, vnew,
"opaque_fixed_array", false);
+}
+
+static void test_opaque_variable_array_set(void)
+{
+ TestOpaqueVariableArray vorig = {
+ .TestOpaqueVariableArray_len = 3,
+ .TestOpaqueVariableArray_val = (char[]) { 0xca, 0xfe, 0x12 },
+ };
+ TestOpaqueVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestOpaqueVariableArray,
+ &vorig, &vnew, "opaque_variable_array_set", false);
+}
+
+static void test_opaque_variable_array_overflow(void)
+{
+ TestOpaqueVariableArray vorig = {
+ .TestOpaqueVariableArray_len = 12,
+ .TestOpaqueVariableArray_val = (char[]) {
+ 0xca, 0xfe, 0x12, 0xca, 0xfe, 0x12,
+ 0xca, 0xfe, 0x12, 0xca, 0xfe, 0x12,
+ },
+ };
+ TestOpaqueVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestOpaqueVariableArray,
+ &vorig, &vnew, "opaque_variable_array_overflow", true);
+}
+
+static void test_opaque_variable_array_empty(void)
+{
+ TestOpaqueVariableArray vorig = {
+ .TestOpaqueVariableArray_len = 0,
+ .TestOpaqueVariableArray_val = (char[]) {0},
+ };
+ TestOpaqueVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestOpaqueVariableArray,
+ &vorig, &vnew, "opaque_variable_array_empty", false);
+}
+
+static void test_enum_scalar(void)
+{
+ TestEnumScalar vorig = TEST_ENUM_TWO;
+ TestEnumScalar vnew = 0;
+
+ test_xdr((xdrproc_t)xdr_TestEnumScalar,
+ &vorig, &vnew, "enum_scalar", false);
+}
+
+static void test_enum_pointer_set(void)
+{
+ TestEnum vorigp = TEST_ENUM_TWO;
+ TestEnumPointer vorig = &vorigp;
+ TestEnumPointer vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestEnumPointer,
+ &vorig, &vnew, "enum_pointer_set", false);
+}
+
+static void test_enum_pointer_null(void)
+{
+ TestEnumPointer vorig = NULL;
+ TestEnumPointer vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestEnumPointer,
+ &vorig, &vnew, "enum_pointer_null", false);
+}
+
+static void test_enum_fixed_array(void)
+{
+ TestEnumFixedArray vorig = {
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE
+ };
+ TestEnumFixedArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestEnumFixedArray, vorig, vnew,
"enum_fixed_array", false);
+}
+
+static void test_enum_variable_array_set(void)
+{
+ TestEnumVariableArray vorig = {
+ .TestEnumVariableArray_len = 3,
+ .TestEnumVariableArray_val = (TestEnum[]) {
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE,
+ },
+ };
+ TestEnumVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestEnumVariableArray,
+ &vorig, &vnew, "enum_variable_array_set", false);
+}
+
+static void test_enum_variable_array_overflow(void)
+{
+ TestEnumVariableArray vorig = {
+ .TestEnumVariableArray_len = 16,
+ .TestEnumVariableArray_val = (TestEnum[]) {
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ }
+ };
+ TestEnumVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestEnumVariableArray,
+ &vorig, &vnew, "enum_variable_array_overflow", true);
+}
+
+static void test_enum_variable_array_empty(void)
+{
+ TestEnumVariableArray vorig = {
+ .TestEnumVariableArray_len = 0,
+ .TestEnumVariableArray_val = (TestEnum[]) {0},
+ };
+ TestEnumVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestEnumVariableArray,
+ &vorig, &vnew, "enum_variable_array_empty", false);
+}
+
+#define TEST_STRUCT_INIT (TestStruct) { .c1 = 0xca, .c2 = 0xfe }
+#define TEST_STRUCT_INIT_ALT (TestStruct) { .c1 = 0x09, .c2 = 0x07 }
+
+static void test_struct_scalar(void)
+{
+ TestStructScalar vorig = TEST_STRUCT_INIT;
+ TestStructScalar vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestStructScalar,
+ &vorig, &vnew, "struct_scalar", false);
+}
+
+static void test_struct_pointer_set(void)
+{
+ TestStruct vorigp = TEST_STRUCT_INIT;
+ TestStructPointer vorig = &vorigp;
+ TestStructPointer vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestStructPointer,
+ &vorig, &vnew, "struct_pointer_set", false);
+}
+
+static void test_struct_pointer_null(void)
+{
+ TestStructPointer vorig = NULL;
+ TestStructPointer vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestStructPointer,
+ &vorig, &vnew, "struct_pointer_null", false);
+}
+
+static void test_struct_fixed_array(void)
+{
+ TestStructFixedArray vorig = {
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT,
+ TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT_ALT
+ };
+ TestStructFixedArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestStructFixedArray, vorig, vnew,
"struct_fixed_array", false);
+}
+
+static void test_struct_variable_array_set(void)
+{
+ TestStructVariableArray vorig = {
+ .TestStructVariableArray_len = 3,
+ .TestStructVariableArray_val = (TestStruct[]) {
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT_ALT,
+ },
+ };
+ TestStructVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestStructVariableArray,
+ &vorig, &vnew, "struct_variable_array_set", false);
+}
+
+static void test_struct_variable_array_overflow(void)
+{
+ TestStructVariableArray vorig = {
+ .TestStructVariableArray_len = 20,
+ .TestStructVariableArray_val = (TestStruct[]) {
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ }
+ };
+ TestStructVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestStructVariableArray,
+ &vorig, &vnew, "struct_variable_array_overflow", true);
+}
+
+static void test_struct_variable_array_empty(void)
+{
+ TestStructVariableArray vorig = {
+ .TestStructVariableArray_len = 0,
+ .TestStructVariableArray_val = (TestStruct[]) {},
+ };
+ TestStructVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestStructVariableArray,
+ &vorig, &vnew, "struct_variable_array_empty", false);
+}
+
+#define TEST_UNION_INIT (TestUnion) { .type = 20, .TestUnion_u = { .i1 = 1729 } }
+#define TEST_UNION_INIT_ALT (TestUnion) { .type = 1729, .TestUnion_u = { .i3 = 87539319 }
}
+
+static void test_union_scalar(void)
+{
+ TestUnionScalar vorig = TEST_UNION_INIT;
+ TestUnionScalar vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnionScalar,
+ &vorig, &vnew, "union_scalar", false);
+}
+
+static void test_union_pointer_set(void)
+{
+ TestUnion vorigp = TEST_UNION_INIT;
+ TestUnionPointer vorig = &vorigp;
+ TestUnionPointer vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestUnionPointer,
+ &vorig, &vnew, "union_pointer_set", false);
+}
+
+static void test_union_pointer_null(void)
+{
+ TestUnionPointer vorig = NULL;
+ TestUnionPointer vnew = NULL;
+
+ test_xdr((xdrproc_t)xdr_TestUnionPointer,
+ &vorig, &vnew, "union_pointer_null", false);
+}
+
+static void test_union_fixed_array(void)
+{
+ TestUnionFixedArray vorig = {
+ TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT,
+ TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT_ALT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT_ALT
+ };
+ TestUnionFixedArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnionFixedArray, vorig, vnew,
"union_fixed_array", false);
+}
+
+static void test_union_variable_array_set(void)
+{
+ TestUnionVariableArray vorig = {
+ .TestUnionVariableArray_len = 3,
+ .TestUnionVariableArray_val = (TestUnion[]) {
+ TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT_ALT,
+ },
+ };
+ TestUnionVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnionVariableArray,
+ &vorig, &vnew, "union_variable_array_set", false);
+}
+
+static void test_union_variable_array_overflow(void)
+{
+ TestUnionVariableArray vorig = {
+ .TestUnionVariableArray_len = 24,
+ .TestUnionVariableArray_val = (TestUnion[]) {
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ }
+ };
+ TestUnionVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnionVariableArray,
+ &vorig, &vnew, "union_variable_array_overflow", true);
+}
+
+static void test_union_variable_array_empty(void)
+{
+ TestUnionVariableArray vorig = {
+ .TestUnionVariableArray_len = 0,
+ .TestUnionVariableArray_val = (TestUnion[]) {},
+ };
+ TestUnionVariableArray vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestUnionVariableArray,
+ &vorig, &vnew, "union_variable_array_empty", false);
+}
+
+static void test_struct_all_types(void)
+{
+ int ip = 1729;
+ TestEnum ep = TEST_ENUM_TWO;
+ TestStruct sp = TEST_STRUCT_INIT;
+ TestUnion up = TEST_UNION_INIT;
+ TestStructAllTypes vorig = {
+ .sc = 'x',
+ .suc = 'y',
+ .ss = -7,
+ .sus = 14,
+ .si = -1729,
+ .sui = 1729,
+ .sh = -87539319,
+ .suh = -87539319,
+ .sb = true,
+ .sf = 0.1729,
+ .sd = 8753.9319,
+ .ip = &ip,
+ .ifa = { 1, 2, 3 },
+ .iva = {
+ .iva_len = 3,
+ .iva_val = (int[]) { 7, 8, 9 },
+ },
+ .stva = (char *)"hello",
+ .ofa = {
+ 0x1, 0x2, 0x3, 0xff, 0xff, 0xff, 0xff, 0x1,
+ 0x1, 0x2, 0x3, 0xff, 0xff, 0xff, 0xff, 0x1,
+ 0x1, 0x2, 0x3, 0xff, 0xff, 0xff, 0xff, 0x1,
+ 0x1, 0x2, 0x3, 0xff, 0xff, 0xff, 0xff, 0x1,
+ 0xff,
+ },
+ .ova = {
+ .ova_len = 3,
+ .ova_val = (char[]) { 0x1, 0xca, 0xfe },
+ },
+ .e1 = TEST_ENUM_ONE,
+ .e2 = TEST_ENUM_TWO,
+ .ep = &ep,
+ .efa = {
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE,
+ },
+ .eva = {
+ .eva_len = 3,
+ .eva_val = (TestEnum[]) {
+ TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ },
+ },
+ .s = TEST_STRUCT_INIT,
+ .sp = &sp,
+ .sfa = {
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
TEST_STRUCT_INIT_ALT,
+ TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT,
TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
TEST_STRUCT_INIT_ALT,
+ TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT,
TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
TEST_STRUCT_INIT_ALT,
+ TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT,
TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT,
+ },
+ .sva = {
+ .sva_len = 3,
+ .sva_val = (TestStruct[]) {
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
+ },
+ },
+ .u = TEST_UNION_INIT,
+ .up = &up,
+ .ufa = {
+ TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT,
+ TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT_ALT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT,
+ TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT_ALT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT,
+ TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT_ALT,
+ },
+ .uva = {
+ .uva_len = 3,
+ .uva_val = (TestUnion[]) {
+ TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT_ALT,
+ },
+ },
+ .tis = 1729,
+ .tip = &ip,
+ .tifa = { 1, 2, 3 },
+ .tiva = {
+ .TestIntVariableArray_len = 3,
+ .TestIntVariableArray_val = (int[]) { 7, 8, 9 },
+ },
+ .tstva = (char *)"hello",
+ .tofa = {
+ 0x1, 0x2, 0x3, 0xff, 0xff, 0xff, 0xff, 0x1,
+ 0xff,
+ },
+ .tova = {
+ .TestOpaqueVariableArray_len = 3,
+ .TestOpaqueVariableArray_val = (char[]) { 0x1, 0xca, 0xfe },
+ },
+ .tes = TEST_ENUM_ONE,
+ .tep = &ep,
+ .tefa = {
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE, TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ TEST_ENUM_ONE,
+ },
+ .teva = {
+ .TestEnumVariableArray_len = 3,
+ .TestEnumVariableArray_val = (TestEnum[]) {
+ TEST_ENUM_TWO, TEST_ENUM_ONE, TEST_ENUM_TWO,
+ },
+ },
+ .tss = TEST_STRUCT_INIT,
+ .tsp = &sp,
+ .tsfa = {
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
TEST_STRUCT_INIT_ALT,
+ TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT,
TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT, TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
TEST_STRUCT_INIT,
+ TEST_STRUCT_INIT,
+ },
+ .tsva = {
+ .TestStructVariableArray_len = 3,
+ .TestStructVariableArray_val = (TestStruct[]) {
+ TEST_STRUCT_INIT, TEST_STRUCT_INIT_ALT, TEST_STRUCT_INIT,
+ },
+ },
+ .tu = TEST_UNION_INIT,
+ .tup = &up,
+ .tufa = {
+ TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT,
+ TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT_ALT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT,
+ TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT, TEST_UNION_INIT_ALT,
+ TEST_UNION_INIT_ALT,
+ },
+ .tuva = {
+ .TestUnionVariableArray_len = 3,
+ .TestUnionVariableArray_val = (TestUnion[]) {
+ TEST_UNION_INIT, TEST_UNION_INIT_ALT, TEST_UNION_INIT_ALT,
+ },
+ },
+ };
+ TestStructAllTypes vnew = {0};
+
+ test_xdr((xdrproc_t)xdr_TestStructAllTypes,
+ &vorig, &vnew, "test_struct_all_types", false);
+}
+
+int main(int argc, char **argv)
+{
+ g_test_init(&argc, &argv, NULL);
+
+ g_test_set_nonfatal_assertions();
+
+ g_test_add_func("/xdr/enum", test_enum);
+
+ g_test_add_func("/xdr/struct", test_struct);
+
+ g_test_add_func("/xdr/union/case", test_union_case);
+ g_test_add_func("/xdr/union/default", test_union_default);
+ g_test_add_func("/xdr/union-void-default/case",
test_union_void_default_case);
+ g_test_add_func("/xdr/union-void-default/default",
test_union_void_default_default);
+ g_test_add_func("/xdr/union-no-default/case", test_union_no_default_case);
+ g_test_add_func("/xdr/union-no-default/default",
test_union_no_default_default);
+
+ g_test_add_func("/xdr/int-scalar", test_int_scalar);
+ g_test_add_func("/xdr/int-pointer/set", test_int_pointer_set);
+ g_test_add_func("/xdr/int-pointer/null", test_int_pointer_null);
+ g_test_add_func("/xdr/int-fixed-array", test_int_fixed_array);
+ g_test_add_func("/xdr/int-variable-array/set",
test_int_variable_array_set);
+ g_test_add_func("/xdr/int-variable-array/overflow",
test_int_variable_array_overflow);
+ g_test_add_func("/xdr/int-variable-array/empty",
test_int_variable_array_empty);
+
+ g_test_add_func("/xdr/string-variable-array/set",
test_string_variable_array_set);
+ g_test_add_func("/xdr/string-variable-array/empty",
test_string_variable_array_empty);
+
+ g_test_add_func("/xdr/opaque-fixed-array", test_opaque_fixed_array);
+ g_test_add_func("/xdr/opaque-variable-array/set",
test_opaque_variable_array_set);
+ g_test_add_func("/xdr/opaque-variable-array/overflow",
test_opaque_variable_array_overflow);
+ g_test_add_func("/xdr/opaque-variable-array/empty",
test_opaque_variable_array_empty);
+
+ g_test_add_func("/xdr/enum-scalar", test_enum_scalar);
+ g_test_add_func("/xdr/enum-pointer/set", test_enum_pointer_set);
+ g_test_add_func("/xdr/enum-pointer/null", test_enum_pointer_null);
+ g_test_add_func("/xdr/enum-fixed-array", test_enum_fixed_array);
+ g_test_add_func("/xdr/enum-variable-array/set",
test_enum_variable_array_set);
+ g_test_add_func("/xdr/enum-variable-array/overflow",
test_enum_variable_array_overflow);
+ g_test_add_func("/xdr/enum-variable-array/empty",
test_enum_variable_array_empty);
+
+ g_test_add_func("/xdr/struct-scalar", test_struct_scalar);
+ g_test_add_func("/xdr/struct-pointer/set", test_struct_pointer_set);
+ g_test_add_func("/xdr/struct-pointer/null", test_struct_pointer_null);
+ g_test_add_func("/xdr/struct-fixed-array", test_struct_fixed_array);
+ g_test_add_func("/xdr/struct-variable-array/set",
test_struct_variable_array_set);
+ g_test_add_func("/xdr/struct-variable-array/overflow",
test_struct_variable_array_overflow);
+ g_test_add_func("/xdr/struct-variable-array/empty",
test_struct_variable_array_empty);
+
+ g_test_add_func("/xdr/union-scalar", test_union_scalar);
+ g_test_add_func("/xdr/union-pointer/set", test_union_pointer_set);
+ g_test_add_func("/xdr/union-pointer/null", test_union_pointer_null);
+ g_test_add_func("/xdr/union-fixed-array", test_union_fixed_array);
+ g_test_add_func("/xdr/union-variable-array/set",
test_union_variable_array_set);
+ g_test_add_func("/xdr/union-variable-array/overflow",
test_union_variable_array_overflow);
+ g_test_add_func("/xdr/union-variable-array/empty",
test_union_variable_array_empty);
+
+ g_test_add_func("/xdr/struct-all-types", test_struct_all_types);
+
+ return g_test_run();
+}
diff --git a/scripts/rpcgen/tests/test_demo_enum.bin
b/scripts/rpcgen/tests/test_demo_enum.bin
new file mode 100644
index 0000000000000000000000000000000000000000..b6a8ef3e7ca7c398cd8f65bb1e21a23c0d251536
GIT binary patch
literal 4
LcmZQzU|<3O00sa9
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_enum_fixed_array.bin
b/scripts/rpcgen/tests/test_demo_enum_fixed_array.bin
new file mode 100644
index 0000000000000000000000000000000000000000..869e8134ac62626562dda76a4eea95f9779ab266
GIT binary patch
literal 52
WcmZQzU|?imU|<4bVrZZ;1_l5E1OO2L
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_enum_pointer_null.bin
b/scripts/rpcgen/tests/test_demo_enum_pointer_null.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_enum_pointer_set.bin
b/scripts/rpcgen/tests/test_demo_enum_pointer_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..dc4fb37fcdbedaa327cd251b1a0666fe66a51917
GIT binary patch
literal 8
PcmZQzU|?imU|<3O01p5J
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_enum_scalar.bin
b/scripts/rpcgen/tests/test_demo_enum_scalar.bin
new file mode 100644
index 0000000000000000000000000000000000000000..b6a8ef3e7ca7c398cd8f65bb1e21a23c0d251536
GIT binary patch
literal 4
LcmZQzU|<3O00sa9
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_enum_variable_array_empty.bin
b/scripts/rpcgen/tests/test_demo_enum_variable_array_empty.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_enum_variable_array_set.bin
b/scripts/rpcgen/tests/test_demo_enum_variable_array_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..63c142946282ff9fc3d398e1a7ff0d354572875a
GIT binary patch
literal 16
TcmZQzU|?ooU|<AdCJ+q(080P}
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_int_fixed_array.bin
b/scripts/rpcgen/tests/test_demo_int_fixed_array.bin
new file mode 100644
index 0000000000000000000000000000000000000000..4e19f58a908989c4cc5af6aa9ed8459959fbc796
GIT binary patch
literal 12
RcmZQzU^~bF1gz%!$^i+z0yzKx
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_int_pointer_null.bin
b/scripts/rpcgen/tests/test_demo_int_pointer_null.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_int_pointer_set.bin
b/scripts/rpcgen/tests/test_demo_int_pointer_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..7574dc886a36e645ac50963f0857faa542bfd3b1
GIT binary patch
literal 8
PcmZQzU|?imU^@r^0NMb_
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_int_scalar.bin
b/scripts/rpcgen/tests/test_demo_int_scalar.bin
new file mode 100644
index 0000000000000000000000000000000000000000..53ae788bb25812da65525031f29181e79fb7dc2e
GIT binary patch
literal 4
LcmZQzU^@r^0MP)*
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_int_variable_array_empty.bin
b/scripts/rpcgen/tests/test_demo_int_variable_array_empty.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_int_variable_array_set.bin
b/scripts/rpcgen/tests/test_demo_int_variable_array_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..2ef627b63f7c9aaed9be8d01a8be2fd889b1453b
GIT binary patch
literal 16
VcmZQzU|?ooU^~bF1gz%!$^i-J0z3c!
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_opaque_fixed_array.bin
b/scripts/rpcgen/tests/test_demo_opaque_fixed_array.bin
new file mode 100644
index 0000000000000000000000000000000000000000..c60ee0612b962fd290f7ad6a6cae4028c7e8f191
GIT binary patch
literal 12
TcmX^0Pe|FsH7vb?fq?-4AIAf%
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_opaque_variable_array_empty.bin
b/scripts/rpcgen/tests/test_demo_opaque_variable_array_empty.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_opaque_variable_array_set.bin
b/scripts/rpcgen/tests/test_demo_opaque_variable_array_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..6970f11f819c17aff128663c8cdcc314ea357545
GIT binary patch
literal 8
PcmZQzU|>G=Ply2k23-N(
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_string_variable_array_empty.bin
b/scripts/rpcgen/tests/test_demo_string_variable_array_empty.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_string_variable_array_set.bin
b/scripts/rpcgen/tests/test_demo_string_variable_array_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..78e29054977ae0cf3a9a29e568c586407891c363
GIT binary patch
literal 12
TcmZQzU|=mttjH{8U|;|M4JiUI
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_struct.bin
b/scripts/rpcgen/tests/test_demo_struct.bin
new file mode 100644
index 0000000000000000000000000000000000000000..17d90c3c949f7e06f21a758ec281b8739386ae32
GIT binary patch
literal 8
PcmZQzU`S+OU`PT00#5+M
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_struct_fixed_array.bin
b/scripts/rpcgen/tests/test_demo_struct_fixed_array.bin
new file mode 100644
index 0000000000000000000000000000000000000000..f0e786ddea02cbd342ec9f6d3c6ee2b090b38792
GIT binary patch
literal 136
ncmezW|Np7~|NsAEU|`?`Vs;=Kg^x=drj8H|(+{K3)x*RAqQp)G
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_struct_pointer_null.bin
b/scripts/rpcgen/tests/test_demo_struct_pointer_null.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_struct_pointer_set.bin
b/scripts/rpcgen/tests/test_demo_struct_pointer_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..572814793222ad03346747bb3041bb7eafc5205e
GIT binary patch
literal 12
ScmZQzU|{_J|Nki<{s#ae=Lf_9
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_struct_scalar.bin
b/scripts/rpcgen/tests/test_demo_struct_scalar.bin
new file mode 100644
index 0000000000..0e6959d56a
--- /dev/null
+++ b/scripts/rpcgen/tests/test_demo_struct_scalar.bin
@@ -0,0 +1 @@
+��������
\ No newline at end of file
diff --git a/scripts/rpcgen/tests/test_demo_struct_variable_array_empty.bin
b/scripts/rpcgen/tests/test_demo_struct_variable_array_empty.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_struct_variable_array_set.bin
b/scripts/rpcgen/tests/test_demo_struct_variable_array_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..a9406a21cf6b767b76e2041536e560f5ef3c0202
GIT binary patch
literal 28
acmZQzU||0L|Nki<{>Q+;zzM|cFd6`$K?mjl
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_test_struct_all_types.bin
b/scripts/rpcgen/tests/test_demo_test_struct_all_types.bin
new file mode 100644
index 0000000000000000000000000000000000000000..5ee4ee5a6d5e467e373add81d6266f4acee2a150
GIT binary patch
literal 1752
zcmds%ze+<<42N@iX{#Vk9efR^ZvNSPk%B|PQJtJ!`zqaqyGeZ@(ZSPSs$Y@Na0U^y
z7s7Xv{Bp?+=f=$L%<R6_`X(L==Vqf`etmzwe1yuCv(uyHMSt>o_3*NA-*um~f!N7@
z>+yGwWe2iD+3<QcpWo<E2A#K9GFEBybY=D7RL`4U|1$kseV&^h^=&JeH(xkI#e5dy
z=x1?sEm99Neaz!S>Y`6PBYN1<kw*_>93M*OmxuYrSx&y)Z_ZyF^~34Yt?GlH#nH7$
zJ<Rkmj}NJfKJkp`VM|9IJ&bYu7Ps~O4<xf?=fLgmY3_&}yWl5#;6MGR`+CpQd$I;<
CFZ~+;
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_case.bin
b/scripts/rpcgen/tests/test_demo_union_case.bin
new file mode 100644
index 0000000000000000000000000000000000000000..b7ca515883a8101f1a1502a59a6adadc4eae6c2e
GIT binary patch
literal 8
PcmZQzU=U$oU^@r^0XYEN
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_default.bin
b/scripts/rpcgen/tests/test_demo_union_default.bin
new file mode 100644
index 0000000000000000000000000000000000000000..7acf7d7ef0eb935218c72dd8048520cd450b79d2
GIT binary patch
literal 8
PcmZQI-&fASz;+M-2}J@q
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_fixed_array.bin
b/scripts/rpcgen/tests/test_demo_union_fixed_array.bin
new file mode 100644
index 0000000000000000000000000000000000000000..c666f3a1d66381b4cbe02e139f80362539ecd719
GIT binary patch
literal 168
pcmZQzU=U$oU^@uHtmga588G;`#9{gf(J=im8eKhH9B4Ie002%@7#9El
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_no_default_case.bin
b/scripts/rpcgen/tests/test_demo_union_no_default_case.bin
new file mode 100644
index 0000000000000000000000000000000000000000..6dbd9a934f737640d1766b1c9d2b8483d1e2fd99
GIT binary patch
literal 8
PcmZQzU=U+qU^@r^0Yd=Z
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_pointer_null.bin
b/scripts/rpcgen/tests/test_demo_union_pointer_null.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_pointer_set.bin
b/scripts/rpcgen/tests/test_demo_union_pointer_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..01dc9dabe89fe0a2c87b838350a422d65cfab6ef
GIT binary patch
literal 12
TcmZQzU|?imU=U$oU^@r^0Y(7b
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_scalar.bin
b/scripts/rpcgen/tests/test_demo_union_scalar.bin
new file mode 100644
index 0000000000000000000000000000000000000000..b7ca515883a8101f1a1502a59a6adadc4eae6c2e
GIT binary patch
literal 8
PcmZQzU=U$oU^@r^0XYEN
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_variable_array_empty.bin
b/scripts/rpcgen/tests/test_demo_union_variable_array_empty.bin
new file mode 100644
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
LcmZQzU|;|M00aO5
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_variable_array_set.bin
b/scripts/rpcgen/tests/test_demo_union_variable_array_set.bin
new file mode 100644
index 0000000000000000000000000000000000000000..3edd18c10589b472d237e6cdbe2da69ba10efea3
GIT binary patch
literal 28
acmZQzU|?ooU=U$oU^@uHtmga5VKe|PG6hcn
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_void_default_case.bin
b/scripts/rpcgen/tests/test_demo_union_void_default_case.bin
new file mode 100644
index 0000000000000000000000000000000000000000..b5f6c99ca52e8881d621342f22940a4931305973
GIT binary patch
literal 8
PcmZQzU=U?sU^@r^0X_iT
literal 0
HcmV?d00001
diff --git a/scripts/rpcgen/tests/test_demo_union_void_default_default.bin
b/scripts/rpcgen/tests/test_demo_union_void_default_default.bin
new file mode 100644
index 0000000000..d7e8f43f03
--- /dev/null
+++ b/scripts/rpcgen/tests/test_demo_union_void_default_default.bin
@@ -0,0 +1 @@
+7�w
\ No newline at end of file
--
2.39.1