[PATCH v6 33/42] dissector: Add some format checks with arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tests/Makefile.am     |  1 +
 tests/check_dissector |  2 ++
 tests/out_array2.txt  | 28 ++++++++++++++++++++++++++++
 tests/test.proto      |  8 ++++++++
 4 files changed, 39 insertions(+)
 create mode 100644 tests/out_array2.txt

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5a23d3d..6a3d166 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -57,6 +57,7 @@ EXTRA_DIST =				\
 	data_empty			\
 	out_empty.txt			\
 	data_base1			\
+	out_array2.txt			\
 	out_base1.txt			\
 	out_struct1.txt			\
 	data_u16s			\
diff --git a/tests/check_dissector b/tests/check_dissector
index 94ce0bc..86b78eb 100755
--- a/tests/check_dissector
+++ b/tests/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/tests/out_array2.txt b/tests/out_array2.txt
new file mode 100644
index 0000000..f695ca1
--- /dev/null
+++ b/tests/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/tests/test.proto b/tests/test.proto
index 4eaa858..7bba890 100644
--- a/tests/test.proto
+++ b/tests/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 {
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]