Imported Upstream version 3.2
[platform/upstream/libwebsockets.git] / minimal-examples / api-tests / api-test-lws_struct-json / README.md
1 # lws api test lws_struct JSON
2
3 Demonstrates how to use and performs selftests for lws_struct
4 JSON serialization and deserialization
5
6 ## build
7
8 ```
9  $ cmake . && make
10 ```
11
12 ## usage
13
14 Commandline option|Meaning
15 ---|---
16 -d <loglevel>|Debug verbosity in decimal, eg, -d15
17
18 ```
19  $ ./lws-api-test-lws_struct-json
20 [2019/03/30 22:09:09:2529] USER: LWS API selftest: lws_struct JSON
21 [2019/03/30 22:09:09:2625] NOTICE: main: ++++++++++++++++ test 1
22 [2019/03/30 22:09:09:2812] NOTICE: builder.hostname = 'learn', timeout = 1800, targets (2)
23 [2019/03/30 22:09:09:2822] NOTICE:     target.name 'target1' (target 0x543a830)
24 [2019/03/30 22:09:09:2824] NOTICE:     target.name 'target2' (target 0x543a860)
25 [2019/03/30 22:09:09:2826] NOTICE: main:    .... strarting serialization of test 1
26 [2019/03/30 22:09:09:2899] NOTICE: ser says 1
27 {"schema":"com-warmcat-sai-builder","hostname":"learn","nspawn_timeout":1800,"targets":[{"name":"target1"},{"name":"target2"}]}
28 [2019/03/30 22:09:09:2929] NOTICE: main: ++++++++++++++++ test 2
29 [2019/03/30 22:09:09:2932] NOTICE: builder.hostname = 'learn', timeout = 0, targets (3)
30 [2019/03/30 22:09:09:2932] NOTICE:     target.name 'target1' (target 0x543b060)
31 [2019/03/30 22:09:09:2933] NOTICE:     target.name 'target2' (target 0x543b090)
32 [2019/03/30 22:09:09:2933] NOTICE:     target.name 'target3' (target 0x543b0c0)
33 [2019/03/30 22:09:09:2934] NOTICE: main:    .... strarting serialization of test 2
34 [2019/03/30 22:09:09:2935] NOTICE: ser says 1
35 {"schema":"com-warmcat-sai-builder","hostname":"learn","nspawn_timeout":0,"targets":[{"name":"target1"},{"name":"target2"},{"name":"target3"}]}
36 [2019/03/30 22:09:09:2940] NOTICE: main: ++++++++++++++++ test 3
37 [2019/03/30 22:09:09:2959] NOTICE: builder.hostname = 'learn', timeout = 1800, targets (2)
38 [2019/03/30 22:09:09:2960] NOTICE:     target.name 'target1' (target 0x543b450)
39 [2019/03/30 22:09:09:2961] NOTICE:       child 0x543b480, target.child.somename 'abc'
40 [2019/03/30 22:09:09:2961] NOTICE:     target.name 'target2' (target 0x543b490)
41 [2019/03/30 22:09:09:2962] NOTICE: main:    .... strarting serialization of test 3
42 [2019/03/30 22:09:09:2969] NOTICE: ser says 1
43 {"schema":"com-warmcat-sai-builder","hostname":"learn","nspawn_timeout":1800,"targets":[{"name":"target1","child":{"somename":"abc"}},{"name":"target2"}]}
44 [2019/03/30 22:09:09:2970] NOTICE: main: ++++++++++++++++ test 4
45 [2019/03/30 22:09:09:2971] NOTICE: builder.hostname = 'learn', timeout = 1800, targets (0)
46 [2019/03/30 22:09:09:2971] NOTICE: main:    .... strarting serialization of test 4
47 [2019/03/30 22:09:09:2973] NOTICE: ser says 1
48 {"schema":"com-warmcat-sai-builder","hostname":"learn","nspawn_timeout":1800}
49 [2019/03/30 22:09:09:2974] NOTICE: main: ++++++++++++++++ test 5
50 [2019/03/30 22:09:09:2978] NOTICE: builder.hostname = '', timeout = 0, targets (0)
51 [2019/03/30 22:09:09:2979] NOTICE: main:    .... strarting serialization of test 5
52 [2019/03/30 22:09:09:2980] NOTICE: ser says 1
53 {"schema":"com-warmcat-sai-builder","hostname":"","nspawn_timeout":0}
54 [2019/03/30 22:09:09:2982] USER: Completed: PASS
55 ```
56