mirror of https://github.com/ARMmbed/mbed-os.git
WiFi: Re-order Greentea tests with minor fixes
Run WIFI-GET-RSSI and WIFI-CONNECT-DISCONNECT-REPEAT tests in secure mode Remove WIFI-CONNECT-PARAMS-VALID-UNSECURE, it's duplicate to WIFI_CONNECT with remains moved to WIFI-CONNECT-SECUREpull/11841/head
parent
816689d1bb
commit
ad1107ef54
|
@ -53,7 +53,6 @@ Please refer to the following table for priorities of test cases. Priorities are
|
||||||
| 4 | WIFI_SET_CHANNEL | | SHOULD |
|
| 4 | WIFI_SET_CHANNEL | | SHOULD |
|
||||||
| 5 | WIFI_GET_RSSI | | SHOULD |
|
| 5 | WIFI_GET_RSSI | | SHOULD |
|
||||||
| 6 | WIFI_CONNECT_PARAMS_NULL | | MUST |
|
| 6 | WIFI_CONNECT_PARAMS_NULL | | MUST |
|
||||||
| 7 | WIFI_CONNECT_PARAMS_VALID_UNSECURE | | MUST |
|
|
||||||
| 8 | WIFI_CONNECT_PARAMS_VALID_SECURE | With security type: | |
|
| 8 | WIFI_CONNECT_PARAMS_VALID_SECURE | With security type: | |
|
||||||
| | | NSAPI_SECURITY_WEP | SHOULD |
|
| | | NSAPI_SECURITY_WEP | SHOULD |
|
||||||
| | | NSAPI_SECURITY_WPA | SHOULD |
|
| | | NSAPI_SECURITY_WPA | SHOULD |
|
||||||
|
@ -271,28 +270,6 @@ Test enviroment is set up as specified in "Test Environment" chapter.
|
||||||
|
|
||||||
Both `connect()` calls return NSAPI_ERROR_PARAMETER.
|
Both `connect()` calls return NSAPI_ERROR_PARAMETER.
|
||||||
|
|
||||||
### WIFI_CONNECT_PARAMS_VALID_UNSECURE
|
|
||||||
|
|
||||||
**Description:**
|
|
||||||
|
|
||||||
Test `WiFiInterface::connect(ssid, pass, security)` with valid parameters for the unsecure network.
|
|
||||||
|
|
||||||
**Precondition:**
|
|
||||||
|
|
||||||
Test enviroment is set up as specified in the "Test Environment" chapter.
|
|
||||||
|
|
||||||
**Test steps:**
|
|
||||||
|
|
||||||
1. Initialize the driver.
|
|
||||||
2. Call `WiFiInterface::connect( <ssid:unsecure>, NULL)`.
|
|
||||||
3. `disconnect()`.
|
|
||||||
4. Call `WiFiInterface::connect( <ssid:unsecure>, "")`.
|
|
||||||
5. `disconnect()`.
|
|
||||||
|
|
||||||
**Expected result:**
|
|
||||||
|
|
||||||
`connect()` calls return NSAPI_ERROR_OK.
|
|
||||||
|
|
||||||
### WIFI_CONNECT_PARAMS_VALID_SECURE
|
### WIFI_CONNECT_PARAMS_VALID_SECURE
|
||||||
|
|
||||||
**Description:**
|
**Description:**
|
||||||
|
@ -350,7 +327,7 @@ Test enviroment is set up as specified in the "Test Environment" chapter.
|
||||||
**Test steps:**
|
**Test steps:**
|
||||||
|
|
||||||
1. Initialize the driver.
|
1. Initialize the driver.
|
||||||
2. Call `WiFiInterface::connect( <ssid:secure>, <pw:secure>, NSAPI_SECURITY_WPA2, <ch:unsecure>)`.
|
2. Call `WiFiInterface::connect( <ssid:secure>, <pw:secure>, NSAPI_SECURITY_WPA2, <ch:secure>)`.
|
||||||
3. `disconnect()`.
|
3. `disconnect()`.
|
||||||
|
|
||||||
**Expected result:**
|
**Expected result:**
|
||||||
|
@ -398,7 +375,7 @@ Test `WiFiInterface::connect()` and `WiFiInterface::disconnect()` in non-blockin
|
||||||
**Test steps:**
|
**Test steps:**
|
||||||
|
|
||||||
1. Initialize the driver.
|
1. Initialize the driver.
|
||||||
2. `Call WiFiInterface::set_credentials( <ssid:unsecure>, NULL)`.
|
2. `Call WiFiInterface::set_credentials( <ssid:secure>, NULL)`.
|
||||||
3. `Call WiFiInterface::set_blocking(false)`
|
3. `Call WiFiInterface::set_blocking(false)`
|
||||||
4. `Call WiFiInterface::connect()`.
|
4. `Call WiFiInterface::connect()`.
|
||||||
5. `Cal WiFiInterface::set_credentials(const char *ssid, const char *pass, nsapi_security_t security)`
|
5. `Cal WiFiInterface::set_credentials(const char *ssid, const char *pass, nsapi_security_t security)`
|
||||||
|
@ -473,7 +450,7 @@ The test enviroment is set up as specified in the "Test Environment" chapter.
|
||||||
**Test steps:**
|
**Test steps:**
|
||||||
|
|
||||||
1. Initialize the driver.
|
1. Initialize the driver.
|
||||||
2. Call `WiFiInterface::set_credentials( <ssid:unsecure>, NULL)`.
|
2. Call `WiFiInterface::set_credentials( <ssid:secure>, NULL)`.
|
||||||
3. Repeat 10 times:
|
3. Repeat 10 times:
|
||||||
1. Call `WiFiInterface::connect()`.
|
1. Call `WiFiInterface::connect()`.
|
||||||
2. `disconnect()`.
|
2. `disconnect()`.
|
||||||
|
|
|
@ -70,21 +70,20 @@ Case cases[] = {
|
||||||
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) || defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) || defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
||||||
Case("WIFI-SCAN", wifi_scan),
|
Case("WIFI-SCAN", wifi_scan),
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
|
||||||
Case("WIFI-GET-RSSI", wifi_get_rssi),
|
|
||||||
Case("WIFI-CONNECT-PARAMS-VALID-UNSECURE", wifi_connect_params_valid_unsecure),
|
|
||||||
Case("WIFI-CONNECT", wifi_connect),
|
|
||||||
//Most boards are not passing this test, but they should if they support non-blocking API.
|
|
||||||
//Case("WIFI_CONNECT_DISCONNECT_NONBLOCK", wifi_connect_disconnect_nonblock),
|
|
||||||
Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat),
|
|
||||||
#endif
|
|
||||||
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID)
|
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID)
|
||||||
|
Case("WIFI-GET-RSSI", wifi_get_rssi),
|
||||||
|
Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat),
|
||||||
Case("WIFI-CONNECT-PARAMS-VALID-SECURE", wifi_connect_params_valid_secure),
|
Case("WIFI-CONNECT-PARAMS-VALID-SECURE", wifi_connect_params_valid_secure),
|
||||||
Case("WIFI-CONNECT-PARAMS-CHANNEL", wifi_connect_params_channel),
|
Case("WIFI-CONNECT-PARAMS-CHANNEL", wifi_connect_params_channel),
|
||||||
Case("WIFI-CONNECT-PARAMS-CHANNEL-FAIL", wifi_connect_params_channel_fail),
|
Case("WIFI-CONNECT-PARAMS-CHANNEL-FAIL", wifi_connect_params_channel_fail),
|
||||||
Case("WIFI-CONNECT-SECURE", wifi_connect_secure),
|
Case("WIFI-CONNECT-SECURE", wifi_connect_secure),
|
||||||
Case("WIFI-CONNECT-SECURE-FAIL", wifi_connect_secure_fail),
|
Case("WIFI-CONNECT-SECURE-FAIL", wifi_connect_secure_fail),
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
||||||
|
Case("WIFI-CONNECT", wifi_connect),
|
||||||
|
//Most boards are not passing this test, but they should if they support non-blocking API.
|
||||||
|
//Case("WIFI_CONNECT_DISCONNECT_NONBLOCK", wifi_connect_disconnect_nonblock),
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
Specification specification(test_setup, cases, greentea_continue_handlers);
|
Specification specification(test_setup, cases, greentea_continue_handlers);
|
||||||
|
|
|
@ -23,14 +23,14 @@
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID)
|
||||||
|
|
||||||
void wifi_connect_disconnect_repeat(void)
|
void wifi_connect_disconnect_repeat(void)
|
||||||
{
|
{
|
||||||
WiFiInterface *wifi = get_interface();
|
WiFiInterface *wifi = get_interface();
|
||||||
nsapi_error_t error;
|
nsapi_error_t error;
|
||||||
|
|
||||||
error = wifi->set_credentials(MBED_CONF_APP_WIFI_UNSECURE_SSID, NULL);
|
error = wifi->set_credentials(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security());
|
||||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, error);
|
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, error);
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
|
@ -41,4 +41,4 @@ void wifi_connect_disconnect_repeat(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID)
|
||||||
|
|
|
@ -30,8 +30,9 @@ void wifi_connect_params_valid_secure(void)
|
||||||
WiFiInterface *wifi = get_interface();
|
WiFiInterface *wifi = get_interface();
|
||||||
|
|
||||||
if (wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security()) == NSAPI_ERROR_OK) {
|
if (wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security()) == NSAPI_ERROR_OK) {
|
||||||
wifi->disconnect();
|
if (wifi->disconnect() == NSAPI_ERROR_OK) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_FAIL();
|
TEST_FAIL();
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017, ARM Limited, All Rights Reserved
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mbed.h"
|
|
||||||
#include "greentea-client/test_env.h"
|
|
||||||
#include "unity.h"
|
|
||||||
#include "utest.h"
|
|
||||||
#include "wifi_tests.h"
|
|
||||||
|
|
||||||
using namespace utest::v1;
|
|
||||||
|
|
||||||
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
|
||||||
|
|
||||||
void wifi_connect_params_valid_unsecure(void)
|
|
||||||
{
|
|
||||||
WiFiInterface *wifi = get_interface();
|
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect(MBED_CONF_APP_WIFI_UNSECURE_SSID, NULL));
|
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
|
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect(MBED_CONF_APP_WIFI_UNSECURE_SSID, ""));
|
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
|
|
@ -29,10 +29,13 @@ void wifi_connect_secure(void)
|
||||||
{
|
{
|
||||||
WiFiInterface *wifi = get_interface();
|
WiFiInterface *wifi = get_interface();
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security()));
|
// Driver shall cache the credentials
|
||||||
|
char ssid[] = MBED_CONF_APP_WIFI_SECURE_SSID;
|
||||||
|
char password[] = MBED_CONF_APP_WIFI_PASSWORD;
|
||||||
|
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(ssid, password, get_security()));
|
||||||
|
ssid[0] = '\0';
|
||||||
|
password[0] = '\0';
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect());
|
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect());
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
|
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,13 @@
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID)
|
||||||
|
|
||||||
void wifi_get_rssi(void)
|
void wifi_get_rssi(void)
|
||||||
{
|
{
|
||||||
WiFiInterface *wifi = get_interface();
|
WiFiInterface *wifi = get_interface();
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(MBED_CONF_APP_WIFI_UNSECURE_SSID, NULL));
|
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security()));
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT8(0, wifi->get_rssi());
|
TEST_ASSERT_EQUAL_INT8(0, wifi->get_rssi());
|
||||||
|
|
||||||
|
@ -40,4 +40,4 @@ void wifi_get_rssi(void)
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
|
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID)
|
||||||
|
|
|
@ -48,9 +48,6 @@ void wifi_get_rssi(void);
|
||||||
/** Test WiFiInterface::connect(ssid, pass, security, channel) with NULL parameters */
|
/** Test WiFiInterface::connect(ssid, pass, security, channel) with NULL parameters */
|
||||||
void wifi_connect_params_null(void);
|
void wifi_connect_params_null(void);
|
||||||
|
|
||||||
/** Test WiFiInterface::connect(ssid, pass, security) with valid parameters for unsecure network */
|
|
||||||
void wifi_connect_params_valid_unsecure(void);
|
|
||||||
|
|
||||||
/** Test WiFiInterface::connect(ssid, pass, security) with valid parameters for secure network */
|
/** Test WiFiInterface::connect(ssid, pass, security) with valid parameters for secure network */
|
||||||
void wifi_connect_params_valid_secure(void);
|
void wifi_connect_params_valid_secure(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue