Clone of official tools
host_tests/serial_complete_auto.py@47:21ae3e5a7128, 2021-02-04 (annotated)
- Committer:
- Anders Blomdell
- Date:
- Thu Feb 04 17:17:13 2021 +0100
- Revision:
- 47:21ae3e5a7128
- Parent:
- 13:ab47a20b66f0
Add a few normpath calls
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
screamer | 13:ab47a20b66f0 | 1 | """ |
screamer | 13:ab47a20b66f0 | 2 | mbed SDK |
screamer | 13:ab47a20b66f0 | 3 | Copyright (c) 2011-2013 ARM Limited |
screamer | 13:ab47a20b66f0 | 4 | |
screamer | 13:ab47a20b66f0 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
screamer | 13:ab47a20b66f0 | 6 | you may not use this file except in compliance with the License. |
screamer | 13:ab47a20b66f0 | 7 | You may obtain a copy of the License at |
screamer | 13:ab47a20b66f0 | 8 | |
screamer | 13:ab47a20b66f0 | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
screamer | 13:ab47a20b66f0 | 10 | |
screamer | 13:ab47a20b66f0 | 11 | Unless required by applicable law or agreed to in writing, software |
screamer | 13:ab47a20b66f0 | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
screamer | 13:ab47a20b66f0 | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
screamer | 13:ab47a20b66f0 | 14 | See the License for the specific language governing permissions and |
screamer | 13:ab47a20b66f0 | 15 | limitations under the License. |
screamer | 13:ab47a20b66f0 | 16 | """ |
screamer | 13:ab47a20b66f0 | 17 | |
screamer | 13:ab47a20b66f0 | 18 | import sys |
screamer | 13:ab47a20b66f0 | 19 | import uuid |
screamer | 13:ab47a20b66f0 | 20 | import time |
screamer | 13:ab47a20b66f0 | 21 | import string |
screamer | 13:ab47a20b66f0 | 22 | from sys import stdout |
screamer | 13:ab47a20b66f0 | 23 | |
screamer | 13:ab47a20b66f0 | 24 | class SerialCompleteTest(): |
screamer | 13:ab47a20b66f0 | 25 | |
screamer | 13:ab47a20b66f0 | 26 | def test(self, selftest): |
screamer | 13:ab47a20b66f0 | 27 | strip_chars = string.whitespace + "\0" |
screamer | 13:ab47a20b66f0 | 28 | out_str = selftest.mbed.serial_readline() |
screamer | 13:ab47a20b66f0 | 29 | selftest.notify("HOST: " + out_str) |
screamer | 13:ab47a20b66f0 | 30 | |
screamer | 13:ab47a20b66f0 | 31 | if not out_str: |
screamer | 13:ab47a20b66f0 | 32 | selftest.notify("HOST: No output detected") |
screamer | 13:ab47a20b66f0 | 33 | return selftest.RESULT_IO_SERIAL |
screamer | 13:ab47a20b66f0 | 34 | |
screamer | 13:ab47a20b66f0 | 35 | out_str_stripped = out_str.strip(strip_chars) |
screamer | 13:ab47a20b66f0 | 36 | |
screamer | 13:ab47a20b66f0 | 37 | if out_str_stripped != "123456789": |
screamer | 13:ab47a20b66f0 | 38 | selftest.notify("HOST: Unexpected output. '123456789' Expected. but received '%s'" % out_str_stripped) |
screamer | 13:ab47a20b66f0 | 39 | return selftest.RESULT_FAILURE |
screamer | 13:ab47a20b66f0 | 40 | |
screamer | 13:ab47a20b66f0 | 41 | else: |
screamer | 13:ab47a20b66f0 | 42 | return selftest.RESULT_SUCCESS |
screamer | 13:ab47a20b66f0 | 43 |