mbedmicro/mbed — pull request #577 by PrzemekWirkus (2014-10-17 16:47:56+00:00)
Title: Host test refactoring - prepare to clean up host test implementation

### Changes:
Just made initial changes in host test code as a starting point for more intrusive refactoring.
1. Removed magic values,
2. Host test refactoring: created separate enum like class for test result strings
3. Use special function (notify) to print and flush so data stdout data from host test in immediately transferred to test suite via queue.

* Please ignore tests NET_1 and NET_7 failing, they are failing because mbed.org address changed to developer.mbed.org. It was fixed and delivered as minor issue to master directly.

### Verification
To check if my implementation works I've ran all tests with modified host tests:
```
C:\Work\m-p\workspace_tools> git branch
* host_test-OO-refactoring
master

C:\Work\m-p\workspace_tools> singletest.py -i test_spec_net.json -M muts_all_net.json

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.53 | 10 | 1/1 |
| OK | K64F | ARM | MBED_10 | Hello World | 0.47 | 10 | 1/1 |
| OK | K64F | ARM | MBED_11 | Ticker Int | 10.45 | 20 | 1/1 |
| OK | K64F | ARM | MBED_12 | C++ | 1.43 | 10 | 1/1 |
| OK | K64F | ARM | MBED_16 | RTC | 4.63 | 15 | 1/1 |
| OK | K64F | ARM | MBED_2 | stdio | 0.8 | 20 | 1/1 |
| OK | K64F | ARM | MBED_23 | Ticker Int us | 10.48 | 15 | 1/1 |
| OK | K64F | ARM | MBED_24 | Timeout Int us | 10.53 | 15 | 1/1 |
| OK | K64F | ARM | MBED_25 | Time us | 10.48 | 15 | 1/1 |
| OK | K64F | ARM | MBED_26 | Integer constant division | 1.5 | 10 | 1/1 |
| OK | K64F | ARM | MBED_34 | Ticker Two callbacks | 10.45 | 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.48 | 10 | 1/1 |
| OK | K64F | ARM | MBED_A9 | Serial Echo at 115200 | 5.91 | 10 | 1/1 |
| FAIL | K64F | ARM | NET_1 | TCP client hello world | 3.81 | 15 | 0/1 |
| OK | K64F | ARM | NET_13 | TCP client echo loop | 2.14 | 15 | 1/1 |
| OK | K64F | ARM | NET_2 | UDP client hello world | 2.45 | 15 | 1/1 |
| OK | K64F | ARM | NET_3 | TCP echo server | 1.62 | 10 | 1/1 |
| OK | K64F | ARM | NET_4 | TCP echo client | 1.62 | 10 | 1/1 |
| OK | K64F | ARM | NET_5 | UDP echo server | 1.5 | 10 | 1/1 |
| OK | K64F | ARM | NET_6 | UDP echo client | 1.62 | 10 | 1/1 |
| FAIL | K64F | ARM | NET_7 | HTTP client | 5.46 | 15 | 0/1 |
| OK | K64F | ARM | NET_8 | NTP client | 2.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.62 | 20 | 1/1 |
| OK | K64F | ARM | RTOS_3 | Semaphore resource lock | 8.53 | 20 | 1/1 |
| OK | K64F | ARM | RTOS_4 | Signals messaging | 6.46 | 10 | 1/1 |
| OK | K64F | ARM | RTOS_5 | Queue messaging | 2.46 | 10 | 1/1 |
| OK | K64F | ARM | RTOS_6 | Mail messaging | 2.4 | 10 | 1/1 |
| OK | K64F | ARM | RTOS_7 | Timer | 11.4 | 15 | 1/1 |
| OK | K64F | ARM | RTOS_8 | ISR (Queue) | 6.51 | 10 | 1/1 |
| OK | LPC1768 | uARM | DTCT_1 | Simple detect test | 1.29 | 10 | 1/1 |
| OK | LPC1768 | uARM | EXAMPLE_1 | /dev/null | 4.38 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_10 | Hello World | 1.23 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_11 | Ticker Int | 12.25 | 20 | 1/1 |
| OK | LPC1768 | uARM | MBED_12 | C++ | 1.5 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_16 | RTC | 5.35 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_2 | stdio | 1.65 | 20 | 1/1 |
| OK | LPC1768 | uARM | MBED_22 | Semihost | 1.44 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_23 | Ticker Int us | 12.25 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_24 | Timeout Int us | 12.34 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_25 | Time us | 12.23 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_26 | Integer constant division | 1.5 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_34 | Ticker Two callbacks | 12.23 | 15 | 1/1 |
| OK | LPC1768 | uARM | MBED_A1 | Basic | 1.43 | 10 | 1/1 |
| FAIL | LPC1768 | uARM | MBED_A18 | Interrupt vector relocation | 3.49 | 10 | 0/1 |
| OK | LPC1768 | uARM | MBED_A2 | Semihost file system | 2.46 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_A21 | Call function before main (mbed_main) | 1.42 | 10 | 1/1 |
| OK | LPC1768 | uARM | MBED_A9 | Serial Echo at 115200 | 6.74 | 10 | 1/1 |
| FAIL | LPC1768 | uARM | NET_1 | TCP client hello world | 7.02 | 15 | 0/1 |
| OK | LPC1768 | uARM | NET_13 | TCP client echo loop | 5.59 | 15 | 1/1 |
| OK | LPC1768 | uARM | NET_2 | UDP client hello world | 5.49 | 15 | 1/1 |
| OK | LPC1768 | uARM | NET_3 | TCP echo server | 5.1 | 10 | 1/1 |
| OK | LPC1768 | uARM | NET_4 | TCP echo client | 5.04 | 10 | 1/1 |
| OK | LPC1768 | uARM | NET_5 | UDP echo server | 4.96 | 10 | 1/1 |
| OK | LPC1768 | uARM | NET_6 | UDP echo client | 5.06 | 10 | 1/1 |
| FAIL | LPC1768 | uARM | NET_7 | HTTP client | 8.5 | 15 | 0/1 |
| OK | LPC1768 | uARM | NET_8 | NTP client | 5.46 | 10 | 1/1 |
| OK | LPC1768 | uARM | RTOS_1 | Basic thread | 12.26 | 15 | 1/1 |
| OK | LPC1768 | uARM | RTOS_2 | Mutex resource lock | 11.58 | 20 | 1/1 |
| OK | LPC1768 | uARM | RTOS_3 | Semaphore resource lock | 9.53 | 20 | 1/1 |
| OK | LPC1768 | uARM | RTOS_4 | Signals messaging | 6.6 | 10 | 1/1 |
| OK | LPC1768 | uARM | RTOS_5 | Queue messaging | 3.48 | 10 | 1/1 |
| OK | LPC1768 | uARM | RTOS_6 | Mail messaging | 3.48 | 10 | 1/1 |
| OK | LPC1768 | uARM | RTOS_7 | Timer | 12.36 | 15 | 1/1 |
| OK | LPC1768 | uARM | RTOS_8 | ISR (Queue) | 6.5 | 10 | 1/1 |
| OK | LPC1768 | ARM | DTCT_1 | Simple detect test | 1.39 | 10 | 1/1 |
| OK | LPC1768 | ARM | EXAMPLE_1 | /dev/null | 4.37 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_10 | Hello World | 1.26 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_11 | Ticker Int | 12.34 | 20 | 1/1 |
| OK | LPC1768 | ARM | MBED_12 | C++ | 2.45 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_16 | RTC | 5.47 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_2 | stdio | 1.65 | 20 | 1/1 |
| OK | LPC1768 | ARM | MBED_22 | Semihost | 2.46 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_23 | Ticker Int us | 12.25 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_24 | Timeout Int us | 12.36 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_25 | Time us | 12.36 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_26 | Integer constant division | 2.47 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_34 | Ticker Two callbacks | 12.33 | 15 | 1/1 |
| OK | LPC1768 | ARM | MBED_A1 | Basic | 1.5 | 10 | 1/1 |
| FAIL | LPC1768 | ARM | MBED_A18 | Interrupt vector relocation | 4.49 | 10 | 0/1 |
| OK | LPC1768 | ARM | MBED_A2 | Semihost file system | 2.43 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_A21 | Call function before main (mbed_main) | 1.48 | 10 | 1/1 |
| OK | LPC1768 | ARM | MBED_A9 | Serial Echo at 115200 | 5.87 | 10 | 1/1 |
| FAIL | LPC1768 | ARM | NET_1 | TCP client hello world | 7.08 | 15 | 0/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.46 | 15 | 1/1 |
| OK | LPC1768 | ARM | NET_3 | TCP echo server | 5.13 | 10 | 1/1 |
| OK | LPC1768 | ARM | NET_4 | TCP echo client | 5.07 | 10 | 1/1 |
| OK | LPC1768 | ARM | NET_5 | UDP echo server | 5.01 | 10 | 1/1 |
| OK | LPC1768 | ARM | NET_6 | UDP echo client | 5.23 | 10 | 1/1 |
| FAIL | LPC1768 | ARM | NET_7 | HTTP client | 8.54 | 15 | 0/1 |
| OK | LPC1768 | ARM | NET_8 | NTP client | 6.54 | 10 | 1/1 |
| OK | LPC1768 | ARM | RTOS_1 | Basic thread | 12.39 | 15 | 1/1 |
| OK | LPC1768 | ARM | RTOS_2 | Mutex resource lock | 12.59 | 20 | 1/1 |
| OK | LPC1768 | ARM | RTOS_3 | Semaphore resource lock | 9.56 | 20 | 1/1 |
| OK | LPC1768 | ARM | RTOS_4 | Signals messaging | 6.54 | 10 | 1/1 |
| OK | LPC1768 | ARM | RTOS_5 | Queue messaging | 3.5 | 10 | 1/1 |
| OK | LPC1768 | ARM | RTOS_6 | Mail messaging | 3.45 | 10 | 1/1 |
| OK | LPC1768 | ARM | RTOS_7 | Timer | 12.36 | 15 | 1/1 |
| OK | LPC1768 | ARM | RTOS_8 | ISR (Queue) | 7.58 | 10 | 1/1 |
+--------+---------+-----------+-----------+---------------------------------------+--------------------+---------------+-------+
Result: 8 FAIL / 94 OK

Completed in 1073.70 sec
```