Skip to content

Commit f4ed666

Browse files
author
Seppo Takalo
authored
Merge pull request #25 from jamesbeyond/test
Add log compare test for kvstore example
2 parents b43a7ed + bba775f commit f4ed666

File tree

4 files changed

+47
-4
lines changed

4 files changed

+47
-4
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@ Image: ./BUILD/K64F/ARM/mbed-os-example-kvstore.bin
110110
1. Open the UART of the board in your favorite UART viewing program. For
111111
example, `screen /dev/ttyACM0`.
112112

113-
**Note:** The default serial port baud rate is 115200 bit/s.
113+
**Note:** The default serial port baud rate is 9600 bit/s.
114114
You may open serial term with:
115+
115116
```
116-
mbed sterm -b 115200 -r
117+
mbed sterm -b 9600 -r
117118
```
118119

119120
Expected output:

mbed_app.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"storage.storage_type": "TDB_INTERNAL"
55
},
66
"*": {
7-
"platform.stdio-baud-rate": 115200,
8-
"platform.default-serial-baud-rate": 115200,
97
"platform.stdio-convert-newlines": 1
108
}
119
}

tests/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Testing examples
2+
3+
Examples are tested using tool [htrun](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-host-tests) and templated print log.
4+
5+
To run the test, use following command after you build the example:
6+
```
7+
mbedhtrun -d D: -p COM4 -m K64F -f .\BUILD\K64F\GCC_ARM\kvstore.bin --compare-log tests\kvstore.log
8+
```
9+
10+
11+
More details about `htrun` are [here](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-host-tests#testing-mbed-os-examples).
12+

tests/kvstore.log

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--- Mbed OS KVStore static API example ---
2+
kv_reset
3+
kv_reset -> 0
4+
kv_set first dummy key
5+
kv_set -> 0
6+
kv_get_info of first key
7+
kv_get_info -> 0
8+
kv_get_info key: \/kv\/dummy_key1
9+
kv_get_info info - size: 31, flags: 0
10+
kv_get first key
11+
kv_get -> 0
12+
kv_get key: \/kv\/dummy_key1
13+
kv_get value: kvstore_dummy_value_hello_world
14+
kv_set second dummy key
15+
kv_set -> 0
16+
kv_set third key with Confidentiality and Replay Protection flags
17+
kv_set -> 0
18+
kv_set Set 'Real' Key 1
19+
kv_set -> 0
20+
kv_set Set 'Real' Key 2 with flag write-once
21+
kv_set -> 0
22+
Removing 'Dummy' Keys
23+
1\) Removing dummy_key2
24+
2\) Removing dummy_auth_enc_key
25+
3\) Removing dummy_key1
26+
Remaining with 'Real' Keys:
27+
1\) real_key1
28+
2\) real_wo_key
29+
kv_remove write-once file - should fail!
30+
kv_remove -> 274
31+
kv_reset format kvstore \(including write-once\)
32+
kv_reset -> 0

0 commit comments

Comments
 (0)