diff --git a/TESTS/netsocket/README.md b/TESTS/netsocket/README.md index 581f9d942a..68da14d7cc 100644 --- a/TESTS/netsocket/README.md +++ b/TESTS/netsocket/README.md @@ -1,12 +1,9 @@ Network Socket test plan ======================== -This is a test plan for the Mbed OS Socket API. This describes all test -cases and their intended behaviors. When an API document is not clear, use -this as a reference for implementing correct behavior. +This is a test plan for the Mbed OS Socket API. This describes all test cases and their intended behaviors. When an API document is not clear, use this as a reference for implementing correct behavior. -**NOTE:** Because testing is a moving target, this test plan might define more test cases than Mbed OS -implements. Refer to [test case priorities](#test-case-priorities) for a list of test cases that the target must pass to be compliant with the Mbed OS socket API. +**NOTE:** Because testing is a moving target, this test plan might define more test cases than Mbed OS implements. Refer to [test case priorities](#test-case-priorities) for a list of test cases that the target must pass to be compliant with the Mbed OS socket API. Target API @@ -20,33 +17,27 @@ The target for this plan is to test: - [TLSSocket](https://github.com/ARMmbed/mbed-os/blob/master/features/netsocket/TLSSocket.h). - [DNS](https://github.com/ARMmbed/mbed-os/blob/master/features/netsocket/DNS.h). -See [Network Socket Documentation](https://os.mbed.com/docs/mbed-os/latest/apis/network-socket.html) for reference. +Please see the [Network Socket Documentation](https://os.mbed.com/docs/mbed-os/latest/apis/network-socket.html) for reference. Tools to use ---------------- - Mbed OS. -- Standard Mbed OS development tools as described in [Arm Mbed tools overview](https://os.mbed.com/docs/latest/tools/index.html). +- Standard Mbed OS development tools as described in the [Arm Mbed tools overview](https://os.mbed.com/docs/latest/tools/index.html). - Test server. -These test cases themselves do not require any special tooling, other than -the test server described in "Test environment" chapter. +These test cases themselves do not require any special tooling, other than the test server described in "Test environment" chapter. Test environment ---------------- -As a general guideline, network connectivity with public Internet access -is required. This satisfies Socket tests, but specific connectivity -methods might require some extra configuration or devices within the -network. +As a general guideline, network connectivity with public Internet access is required. This satisfies Socket tests, but specific connectivity methods might require some extra configuration or devices within the network. -The test environment consist of DUTs, network connection and the test -server. Arm provides a public test server, but it can be installed locally -as well, if an isolated test environment is required. +The test environment consist of DUTs, network connection and the test server. Arm provides a public test server, but it can be installed locally as well, if an isolated test environment is required. ### Public test server -Address: `echo.mbedcloudtesting.com` +Address: `echo.mbedcloudtesting.com'. Both IPv4 and IPv6 addresses are available from a public DNS service: @@ -58,26 +49,17 @@ echo.mbedcloudtesting.com has IPv6 address 2a05:d018:21f:3800:8584:60f8:bc9f:e61 **Open services in the test server** -- Echo protocol, [RFC 862](https://tools.ietf.org/html/rfc862) is - enabled in both TCP and UDP. Port 7. Port 2007 for TLS. -- Discard protocol, [RFC 863](https://tools.ietf.org/html/rfc863) is - enabled in both TCP and UDP. Port 9. Port 2009 for TLS. -- Character generator protocol, [RFC 864](https://tools.ietf.org/html/rfc864) is - enabled in both TCP and UDP. Port 19. Output pattern should follow - the proposed example pattern in RFC. -- Daytime protocol, [RFC 867](https://tools.ietf.org/html/rfc867) in - both TCP and UDP. Port 13. Port 2013 for TLS. -- Time protocol, [RFC 868](https://tools.ietf.org/html/rfc868) in - both TCP and UDP. Port 37. +- Echo protocol, [RFC 862](https://tools.ietf.org/html/rfc862) is enabled on both TCP and UDP on port 7. Port 2007 for TLS +- Discard protocol, [RFC 863](https://tools.ietf.org/html/rfc863) is enabled in both TCP and UDP on port 9. Port 2009 for TLS. +- Character generator protocol, [RFC 864](https://tools.ietf.org/html/rfc864) is enabled in both TCP and UDP on port 19. Output pattern should follow the proposed example pattern in RFC. +- Daytime protocol, [RFC 867](https://tools.ietf.org/html/rfc867) in both TCP and UDP on port 13. Port 2013 for TLS. +- Time protocol, [RFC 868](https://tools.ietf.org/html/rfc868) in both TCP and UDP on port 37. Configure the firewall to allow this traffic to access the test server. **Example configuration for Debian/Ubuntu Linux** -These services are available on many operating systems, and installing them is out of -scope of this document. Below is an -example of how to install these services into a Debian/Ubuntu based Linux distribution -using standard Inet Daemon: +These services are available on many operating systems, and installing them is out of scope of this document. Below is an example of how to install these services into a Debian/Ubuntu based Linux distribution using standard Inet Daemon: ```.sh $ sudo apt install inetutils-inetd @@ -144,25 +126,18 @@ Nmap done: 1 IP address (1 host up) scanned in 1.78 seconds ![Ethernet](eth_environment.png) -The Ethernet test environment consists of devices, an ethernet switch and an optional -firewall that allows connecting to the Echo server. +The Ethernet test environment consists of devices, an ethernet switch and an optional firewall that allows connecting to the Echo server. ### Wi-Fi test environment ![Wi-Fi](wifi_environment.png) -The Wi-Fi test environment is equivalent to the Ethernet test environment, except that the -Wi-Fi test environment has two separate access points or one with dual SSID. Connectivity to -echo server is required, but it can be hosted locally, as specified in -the Ethernet environment. +The Wi-Fi test environment is equivalent to the Ethernet test environment, except that the Wi-Fi test environment has two separate access points or one with dual SSID. Connectivity to echo server is required, but it can be hosted locally, as specified in the Ethernet environment. Test case priorities -------------------- -Please refer to the following table for priorities of test cases. Priorities -are labeled as MUST and SHOULD. MUST means this is a requirement and -therefore mandatory to pass the test. SHOULD means it is recommended to -pass the test if the driver implements the feature in question. +Please refer to the following table for priorities of test cases. Priorities are labeled as MUST and SHOULD. MUST means this is a requirement and therefore mandatory to pass the test. SHOULD means it is recommended to pass the test if the driver implements the feature in question. | | Test case | Priority | |-----|-----------------------------------------|----------| @@ -248,8 +223,7 @@ pass the test if the driver implements the feature in question. Building test binaries -------------------------- -For testing the board and driver, test against the Mbed OS -master branch to get the most recent, up-to-date test cases and drivers. +For testing the board and driver, test against the Mbed OS master branch to get the most recent, up-to-date test cases and drivers. To create a build environment: @@ -261,9 +235,7 @@ git checkout master cd .. ``` -Also, building socket test cases requires a special macro to -enable all tests, so create an `mbed_app.json` file with the following -content at minimum: +Also, building socket test cases requires a special macro to enable all tests, so create an `mbed_app.json` file with the following content at minimum: ``` { @@ -292,8 +264,7 @@ content at minimum: } ``` -Wi-Fi tests require some more configuration, so for Wi-Fi purposes, -the `mbed_app.json` might look like this: +Wi-Fi tests require some more configuration, so for Wi-Fi purposes, the `mbed_app.json` might look like this: ``` { @@ -357,7 +328,7 @@ the `mbed_app.json` might look like this: } } ``` -See `mbed-os/tools/test_configs` folder for examples. +Please, see `mbed-os/tools/test_configs` folder for examples. Now build test binaries: @@ -368,8 +339,7 @@ mbed test --compile -t -m -n mbed-os-tests-network-*,mbed-o Running tests ------------- -When device is connected to network, or in case of wireless device near -the access point. +When device is connected to network, or in case of wireless device near the access point. ```.sh mbed test -n mbed-os-tests-network-*,mbed-os-tests-netsocket* @@ -378,35 +348,30 @@ mbed test -n mbed-os-tests-network-*,mbed-os-tests-netsocket* Test cases for Socket class --------------------------- -These test are equal for UDPSocket and TCPSocket but are described here -because of identical API and behaviour. Socket class is abstract so it -cannot be instantiated, therefore these test cases are implemented using -both TCPSocket and UDPSocket. Some of these tests are also implemented -for TLSSocket class. In such case certificate has to be set for the Socket -before calling `open()`, unless specified otherwise in the test's +These test are equal for UDPSocket and TCPSocket but are described here because of identical API and behaviour. Socket class is abstract so it cannot be instantiated, therefore these test cases are implemented using both TCPSocket and UDPSocket. Some of these tests are also implemented for TLSSocket class. In such case certificate has to be set for the Socket before calling `open()`, unless specified otherwise in the test's description. ### SOCKET_OPEN_DESTRUCT **Description:** -Call `Socket::open()` and then destruct the socket +Call `Socket::open()` and then destruct the socket. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` -3. Call "delete" for the object +1. Create an object by calling `new Socket()`. +2. Call `Socket::open(stack)`. +3. Delete the object. 4. Repeat 100 times. **Expected result:** -`Socket::open()` should always return NSAPI_ERROR_OK +`Socket::open()` should always return `NSAPI_ERROR_OK`. @@ -419,22 +384,20 @@ in the stack is reached. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` -3. repeat until `NSAPI_ERROR_NO_MEMORY` or `NSAPI_ERROR_NO_SOCKET` - error is returned. +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. +3. Repeat until `NSAPI_ERROR_NO_MEMORY` or `NSAPI_ERROR_NO_SOCKET` error code is returned. 4. Call "delete" for all previously allocated sockets. -5. repeat +5. Repeat. **Expected result:** -Should be able to reserve at least 4 sockets. After freeing all sockets, -should be able to reserve same number of sockets. +Should be able to reserve at least 4 sockets. After freeing all sockets, should be able to reserve same number of sockets. @@ -446,20 +409,19 @@ Call `Socket::open()` twice **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` -3. Call `Socket::open(stack)` -4. delete the socket +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. +3. Call `Socket::open(stack)`. +4. Delete the socket. **Expected result:** -`Socket::open()` should first return `NSAPI_ERROR_OK` and second -call `NSAPI_ERROR_PARAMETER`. +`Socket::open()` should first return `NSAPI_ERROR_OK` and second call `NSAPI_ERROR_PARAMETER`. @@ -467,50 +429,48 @@ call `NSAPI_ERROR_PARAMETER`. **Description:** -Call `Socket::open()` followed by `Socket::close()` and then again -`Socket::open()`. Should allow you to reuse the same object. +Call `Socket::open()` followed by `Socket::close()` and then again `Socket::open()`. Should allow you to reuse the same object. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` -3. Call `Socket::close(stack)` -4. Call `Socket::open(stack)` -5. Call `Socket::close(stack)` -6. delete the socket +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. +3. Call `Socket::close(stack)`. +4. Call `Socket::open(stack)`. +5. Call `Socket::close(stack)`. +6. Delete the socket. **Expected result:** -All `Socket::open()` and `Socket::close()` calls should return -NSAPI_ERROR_OK. +All `Socket::open()` and `Socket::close()` calls should return `NSAPI_ERROR_OK`. ### SOCKET_BIND_PORT **Description:** -Call `Socket::bind(port)` +Call `Socket::bind(port)'. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` -3. Call `Socket::bind();` -4. destroy socket +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. +3. Call `Socket::bind();`. +4. Destroy socket. **Expected result:** -All calls return NSAPI_ERROR_OK +All calls return `NSAPI_ERROR_OK`. @@ -522,20 +482,20 @@ Call `Socket::bind(port)` on port number that is already used **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` -3. Call `Socket::bind();` +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. +3. Call `Socket::bind();`. 4. Repeat 1-3 for a new socket. -5. destroy both sockets +5. Destroy both sockets. **Expected result:** -Second `Socket::bind()` should return NSAPI_ERROR_PARAMETER +Second `Socket::bind()` should return `NSAPI_ERROR_PARAMETER`. @@ -543,24 +503,24 @@ Second `Socket::bind()` should return NSAPI_ERROR_PARAMETER **Description:** -Call `Socket::bind(addr, port)` +Call `Socket::bind(addr, port)`. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` -3. Get address by calling NetworkInterface::get_ip_address(); -4. Call `Socket::bind(address, );` -5. destroy socket +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. +3. Get address by calling `NetworkInterface::get_ip_address()`. +4. Call `Socket::bind(address, );`. +5. Destroy socket. **Expected result:** -All calls return NSAPI_ERROR_OK +All calls return `NSAPI_ERROR_OK`. @@ -568,23 +528,23 @@ All calls return NSAPI_ERROR_OK **Description:** -Call `Socket::bind(NULL, port)` +Call `Socket::bind(NULL, port)`. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` -3. Call `Socket::bind(NULL, );` -4. destroy socket +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. +3. Call `Socket::bind(NULL, );`. +4. Destroy socket. **Expected result:** -`Socket::bind()` should return NSAPI_ERROR_OK +`Socket::bind()` should return `NSAPI_ERROR_OK'. @@ -597,22 +557,22 @@ to us. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. 3. Check whether device is IPv4 or IPv6 connected. - 1. For IPv4: Call `Socket::bind("190.2.3.4", );` - 2. For IPv6: Call `Socket::bind("fe80::ff01", );` + 1. For IPv4: Call `Socket::bind("190.2.3.4", );`. + 2. For IPv6: Call `Socket::bind("fe80::ff01", );`. -4. destroy socket +4. Destroy socket. **Expected result:** -`Socket::bind()` should return NSAPI_ERROR_PARAMETER +`Socket::bind()` should return `NSAPI_ERROR_PARAMETER'. @@ -620,28 +580,27 @@ to us. **Description:** -Call `Socket::bind(SocketAddress)` with and address that is not wrong type -for the connection. +Call `Socket::bind(SocketAddress)` with and address that is not wrong type for the connection. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. 3. Check whether device is IPv4 or IPv6 connected. - 1. For IPv4: Create `SocketAddress("fe80::ff01", );` - 2. For IPv6: Create `SocketAddress("190.2.3.4", );` + 1. For IPv4: Create `SocketAddress("fe80::ff01", );`. + 2. For IPv6: Create `SocketAddress("190.2.3.4", );`. -4. Call `Socket::bind(address);` -5. destroy socket +4. Call `Socket::bind(address);`. +5. Destroy socket. **Expected result:** -`Socket::bind()` should return NSAPI_ERROR_PARAMETER +`Socket::bind()` should return `NSAPI_ERROR_PARAMETER'. @@ -649,26 +608,26 @@ for the connection. **Description:** -Call `Socket::bind(SocketAddress)` +Call `Socket::bind(SocketAddress)'. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::open(stack)` +1. Create a object by calling `new Socket()`. +2. Call `Socket::open(stack)`. 3. Get address by calling NetworkInterface::get_ip_address(); -4. Create a SocketAddress object using this address and any non-used +4. Create a SocketAddress object using this address and any non-used. port number. -5. Call `Socket::bind(address);` -6. destroy socket +5. Call `Socket::bind(address);`. +6. Destroy socket. **Expected result:** -All calls return NSAPI_ERROR_OK +All calls return `NSAPI_ERROR_OK'. @@ -676,18 +635,18 @@ All calls return NSAPI_ERROR_OK **Description:** -Call `Socket::bind()` on socket that has not been opened +Call `Socket::bind()` on socket that has not been opened. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create a object by calling `new Socket()` -2. Call `Socket::bind();` -3. destroy socket +1. Create a object by calling `new Socket()`. +2. Call `Socket::bind();`. +3. Destroy socket. **Expected result:** @@ -700,51 +659,51 @@ Test cases for UDPSocket class ### UDPSOCKET_OPEN_DESTRUCT -**Description:** Run SOCKET_OPEN_DESTRUCT for UDPSocket +**Description:** Run SOCKET_OPEN_DESTRUCT for UDPSocket. ### UDPSOCKET_OPEN_LIMIT -**Description:** Run SOCKET_OPEN_LIMIT for UDPSocket +**Description:** Run SOCKET_OPEN_LIMIT for UDPSocket. ### UDPSOCKET_OPEN_TWICE -**Description:** Run SOCKET_OPEN_TWICE for UDPSocket +**Description:** Run SOCKET_OPEN_TWICE for UDPSocket. ### UDPSOCKET_OPEN_CLOSE_REPEAT -**Description:** Run SOCKET_OPEN_CLOSE_REPEAT for UDPSocket +**Description:** Run SOCKET_OPEN_CLOSE_REPEAT for UDPSocket. ### UDPSOCKET_BIND_PORT -**Description:** Run SOCKET_BIND_PORT for UDPSocket +**Description:** Run SOCKET_BIND_PORT for UDPSocket. ### UDPSOCKET_BIND_PORT_FAIL -**Description:** Run SOCKET_BIND_PORT_FAIL for UDPSocket +**Description:** Run SOCKET_BIND_PORT_FAIL for UDPSocket. ### UDPSOCKET_BIND_ADDRESS_PORT -**Description:** Run SOCKET_BIND_ADDRESS_PORT for UDPSocket +**Description:** Run SOCKET_BIND_ADDRESS_PORT for UDPSocket. ### UDPSOCKET_BIND_ADDRESS_NULL -**Description:** Run SOCKET_BIND_ADDRESS_NULL for UDPSocket +**Description:** Run SOCKET_BIND_ADDRESS_NULL for UDPSocket. ### UDPSOCKET_BIND_ADDRESS_INVALID -**Description:** Run SOCKET_BIND_ADDRESS_INVALID for UDPSocket +**Description:** Run SOCKET_BIND_ADDRESS_INVALID for UDPSocket. ### UDPSOCKET_BIND_WRONG_TYPE -**Description:** Run SOCKET_BIND_WRONG_TYPE for UDPSocket +**Description:** Run SOCKET_BIND_WRONG_TYPE for UDPSocket. ### UDPSOCKET_BIND_ADDRESS -**Description:** Run SOCKET_BIND_ADDRESS for UDPSocket +**Description:** Run SOCKET_BIND_ADDRESS for UDPSocket. ### UDPSOCKET_BIND_UNOPENED -**Description:** Run SOCKET_BIND_UNOPENED for UDPSocket +**Description:** Run SOCKET_BIND_UNOPENED for UDPSocket. ### UDPSOCKET_SENDTO_INVALID @@ -754,18 +713,18 @@ Call `UDPSocket::sendto()` with invalid parameters. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. UDPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. UDPSocket is open. **Test steps:** -1. Call `UDPSocket:sendto( NULL, 9, NULL, 0);` -2. Call `UDPSocket:sendto( "", 9, NULL, 0);` -3. Call `UDPSocket:sendto( "", 0, NULL, 0);` -4. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 9,NULL, 0);` -5. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 9, "hello", 5);` -6. destroy the socket +1. Call `UDPSocket:sendto( NULL, 9, NULL, 0);`. +2. Call `UDPSocket:sendto( "", 9, NULL, 0);`. +3. Call `UDPSocket:sendto( "", 0, NULL, 0);`. +4. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 9,NULL, 0);`. +5. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 9, "hello", 5);`. +6. Destroy the socket. **Expected result:** @@ -784,17 +743,17 @@ Repeatedly send small packets. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. UDPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. UDPSocket is open. **Test steps:** -1. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 9, "hello", 5);` -2. repeat 100 times -3. Fail if `NSAPI_ERROR_NO_MEMORY` is returned two times in a row, - wait 1 second before retry -4. destroy the socket +1. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 9, "hello", 5);`. +2. Repeat 100 times. +3. Fail if `NSAPI_ERROR_NO_MEMORY` is returned two times in a row,. + Wait 1 second before retry +4. Destroy the socket. **Expected result:** @@ -811,18 +770,18 @@ Verify working of different packet sizes. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. UDPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. UDPSocket is open. **Test steps:** -1. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , );` -2. Wait for incomming packet. If timeout happens, retry +1. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , );`. +2. Wait for incomming packet. If timeout happens, retry. sending&receiving, max 3 times. -3. Verify incomming content was the same that was sent -4. Repeat 1200 times -5. destroy the socket +3. Verify incomming content was the same that was sent. +4. Repeat 1200 times. +5. Destroy the socket. **Expected result:** @@ -842,22 +801,21 @@ mode **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. UDPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. UDPSocket is open. **Test steps:** -1. Call `UDPSocket::set_blocking(false)` -2. Register event handler with `UDPSocket::sigio()` -3. Create another thread that constantly waits signal from sigio() - handler, when received try `UDPSocket::recvfrom()` -4. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , );` +1. Call `UDPSocket::set_blocking(false)`. +2. Register event handler with `UDPSocket::sigio()`. +3. Create another thread that constantly waits signal from sigio() handler, when received try `UDPSocket::recvfrom()`. +4. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , );`. 5. Wait for incomming packet for one second. If nothing received retry, max 3 times. -6. Verify incomming content was the same that was sent -7. Repeat 1200 times -8. destroy the socket +6. Verify incomming content was the same that was sent. +7. Repeat 1200 times. +8. Destroy the socket. **Expected result:** @@ -877,28 +835,28 @@ Test whether timeouts are obeyed in UDPSockets. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Call `UDPSocket::set_timeout(100)` -2. Call `UDPSocket::sendto("echo.mbedcloudtesting.com", 7, , 100);` -3. Repeat 5 times - 1. record a time in millisecond precission - 2. Call `UDPSocket::recvfrom()` - 3. record a time in millisecond precission +1. Call `UDPSocket::set_timeout(100)`. +2. Call `UDPSocket::sendto("echo.mbedcloudtesting.com", 7, , 100);`. +3. Repeat 5 times. + 1. Record a time in millisecond precission. + 2. Call `UDPSocket::recvfrom()`. + 3. Record a time in millisecond precission. -4. repeat testcase 10 times. +4. Repeat testcase 10 times. **Expected result:** Each `sendto()` calls should return 100. Within each loop, one `recvfrom()` may return the received packet size -(100). Other calls should return NSAPI_ERROR_WOULD_BLOCK. +(100). Other calls should return `NSAPI_ERROR_WOULD_BLOCK`. -When NSAPI_ERROR_WOULD_BLOCK is received, check that time consumed is +When `NSAPI_ERROR_WOULD_BLOCK` is received, check that time consumed is more that 100 milliseconds but less than 200 milliseconds. After repeating for 10 times, at least 5 packets must have been @@ -913,17 +871,17 @@ Test whether timeouts are obeyed in UDPSockets. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Record time -2. Call `UDPSocket::sendto("echo.mbedcloudtesting.com", 9, , 100);` -3. Record time -4. Call `UDPSocket::set_timeout(1000)` -5. Call `UDPSocket::sendto("echo.mbedcloudtesting.com", 9, , 100);` -6. Record time +1. Record time. +2. Call `UDPSocket::sendto("echo.mbedcloudtesting.com", 9, , 100);`. +3. Record time. +4. Call `UDPSocket::set_timeout(1000)`. +5. Call `UDPSocket::sendto("echo.mbedcloudtesting.com", 9, , 100);`. +6. Record time. **Expected result:** @@ -938,51 +896,51 @@ Test cases for TCPSocket class ### TCPSOCKET_OPEN_DESTRUCT -**Description:** Run SOCKET_OPEN_DESTRUCT for TCPSocket +**Description:** Run SOCKET_OPEN_DESTRUCT for TCPSocket. ### TCPSOCKET_OPEN_LIMIT -**Description:** Run SOCKET_OPEN_LIMIT for TCPSocket +**Description:** Run SOCKET_OPEN_LIMIT for TCPSocket. ### TCPSOCKET_OPEN_TWICE -**Description:** Run SOCKET_OPEN_TWICE for TCPSocket +**Description:** Run SOCKET_OPEN_TWICE for TCPSocket. ### TCPSOCKET_OPEN_CLOSE_REPEAT -**Description:** Run SOCKET_OPEN_CLOSE_REPEAT for TCPSocket +**Description:** Run SOCKET_OPEN_CLOSE_REPEAT for TCPSocket. ### TCPSOCKET_BIND_PORT -**Description:** Run SOCKET_BIND_PORT for TCPSocket +**Description:** Run SOCKET_BIND_PORT for TCPSocket. ### TCPSOCKET_BIND_PORT_FAIL -**Description:** Run SOCKET_BIND_PORT_FAIL for TCPSocket +**Description:** Run SOCKET_BIND_PORT_FAIL for TCPSocket. ### TCPSOCKET_BIND_ADDRESS_PORT -**Description:** Run SOCKET_BIND_ADDRESS_PORT for TCPSocket +**Description:** Run SOCKET_BIND_ADDRESS_PORT for TCPSocket. ### TCPSOCKET_BIND_ADDRESS_NULL -**Description:** Run SOCKET_BIND_ADDRESS_NULL for TCPSocket +**Description:** Run SOCKET_BIND_ADDRESS_NULL for TCPSocket. ### TCPSOCKET_BIND_ADDRESS_INVALID -**Description:** Run SOCKET_BIND_ADDRESS_INVALID for TCPSocket +**Description:** Run SOCKET_BIND_ADDRESS_INVALID for TCPSocket. ### TCPSOCKET_BIND_WRONG_TYPE -**Description:** Run SOCKET_BIND_WRONG_TYPE for TCPSocket +**Description:** Run SOCKET_BIND_WRONG_TYPE for TCPSocket. ### TCPSOCKET_BIND_ADDRESS -**Description:** Run SOCKET_BIND_ADDRESS for TCPSocket +**Description:** Run SOCKET_BIND_ADDRESS for TCPSocket. ### TCPSOCKET_BIND_UNOPENED -**Description:** Run SOCKET_BIND_UNOPENED for TCPSocket +**Description:** Run SOCKET_BIND_UNOPENED for TCPSocket. ### TCPSOCKET_CONNECT_INVALID @@ -992,22 +950,22 @@ Call `TCPSocket::connect()` with invalid parameters. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. TCPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket:connect( NULL, 9);` -2. Call `TCPSocket:connect( "", 9);` -3. Call `TCPSocket:connect( "", 0);` -4. Call `TCPSocket:connect( "echo.mbedcloudtesting.com", 9);` -5. destroy the socket +1. Call `TCPSocket:connect( NULL, 9);`. +2. Call `TCPSocket:connect( "", 9);`. +3. Call `TCPSocket:connect( "", 0);`. +4. Call `TCPSocket:connect( "echo.mbedcloudtesting.com", 9);`. +5. Destroy the socket. **Expected result:** All connect() calls should return some error code except the number 4 -should return NSAPI_ERROR_OK. +should return `NSAPI_ERROR_OK`. @@ -1019,20 +977,20 @@ Repeatedly send small packets. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. TCPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 9);` -2. Call `TCPSocket::send("hello", 5);` -3. repeat 100 times -4. destroy the socket +1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 9);`. +2. Call `TCPSocket::send("hello", 5);`. +3. Repeat 100 times. +4. Destroy the socket. **Expected result:** -`TCPSocket::connect()` should return NSAPI_ERROR_OK +`TCPSocket::connect()` should return `NSAPI_ERROR_OK'. All send() calls should return 5. @@ -1047,20 +1005,20 @@ Verify working of different packet sizes. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. TCPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);` -2. Call `TCPSocket::send(, );` - 1. If less than was returned, size = sent bytes +1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);`. +2. Call `TCPSocket::send(, );`. + 1. If less than was returned, size = sent bytes. -3. Call `TCPSocket::recv(buffer, );` -4. Verify incomming content was the same that was sent -5. Repeat 1200 times -6. destroy the socket +3. Call `TCPSocket::recv(buffer, );`. +4. Verify incomming content was the same that was sent. +5. Repeat 1200 times. +6. Destroy the socket. **Expected result:** @@ -1082,34 +1040,29 @@ mode **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. TCPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);` -2. Call `TCPSocket::set_blocking(false)` -3. Register event handler with `TCPSocket::sigio()` -4. Create another thread that constantly waits signal from `sigio()` - handler, when received try `TCPSocket::recv(buf+index, - index)`, where index is the amount of data - already received. -5. Call `TCPSocket:send(, );` - 1. If less than was returned, try immeadiately - sending remaining bytes. - 2. If NSAPI_ERROR_WOULD_BLOCK is returned, wait for sigio() call - to happen. +1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);`. +2. Call `TCPSocket::set_blocking(false)`. +3. Register event handler with `TCPSocket::sigio()`. +4. Create another thread that constantly waits signal from `sigio()` handler, when received try `TCPSocket::recv(buf+index, - index)`, where index is the amount of data already received. +5. Call `TCPSocket:send(, );`. + 1. If less than was returned, try immeadiately sending remaining bytes. + 2. If `NSAPI_ERROR_WOULD_BLOCK` is returned, wait for sigio() call to happen. 6. Wait for incomming packet for one second. -7. Verify incomming content was the same that was sent, set index for - receiving thread to zero. -8. Repeat 1200 times -9. destroy the socket +7. Verify incomming content was the same that was sent, set index for receiving thread to zero. +8. Repeat 1200 times. +9. Destroy the socket. **Expected result:** All send() calls should return the packet size or less. All recv() calls -should return NSAPI_ERROR_WOULD_BLOCK or packet size that is equal or +should return `NSAPI_ERROR_WOULD_BLOCK` or packet size that is equal or less than what has been sent. ### TCPSOCKET_RECV_TIMEOUT @@ -1120,30 +1073,30 @@ Test whether timeouts are obeyed in TCPSockets. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. TCPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);` -2. Call `TCPSocket::set_timeout(100);` -3. Call `TCPSocket::send(;, 100);` -4. Repeat 5 times - 1. record a time in millisecond precission - 2. Call `TCPSocket::recv()` - 3. record a time in millisecond precission +1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);`. +2. Call `TCPSocket::set_timeout(100);`. +3. Call `TCPSocket::send(;, 100);`. +4. Repeat 5 times. + 1. Record a time in millisecond precission. + 2. Call `TCPSocket::recv()`. + 3. Record a time in millisecond precission. -5. repeat testcase 10 times. +5. Repeat testcase 10 times. **Expected result:** Each send() call should return 100. Within each loop, one recv() may return the received packet size (100). -Other calls should return NSAPI_ERROR_WOULD_BLOCK. +Other calls should return `NSAPI_ERROR_WOULD_BLOCK`. -When NSAPI_ERROR_WOULD_BLOCK is received, check that time consumed is +When `NSAPI_ERROR_WOULD_BLOCK` is received, check that time consumed is more that 100 milliseconds but less than 200 milliseconds. @@ -1155,21 +1108,21 @@ Repeatedly send small packets in a given time limit **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. TCPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket:connect("echo.mbedcloudtesting.com", 9);` -3. Call `TCPSocket:set_blocking(false);` -3. Call `TCPSocket:send("hello", 5);` -4. repeat 10 times -5. destroy the socket +1. Call `TCPSocket:connect("echo.mbedcloudtesting.com", 9);`. +3. Call `TCPSocket:set_blocking(false);`. +3. Call `TCPSocket:send("hello", 5);`. +4. Repeat 10 times. +5. Destroy the socket. **Expected result:** -`TCPSocket::connect()` should return NSAPI_ERROR_OK +`TCPSocket::connect()` should return `NSAPI_ERROR_OK'. All send() calls should return in less than 800 milliseconds @@ -1182,26 +1135,25 @@ Test whether we tolerate endpoint closing the connection. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. TCPSocket is open +1. Network interface and stack are initialized. +2. Network connection is up. +3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 13);` -2. Call `TCPSocket::recv(, 30);` -3. Repeat until recv() returns 0 -4. Call `TCPSocket::close();` -5. delete socket +1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 13);`. +2. Call `TCPSocket::recv(, 30);`. +3. Repeat until recv() returns 0. +4. Call `TCPSocket::close();`. +5. Delete socket. **Expected result:** -Connect should return NSAPI_ERROR_OK. +Connect should return `NSAPI_ERROR_OK`. -First recv() should return more that zero. Something between 10 and 30 -bytes (datetime string) +First recv() should return more that zero. Something between 10 and 30 bytes (datetime string) Second recv() should return zero because endpoint closed the connection. -(EOF). close() should return NSAPI_ERROR_OK +close() should return `NSAPI_ERROR_OK'. ### TCPSOCKET_SETSOCKOPT_KEEPALIVE_VALID @@ -1211,43 +1163,42 @@ Test we are able to request setting valid TCP keepalive values **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Call `TCPSocket::setsockopt(keepalive, [0,1 or 7200]);` -2. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 9);` -3. Call `TCPSocket::getsockopt(keepalive);` +1. Call `TCPSocket::setsockopt(keepalive, [0,1 or 7200]);`. +2. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 9);`. +3. Call `TCPSocket::getsockopt(keepalive);`. **Postconditions:** -1. Call `TCPSocket::close();` -2. delete socket +1. Call `TCPSocket::close();`. +2. Delete socket. **Expected result:** -`TCPSocket::getsockopt(keepalive)` returns same value as was set with -`TCPSocket::setsockopt()` or NSAPI_ERROR_UNSUPPORTED +`TCPSocket::getsockopt(keepalive)` returns same value as was set with `TCPSocket::setsockopt()` or `NSAPI_ERROR_UNSUPPORTED'. Test cases for TLSSocket class ------------------------------ ### TLSSOCKET_OPEN_DESTRUCT -**Description:** Run SOCKET_OPEN_DESTRUCT for TLSSocket +**Description:** Run SOCKET_OPEN_DESTRUCT for TLSSocket. ### TLSSOCKET_OPEN_LIMIT -**Description:** Run SOCKET_OPEN_LIMIT for TLSSocket +**Description:** Run SOCKET_OPEN_LIMIT for TLSSocket. ### TLSSOCKET_OPEN_TWICE -**Description:** Run SOCKET_OPEN_TWICE for TLSSocket +**Description:** Run SOCKET_OPEN_TWICE for TLSSocket. ### TLSSOCKET_CONNECT_INVALID -**Description:** Run SOCKET_CONNECT_INVALID for TLSSocket +**Description:** Run SOCKET_CONNECT_INVALID for TLSSocket. ### TLSSOCKET_HANDSHAKE_INVALID @@ -1257,15 +1208,15 @@ Execute TLS handshake by calling `TLSSocket::connect()` - server must not match **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create TLSSocket -2. Call `TLSSocket::open()` -3. Call `TLSSocket::connect("os.mbed.com", 2009)` -4. Call `TLSSocket::close()` +1. Create TLSSocket. +2. Call `TLSSocket::open()`. +3. Call `TLSSocket::connect("os.mbed.com", 2009)`. +4. Call `TLSSocket::close()`. **Expected result:** @@ -1275,20 +1226,20 @@ TLSSocket::connect must return an error **Description:** -Make a HTTP request to a closed socket +Make a HTTP request to a closed socket. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create TLSSocket -2. Call `TLSSocket::open()` -3. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2007)` -4. Call `TLSSocket::close()` -5. Call `TLSSocket::send("12345", 5)` +1. Create TLSSocket. +2. Call `TLSSocket::open()`. +3. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2007)`. +4. Call `TLSSocket::close()`. +5. Call `TLSSocket::send("12345", 5)`. **Expected result:** @@ -1306,19 +1257,19 @@ TLSSocket::send must return an error **Description:** -Make a HTTP request to an unconnected socket +Make a HTTP request to an unconnected socket. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** -1. Create TLSSocket -2. Call `TLSSocket::open()` -3. Call `TLSSocket::send("12345", 5)` -4. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2007)` +1. Create TLSSocket. +2. Call `TLSSocket::open()`. +3. Call `TLSSocket::send("12345", 5)`. +4. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2007)`. **Expected result:** @@ -1344,14 +1295,14 @@ Verify that TLS Socket fails to connect without certificate. **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up +1. Network interface and stack are initialized. +2. Network connection is up. **Test steps:** 1. Create TLSSocket, without adding a default certificate. -2. Call `TLSSocket::open()` -3. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2009)` +2. Call `TLSSocket::open()`. +3. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2009)`. **Expected result:** @@ -1361,7 +1312,7 @@ TLSSocket::connect must return an error if the certificate is not present. **Description:** -Run TCPSOCKET_RECV_TIMEOUT for TLSSOCKET by using port number 2007.  +Run TCPSOCKET_RECV_TIMEOUT for TLSSOCKET by using port number 2007. ### TLSSOCKET_SIMULTANEOUS_TEST @@ -1371,34 +1322,33 @@ Simultaneously send packets to echo server on two opened sockets and read incom **Preconditions:** -1. Network interface and stack are initialised -2. Network connection is up -3. TLSSockets are open and one additional thread has been created - -4. Both threads get their own socket instance +1. Network interface and stack are initialized. +2. Network connection is up. +3. TLSSockets are open and one additional thread has been created. +4. Both threads get their own socket instance. **Test steps:** 1. On main thread: - 1. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2007);` - 2. Call `TLSSocket::send(, );` - 1. If less than was returned, size = sent bytes + 1. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2007);`. + 2. Call `TLSSocket::send(, );`. + 1. If less than was returned, size = sent bytes. - 3. `Call TLSSocket::recv(buffer, );` - 4. Verify incomming content was the same that was sent - 5. Repeat 100 times + 3. `Call TLSSocket::recv(buffer, );`. + 4. Verify incomming content was the same that was sent. + 5. Repeat 100 times. 2. Simultaneously with the earlier step do on the additional thread: - 1. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2007);` - 2. Call `TLSSocket::send(, );` - 1. If less than was returned, size = sent bytes + 1. Call `TLSSocket::connect("echo.mbedcloudtesting.com", 2007);`. + 2. Call `TLSSocket::send(, );'. + 1. If less than was returned, size = sent bytes. - 3. Call `TLSSocket::recv(buffer, );` - 4. Verify incomming content was the same that was sent - 5. Repeat 100 times + 3. Call `TLSSocket::recv(buffer, );`. + 4. Verify incomming content was the same that was sent. + 5. Repeat 100 times. -3. Wait for end additional thread -4. Close and destroy the sockets +3. Wait for end additional thread. +4. Close and destroy the sockets. **Expected result:** @@ -1416,20 +1366,19 @@ Send burst of packets to echo server and read incoming packets back. **Preconditions:** -1. Network interface and stack are initialised. +1. Network interface and stack are initialized. 2. Network connection is up. 3. UDPSocket is open. **Test steps:** -1. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 100);` -2. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 200);` -3. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 300);` -4. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 120);` -5. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 500);` +1. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 100);`. +2. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 200);`. +3. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 300);`. +4. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 120);`. +5. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 500);`. 6. Wait for incomming packets for five second. -7. Verify incomming content was the same that was sent. Allow - packet reordering. +7. Verify incomming content was the same that was sent. Allow packet reordering. 8. Repeat 100 times. 9. Destroy the socket. @@ -1437,8 +1386,7 @@ Send burst of packets to echo server and read incoming packets back. All sendto() calls should return the packet size. -All recvfrom() calls should return the same sized packet that was send -with same content. Allow packet reordering. +All recvfrom() calls should return the same sized packet that was send with same content. Allow packet reordering. Calculate packet loss rate, maximum tolerated packet loss rate is 30%. @@ -1449,29 +1397,26 @@ Calculate number of succesfull rounds, it should be higher than 70. **Description:** -Send burst of packets to echo server and read incoming packets back. Use -socket in non-blocking mode. +Send burst of packets to echo server and read incoming packets back. Use socket in non-blocking mode. **Preconditions:** -1. Network interface and stack are initialised. +1. Network interface and stack are initialized. 2. Network connection is up. 3. UDPSocket is open. **Test steps:** -1. Call `UDPSocket::set_blocking(false)` -2. Register event handler with `UDPSocket::sigio()` -3. Create another thread that constantly waits signal from sigio() - handler, when received try `UDPSocket::recvfrom()` -4. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 100);` -5. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 200);` -6. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 300);` -7. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 120);` -8. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 500);` +1. Call `UDPSocket::set_blocking(false)`. +2. Register event handler with `UDPSocket::sigio()`. +3. Create another thread that constantly waits signal from sigio() handler, when received try `UDPSocket::recvfrom()`. +4. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 100);`. +5. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 200);`. +6. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 300);`. +7. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 120);`. +8. Call `UDPSocket:sendto("echo.mbedcloudtesting.com", 7, , 500);`. 9. Wait for incomming packets for five second. -10. Verify incomming content was the same that was sent. Allow - packet reordering. +10. Verify incomming content was the same that was sent. Allow packet reordering. 11. Repeat 100 times. 12. Destroy the socket. @@ -1479,8 +1424,7 @@ socket in non-blocking mode. All sendto() calls should return the packet size. -All recvfrom() calls should return the same sized packet that was send -with same content. Allow packet reordering. +All recvfrom() calls should return the same sized packet that was send with same content. Allow packet reordering. Calculate packet loss rate, maximum tolerated packet loss rate is 30%. @@ -1496,19 +1440,19 @@ Send burst of packets to echo server and read incoming packets back. **Preconditions:** -1. Network interface and stack are initialised. +1. Network interface and stack are initialized. 2. Network connection is up. 3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);` -2. Call `TCPSocket::send(, 100);` -3. Call `TCPSocket::send(, 200);` -4. Call `TCPSocket::send(, 300);` -5. Call `TCPSocket::send(, 120);` -6. Call `TCPSocket::send(, 500);` -7. Call `TCPSocket::recv(buf, 1220)` +1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);`. +2. Call `TCPSocket::send(, 100);`. +3. Call `TCPSocket::send(, 200);`. +4. Call `TCPSocket::send(, 300);`. +5. Call `TCPSocket::send(, 120);`. +6. Call `TCPSocket::send(, 500);`. +7. Call `TCPSocket::recv(buf, 1220)`. 8. Verify incomming content was the same that was sent. 9. Repeat 100 times. 10. Destroy the socket. @@ -1517,55 +1461,46 @@ Send burst of packets to echo server and read incoming packets back. All send() calls should return the packet size. -NOTE: This is stream so recv() might return less data than what was -requested. In this case you need to keep calling recv() with remaining -size until all data that you have sent is returned. +NOTE: This is stream so recv() might return less data than what was requested. In this case you need to keep calling recv() with remaining size until all data that you have sent is returned. -Consecutive calls to recv() should return all the data that has been -send. Total amount of returned must match 1220. +Consecutive calls to recv() should return all the data that has been send. Total amount of returned must match 1220. ### TCPSOCKET_ECHOTEST_BURST_NONBLOCK **Description:** -Send burst of packets to echo server and read incoming packets back. Use -socket in non-blocking mode. +Send burst of packets to echo server and read incoming packets back. Use socket in non-blocking mode. **Preconditions:** -1. Network interface and stack are initialised. +1. Network interface and stack are initialized. 2. Network connection is up. 3. TCPSocket is open. **Test steps:** -1. Register event handler with `TCPSocket::sigio()` -2. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);` -3. Call `TCPSocket::set_blocking(false)` -4. Create another thread that constantly waits signal from sigio() - handler, when received try `TCPSocket::recv()` +1. Register event handler with `TCPSocket::sigio()`. +2. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7);`. +3. Call `TCPSocket::set_blocking(false)`. +4. Create another thread that constantly waits signal from sigio() handler, when received try `TCPSocket::recv()`. 5. For randomly generated packets, sized 100, 200, 300, 120 and 500 do - 1. Call `TCPSocket::send(packet, size);` + 1. Call `TCPSocket::send(packet, size);`. 2. If less than size is sent, repeat with remaining. - 3. If NSAPI_ERROR_WOULD_BLOCK returned, wait for next sigio(). + 3. If `NSAPI_ERROR_WOULD_BLOCK` returned, wait for next sigio(). 6. Wait for incomming packets for five second. -7. Verify incomming content was the same that was sent. Allow recv() to - return smaller piezes. +7. Verify incomming content was the same that was sent. Allow recv() to return smaller piezes. 8. Repeat 100 times. 9. Destroy the socket. **Expected result:** -All send() calls should return NSAPI_ERROR_WOULD_BLOCK or size which -is equal or less than requested. +All send() calls should return `NSAPI_ERROR_WOULD_BLOCK` or size which is equal or less than requested. -All recv() calls should return value that is less or equal to what have -been sent. With consecutive calls, size should match. +All recv() calls should return value that is less or equal to what have been sent. With consecutive calls, size should match. -When recv() returns NSAPI_ERROR_WOULD_BLOCK wait for next sigio() -event. No other error codes allowed. +When recv() returns `NSAPI_ERROR_WOULD_BLOCK` wait for next sigio() event. No other error codes allowed. ### TCPSOCKET_RECV_100K @@ -1576,14 +1511,14 @@ Download 100kB of data **Preconditions:** -1. Network interface and stack are initialised. +1. Network interface and stack are initialized. 2. Network connection is up. 3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 19);` -2. Call `TCPSocket::recv(buffer, 100);` +1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 19);`. +2. Call `TCPSocket::recv(buffer, 100);`. 3. Verify input according to known pattern. 4. Loop until 100kB of data received. 5. Close socket. @@ -1603,17 +1538,16 @@ Download 100kB of data **Preconditions:** -1. Network interface and stack are initialised. +1. Network interface and stack are initialized. 2. Network connection is up. 3. TCPSocket is open. **Test steps:** -1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 19);` -2. Call `TCPSocket::set_blocking(false)` -3. Create another thread that constantly waits signal from sigio() - handler, when received try `TCPSocket::recv()` - 1. Call `TCPSocket::recv(buffer, 100);` +1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 19);`. +2. Call `TCPSocket::set_blocking(false)`. +3. Create another thread that constantly waits signal from sigio() handler, when received try `TCPSocket::recv()`. + 1. Call `TCPSocket::recv(buffer, 100);`. 2. Verify input according to known pattern. 4. Wait until 100kB of data received. @@ -1621,9 +1555,7 @@ Download 100kB of data **Expected result:** -Each recv() call should return equal or less than 100 bytes of data or -NSAPI_ERROR_WOULD_BLOCK in which case thread should wait for another -sigio(). No errors should be returned. +Each recv() call should return equal or less than 100 bytes of data or `NSAPI_ERROR_WOULD_BLOCK` in which case thread should wait for another sigio(). No errors should be returned. Measure time taken for receiving, report speed. @@ -1631,43 +1563,37 @@ Measure time taken for receiving, report speed. **Description:** -Run two threads which both exercise the underlying stack and driver -through a dedicated socket +Run two threads which both exercise the underlying stack and driver through a dedicated socket. **Preconditions:** -1. Network interface and stack are initialised. +1. Network interface and stack are initialized. 2. Network connection is up. 3. 2 TCPSockets are open and one additional thread has been created. 4. Both threads get their own socket instance. **Test steps:** -1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7)` - in both threads - in the main thread executing the test case and on - the additional one. +1. Call `TCPSocket::connect("echo.mbedcloudtesting.com", 7)` in both threads - in the main thread executing the test case and on the additional one. 2. On main thread - 1. For randomly generated packets, sized 1001, 901, 801,...,101,1 - do - 1. Call `TCPSocket::send(packet, size);` + 1. For randomly generated packets, sized 1001, 901, 801,...,101,1 do + 1. Call `TCPSocket::send(packet, size);`. 2. Verify incoming content was the same that was sent. - Allow recv() to return smaller piezes. + Allow recv() to return smaller pieces. 3. Simultaneously with the earlier step do on the additional thread 1. For randomly generated packets, sized 10 do - 1. Call `TCPSocket::send(packet, size);` + 1. Call `TCPSocket::send(packet, size);`. 2. Verify incomming content was the same that was sent. Allow recv() to return smaller piezes. - 3. stop the thread if inconsistensies were found and report it - to main thread + 3. Stop the thread if inconsistensies were found and report it to main thread. 4. Kill the additional thread. 5. Close and destroy the sockets. **Expected result:** -Echo server returns data to both threads and received data matches to -send data. The additional thread isn't stopped prematurely. +Echo server returns data to both threads and received data matches to send data. The additional thread isn't stopped prematurely. Test cases for DNS class --------------------------- @@ -1676,11 +1602,11 @@ Test cases for DNS class **Description:** -Verify basic functionality of asynchronous DNS. Call `NetworkInterface::gethostbyname_async()` with a valid host name and verify result. +Verify the basic functionality of asynchronous DNS. Call `NetworkInterface::gethostbyname_async()` with a valid host name, and verify the result. **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** @@ -1690,38 +1616,38 @@ Verify basic functionality of asynchronous DNS. Call `NetworkInterface::gethostb **Expected result:** -Callback is called with NSAPI_ERROR_OK and IP address. +Callback is called with `NSAPI_ERROR_OK` and IP address. ### ASYNCHRONOUS_DNS_SIMULTANEOUS **Description:** -Verify that simultaneous asynchronous DNS queries work correctly. Call `NetworkInterface::gethostbyname_async()` in a row 6 times with a different host names. Wait for all requests to complete and verify result. Cache shall not contain host names used in asynchronous request. +Verify that simultaneous asynchronous DNS queries work correctly. Call `NetworkInterface::gethostbyname_async()` in a row 6 times with a different host names. Wait for all requests to complete, and verify the result. Cache should not contain host names used in asynchronous request. **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** 1. Call `gethostbyname_async()` in a row 6 times with a different host names. Host names shall not be found from cache. -2. Verify that last `gethostbyname_async()` operation is rejected since there is room only for 5 simultaneous operations. +2. Verify that last `gethostbyname_async()` operation is rejected because there is room only for 5 simultaneous operations. 3. Verify that callback is called with correct parameters 5 times. **Expected result:** -Sixth `gethostbyname_async()` is rejected. Callback is called with NSAPI_ERROR_OK and IP address 5 times. +Sixth `gethostbyname_async()` is rejected. Callback is called with `NSAPI_ERROR_OK` and IP address 5 times. ### ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE **Description:** -Verify that the caching of DNS results works correctly with simultaneous asynchronous DNS queries. Call `NetworkInterface::gethostbyname_async()` in a row 6 times with a different host names. Wait for all requests to complete and verify result. Cache shall contain at least one host name used in asynchronous request. This can be achieved e.g. by running test "Asynchronous DNS simultaneous" before this test and using same host names in this run. +Verify that the caching of DNS results works correctly with simultaneous asynchronous DNS queries. Call `NetworkInterface::gethostbyname_async()` in a row 6 times with a different host names. Wait for all requests to complete and verify result. Cache shall contain at least one host name used in asynchronous request. You can achieve this, for example, by running test "Asynchronous DNS simultaneous" before this test and using same host names in this run. **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** @@ -1731,7 +1657,7 @@ Verify that the caching of DNS results works correctly with simultaneous asynchr **Expected result:** -Callback is called with NSAPI_ERROR_OK and IP address 6 times. +Callback is called with `NSAPI_ERROR_OK` and IP address 6 times. ### ASYNCHRONOUS_DNS_CACHE @@ -1741,7 +1667,7 @@ Verify that the caching of DNS results works correctly. Call `NetworkInterface:: **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** @@ -1753,17 +1679,17 @@ Verify that the caching of DNS results works correctly. Call `NetworkInterface:: **Expected result:** -Callback is called with NSAPI_ERROR_OK and IP address 5 times. First request shall complete slower than the requests made after it (where the response is found from cache). +Callback is called with `NSAPI_ERROR_OK` and IP address 5 times. First request shall complete before the requests made after it (where the response is found from cache). ### ASYNCHRONOUS_DNS_NON_ASYNC_AND_ASYNC **Description:** -Verify that non-asynchronous i.e. blocking DNS queries and asynchronous i.e. non-blocking queries work at the same time. Call `NetworkInterface::gethostbyname_async()`. Right after that make 6 non-asynchronous `NetworkInterface::gethostbyname()` calls with different host names. +Verify synchronous (in other words, blocking) DNS queries and asynchronous (in other words, non-blocking) queries work at the same time. Call `NetworkInterface::gethostbyname_async()`. Right after that, make 6 synchronous `NetworkInterface::gethostbyname()` calls with different host names. **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** @@ -1775,29 +1701,29 @@ Verify that non-asynchronous i.e. blocking DNS queries and asynchronous i.e. non **Expected result:** -All operations shall return NSAPI_ERROR_OK and IP address. +All operations shall return `NSAPI_ERROR_OK` and IP address. ### ASYNCHRONOUS_DNS_CANCEL **Description:** -Verify that asynchronous DNS query cancel works correctly. Call `NetworkInterface::gethostbyname_async()` in a row 6 times with a different host names. Cache shall contain 3 host names used in requests. This can be achieved e.g. by running test "Asynchronous DNS non-asynchronous and asynchronous" before this test and using same host names in this run. For each request that was given an unique id, call cancel. Verify that callback is not called for cancelled requests. +Verify that asynchronous DNS query cancel works correctly. Call `NetworkInterface::gethostbyname_async()` in a row 6 times with a different host names. Cache shall contain 3 host names used in requests. This can be achieved e.g. by running test "Asynchronous DNS synchronous and asynchronous" before this test and using same host names in this run. For each request that was given an unique ID, call cancel. Verify that callback is not called for canceled requests. **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** 1. Call `gethostbyname_async()` in a row 6 times with a different host names. Cache shall contain in maximum 3 host names used in requests. -2. Call `gethostbyname_async_cancel()` for each request that was given an unique id. -3. Verify that for cancelled requests, callback is not called. -4. Verify that for other request, callback is called. +2. Call `gethostbyname_async_cancel()` for each request that was given an unique ID. +3. Verify that for canceled requests, callback is not called. +4. Verify that for other requests, callback is called. **Expected result:** -Callback shall be called only for requests that were not cancelled. +Callback shall be called only for requests that were not canceled. ### ASYNCHRONOUS_DNS_EXTERNAL_EVENT_QUEUE @@ -1807,7 +1733,7 @@ Verify that providing an external event queue works correctly. Define a thread a **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** @@ -1823,7 +1749,7 @@ Verify that providing an external event queue works correctly. Define a thread a **Expected result:** -Sixth `gethostbyname_async()` is rejected. Callback is called with NSAPI_ERROR_OK and IP address 5 times. +Sixth `gethostbyname_async()` is rejected. Callback is called with `NSAPI_ERROR_OK` and IP address 5 times. ### ASYNCHRONOUS_DNS_INVALID_HOST @@ -1833,7 +1759,7 @@ Verify that DNS failure error is provided for invalid hosts. Call `NetworkInterf **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** @@ -1844,7 +1770,7 @@ Verify that DNS failure error is provided for invalid hosts. Call `NetworkInterf **Expected result:** -Sixth `gethostbyname_async()` is rejected. Callback is called with NSAPI_ERROR_DNS_FAILURE for first, third and fifth host name. Callback is called with NSAPI_ERROR_OK and IP address for second and fourth host name. +Sixth `gethostbyname_async()` is rejected. Callback is called with `NSAPI_ERROR_DNS_FAILURE` for first, third and fifth host name. Callback is called with `NSAPI_ERROR_OK` and IP address for second and fourth host name. ### ASYNCHRONOUS_DNS_TIMEOUTS @@ -1854,7 +1780,7 @@ Test DNS timeouts using an external event queue that is modified to timeout the **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** @@ -1869,7 +1795,7 @@ Test DNS timeouts using an external event queue that is modified to timeout the **Expected result:** -Sixth `gethostbyname_async()` is rejected. At least for one operation, callback is called with NSAPI_ERROR_TIMEOUT value. +Sixth `gethostbyname_async()` is rejected. At least for one operation, callback is called with `NSAPI_ERROR_TIMEOUT` value. ### ASYNCHRONOUS_DNS_SIMULTANEOUS_REPEAT @@ -1879,90 +1805,90 @@ Verify that simultaneous asynchronous DNS queries work correctly when repeated i **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** -1. Call `gethostbyname_async()` in a row 5 times with a different host names. -2. Verify that callback is called with correct parameters 5 times for first operation. +1. Call `gethostbyname_async()` in a row 5 times with a different host names, providing a callback to be called when the operation completes. +2. Verify that callback is called with correct parameters 5 times for the first operation. 3. Repeat 100 times steps 1 to 2. **Expected result:** -Callback is called with NSAPI_ERROR_OK and IP address 5 times for every repeat. +Callback, registered for `gethostbyname_async()`, is called with `NSAPI_ERROR_OK` and an IP address 5 times for every one of a hundred repetitions of the test. ### SYNCHRONOUS_DNS **Description:** -Verify basic functionality of synchronous DNS. Call `NetworkInterface::gethostbyname()` with a valid host name and verify result. +Verify the basic functionality of synchronous DNS. Call `NetworkInterface::gethostbyname()` with a valid host name, and verify the result. **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** 1. Call `gethostbyname()` with a valid host name. -2. Verify that address was resolved and return value was valid. +2. Verify the address was resolved and the return value was valid. **Expected result:** -Return value is NSAPI_ERROR_OK and IP address is obtained from the function call. +Return value is `NSAPI_ERROR_OK` and IP address is obtained from the function call. ### SYNCHRONOUS_DNS_MULTIPLE **Description:** -Verify basic functionality of synchronous DNS. Call `NetworkInterface::gethostbyname()` with a list of 6 host names and verify result. +Verify the basic functionality of synchronous DNS. Call `NetworkInterface::gethostbyname()` with a list of 6 host names, and verify the result. **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** -1. Call `gethostbyname()` with a list of 6 host names -2. Verify that each of the addresses was resolved and return value was valid. +1. Call `gethostbyname()` with a list of 6 host names. +2. Verify that each of the addresses was resolved and the return value was valid. **Expected result:** -Return value is NSAPI_ERROR_OK and IP addresses are obtained from the function call. +Return value is `NSAPI_ERROR_OK` and IP addresses are obtained from the function call. ### SYNCHRONOUS_DNS_CACHE **Description:** -Verify that the caching of DNS results works correctly. Call `NetworkInterface::gethostbyname()` 5 times with the same host name and verify result after each request. For first request, cache shall not contain the host name. Verify that first request completes slower than the requests made after it (where the response is found from cache). +Verify that the caching of DNS results works correctly. Call `NetworkInterface::gethostbyname()` 5 times with the same host name, and verify the result after each request. For first request, cache shall not contain the host name. Verify that first request completes before the requests made after it (where the response is found from cache). **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** -1. Call `gethostbyname()` with a host name. For the first request, host name shall not be found from cache. -2. Verify that address was resolved and return value was valid. +1. Call `gethostbyname()` with a host name. For the first request, host name should not be found in cache and an error should be returned. +2. Verify that address was resolved and the return value was valid. 3. Repeat the sequence 4 times using the same host name. 4. For each request, calculate how long time it takes for DNS query to complete. **Expected result:** -Return value is NSAPI_ERROR_OK and IP address is obtained from the function call 5 times. First request shall complete slower than the requests made after it (where the response is found from cache). +Return value is `NSAPI_ERROR_OK` and IP address is obtained from the function call 5 times. First request shall complete before the requests made after it (where the response is found from cache). ### SYNCHRONOUS_DNS_INVALID_HOST **Description:** -Verify that DNS failure error is provided for invalid hosts. Call `NetworkInterface::gethostbyname()` in a row 6 times with a different host names. First, third and fifth host name shall be invalid. +Verify that DNS failure error is provided for invalid hosts. Call `NetworkInterface::gethostbyname()` in a row 6 times with different host names. First, third and fifth of the host names used in this test shall be invalid (for example by adding an incorrect suffic, like so: "google.com_invalid"). **Preconditions:** -1. Network interface is initialised. +1. Network interface is initialized. 2. Network connection is up. **Test steps:** @@ -1972,7 +1898,7 @@ Verify that DNS failure error is provided for invalid hosts. Call `NetworkInterf **Expected result:** -Return value is NSAPI_ERROR_DNS_FAILURE for first, third and fifth host name. Return value is NSAPI_ERROR_OK and IP address is obtained for second and fourth host name. +Return value is `NSAPI_ERROR_DNS_FAILURE` for first, third and fifth host name, which were invalidated at the beginning of the test. Return value is `NSAPI_ERROR_OK` and IP address is obtained for second and fourth host name, which were valid. Subset for driver test ----------------------