test_blobmsg.t 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. check that blobmsg is producing expected results:
  2. $ [ -n "$TEST_BIN_DIR" ] && export PATH="$TEST_BIN_DIR:$PATH"
  3. $ valgrind --quiet --leak-check=full test-blobmsg
  4. [*] blobmsg dump:
  5. Message: Hello, world!
  6. List: {
  7. 0 (i8)
  8. 100 (i8)
  9. -128 (i8)
  10. 127 (i8)
  11. -32768 (i16)
  12. 32767 (i16)
  13. -2147483648 (i32)
  14. 2147483647 (i32)
  15. -9223372036854775808 (i64)
  16. 9223372036854775807 (i64)
  17. 0.000000 (dbl)
  18. 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl)
  19. }
  20. Testdata: {
  21. \tdbl-min : 0.000000 (dbl) (esc)
  22. \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc)
  23. \tfoo : 0 (i8) (esc)
  24. \tpoo : 100 (i8) (esc)
  25. \tmoo-min : -128 (i8) (esc)
  26. \tmoo-max : 127 (i8) (esc)
  27. \tbar-min : -32768 (i16) (esc)
  28. \tbar-max : 32767 (i16) (esc)
  29. \tbaz-min : -2147483648 (i32) (esc)
  30. \tbaz-max : 2147483647 (i32) (esc)
  31. \ttaz-min : -9223372036854775808 (i64) (esc)
  32. \ttaz-max : 9223372036854775807 (i64) (esc)
  33. \tworld : 2 (str) (esc)
  34. }
  35. [*] blobmsg to json: {"message":"Hello, world!","testdata":{"dbl-min":0.000000,"dbl-max":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,0.000000,179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]}
  36. [*] blobmsg from json:
  37. Message: Hello, world!
  38. List: {
  39. 0 (i8)
  40. 1 (i8)
  41. 1 (i8)
  42. 1 (i8)
  43. -32768 (i32)
  44. 32767 (i32)
  45. -2147483648 (i32)
  46. 2147483647 (i32)
  47. -9223372036854775808 (i64)
  48. 9223372036854775807 (i64)
  49. 0.000000 (dbl)
  50. 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl)
  51. }
  52. Testdata: {
  53. \tdbl-min : 0.000000 (dbl) (esc)
  54. \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc)
  55. \tfoo : 0 (i8) (esc)
  56. \tpoo : 1 (i8) (esc)
  57. \tmoo-min : 1 (i8) (esc)
  58. \tmoo-max : 1 (i8) (esc)
  59. \tbar-min : -32768 (i32) (esc)
  60. \tbar-max : 32767 (i32) (esc)
  61. \tbaz-min : -2147483648 (i32) (esc)
  62. \tbaz-max : 2147483647 (i32) (esc)
  63. \ttaz-min : -9223372036854775808 (i64) (esc)
  64. \ttaz-max : 9223372036854775807 (i64) (esc)
  65. \tworld : 2 (str) (esc)
  66. }
  67. $ test-blobmsg-san
  68. [*] blobmsg dump:
  69. Message: Hello, world!
  70. List: {
  71. 0 (i8)
  72. 100 (i8)
  73. -128 (i8)
  74. 127 (i8)
  75. -32768 (i16)
  76. 32767 (i16)
  77. -2147483648 (i32)
  78. 2147483647 (i32)
  79. -9223372036854775808 (i64)
  80. 9223372036854775807 (i64)
  81. 0.000000 (dbl)
  82. 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl)
  83. }
  84. Testdata: {
  85. \tdbl-min : 0.000000 (dbl) (esc)
  86. \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc)
  87. \tfoo : 0 (i8) (esc)
  88. \tpoo : 100 (i8) (esc)
  89. \tmoo-min : -128 (i8) (esc)
  90. \tmoo-max : 127 (i8) (esc)
  91. \tbar-min : -32768 (i16) (esc)
  92. \tbar-max : 32767 (i16) (esc)
  93. \tbaz-min : -2147483648 (i32) (esc)
  94. \tbaz-max : 2147483647 (i32) (esc)
  95. \ttaz-min : -9223372036854775808 (i64) (esc)
  96. \ttaz-max : 9223372036854775807 (i64) (esc)
  97. \tworld : 2 (str) (esc)
  98. }
  99. [*] blobmsg to json: {"message":"Hello, world!","testdata":{"dbl-min":0.000000,"dbl-max":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,0.000000,179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]}
  100. [*] blobmsg from json:
  101. Message: Hello, world!
  102. List: {
  103. 0 (i8)
  104. 1 (i8)
  105. 1 (i8)
  106. 1 (i8)
  107. -32768 (i32)
  108. 32767 (i32)
  109. -2147483648 (i32)
  110. 2147483647 (i32)
  111. -9223372036854775808 (i64)
  112. 9223372036854775807 (i64)
  113. 0.000000 (dbl)
  114. 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl)
  115. }
  116. Testdata: {
  117. \tdbl-min : 0.000000 (dbl) (esc)
  118. \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc)
  119. \tfoo : 0 (i8) (esc)
  120. \tpoo : 1 (i8) (esc)
  121. \tmoo-min : 1 (i8) (esc)
  122. \tmoo-max : 1 (i8) (esc)
  123. \tbar-min : -32768 (i32) (esc)
  124. \tbar-max : 32767 (i32) (esc)
  125. \tbaz-min : -2147483648 (i32) (esc)
  126. \tbaz-max : 2147483647 (i32) (esc)
  127. \ttaz-min : -9223372036854775808 (i64) (esc)
  128. \ttaz-max : 9223372036854775807 (i64) (esc)
  129. \tworld : 2 (str) (esc)
  130. }
  131. $ test-blobmsg-san
  132. [*] blobmsg dump:
  133. Message: Hello, world!
  134. List: {
  135. 0 (i8)
  136. 100 (i8)
  137. -128 (i8)
  138. 127 (i8)
  139. -32768 (i16)
  140. 32767 (i16)
  141. -2147483648 (i32)
  142. 2147483647 (i32)
  143. -9223372036854775808 (i64)
  144. 9223372036854775807 (i64)
  145. 0.000000 (dbl)
  146. 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl)
  147. }
  148. Testdata: {
  149. \tdbl-min : 0.000000 (dbl) (esc)
  150. \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc)
  151. \tfoo : 0 (i8) (esc)
  152. \tpoo : 100 (i8) (esc)
  153. \tmoo-min : -128 (i8) (esc)
  154. \tmoo-max : 127 (i8) (esc)
  155. \tbar-min : -32768 (i16) (esc)
  156. \tbar-max : 32767 (i16) (esc)
  157. \tbaz-min : -2147483648 (i32) (esc)
  158. \tbaz-max : 2147483647 (i32) (esc)
  159. \ttaz-min : -9223372036854775808 (i64) (esc)
  160. \ttaz-max : 9223372036854775807 (i64) (esc)
  161. \tworld : 2 (str) (esc)
  162. }
  163. [*] blobmsg to json: {"message":"Hello, world!","testdata":{"dbl-min":0.000000,"dbl-max":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,0.000000,179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]}
  164. [*] blobmsg from json:
  165. Message: Hello, world!
  166. List: {
  167. 0 (i8)
  168. 1 (i8)
  169. 1 (i8)
  170. 1 (i8)
  171. -32768 (i32)
  172. 32767 (i32)
  173. -2147483648 (i32)
  174. 2147483647 (i32)
  175. -9223372036854775808 (i64)
  176. 9223372036854775807 (i64)
  177. 0.000000 (dbl)
  178. 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl)
  179. }
  180. Testdata: {
  181. \tdbl-min : 0.000000 (dbl) (esc)
  182. \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc)
  183. \tfoo : 0 (i8) (esc)
  184. \tpoo : 1 (i8) (esc)
  185. \tmoo-min : 1 (i8) (esc)
  186. \tmoo-max : 1 (i8) (esc)
  187. \tbar-min : -32768 (i32) (esc)
  188. \tbar-max : 32767 (i32) (esc)
  189. \tbaz-min : -2147483648 (i32) (esc)
  190. \tbaz-max : 2147483647 (i32) (esc)
  191. \ttaz-min : -9223372036854775808 (i64) (esc)
  192. \ttaz-max : 9223372036854775807 (i64) (esc)
  193. \tworld : 2 (str) (esc)
  194. }
  195. $ test-blobmsg-san
  196. [*] blobmsg dump:
  197. Message: Hello, world!
  198. List: {
  199. 0 (i8)
  200. 100 (i8)
  201. -128 (i8)
  202. 127 (i8)
  203. -32768 (i16)
  204. 32767 (i16)
  205. -2147483648 (i32)
  206. 2147483647 (i32)
  207. -9223372036854775808 (i64)
  208. 9223372036854775807 (i64)
  209. 0.000000 (dbl)
  210. 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl)
  211. }
  212. Testdata: {
  213. \tdbl-min : 0.000000 (dbl) (esc)
  214. \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc)
  215. \tfoo : 0 (i8) (esc)
  216. \tpoo : 100 (i8) (esc)
  217. \tmoo-min : -128 (i8) (esc)
  218. \tmoo-max : 127 (i8) (esc)
  219. \tbar-min : -32768 (i16) (esc)
  220. \tbar-max : 32767 (i16) (esc)
  221. \tbaz-min : -2147483648 (i32) (esc)
  222. \tbaz-max : 2147483647 (i32) (esc)
  223. \ttaz-min : -9223372036854775808 (i64) (esc)
  224. \ttaz-max : 9223372036854775807 (i64) (esc)
  225. \tworld : 2 (str) (esc)
  226. }
  227. [*] blobmsg to json: {"message":"Hello, world!","testdata":{"dbl-min":0.000000,"dbl-max":179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,"foo":false,"poo":true,"moo-min":true,"moo-max":true,"bar-min":-32768,"bar-max":32767,"baz-min":-2147483648,"baz-max":2147483647,"taz-min":-9223372036854775808,"taz-max":9223372036854775807,"world":"2"},"list":[false,true,true,true,-32768,32767,-2147483648,2147483647,-9223372036854775808,9223372036854775807,0.000000,179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]}
  228. [*] blobmsg from json:
  229. Message: Hello, world!
  230. List: {
  231. 0 (i8)
  232. 1 (i8)
  233. 1 (i8)
  234. 1 (i8)
  235. -32768 (i32)
  236. 32767 (i32)
  237. -2147483648 (i32)
  238. 2147483647 (i32)
  239. -9223372036854775808 (i64)
  240. 9223372036854775807 (i64)
  241. 0.000000 (dbl)
  242. 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl)
  243. }
  244. Testdata: {
  245. \tdbl-min : 0.000000 (dbl) (esc)
  246. \tdbl-max : 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 (dbl) (esc)
  247. \tfoo : 0 (i8) (esc)
  248. \tpoo : 1 (i8) (esc)
  249. \tmoo-min : 1 (i8) (esc)
  250. \tmoo-max : 1 (i8) (esc)
  251. \tbar-min : -32768 (i32) (esc)
  252. \tbar-max : 32767 (i32) (esc)
  253. \tbaz-min : -2147483648 (i32) (esc)
  254. \tbaz-max : 2147483647 (i32) (esc)
  255. \ttaz-min : -9223372036854775808 (i64) (esc)
  256. \ttaz-max : 9223372036854775807 (i64) (esc)
  257. \tworld : 2 (str) (esc)
  258. }