Skip to content

Rollup v2 for 5.11rc1 #8838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Nov 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c97d343
wifi-headerfile-updates
M-ichae-l Nov 15, 2018
e53ee63
Greentea netsocket and network tests improvements
michalpasztamobica Nov 16, 2018
9bdeb68
Cellular: Updated debug prints, and network registration return value
Nov 15, 2018
42940fa
Deprecate TCP/UDPSocket open-calling constructors
michalpasztamobica Nov 16, 2018
cf84615
Add block device small data size test
theamirocohen Nov 19, 2018
d22adbd
Implement DTLSSocketWrapper and fix non-blocking connections on TLSSo…
Nov 1, 2018
2ca1fe6
Implement DTLSSocket helper
Nov 6, 2018
392bccf
Add unit tests for TLSSocket and TLSSocketWrapper
michalpasztamobica Nov 8, 2018
695db63
Decrease verbosity of the TLSSocketWrapper
Nov 14, 2018
46c4601
Refactor DTLSSocket to use Socket::getpeername()
Nov 14, 2018
2229a2f
Need to protect members with MBEDTLS_PK_C and X509_CRT_PARSE flags.
Nov 14, 2018
6192ed1
Compare the intermediate timestamps as well
Nov 14, 2018
5d170f2
Clarify that TLSSocket should not be reopened.
Nov 16, 2018
bdc355f
Astyle fixes
Nov 19, 2018
0f5cec3
Include TLSSocket and DTLSSocket in Doxygen
Nov 19, 2018
8e41cac
Add license headers into TLSSocket unittests
Nov 19, 2018
5459a7b
Add license headers into TLSSocket files
Nov 19, 2018
a5e8df2
travis: astyle anchor fix
0xc0170 Nov 20, 2018
c1d00df
test: fix coding style
0xc0170 Nov 20, 2018
8d341ae
Update mbed-coap to version 4.7.2
Nov 22, 2018
95b1e75
Merge branch 'dtls' of https://github.com/SeppoTakalo/mbed-os into de…
0xc0170 Nov 23, 2018
b75aae6
Merge branch 'block_device_general_tests' of https://github.com/theam…
0xc0170 Nov 23, 2018
7a6b166
Merge branch 'realtek-rtl8195am-wifi-headerfile-updates' of https://g…
0xc0170 Nov 23, 2018
61c7947
Merge branch 'cell-trace' of https://github.com/AriParkkila/mbed-os i…
0xc0170 Nov 23, 2018
36bc2ef
Merge branch 'greentea_improvements' of https://github.com/michalpasz…
0xc0170 Nov 23, 2018
b9ea30a
Merge branch 'socket_open_deprecated' of https://github.com/michalpas…
0xc0170 Nov 23, 2018
80ed251
Merge branch 'fix_travis_astyle_files' of https://github.com/0xc0170/…
0xc0170 Nov 23, 2018
0f14f4b
Merge branch 'update_coap_to_4.7.2' of https://github.com/anttiylitok…
0xc0170 Nov 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ matrix:
after_success:
# run astyle for all files on the branch
- git checkout -- .
- find -regex '.*\.\(h\|c\|hpp\|cpp\)' -type f | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle-branch.out;
- find -regex '.*\.\(h\|c\|hpp\|cpp\)$' -type f | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle-branch.out;
# update status if we succeeded, compare with master if possible
- |
CURR=$(cat astyle-branch.out | grep Formatted | wc -l)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void ASYNCHRONOUS_DNS_NON_ASYNC_AND_ASYNC()
TEST_ASSERT(strlen(addr.get_ip_address()) > 1);
}

semaphore.wait();
semaphore.wait(100);

TEST_ASSERT(data.result == NSAPI_ERROR_OK);

Expand Down
2 changes: 1 addition & 1 deletion TESTS/netsocket/tcp/tcp_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket &sock);
int split2half_rmng_tcp_test_time(); // [s]

namespace tcp_global {
static const int TESTS_TIMEOUT = 960;
static const int TESTS_TIMEOUT = 480;
static const int TCP_OS_STACK_SIZE = 2048;

static const int RX_BUFF_SIZE = 1220;
Expand Down
4 changes: 2 additions & 2 deletions TESTS/netsocket/tcp/tcpsocket_recv_timeout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ void TCPSOCKET_RECV_TIMEOUT()
TEST_FAIL();
goto CLEANUP;
}
printf("MBED: recv() took: %dms\n", timer.read_ms());
TEST_ASSERT_INT_WITHIN(50, 150, timer.read_ms());
printf("MBED: recv() took: %dus\n", timer.read_us());
TEST_ASSERT_INT_WITHIN(51, 150, (timer.read_us() + 500) / 1000);
continue;
} else if (recvd < 0) {
printf("[pkt#%02d] network error %d\n", i, recvd);
Expand Down
9 changes: 6 additions & 3 deletions TESTS/network/interface/networkinterface_status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ void NETWORKINTERFACE_STATUS()
}
TEST_ASSERT_EQUAL(NSAPI_STATUS_GLOBAL_UP, status);

net->disconnect();
err = net->disconnect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);

status = wait_status_callback();
TEST_ASSERT_EQUAL(NSAPI_STATUS_DISCONNECTED, status);
Expand Down Expand Up @@ -123,7 +124,8 @@ void NETWORKINTERFACE_STATUS_NONBLOCK()
}
TEST_ASSERT_EQUAL(NSAPI_STATUS_GLOBAL_UP, status);

net->disconnect();
err = net->disconnect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);

status = wait_status_callback();
TEST_ASSERT_EQUAL(NSAPI_STATUS_DISCONNECTED, status);
Expand All @@ -150,7 +152,8 @@ void NETWORKINTERFACE_STATUS_GET()
wait(0.5);
}

net->disconnect();
err = net->disconnect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);

TEST_ASSERT_EQUAL(NSAPI_STATUS_DISCONNECTED, net->get_connection_status());
}
Expand Down
2 changes: 1 addition & 1 deletion TESTS/network/wifi/wifi_connect_params_null.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void wifi_connect_params_null(void)
error = wifi->connect(NULL, NULL);
wifi->disconnect();
TEST_ASSERT(error == NSAPI_ERROR_PARAMETER);
error = wifi->connect("", "");
error = wifi->connect("", "");
wifi->disconnect();
TEST_ASSERT(error == NSAPI_ERROR_PARAMETER);
}
2 changes: 1 addition & 1 deletion TESTS/network/wifi/wifi_connect_secure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void wifi_connect_secure(void)
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_INT(NSAPI_ERROR_OK, wifi->connect());

TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
reg_params._periodic_tau = 3;

EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.get_registration_params(CellularNetwork::C_EREG, reg_params));
EXPECT_TRUE(reg_params._status == CellularNetwork::StatusNotAvailable);
EXPECT_TRUE(reg_params._status == CellularNetwork::NotRegistered);
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_UNKNOWN);
EXPECT_TRUE(reg_params._cell_id == -1 && reg_params._active_time == -1 && reg_params._periodic_tau == -1);

EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.get_registration_params(CellularNetwork::C_GREG, reg_params));
EXPECT_TRUE(reg_params._status == CellularNetwork::StatusNotAvailable);
EXPECT_TRUE(reg_params._status == CellularNetwork::NotRegistered);
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_UNKNOWN);
EXPECT_TRUE(reg_params._cell_id == -1);

Expand All @@ -201,12 +201,12 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
reg_params._periodic_tau = 3;

EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == nw.get_registration_params(CellularNetwork::C_EREG, reg_params));
EXPECT_TRUE(reg_params._status == CellularNetwork::StatusNotAvailable);
EXPECT_TRUE(reg_params._status == CellularNetwork::NotRegistered);
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_UNKNOWN);
EXPECT_TRUE(reg_params._cell_id == -1 && reg_params._active_time == -1 && reg_params._periodic_tau == -1);
// Check get_registration_params without specifying the registration type
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(reg_params_check));
EXPECT_TRUE(reg_params_check._status == CellularNetwork::StatusNotAvailable);
EXPECT_TRUE(reg_params_check._status == CellularNetwork::NotRegistered);
EXPECT_TRUE(reg_params_check._act == CellularNetwork::RAT_UNKNOWN);
EXPECT_TRUE(reg_params_check._cell_id == -1 && reg_params_check._active_time == -1 && reg_params_check._periodic_tau == -1);
}
Expand Down Expand Up @@ -497,7 +497,7 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_signal_quality)
ATHandler_stub::int_value = 1;
ATHandler_stub::nsapi_error_value = NSAPI_ERROR_OK;
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_signal_quality(rs, ber));
EXPECT_TRUE(rs == 1 && ber == 1);
EXPECT_TRUE(rs == -111 && ber == 1);
}

TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_3gpp_error)
Expand Down
24 changes: 24 additions & 0 deletions UNITTESTS/features/netsocket/DTLSSocket/dtls_test_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates
* 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.
*/

#ifndef UNITTESTS_FEATURES_NETSOCKET_DTLSSOCKET_DTLS_TEST_CONFIG_H_
#define UNITTESTS_FEATURES_NETSOCKET_DTLSSOCKET_DTLS_TEST_CONFIG_H_

#define MBEDTLS_SSL_CLI_C


#endif /* UNITTESTS_FEATURES_NETSOCKET_DTLSSOCKET_DTLS_TEST_CONFIG_H_ */
73 changes: 73 additions & 0 deletions UNITTESTS/features/netsocket/DTLSSocket/test_DTLSSocket.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates
* 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 "gtest/gtest.h"
#include "features/netsocket/DTLSSocket.h"
#include "NetworkStack_stub.h"

#include "mbed_error.h"
mbed_error_status_t mbed_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
{
return 0;
}

// Control the rtos EventFlags stub. See EventFlags_stub.cpp
extern std::list<uint32_t> eventFlagsStubNextRetval;

class TestDTLSSocket : public testing::Test {
public:
unsigned int dataSize = 10;
char dataBuf[10];
protected:
DTLSSocket *socket;
NetworkStackstub stack;

virtual void SetUp()
{
socket = new DTLSSocket();
}

virtual void TearDown()
{
stack.return_values.clear();
eventFlagsStubNextRetval.clear();
delete socket;
}
};

TEST_F(TestDTLSSocket, constructor)
{
EXPECT_TRUE(socket);
}

/* connect */

TEST_F(TestDTLSSocket, connect)
{
socket->open((NetworkStack *)&stack);

stack.return_value = NSAPI_ERROR_OK;
EXPECT_EQ(socket->connect("127.0.0.1", 1024), NSAPI_ERROR_OK);
}

TEST_F(TestDTLSSocket, connect_error)
{
socket->open((NetworkStack *)&stack);

stack.return_value = NSAPI_ERROR_DNS_FAILURE;
EXPECT_EQ(socket->connect("127.0.0.1", 1024), NSAPI_ERROR_DNS_FAILURE);
}
40 changes: 40 additions & 0 deletions UNITTESTS/features/netsocket/DTLSSocket/unittest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

####################
# UNIT TESTS
####################

set(unittest-sources
../features/netsocket/SocketAddress.cpp
../features/netsocket/NetworkStack.cpp
../features/netsocket/InternetSocket.cpp
../features/netsocket/UDPSocket.cpp
../features/netsocket/DTLSSocket.cpp
../features/netsocket/DTLSSocketWrapper.cpp
../features/netsocket/TLSSocketWrapper.cpp
../features/frameworks/nanostack-libservice/source/libip4string/ip4tos.c
../features/frameworks/nanostack-libservice/source/libip6string/ip6tos.c
../features/frameworks/nanostack-libservice/source/libip4string/stoip4.c
../features/frameworks/nanostack-libservice/source/libip6string/stoip6.c
../features/frameworks/nanostack-libservice/source/libBits/common_functions.c
)

set(unittest-test-sources
features/netsocket/DTLSSocket/test_DTLSSocket.cpp
stubs/Mutex_stub.cpp
stubs/mbed_assert_stub.c
stubs/equeue_stub.c
../features/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c
stubs/EventQueue_stub.cpp
stubs/mbed_shared_queues_stub.cpp
stubs/nsapi_dns_stub.cpp
stubs/EventFlags_stub.cpp
stubs/stoip4_stub.c
stubs/ip4tos_stub.c
stubs/Kernel_stub.cpp
)

set(MBEDTLS_USER_CONFIG_FILE_PATH "\"../UNITTESTS/features/netsocket/DTLSSocket/dtls_test_config.h\"")
set_source_files_properties(features/netsocket/DTLSSocket/test_DTLSSocket.cpp PROPERTIES COMPILE_DEFINITIONS MBEDTLS_USER_CONFIG_FILE=${MBEDTLS_USER_CONFIG_FILE_PATH})
set_source_files_properties(../features/netsocket/DTLSSocket.cpp PROPERTIES COMPILE_DEFINITIONS MBEDTLS_USER_CONFIG_FILE=${MBEDTLS_USER_CONFIG_FILE_PATH})
set_source_files_properties(../features/netsocket/DTLSSocketWrapper.cpp PROPERTIES COMPILE_DEFINITIONS MBEDTLS_USER_CONFIG_FILE=${MBEDTLS_USER_CONFIG_FILE_PATH})

24 changes: 24 additions & 0 deletions UNITTESTS/features/netsocket/DTLSSocketWrapper/dtls_test_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates
* 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.
*/

#ifndef UNITTESTS_FEATURES_NETSOCKET_DTLSSOCKETWRAPPER_TLS_TEST_CONFIG_H_
#define UNITTESTS_FEATURES_NETSOCKET_DTLSSOCKETWRAPPER_TLS_TEST_CONFIG_H_

#define MBEDTLS_SSL_CLI_C


#endif /* UNITTESTS_FEATURES_NETSOCKET_DTLSSOCKETWRAPPER_TLS_TEST_CONFIG_H_ */
Loading