-
Notifications
You must be signed in to change notification settings - Fork 44
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
[devel_transport] Async host test execition support #78
Conversation
|
||
def get_test_result(output): | ||
"""! Parse test 'output' data | ||
@details If test result not found returns by default TEST_RESULT_TIMEOUT value | ||
@return Returns found test result | ||
""" | ||
result = TEST_RESULT_TIMEOUT | ||
RE_DETECT_TESTCASE_RESULT = re.compile("\\{(" + "|".join(TEST_RESULT_MAPPING.keys()) + ")\\}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still valid to use capital letter for this local variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change it to lower case !
PS: CircleCI dies because of not mocked |
Parallel tests are incompatible with new htrun
Fixed missing text reporting table with test cases
Add YottaModule unit tests Fix for IOTSFW-2070: ``` mbedgt: mbed-host-test-runner: stopped mbedgt: mbed-host-test-runner: returned 'OK' mbedgt: test on hardware with target id: 0240022648e91e7c000000000000000000000000b530e3c4 mbedgt: test suite 'utest-test-case_control_async' ................................................... OK in 16.41 sec test case: 'Control: RepeatAllOnTimeout' ..................................................... OK in 0.09 sec test case: 'Control: RepeatHandlerOnTimeout' ................................................. OK in 1.48 sec test case: 'Control: Timeout (Failure)' ...................................................... OK in 0.00 sec test case: 'Control: Timeout (Success)' ...................................................... OK in 0.00 sec mbedgt: test case summary: 7 passes, 0 failures mbedgt: test case summary mismatch: reported passes vs failures miscount! mbedgt: shuffle seed: 0.8589458441 mbedgt: exporting to JUnit file 'JUnit.xml'... mbedgt: unexpected error: can only join an iterable Traceback (most recent call last): File "C:\jslv3_2\ws\gtt@2\venv\Scripts\mbedgt-script.py", line 9, in <module> load_entry_point('mbed-greentea', 'console_scripts', 'mbedgt')() File "c:\jslv3_2\ws\gtt@2\venv\src\mbed-greentea\mbed_greentea\mbed_greentea_cli.py", line 315, in main cli_ret = main_cli(opts, args) File "c:\jslv3_2\ws\gtt@2\venv\src\mbed-greentea\mbed_greentea\mbed_greentea_cli.py", line 788, in main_cli junit_report = exporter_testcase_junit(test_report, test_suite_properties=yotta_module.get_data()) File "c:\jslv3_2\ws\gtt@2\venv\src\mbed-greentea\mbed_greentea\mbed_report_api.py", line 225, in exporter_testcase_junit tc_stdout = '\n'.join(utest_log) ...
Polishing of "test case summary mismatch" message
ac817f2
to
7280188
Compare
This feature is used to assume that some binaries will operate without utest instrumentation. For example tests for MINAR, some tests in CORE-UTIL etc. may require special binary preparation.
[devel_transport] Async host test execition support Road to version 0.2.0.
Description
Async host test execution feature:
--digest <stdin>
and--digest <filename>
(This may breakyotta test
command).Related PRs:
mbed-drivers
test_env.*
APIs.Design
{{KEY;VALUE}}}
messages sent by slave (DUT). Both key and value are strings.{{__sync;UUID-STRING}}}
with message value containing random UUID string.{{__sync;...}}
message in input stream and replies with the same packer{{__sync;...}}
.{{__timeout;%d}}
and{{__host_test_name}}
are expected.(key, value, timestamp)
, where key and value are extracted from message and{{key;value}}
string captured on DUT output.key
(string),value
(string),timestamp
where timestamp``` is time of message reception in Python time.time() format (float, time in seconds since the epoch as a floating point number.).__
in name:__sync
- sync message, used by master and DUT to handshake.__timeout
- timeout in sec, sent by DUT after{{sync;UUID}}
is received.__host_test_name
- host test name, sent by DUT after{{sync;UUID}}
is received.__notify_prn
- sent by host test to print log message.__notify_conn_lost
- sent by host test's connection process to notify serial port connection lost.__notify_complete
- sent by DUT, async notificaion about test case result (true, false, none).__coverage_start
- sent by DUT, coverage data.__testcase_start
- sent by DUT, test case start data.__testcase_finish
- sent by DUT, test case result.__exit
- sent by DUT, test suite execution finished.__
in name:__rxd_line
- Event triggered when\n
was found on DUT RXD channel. It can be overridden (self.register_callback('__rxd_line', <callback_function>)
) and used by user. Event is sent by host test to notify a new line of text was received on RXD channel.__rxd_line
event payload (value) in a line of text received from DUT over RXD.setup()
used to initialize host test and register callbacks.result()
used to return test case result whennotify_complete()
is not called.teardown()
used to finalize and resource freeing. It is guaranteed thatteardown()
will be always called after timeout or async test completion().notify_complete(result : bool)
used by host test to notify test case result. This result will be read after test suiteTIMEOUT
s or after DUT send__exit
message (test suite execution finished event).self.send_kv(key : string, value : string)
- send key-value message to DUT.self.log(text : string)
- send event__notify_prn
with text as payload (value). Your message will be printed in log.utest
framework.Callback
You can register callbacks in
setup()
phase or decorate callback functions using@event_callback
decorator.Callback registration in setup() method
Below the same callback registered using decorator:
Callback decorator definition
Parsing text received from DUT (line by line)
Example of host test expecting
Runtime error ... CallbackNode ...
string in DUT output.We will use allowed to override
__rxd_line
event to hook to DUT RXD channel lines of text.Before Greentea v0.2.0
Using __rdx_line event
htrun
new log format:[timestamp][source][level]
- new log format, where:timestamp
- returned by Python'stime.time()
.source
- log source.CONN
- connection process (pooling for connection source e.g. serial port),SERI
- serial port wrapper with standard read, write, flush interface,HTST
- host test object, HostTestBase derived object,level
- logging level:INF
(info),WRN
(warning) andERR
(error).TXD
(host's TX channel, to DUT).RXD
(host's RX channel, from DUT).Log example
CONN
(connection process).RXD
channel emitted{{__sync;a7ace3a2-4025-4950-b9fc-a3671103387a}}
.2016-02-11 19:53:27
, see below:Greentea client API (currently test_env.h/cpp)
Functions are used to send key-string or key-integer value messages to master. This functions should replace typical
printf()
calls with payload/control data to host.This function should replace
scanf()
used to check for incoming messages from master.Function parses input and if key-value message is found load to
out_key
,out_value
key-value pair. Useout_key_size
and `out_value_size`` to define out buffers max size (including trailing zero).Key-value transport protocol sequence
DUT - host test case workflow
DUT implementation
Example of corresponding host test
Log:
Host test examples
Return result after __exit
Corresponding log:
TODO
Changes
See corresponding changes in:
Example use / test change
greentea
(skip build to avoid errors related to core-util dependencies mismatch):(you can start gently with one test case:)
You should get something like this: