[Spice-devel,v3,43/51] Add some format checks with arrays

Submitted by Frediano Ziglio on July 21, 2015, 4:46 p.m.

Details

Message ID 1437497181-26929-44-git-send-email-fziglio@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Frediano Ziglio July 21, 2015, 4:46 p.m.
Check different format or small arrays formatting.
Is possible to omit to have a tree and dump just the elements.
This is useful for small arrays or if is possible to format all
the item (for instance having a small structure) in a single line.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 codegen/Makefile.am     |  1 +
 codegen/check_dissector |  2 ++
 codegen/out_array2.txt  | 28 ++++++++++++++++++++++++++++
 codegen/test.proto      |  8 ++++++++
 4 files changed, 39 insertions(+)
 create mode 100644 codegen/out_array2.txt

Patch hide | download patch | download mbox

diff --git a/codegen/Makefile.am b/codegen/Makefile.am
index 15e277e..e169d88 100644
--- a/codegen/Makefile.am
+++ b/codegen/Makefile.am
@@ -58,6 +58,7 @@  EXTRA_DIST =				\
 	data_empty			\
 	out_empty.txt			\
 	data_base1			\
+	out_array2.txt			\
 	out_base1.txt			\
 	out_struct1.txt			\
 	data_u16s			\
diff --git a/codegen/check_dissector b/codegen/check_dissector
index 94ce0bc..86b78eb 100755
--- a/codegen/check_dissector
+++ b/codegen/check_dissector
@@ -65,4 +65,6 @@  check data_base1 1 2 out_channel.txt
 # flags and descriptions
 check data_base1 1 3 out_flags1.txt
 
+check data_u16s 1 103 out_array2.txt --client
+
 exit 0
diff --git a/codegen/out_array2.txt b/codegen/out_array2.txt
new file mode 100644
index 0000000..f695ca1
--- /dev/null
+++ b/codegen/out_array2.txt
@@ -0,0 +1,28 @@ 
+--- tree
+    --- item
+    Text: small[0]: 0
+    Name: small
+    Abbrev: spice2.auto.Array2_array_small
+    Type: FT_UINT16
+    Base: BASE_DEC
+    --- item
+    Text: small[1]: 1
+    Name: small
+    Abbrev: spice2.auto.Array2_array_small
+    Type: FT_UINT16
+    Base: BASE_DEC
+    --- item
+    Text: Small array
+        --- tree
+            --- item
+            Text: small_named[0]: 2
+            Name: small_named
+            Abbrev: spice2.auto.Array2_array_small_named
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: small_named[1]: 3
+            Name: small_named
+            Abbrev: spice2.auto.Array2_array_small_named
+            Type: FT_UINT16
+            Base: BASE_DEC
diff --git a/codegen/test.proto b/codegen/test.proto
index 4eaa858..7bba890 100644
--- a/codegen/test.proto
+++ b/codegen/test.proto
@@ -59,6 +59,13 @@  message ArrayStruct {
     Dummy array4[4];
 };
 
+message Array2 {
+    /* small arrays, format with text and numbers, no tree generated */
+    uint16 @ws_txt("small[%u]: %u", INDEX, small) small[2];
+    /* small arrays, format with text and numbers, tree generated due to description */
+    uint16 @ws_txt("small_named[%u]: %u", INDEX, small_named) small_named[2] @ws_desc("Small array");
+};
+
 channel BaseChannel {
   server:
     message {
@@ -96,6 +103,7 @@  channel BaseChannel {
     ArrayPrimitive array_primitive = 100;
     ArrayRaw array_raw;
     ArrayStruct array_struct;
+    Array2 array2;
 };
 
 channel Test1Channel: BaseChannel {