Commit Graph

19 Commits (mbed-os-5.10)

Author SHA1 Message Date
adbridge 3aa8d7f906 Revert "Use the parsing status as a way to detect if the IP string represent a valid IPv6 address"
This reverts commit 99aa1dca0a.
This has been moved to 5.11
2018-11-05 12:36:59 +00:00
Michal Paszta e1887a7738 TCPSocket accept refactored to close cleanly and icetea test added
Private constructor called in TCPSocket accept, when creating a new Socket.
Close() method calls moved "up" to InternetSocket.
InternetSocket::close() returns proper error code when no socket available.
Add TcpSocket::accept icetea tests.
Deleting sockets moved to teardown.
2018-11-02 19:49:59 -05:00
Taiki 99aa1dca0a Use the parsing status as a way to detect if the IP string represent a valid IPv6 address 2018-11-02 19:49:54 -05:00
Sławek Piotrowski 50dd1eb950 Fix hard-fault when socket created using accept() is closed
When socket created  using accept() is closed by calling the close()
method, "delete this" is executed which triggers the destructor call
on TCPSocket which in turn calls close() once again. Because _stack
is already 0 this results in a hard-fault.

Add a check that skips the rest of the close() method is the _stack
is already 0.
2018-10-19 11:46:55 +01:00
Michal Paszta 8c72bd5c0b unittests: Added tests for netsocket classes
New classes covered with unit tests: SocketAddress, EthernetInterface, EMACInterface, WiFiAccessPoint.
Also added missing namespace in front of mbed::Callback usages.
EMACInterface is covered by the EthernetInterface unit tests.
2018-10-19 11:46:55 +01:00
Antti Kauppila dbe2b15daa equeue_stub updated and code fixed accordingly 2018-10-08 15:29:18 +01:00
Seppo Takalo 3664339c39 Use SocketAddr that actually has IP bytes in UDP test 2018-10-08 15:18:50 +01:00
Seppo Takalo 5b659c898b Fix TCPSocket::accept() unittest.
accept() is not anymore returning NULL pointer. It was a bug.
2018-10-08 15:18:50 +01:00
Michal Paszta 6c012fc476 unittests: Add tests for NetworkStack class.
Improved the stubs for event queue and nsapi_dns, to allow checking if callback are handled correctly. This involves some memory allocation and deallocation.
The NetworkStackWrapper is not covered as it seems to be deprecated code.
2018-10-08 15:18:50 +01:00
Michal Paszta 43ca738436 unittests: Add TCPServer unit tests
TCPServer class only really implements attach method.
2018-10-08 15:18:50 +01:00
Michal Paszta 54ee25cf1e unittests: Added NetworkInterface unit tests
Most functions are empty or simply return "UNSUPPORTED", but it is still worth covering this functions with unit tests to have better control of unwanted changes.
2018-10-08 15:18:50 +01:00
Michal Paszta 77fc6a0347 unittests: InternetSocket class coverage improved.
Added more tests, improved the existing ones. setblocking tests were not checking anything, so they were removed and these functions are called in TCPSocket tests instead.
2018-10-08 15:18:50 +01:00
Michal Paszta 46b529a1ea unittests: Check NULL pointer scenario in TCPSocket::recvfrom 2018-10-08 15:18:50 +01:00
Michal Paszta 2bbf033fe2 unittests: improved coverage for UDPSocket and TCPSocket
Add functional and line coverage for UDPSocket and TCPSocket. The EventFlagsstub and NetworkStackstub classes are allowed to store multiple return values to allow running internal loops multiple times.
2018-10-08 15:18:50 +01:00
Lari-Matias Orjala b6b331f94d add auto-naming of unit test suites 2018-10-08 15:18:50 +01:00
Antti Kauppila fc97b2aca0 Rebased & fixed 2018-10-08 15:18:50 +01:00
Seppo Takalo b1ebb42d6b Fix SocketAddress unittests
Add ip4tos() and stoip4() into unittests.
NOTE: Probably should have been stubbed but this way we can also
test these helper functions.
2018-09-17 21:42:55 -05:00
Brian Daniels c2f6de6dbe Moving all unit tests to use hyphenated test name 2018-09-17 21:42:55 -05:00
Lari-Matias Orjala 4dde13db6d Add unit testing framework 2018-08-27 14:32:35 +03:00