[PATCH 09/16] rpcgen: add test case for XDR serialization

Michal Prívozník mprivozn at redhat.com
Thu Mar 9 15:12:04 UTC 2023


On 3/8/23 17:39, Daniel P. Berrangé wrote:
> 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 at 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/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 @@
> +
> 

I don't know what's going on but this surely can't be an empty file.
Also, some other .bin files are missing. Squash this in (generated by
VIR_TEST_REGENERATE_OUTPUT=1)

---
 scripts/rpcgen/tests/test_demo_struct_scalar.bin |   2 +-
 .../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
 scripts/rpcgen/tests/test_demo_union_default.bin | Bin 0 -> 8 bytes
 .../rpcgen/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
 .../rpcgen/tests/test_demo_union_pointer_set.bin | Bin 0 -> 12 bytes
 scripts/rpcgen/tests/test_demo_union_scalar.bin  | Bin 0 -> 8 bytes
 .../test_demo_union_variable_array_empty.bin     | Bin 0 -> 4 bytes
 .../tests/test_demo_union_variable_array_set.bin | Bin 0 -> 28 bytes
 .../tests/test_demo_union_void_default_case.bin  | Bin 0 -> 8 bytes
 .../test_demo_union_void_default_default.bin     |   1 +
 15 files changed, 2 insertions(+), 1 deletion(-)
 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/scripts/rpcgen/tests/test_demo_struct_scalar.bin b/scripts/rpcgen/tests/test_demo_struct_scalar.bin
index 8b13789179..0e6959d56a 100644
--- a/scripts/rpcgen/tests/test_demo_struct_scalar.bin
+++ b/scripts/rpcgen/tests/test_demo_struct_scalar.bin
@@ -1 +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 at iX{#Vk9efR^ZvNSPk%B|PQJtJ!`zqaqyGeZ@(ZSPSs$Y at 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 at 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.2




More information about the libvir-list mailing list