mirror of https://github.com/ARMmbed/mbed-os.git
Updated emac greentea tests
- Improved markdown - Set tests to fail if CTP echo server is not presentpull/6847/head
parent
d9a66f1c54
commit
026af3a72e
|
@ -6,6 +6,76 @@ This document describes how to run EMAC tests. The EMAC test cases are made usin
|
|||
|
||||
To configure a device to be a CTP echo server, you need to enable the `echo-server` setting in the `json` file of the test environment application. When a device is configured to be a CTP echo server, it starts to forward CTP messages automatically when it is switched on and continues to do so until it is switched off.
|
||||
|
||||
## Other configuration options
|
||||
|
||||
Default configuration files included with tests are configured for ethernet. For Wifi, set `test-ethernet` to 0 and `test-wifi` to 1. Also Wifi SSID and security options need to be configured to the configuration file.
|
||||
|
||||
## Example commands
|
||||
|
||||
### CTP echo server
|
||||
|
||||
You can use following command to build CTP echo server:
|
||||
|
||||
`mbed test --compile -m TARGET -t GCC_ARM -v -n tests-network-emac --app-config TESTS/network/emac/template_mbed_app_echo_server.txt`
|
||||
|
||||
Replace TARGET with the target device. After building, flash the binary to the CTP echo server device.
|
||||
|
||||
You can verify that the CTP echo server has been started properly by making terminal connection to the device, resetting it and verifying that `echo server started successfully` is printed on the terminal. Host tests can be run when the CTP echo server is running on the Ethernet segment.
|
||||
|
||||
For Wifi tests the CTP echo server can be also running of ethernet side as long as network configuration is such that Ethernet frames are routed between Wifi and Ethernet.
|
||||
|
||||
CTP echo server is sending 100 bytes long broadcast CTP Ethernet frame every 60 seconds to inform the network of its presence.
|
||||
|
||||
### Running tests
|
||||
|
||||
You can use following command to run tests:
|
||||
|
||||
`mbed test --compile --run -m TARGET -t GCC_ARM -v -n tests-network-emac --app-config TESTS/network/emac/template_mbed_app.txt`
|
||||
|
||||
Replace TARGET with the target device.
|
||||
|
||||
## Traces
|
||||
|
||||
Test cases have different trace levels based on how much tracing can be done without affecting the performance of the test case. Tracing is configured using `SET\_TRACE\_LEVEL' macro.
|
||||
|
||||
For example `EMAC broadcast` test enables send, input CTP frame, success and failure traces:
|
||||
|
||||
`SET_TRACE_LEVEL(TRACE_SEND | TRACE_ETH_FRAMES | TRACE_SUCCESS | TRACE_FAILURE);`
|
||||
|
||||
Here is an example trace about a message that has been send to broadcast address `ff:ff:ff:ff:ff:ff` and is answered by echo server:
|
||||
|
||||
```
|
||||
|
||||
message sent ff:ff:ff:ff:ff:ff
|
||||
|
||||
response: receipt number 24 LENGTH OK DATA OK BROADCAST
|
||||
|
||||
```
|
||||
|
||||
Here is an example trace about a message that has been send to broadcast address `ff:ff:ff:ff:ff:ff` and is not answered by echo server:
|
||||
|
||||
```
|
||||
|
||||
message sent ff:ff:ff:ff:ff:ff
|
||||
|
||||
NO RESPONSE: receipt number 25
|
||||
|
||||
```
|
||||
|
||||
Here is an example about input message trace, message hex dump contains the first 32 bytes of the received Ethernet frame.
|
||||
|
||||
```
|
||||
|
||||
INP> LEN 100
|
||||
|
||||
INP> 000000 ff ff ff ff ff ff ba 42 ed 79 11 8a 90 00
|
||||
|
||||
INP> 00000e 00 00 02 00 ba 42 ed 79 11 8a 01 00 01 00
|
||||
|
||||
```
|
||||
|
||||
If you like to verify whether the echo server is receiving CTP Ethernet frames you can enable `echo-server-trace` option in the echo server configuration file. This can be used for debugging purposes. Do not run performance test like `EMAC unicast burst` with tracing enabled, since tracing affects the echo server performance.
|
||||
|
||||
## Test cases
|
||||
|
||||
### EMAC initialize
|
||||
|
|
|
@ -45,7 +45,9 @@ void test_emac_broadcast_cb(int opt)
|
|||
#if MBED_CONF_APP_ECHO_SERVER
|
||||
static bool echo_server_started = false;
|
||||
if (!echo_server_started) {
|
||||
#if MBED_CONF_APP_ECHO_SERVER_TRACE == 0
|
||||
SET_TRACE_LEVEL(TRACE_NONE);
|
||||
#endif
|
||||
printf("echo server started successfully\r\n\r\n");
|
||||
echo_server_started = true;
|
||||
} else {
|
||||
|
@ -65,7 +67,6 @@ void test_emac_broadcast_cb(int opt)
|
|||
if (++no_response_cnt > 3) {
|
||||
if (++retries > 6) {
|
||||
printf("too many retries\r\n\r\n");
|
||||
RESET_ERROR_FLAGS(NO_RESPONSE);
|
||||
END_TEST_LOOP;
|
||||
} else {
|
||||
printf("retry count %i\r\n\r\n", retries);
|
||||
|
|
|
@ -510,13 +510,11 @@ static void worker_loop_event_cb(int event)
|
|||
{
|
||||
if (event == LINK_UP) {
|
||||
link_up = true;
|
||||
printf("cable connected\r\n\r\n");
|
||||
link_status_semaphore.release();
|
||||
}
|
||||
|
||||
if (event == LINK_DOWN) {
|
||||
link_up = false;
|
||||
printf("cable disconnected\r\n\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(MBED_CONF_APP_TEST_WIFI) || \
|
||||
!defined(MBED_CONF_APP_TEST_ETHERNET) || \
|
||||
!defined(MBED_CONF_APP_ECHO_SERVER) || \
|
||||
!defined(MBED_CONF_APP_WIFI_SCAN) || \
|
||||
!defined(MBED_CONF_APP_WIFI_SSID ) || \
|
||||
!defined(MBED_CONF_APP_WIFI_SECURITY) || \
|
||||
#if !defined(MBED_CONF_APP_TEST_WIFI) || \
|
||||
!defined(MBED_CONF_APP_TEST_ETHERNET) || \
|
||||
!defined(MBED_CONF_APP_ECHO_SERVER) || \
|
||||
!defined(MBED_CONF_APP_ECHO_SERVER_TRACE) || \
|
||||
!defined(MBED_CONF_APP_WIFI_SCAN) || \
|
||||
!defined(MBED_CONF_APP_WIFI_SSID ) || \
|
||||
!defined(MBED_CONF_APP_WIFI_SECURITY) || \
|
||||
!defined(MBED_CONF_APP_WIFI_PASSWORD)
|
||||
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json
|
||||
#endif
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
"help": "Build test to be echo server",
|
||||
"value": 0
|
||||
},
|
||||
"echo-server-trace": {
|
||||
"help": "Trace incoming messages on echo server",
|
||||
"value": 0
|
||||
},
|
||||
"wifi-scan": {
|
||||
"help": "Scan and list access points",
|
||||
"value": 0
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"config": {
|
||||
"test-ethernet": {
|
||||
"help": "Enable ethernet testing",
|
||||
"value": 1
|
||||
},
|
||||
"test-wifi": {
|
||||
"help": "Enable wifi testing",
|
||||
"value": 0
|
||||
},
|
||||
"echo-server": {
|
||||
"help": "Build test to be echo server",
|
||||
"value": 1
|
||||
},
|
||||
"echo-server-trace": {
|
||||
"help": "Trace incoming messages on echo server",
|
||||
"value": 0
|
||||
},
|
||||
"wifi-scan": {
|
||||
"help": "Scan and list access points",
|
||||
"value": 0
|
||||
},
|
||||
"wifi-ssid": {
|
||||
"help": "WiFi SSID for network",
|
||||
"value": "\"SSID\""
|
||||
},
|
||||
"wifi-security": {
|
||||
"help": "WiFi Security",
|
||||
"value": "NSAPI_SECURITY_WPA_WPA2"
|
||||
},
|
||||
"wifi-password": {
|
||||
"help": "WiFi Password",
|
||||
"value": "\"PASSWORD\""
|
||||
}
|
||||
},
|
||||
"target_overrides": {
|
||||
"*": {
|
||||
"nsapi.default-stack": "TEST"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue