Clone of official tools
host_tests/default_auto.py@43:2a7da56ebd24, 2018-09-25 (annotated)
- Committer:
- theotherjimmy
- Date:
- Tue Sep 25 13:43:09 2018 -0500
- Revision:
- 43:2a7da56ebd24
- Parent:
- 0:66f3b5499f7f
Release 5.10.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
screamer | 0:66f3b5499f7f | 1 | """ |
screamer | 0:66f3b5499f7f | 2 | mbed SDK |
screamer | 0:66f3b5499f7f | 3 | Copyright (c) 2011-2013 ARM Limited |
screamer | 0:66f3b5499f7f | 4 | |
screamer | 0:66f3b5499f7f | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
screamer | 0:66f3b5499f7f | 6 | you may not use this file except in compliance with the License. |
screamer | 0:66f3b5499f7f | 7 | You may obtain a copy of the License at |
screamer | 0:66f3b5499f7f | 8 | |
screamer | 0:66f3b5499f7f | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
screamer | 0:66f3b5499f7f | 10 | |
screamer | 0:66f3b5499f7f | 11 | Unless required by applicable law or agreed to in writing, software |
screamer | 0:66f3b5499f7f | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
screamer | 0:66f3b5499f7f | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
screamer | 0:66f3b5499f7f | 14 | See the License for the specific language governing permissions and |
screamer | 0:66f3b5499f7f | 15 | limitations under the License. |
screamer | 0:66f3b5499f7f | 16 | """ |
theotherjimmy |
43:2a7da56ebd24 | 17 | from __future__ import print_function |
screamer | 0:66f3b5499f7f | 18 | |
screamer | 0:66f3b5499f7f | 19 | from sys import stdout |
screamer | 0:66f3b5499f7f | 20 | |
screamer | 0:66f3b5499f7f | 21 | class DefaultAuto(): |
screamer | 0:66f3b5499f7f | 22 | """ Simple, basic host test's test runner waiting for serial port |
screamer | 0:66f3b5499f7f | 23 | output from MUT, no supervision over test running in MUT is executed. |
screamer | 0:66f3b5499f7f | 24 | """ |
screamer | 0:66f3b5499f7f | 25 | def test(self, selftest): |
screamer | 0:66f3b5499f7f | 26 | result = selftest.RESULT_SUCCESS |
screamer | 0:66f3b5499f7f | 27 | try: |
screamer | 0:66f3b5499f7f | 28 | while True: |
screamer | 0:66f3b5499f7f | 29 | c = selftest.mbed.serial_read(512) |
screamer | 0:66f3b5499f7f | 30 | if c is None: |
screamer | 0:66f3b5499f7f | 31 | return selftest.RESULT_IO_SERIAL |
screamer | 0:66f3b5499f7f | 32 | stdout.write(c) |
screamer | 0:66f3b5499f7f | 33 | stdout.flush() |
theotherjimmy |
43:2a7da56ebd24 | 34 | except KeyboardInterrupt: |
screamer | 0:66f3b5499f7f | 35 | selftest.notify("\r\n[CTRL+C] exit") |
screamer | 0:66f3b5499f7f | 36 | result = selftest.RESULT_ERROR |
screamer | 0:66f3b5499f7f | 37 | return result |