Skip to content

Add log compare test for kvstore example #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ Image: ./BUILD/K64F/ARM/mbed-os-example-kvstore.bin
1. Open the UART of the board in your favorite UART viewing program. For
example, `screen /dev/ttyACM0`.

**Note:** The default serial port baud rate is 115200 bit/s.
**Note:** The default serial port baud rate is 9600 bit/s.
You may open serial term with:

```
mbed sterm -b 115200 -r
mbed sterm -b 9600 -r
```

Expected output:
Expand Down
2 changes: 0 additions & 2 deletions mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"storage.storage_type": "TDB_INTERNAL"
},
"*": {
"platform.stdio-baud-rate": 115200,
"platform.default-serial-baud-rate": 115200,
"platform.stdio-convert-newlines": 1
}
}
Expand Down
12 changes: 12 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Testing examples

Examples are tested using tool [htrun](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-host-tests) and templated print log.

To run the test, use following command after you build the example:
```
mbedhtrun -d D: -p COM4 -m K64F -f .\BUILD\K64F\GCC_ARM\kvstore.bin --compare-log tests\kvstore.log
```


More details about `htrun` are [here](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-host-tests#testing-mbed-os-examples).

32 changes: 32 additions & 0 deletions tests/kvstore.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--- Mbed OS KVStore static API example ---
kv_reset
kv_reset -> 0
kv_set first dummy key
kv_set -> 0
kv_get_info of first key
kv_get_info -> 0
kv_get_info key: \/kv\/dummy_key1
kv_get_info info - size: 31, flags: 0
kv_get first key
kv_get -> 0
kv_get key: \/kv\/dummy_key1
kv_get value: kvstore_dummy_value_hello_world
kv_set second dummy key
kv_set -> 0
kv_set third key with Confidentiality and Replay Protection flags
kv_set -> 0
kv_set Set 'Real' Key 1
kv_set -> 0
kv_set Set 'Real' Key 2 with flag write-once
kv_set -> 0
Removing 'Dummy' Keys
1\) Removing dummy_key2
2\) Removing dummy_auth_enc_key
3\) Removing dummy_key1
Remaining with 'Real' Keys:
1\) real_key1
2\) real_wo_key
kv_remove write-once file - should fail!
kv_remove -> 274
kv_reset format kvstore \(including write-once\)
kv_reset -> 0