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