mbedmicro/mbed — pull request #588 by PrzemekWirkus (2014-10-21 13:01:04+00:00)
Title: Host test refactoring  - part2

## Description
This pull request is following previous one.
Changed host test to support run() and test() method tandem.
When users will trite their own host tests in future they can just overload test() method and return proper result status which will be handled by Test::run() method.
Current host test improvement are done so host test code is shorter, cleaner and faster. Also control flow goes to one place from each host test.

* Host test refactoring: cleaned a bit functionality of host tests. Forced test() function in DefaultTest to be method returning test result.
* Cleaned pyFlakes issues with unused imports
* Minor style improvement
* This refactoring is also preparing host tests for plug-in architecture improvements.
* Still NET_ related tests can be refactored.
## Verification Results
Before pull request I've ran tests with new host test implementation in CI server. Results below:

```
C:\Work\m-p\workspace_tools> git branch
host_test-OO-refactoring
* host_test_OO_refactoring_part2
master

Test summary:
+--------+---------+-----------+-----------+---------------------------------------+--------------------+---------------+-------+
| Result | Target | Toolchain | Test ID | Test Description | Elapsed Time (sec) | Timeout (sec) | Loops |
+--------+---------+-----------+-----------+---------------------------------------+--------------------+---------------+-------+
| OK | K64F | ARM | DTCT_1 | Simple detect test | 0.53 | 10 | 1/1 |
| OK | K64F | ARM | EXAMPLE_1 | /dev/null | 3.56 | 10 | 1/1 |
| OK | K64F | ARM | MBED_10 | Hello World | 0.42 | 10 | 1/1 |
| OK | K64F | ARM | MBED_11 | Ticker Int | 10.49 | 20 | 1/1 |
| OK | K64F | ARM | MBED_12 | C++ | 1.44 | 10 | 1/1 |
| OK | K64F | ARM | MBED_16 | RTC | 4.66 | 15 | 1/1 |
| OK | K64F | ARM | MBED_2 | stdio | 0.83 | 20 | 1/1 |
| OK | K64F | ARM | MBED_23 | Ticker Int us | 11.47 | 15 | 1/1 |
| OK | K64F | ARM | MBED_24 | Timeout Int us | 11.53 | 15 | 1/1 |
| OK | K64F | ARM | MBED_25 | Time us | 11.42 | 15 | 1/1 |
| OK | K64F | ARM | MBED_26 | Integer constant division | 1.44 | 10 | 1/1 |
| OK | K64F | ARM | MBED_34 | Ticker Two callbacks | 10.42 | 15 | 1/1 |
| OK | K64F | ARM | MBED_A1 | Basic | 1.48 | 10 | 1/1 |
| OK | K64F | ARM | MBED_A21 | Call function before main (mbed_main) | 1.43 | 10 | 1/1 |
| OK | K64F | ARM | MBED_A9 | Serial Echo at 115200 | 5.9 | 10 | 1/1 |
| OK | K64F | ARM | NET_1 | TCP client hello world | 2.45 | 15 | 1/1 |
| OK | K64F | ARM | NET_13 | TCP client echo loop | 2.11 | 15 | 1/1 |
| OK | K64F | ARM | NET_2 | UDP client hello world | 5.49 | 15 | 1/1 |
| OK | K64F | ARM | NET_3 | TCP echo server | 1.61 | 10 | 1/1 |
| OK | K64F | ARM | NET_4 | TCP echo client | 1.59 | 10 | 1/1 |
| OK | K64F | ARM | NET_5 | UDP echo server | 1.54 | 10 | 1/1 |
| OK | K64F | ARM | NET_6 | UDP echo client | 1.68 | 10 | 1/1 |
| OK | K64F | ARM | NET_7 | HTTP client | 4.46 | 15 | 1/1 |
| OK | K64F | ARM | NET_8 | NTP client | 4.45 | 10 | 1/1 |
| OK | K64F | ARM | RTOS_1 | Basic thread | 10.44 | 15 | 1/1 |
| OK | K64F | ARM | RTOS_2 | Mutex resource lock | 11.67 | 20 | 1/1 |
| OK | K64F | ARM | RTOS_3 | Semaphore resource lock | 8.56 | 20 | 1/1 |
| OK | K64F | ARM | RTOS_4 | Signals messaging | 6.54 | 10 | 1/1 |
| OK | K64F | ARM | RTOS_5 | Queue messaging | 2.43 | 10 | 1/1 |
| OK | K64F | ARM | RTOS_6 | Mail messaging | 2.53 | 10 | 1/1 |
| OK | K64F | ARM | RTOS_7 | Timer | 11.44 | 15 | 1/1 |
| OK | K64F | ARM | RTOS_8 | ISR (Queue) | 6.5 | 10 | 1/1 |
| OK | LPC1768 | uARM | DTCT_1 | Simple detect test | 1.33 | 10 | 1/1 |
| OK | LPC1768 | uARM | EXAMPLE_1 | /dev/null | 4.26 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_10 | Hello World | 1.19 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_11 | Ticker Int | 12.2 | 20 | 1/1 |
| OK | LPC1768 | uARM | MBED_12 | C++ | 1.44 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_16 | RTC | 5.41 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_2 | stdio | 1.67 | 20 | 1/1 |
| OK | LPC1768 | uARM | MBED_22 | Semihost | 1.43 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_23 | Ticker Int us | 12.22 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_24 | Timeout Int us | 12.28 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_25 | Time us | 12.23 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_26 | Integer constant division | 1.48 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_34 | Ticker Two callbacks | 12.14 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_A1 | Basic | 1.44 | 10 | 1/1 |
| FAIL | LPC1768 | uARM | MBED_A18 | Interrupt vector relocation | 3.46 | 10 | 0/1 |
| OK | LPC1768 | uARM | MBED_A2 | Semihost file system | 2.53 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_A21 | Call function before main (mbed_main) | 1.5 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_A9 | Serial Echo at 115200 | 6.68 | 10 | 1/1 |
| OK | LPC1768 | uARM | NET_1 | TCP client hello world | 5.51 | 15 | 1/1 |
| OK | LPC1768 | uARM | NET_13 | TCP client echo loop | 5.6 | 15 | 1/1 |
| OK | LPC1768 | uARM | NET_2 | UDP client hello world | 5.46 | 15 | 1/1 |
| OK | LPC1768 | uARM | NET_3 | TCP echo server | 5.05 | 10 | 1/1 |
| OK | LPC1768 | uARM | NET_4 | TCP echo client | 5.02 | 10 | 1/1 |
| OK | LPC1768 | uARM | NET_5 | UDP echo server | 4.98 | 10 | 1/1 |
| OK | LPC1768 | uARM | NET_6 | UDP echo client | 5.63 | 10 | 1/1 |
| OK | LPC1768 | uARM | NET_7 | HTTP client | 7.52 | 15 | 1/1 |
| OK | LPC1768 | uARM | NET_8 | NTP client | 5.56 | 10 | 1/1 |
| OK | LPC1768 | uARM | RTOS_1 | Basic thread | 12.32 | 15 | 1/1 |
| OK | LPC1768 | uARM | RTOS_2 | Mutex resource lock | 11.55 | 20 | 1/1 |
| OK | LPC1768 | uARM | RTOS_3 | Semaphore resource lock | 9.56 | 20 | 1/1 |
| OK | LPC1768 | uARM | RTOS_4 | Signals messaging | 6.51 | 10 | 1/1 |
| OK | LPC1768 | uARM | RTOS_5 | Queue messaging | 3.46 | 10 | 1/1 |
| OK | LPC1768 | uARM | RTOS_6 | Mail messaging | 3.45 | 10 | 1/1 |
| OK | LPC1768 | uARM | RTOS_7 | Timer | 12.29 | 15 | 1/1 |
| OK | LPC1768 | uARM | RTOS_8 | ISR (Queue) | 6.51 | 10 | 1/1 |
| OK | LPC1768 | ARM | DTCT_1 | Simple detect test | 1.4 | 10 | 1/1 |
| OK | LPC1768 | ARM | EXAMPLE_1 | /dev/null | 4.43 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_10 | Hello World | 1.36 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_11 | Ticker Int | 12.26 | 20 | 1/1 |
| OK | LPC1768 | ARM | MBED_12 | C++ | 2.53 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_16 | RTC | 5.51 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_2 | stdio | 1.79 | 20 | 1/1 |
| OK | LPC1768 | ARM | MBED_22 | Semihost | 2.53 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_23 | Ticker Int us | 12.31 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_24 | Timeout Int us | 12.39 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_25 | Time us | 12.39 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_26 | Integer constant division | 2.4 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_34 | Ticker Two callbacks | 12.36 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_A1 | Basic | 1.43 | 10 | 1/1 |
| FAIL | LPC1768 | ARM | MBED_A18 | Interrupt vector relocation | 3.51 | 10 | 0/1 |
| OK | LPC1768 | ARM | MBED_A2 | Semihost file system | 2.45 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_A21 | Call function before main (mbed_main) | 1.43 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_A9 | Serial Echo at 115200 | 6.8 | 10 | 1/1 |
| OK | LPC1768 | ARM | NET_1 | TCP client hello world | 5.52 | 15 | 1/1 |
| OK | LPC1768 | ARM | NET_13 | TCP client echo loop | 5.63 | 15 | 1/1 |
| OK | LPC1768 | ARM | NET_2 | UDP client hello world | 5.52 | 15 | 1/1 |
| FAIL | LPC1768 | ARM | NET_3 | TCP echo server | 5.49 | 10 | 0/1 |
| OK | LPC1768 | ARM | NET_4 | TCP echo client | 5.16 | 10 | 1/1 |
| OK | LPC1768 | ARM | NET_5 | UDP echo server | 5.15 | 10 | 1/1 |
| OK | LPC1768 | ARM | NET_6 | UDP echo client | 5.24 | 10 | 1/1 |
| OK | LPC1768 | ARM | NET_7 | HTTP client | 7.57 | 15 | 1/1 |
| OK | LPC1768 | ARM | NET_8 | NTP client | 5.52 | 10 | 1/1 |
| OK | LPC1768 | ARM | RTOS_1 | Basic thread | 12.36 | 15 | 1/1 |
| OK | LPC1768 | ARM | RTOS_2 | Mutex resource lock | 12.62 | 20 | 1/1 |
| OK | LPC1768 | ARM | RTOS_3 | Semaphore resource lock | 9.58 | 20 | 1/1 |
| OK | LPC1768 | ARM | RTOS_4 | Signals messaging | 6.54 | 10 | 1/1 |
| OK | LPC1768 | ARM | RTOS_5 | Queue messaging | 3.48 | 10 | 1/1 |
| OK | LPC1768 | ARM | RTOS_6 | Mail messaging | 3.48 | 10 | 1/1 |
| OK | LPC1768 | ARM | RTOS_7 | Timer | 12.4 | 15 | 1/1 |
| OK | LPC1768 | ARM | RTOS_8 | ISR (Queue) | 6.59 | 10 | 1/1 |
+--------+---------+-----------+-----------+---------------------------------------+--------------------+---------------+-------+
Result: 3 FAIL / 99 OK

Completed in 1062.08 sec
```