[Spice-devel] [PATCH v4 38/41] dissector: Test we don't override text handling other fields

Frediano Ziglio fziglio at redhat.com
Thu Jul 23 08:54:55 PDT 2015


Is possible the nested fields override text as text could be updated
at the end of container.
Check we don't do it and we correctly nest protocol items.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 codegen/check_dissector |   1 +
 codegen/data_struct2    | Bin 0 -> 9 bytes
 codegen/out_struct2.txt |  28 ++++++++++++++++++++++++++++
 codegen/test.proto      |   9 +++++++++
 4 files changed, 38 insertions(+)
 create mode 100644 codegen/data_struct2
 create mode 100644 codegen/out_struct2.txt

diff --git a/codegen/check_dissector b/codegen/check_dissector
index 86b78eb..b6ee52a 100755
--- a/codegen/check_dissector
+++ b/codegen/check_dissector
@@ -55,6 +55,7 @@ fi
 check data_base1 1 1 out_base1.txt
 
 check data_base1 1 1 out_struct1.txt --client
+check data_struct2 1 2 out_struct2.txt --client
 
 check data_u16s 1 100 out_array_primitive.txt --client
 check data_u16s 1 101 out_array_raw.txt --client
diff --git a/codegen/data_struct2 b/codegen/data_struct2
new file mode 100644
index 0000000000000000000000000000000000000000..dabffc9f0eed655407b62a7e00d28bb6137d9846
GIT binary patch
literal 9
QcmZRnW?*1oVc=i at 00bofi~s-t

literal 0
HcmV?d00001

diff --git a/codegen/out_struct2.txt b/codegen/out_struct2.txt
new file mode 100644
index 0000000..7cda803
--- /dev/null
+++ b/codegen/out_struct2.txt
@@ -0,0 +1,28 @@
+--- tree
+    --- item
+    Text: size 4
+        --- tree
+            --- item
+            Text: 4 (0x4)
+            Name: size
+            Abbrev: spice2.auto.StructTxts_size
+            Type: FT_UINT8
+            Base: BASE_DEC
+            --- item
+            Text: data is 123
+            Name: data
+            Abbrev: spice2.auto.StructTxts_data
+            Type: FT_UINT32
+            Base: BASE_DEC
+            --- item
+            Text: array[0] = 4
+            Name: array
+            Abbrev: spice2.auto.StructTxts_array_array
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: array[1] = 8
+            Name: array
+            Abbrev: spice2.auto.StructTxts_array_array
+            Type: FT_UINT16
+            Base: BASE_DEC
diff --git a/codegen/test.proto b/codegen/test.proto
index 7bba890..3b4e48f 100644
--- a/codegen/test.proto
+++ b/codegen/test.proto
@@ -66,6 +66,12 @@ message Array2 {
     uint16 @ws_txt("small_named[%u]: %u", INDEX, small_named) small_named[2] @ws_desc("Small array");
 };
 
+struct StructTxts {
+    uint8 size;
+    uint32 data @ws_txt("data is %u", data);
+    uint16 @ws_txt_n("array[%u] = %u", INDEX, array) array[2];
+} @ws_txt("size %u", size);
+
 channel BaseChannel {
   server:
     message {
@@ -99,6 +105,9 @@ channel BaseChannel {
     message {
         Dummy struct;
     } Struct1 = 1;
+    message {
+        StructTxts struct;
+    } struct2;
 
     ArrayPrimitive array_primitive = 100;
     ArrayRaw array_raw;
-- 
2.1.0



More information about the Spice-devel mailing list