Updated greentea EMAC tests to use default interface

pull/7812/head
Mika Leppänen 2018-08-16 10:05:21 +03:00
parent 96af5a447e
commit 5fa2edc73f
19 changed files with 48 additions and 150 deletions

View File

@ -8,7 +8,34 @@ To configure a device to be a CTP echo server, you need to enable the `echo-serv
## Other configuration options
Default configuration files included with tests are configured for ethernet. For Wi-Fi, set `test-ethernet` to 0 and `test-wifi` to 1. You also need to configure Wi-Fi SSID and security options to the configuration file.
Targets with connectivity set the target.network-default-interface-type configuration variable appropriately, either to their only interface or their most-commonly-used one. For targets that provide more than one type of connectivity, you may choose the default by overriding the target.network-default-interface-type configuration variable.
For Ethernet, if you want to overrride the default, set the `json` configuration to:
```
"target_overrides": {
"*": {
"target.network-default-interface-type": "ETHERNET",
"nsapi.default-stack": "TEST"
}
}
```
For Wi-Fi set the `json` configuration to:
```
"target_overrides": {
"*": {
"target.network-default-interface-type": "WIFI",
"nsapi.default-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY",
"nsapi.default-stack": "TEST"
}
}
```
For Wi-Fi you also need to configure Wi-Fi SSID and security options to the configuration file.
## Example commands

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
@ -556,4 +554,3 @@ EmacTestMemoryManager &EmacTestMemoryManager::get_instance()
return test_memory_manager;
}
#endif

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#ifndef EMAC_TEST_MEMORY_MANAGER_H
#define EMAC_TEST_MEMORY_MANAGER_H
@ -229,4 +227,3 @@ private:
};
#endif /* EMAC_TEST_MEMORY_MANAGER_H */
#endif

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "unity.h"
#include "EMACMemoryManager.h"
@ -205,5 +203,3 @@ OnboardNetworkStack &OnboardNetworkStack::get_default_instance()
return EmacTestNetworkStack::get_instance();
}
#endif
#endif

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#ifndef EMAC_TEST_NETWORK_STACK_H
#define EMAC_TEST_NETWORK_STACK_H
@ -392,5 +390,3 @@ private:
};
#endif /* EMAC_TEST_NETWORK_STACK_H */
#endif

View File

@ -19,8 +19,6 @@
#include "unity/unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "mbed.h"
#include "EMAC.h"
@ -152,5 +150,4 @@ void emac_if_ctp_msg_build(int eth_frame_len, const unsigned char *dest_addr, co
emac_if_check_memory(false);
}
#endif

View File

@ -20,10 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "lwip/opt.h" /* ETH_PAD_SIZE */
#include "mbed.h"
#include "EMAC.h"
@ -79,5 +75,3 @@ void emac_if_memory_buffer_write(void *buf, unsigned char *eth_frame, bool write
}
}
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -101,4 +99,3 @@ void test_emac_broadcast(void)
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -22,30 +22,11 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "EthernetInterface.h"
#include "NetworkInterface.h"
#include "EMAC.h"
#include "EMACMemoryManager.h"
#include "emac_TestMemoryManager.h"
#include "emac_TestNetworkStack.h"
#if MBED_CONF_APP_TEST_WIFI
#if defined(TARGET_UBLOX_EVK_ODIN_W2) || defined(TARGET_MTB_UBLOX_ODIN_W2)
#include "OdinWiFiInterface.h"
#endif
#ifdef TARGET_REALTEK_RTL8195AM
#include "RTWInterface.h"
#endif
#if defined(TARGET_MTB_ADV_WISE_1530) || \
defined(TARGET_MTB_USI_WM_BN_BM_22) || \
defined(TARGET_MTB_MXCHIP_EMW3166)
#include "WicedInterface.h"
#endif
#endif
#include "emac_initialize.h"
#include "emac_tests.h"
#include "emac_util.h"
@ -59,29 +40,14 @@ void test_emac_initialize()
{
worker_loop_init();
#if MBED_CONF_APP_TEST_ETHERNET
static EthernetInterface *network_interface = new EthernetInterface;
#elif MBED_CONF_APP_TEST_WIFI
// Add wifi classes here
#if defined(TARGET_UBLOX_EVK_ODIN_W2) || defined(TARGET_MTB_UBLOX_ODIN_W2)
static WiFiInterface *network_interface = new OdinWiFiInterface;
#elif defined(TARGET_REALTEK_RTL8195AM)
static WiFiInterface *network_interface = new RTWInterface;
#elif defined(TARGET_MTB_ADV_WISE_1530) || \
defined(TARGET_MTB_USI_WM_BN_BM_22) || \
defined(TARGET_MTB_MXCHIP_EMW3166)
static WiFiInterface *network_interface = new WicedInterface;
#else
static WiFiInterface *network_interface = new WiFiInterface;
#endif
static NetworkInterface *network_interface = NetworkInterface::get_default_instance();
#define WIFI 2
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI
#if MBED_CONF_APP_WIFI_SCAN
WiFiAccessPoint ap[30];
int size = network_interface->scan(ap, 30);
int size = network_interface->wifiInterface()->scan(ap, 30);
for (int i = 0; i < size; i++) {
const char *ssid = ap[i].get_ssid();
@ -96,9 +62,6 @@ void test_emac_initialize()
printf("ch %i\r\n\r\n", ch);
}
#endif
network_interface->set_credentials(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, MBED_CONF_APP_WIFI_SECURITY);
#endif
// Power up the interface and emac driver
@ -154,5 +117,3 @@ bool emac_if_init(EMAC *emac)
return true;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -163,5 +161,3 @@ void test_emac_memory()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -166,5 +164,3 @@ void test_emac_multicast_filter()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -78,4 +76,3 @@ void test_emac_unicast()
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -86,5 +84,3 @@ void test_emac_unicast_burst()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -81,5 +79,3 @@ void test_emac_unicast_frame_len()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -83,5 +81,3 @@ void test_emac_unicast_long()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "mbed.h"
#include "EMAC.h"
@ -584,5 +582,3 @@ void emac_if_set_mtu_size(int mtu_size)
{
eth_mtu_size = mtu_size;
}
#endif

View File

@ -15,24 +15,21 @@
* limitations under the License.
*/
#if !defined(MBED_CONF_APP_TEST_WIFI) || \
!defined(MBED_CONF_APP_TEST_ETHERNET) || \
!defined(MBED_CONF_APP_ECHO_SERVER) || \
#if !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)
!defined(MBED_CONF_APP_WIFI_SCAN)
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json
#endif
#if !MBED_CONF_APP_TEST_WIFI && !MBED_CONF_APP_TEST_ETHERNET
#define ETHERNET 1
#define WIFI 2
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE != ETHERNET && \
MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE != WIFI
#error [NOT_SUPPORTED] Either wifi or ethernet testing need to be enabled
#endif
#if MBED_CONF_APP_TEST_WIFI && MBED_CONF_APP_TEST_ETHERNET
#error [NOT_SUPPORTED] Both wifi and ethernet testing cannot be enabled
#endif
#if MBED_CONF_APP_TEST_WIFI
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI
#if !defined(TARGET_UBLOX_EVK_ODIN_W2) && \
!defined(TARGET_REALTEK_RTL8195AM) && \
!defined(TARGET_MTB_ADV_WISE_1530) && \

View File

@ -1,13 +1,5 @@
{
"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": 0
@ -19,22 +11,13 @@
"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-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY",
"nsapi.default-stack": "TEST"
}
}

View File

@ -1,13 +1,5 @@
{
"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
@ -19,22 +11,13 @@
"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-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY",
"nsapi.default-stack": "TEST"
}
}