]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/workspace_tools/host_tests/hello_auto.py
xt_usb: Fix XT soft reset
[max/tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / workspace_tools / host_tests / hello_auto.py
1 """
2 mbed SDK
3 Copyright (c) 2011-2013 ARM Limited
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 """
17
18 class HelloTest():
19     HELLO_WORLD = "Hello World"
20
21     def test(self, selftest):
22         c = selftest.mbed.serial_readline()
23         if c is None:
24            return selftest.RESULT_IO_SERIAL
25         selftest.notify("Read %d bytes:"% len(c))
26         selftest.notify(c.strip())
27
28         result = True
29         # Because we can have targetID here let's try to decode
30         if len(c) < len(self.HELLO_WORLD):
31             result = False
32         else:
33             result = self.HELLO_WORLD in c
34         return selftest.RESULT_SUCCESS if result else selftest.RESULT_FAILURE