OVMS3-idf/tools/kconfig_new/test
Angus Gratton 90ddbaac16 confserver: Add support for new V2 protocol
V2 adds:
* Independent result for visibility (showing/hiding menus)
* Includes adding IDs for all items (menus & symbols) in kconfig_menus.json

Still backwards compatible with V1, with some small changes (menu items now listed in results).

Also added some protocol docs, changed the "listening on stdin" message to come after any kconfiglib warnings
2019-03-15 17:37:09 +11:00
..
Kconfig confserver: Add support for new V2 protocol 2019-03-15 17:37:09 +11:00
README.md confserver: Add support for new V2 protocol 2019-03-15 17:37:09 +11:00
sdkconfig kconfig: Add confserver.py to expose sdkconfig to clients 2018-06-07 14:23:08 +10:00
test_confserver.py confserver: Add support for new V2 protocol 2019-03-15 17:37:09 +11:00
testcases_v1.txt confserver: Add support for new V2 protocol 2019-03-15 17:37:09 +11:00
testcases_v2.txt confserver: Add support for new V2 protocol 2019-03-15 17:37:09 +11:00

KConfig Tests

confserver.py tests

Install pexpect (pip install pexpect).

Then run the tests manually like this:

./test_confserver.py --logfile tests.log

If a weird error message comes up from the test, check the log file (tests.log) which has the full interaction session (input and output) from confserver.py - sometimes the test suite misinterprets some JSON-like content in a Python error message as JSON content.

Note: confserver.py prints its error messages on stderr, to avoid overlap with JSON content on stdout. However pexpect uses a pty (virtual terminal) which can't distinguish stderr and stdout.

Test cases apply to KConfig config schema. Cases are listed in testcases.txt and are each of this form:

* Set TEST_BOOL, showing child items
> { "TEST_BOOL" : true }
< { "values" : { "TEST_BOOL" : true, "TEST_CHILD_STR" : "OHAI!", "TEST_CHILD_BOOL" : true }, "ranges": {"TEST_CONDITIONAL_RANGES": [0, 100]}, "visible": {"TEST_CHILD_BOOL" : true, "TEST_CHILD_STR" : true} }

  • First line (*) is description
  • Second line (>) is changes to send
  • Third line (<) is response to expect back
  • (Blank line between cases)

Test cases are run in sequence, so any test case depends on the state changes caused by all items above it.