From c9bf20f3db9433f2d1877c7cd92aff572dbf5a93 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Wed, 29 Nov 2017 12:58:27 +0200 Subject: [PATCH] Remove test and unittest folders -Remove tests/unittest as they can't be executed in mbed-os. -Remove unittest scripts --- junit_xsl.xslt | 102 - run_unit_tests.sh | 17 - test/nanostack/unittest/6LoWPAN/Mesh/Makefile | 19 - test/nanostack/unittest/6LoWPAN/Mesh/main.cpp | 24 - .../unittest/6LoWPAN/Mesh/mesh_test.cpp | 96 - .../unittest/6LoWPAN/Mesh/test_mesh.cpp | 108 - .../unittest/6LoWPAN/Mesh/test_mesh.h | 49 - test/nanostack/unittest/6LoWPAN/NVM/Makefile | 36 - test/nanostack/unittest/6LoWPAN/NVM/main.cpp | 28 - .../unittest/6LoWPAN/NVM/nwk_nvmtest.cpp | 50 - .../unittest/6LoWPAN/NVM/test_nwk_nvm.c | 192 -- .../unittest/6LoWPAN/NVM/test_nwk_nvm.h | 35 - .../6LoWPAN/adaptation_interface/Makefile | 35 - .../adaptation_interfacetest.cpp | 83 - .../6LoWPAN/adaptation_interface/main.cpp | 28 - .../test_adaptation_interface.c | 920 ------ .../test_adaptation_interface.h | 47 - .../6LoWPAN/nd_router_object/Makefile | 41 - .../6LoWPAN/nd_router_object/main.cpp | 28 - .../nd_router_object/nd_router_objecttest.cpp | 35 - .../nd_router_object/test_nd_router_object.c | 26 - .../nd_router_object/test_nd_router_object.h | 33 - .../6LoWPAN/reassemly_interface/Makefile | 34 - .../6LoWPAN/reassemly_interface/main.cpp | 28 - .../reassembly_interfacetest.cpp | 59 - .../test_cipv6_reassembly_interface.c | 623 ---- .../test_cipv6_reassembly_interface.h | 42 - .../unittest/6lp_mac/beacon_handler/Makefile | 24 - .../beacon_handler/beacon_handlertest.cpp | 51 - .../unittest/6lp_mac/beacon_handler/main.cpp | 28 - .../beacon_handler/test_beacon_handler.c | 422 --- .../beacon_handler/test_beacon_handler.h | 39 - .../unittest/6lp_mac/mac_data_poll/Makefile | 30 - .../mac_data_poll/mac_data_polltest.cpp | 96 - .../unittest/6lp_mac/mac_data_poll/main.cpp | 28 - .../mac_data_poll/test_mac_data_poll.c | 456 --- .../mac_data_poll/test_mac_data_poll.h | 57 - .../unittest/6lp_mac/mac_helper/Makefile | 21 - .../6lp_mac/mac_helper/mac_helpertest.cpp | 244 -- .../unittest/6lp_mac/mac_helper/main.cpp | 28 - .../6lp_mac/mac_helper/test_mac_helper.c | 869 ------ .../6lp_mac/mac_helper/test_mac_helper.h | 111 - .../6lp_mac/mac_pairwise_key/Makefile | 23 - .../mac_pairwise_key/mac_pairwise_keytest.cpp | 58 - .../6lp_mac/mac_pairwise_key/main.cpp | 28 - .../mac_pairwise_key/test_mac_pairwise_key.c | 376 --- .../mac_pairwise_key/test_mac_pairwise_key.h | 42 - .../6lp_mac/mac_response_handler/Makefile | 31 - .../mac_response_handlertest.cpp | 49 - .../6lp_mac/mac_response_handler/main.cpp | 28 - .../test_mac_response_handler.c | 240 -- .../test_mac_response_handler.h | 39 - .../unittest/Bootstraps/network_lib/Makefile | 28 - .../unittest/Bootstraps/network_lib/main.cpp | 28 - .../network_lib/network_libtest.cpp | 35 - .../Bootstraps/network_lib/test_network_lib.c | 26 - .../Bootstraps/network_lib/test_network_lib.h | 33 - .../Bootstraps/protocol_6lowpan/Makefile | 47 - .../Bootstraps/protocol_6lowpan/main.cpp | 28 - .../protocol_6lowpan/protocol_6lowpantest.cpp | 35 - .../protocol_6lowpan/test_protocol_6lowpan.c | 26 - .../protocol_6lowpan/test_protocol_6lowpan.h | 33 - .../protocol_6lowpan_bootstrap/Makefile | 48 - .../protocol_6lowpan_bootstrap/main.cpp | 28 - .../protocol_6lowpan_bootstraptest.cpp | 35 - .../test_protocol_6lowpan_bootstrap.c | 26 - .../test_protocol_6lowpan_bootstrap.h | 33 - .../protocol_6lowpan_interface/Makefile | 32 - .../protocol_6lowpan_interface/main.cpp | 28 - .../protocol_6lowpan_interfacetest.cpp | 35 - .../test_protocol_6lowpan_interface.c | 33 - .../test_protocol_6lowpan_interface.h | 33 - .../BorderRouter/border_router/Makefile | 51 - .../border_router/border_routertest.cpp | 35 - .../BorderRouter/border_router/main.cpp | 28 - .../border_router/test_border_router.c | 29 - .../border_router/test_border_router.h | 33 - .../unittest/Common_Protocols/icmpv6/Makefile | 37 - .../Common_Protocols/icmpv6/icmpv6test.cpp | 35 - .../unittest/Common_Protocols/icmpv6/main.cpp | 28 - .../Common_Protocols/icmpv6/test_icmpv6.c | 29 - .../Common_Protocols/icmpv6/test_icmpv6.h | 33 - .../Common_Protocols/icmpv6_prefix/Makefile | 20 - .../icmpv6_prefix/icmpv6_prefixtest.cpp | 35 - .../Common_Protocols/icmpv6_prefix/main.cpp | 28 - .../icmpv6_prefix/test_icmpv6_prefix.c | 28 - .../icmpv6_prefix/test_icmpv6_prefix.h | 33 - .../Common_Protocols/icmpv6_radv/Makefile | 29 - .../icmpv6_radv/icmpv6_radvtest.cpp | 35 - .../Common_Protocols/icmpv6_radv/main.cpp | 28 - .../icmpv6_radv/test_icmpv6_radv.c | 29 - .../icmpv6_radv/test_icmpv6_radv.h | 33 - .../unittest/Common_Protocols/ipv6/Makefile | 40 - .../Common_Protocols/ipv6/ipv6test.cpp | 29 - .../unittest/Common_Protocols/ipv6/main.cpp | 28 - .../Common_Protocols/ipv6/test_ipv6.c | 19 - .../Common_Protocols/ipv6/test_ipv6.h | 30 - .../Common_Protocols/ipv6_flow/Makefile | 19 - .../ipv6_flow/ipv6_flowtest.cpp | 35 - .../Common_Protocols/ipv6_flow/main.cpp | 28 - .../ipv6_flow/test_ipv6_flow.c | 26 - .../ipv6_flow/test_ipv6_flow.h | 33 - .../ipv6_fragmentation/Makefile | 29 - .../ipv6_fragmentationtest.cpp | 35 - .../ipv6_fragmentation/main.cpp | 28 - .../test_ipv6_fragmentation.c | 26 - .../test_ipv6_fragmentation.h | 33 - .../Common_Protocols/ipv6_resolution/Makefile | 27 - .../ipv6_resolution/ipv6_resolutiontest.cpp | 35 - .../Common_Protocols/ipv6_resolution/main.cpp | 28 - .../ipv6_resolution/test_ipv6_resolution.c | 27 - .../ipv6_resolution/test_ipv6_resolution.h | 33 - .../unittest/Common_Protocols/tcp/Makefile | 33 - .../unittest/Common_Protocols/tcp/main.cpp | 28 - .../unittest/Common_Protocols/tcp/tcptest.cpp | 35 - .../unittest/Common_Protocols/tcp/test_tcp.c | 31 - .../unittest/Common_Protocols/tcp/test_tcp.h | 33 - .../unittest/Common_Protocols/udp/Makefile | 31 - .../unittest/Common_Protocols/udp/main.cpp | 28 - .../unittest/Common_Protocols/udp/test_udp.c | 31 - .../unittest/Common_Protocols/udp/test_udp.h | 33 - .../unittest/Common_Protocols/udp/udptest.cpp | 35 - test/nanostack/unittest/Core/address/Makefile | 29 - .../unittest/Core/address/addresstest.cpp | 39 - test/nanostack/unittest/Core/address/main.cpp | 28 - .../unittest/Core/address/test_address.c | 39 - .../unittest/Core/address/test_address.h | 34 - .../unittest/Core/buffer_dyn/Makefile | 24 - .../Core/buffer_dyn/buffer_dyntest.cpp | 35 - .../unittest/Core/buffer_dyn/main.cpp | 28 - .../Core/buffer_dyn/test_buffer_dyn.c | 28 - .../Core/buffer_dyn/test_buffer_dyn.h | 33 - test/nanostack/unittest/Core/socket/Makefile | 32 - test/nanostack/unittest/Core/socket/main.cpp | 28 - .../unittest/Core/socket/sockettest.cpp | 35 - .../unittest/Core/socket/test_socket.c | 29 - .../unittest/Core/socket/test_socket.h | 33 - .../dhcpv6_server_service/Makefile | 37 - .../dhcpv6_server_servicetest.cpp | 35 - .../dhcpv6_server_service/main.cpp | 28 - .../test_dhcpv6_server_service.c | 29 - .../test_dhcpv6_server_service.h | 33 - .../IPHC/6lowpan_iphc/6lowpan_iphctest.cpp | 35 - .../unittest/IPHC/6lowpan_iphc/Makefile | 39 - .../unittest/IPHC/6lowpan_iphc/main.cpp | 28 - .../IPHC/6lowpan_iphc/test_6lowpan_iphc.c | 31 - .../IPHC/6lowpan_iphc/test_6lowpan_iphc.h | 33 - .../unittest/IPHC/iphc_compress/Makefile | 23 - .../IPHC/iphc_compress/iphc_compresstest.cpp | 35 - .../unittest/IPHC/iphc_compress/main.cpp | 28 - .../IPHC/iphc_compress/test_iphc_compress.c | 33 - .../IPHC/iphc_compress/test_iphc_compress.h | 33 - .../unittest/IPHC/iphc_decompress/Makefile | 25 - .../iphc_decompress/iphc_decompresstest.cpp | 35 - .../unittest/IPHC/iphc_decompress/main.cpp | 28 - .../iphc_decompress/test_iphc_decompress.c | 32 - .../iphc_decompress/test_iphc_decompress.h | 33 - .../unittest/IPHC/lowpan_context/Makefile | 23 - .../lowpan_context/lowpan_contexttest.cpp | 35 - .../unittest/IPHC/lowpan_context/main.cpp | 28 - .../IPHC/lowpan_context/test_lowpan_context.c | 28 - .../IPHC/lowpan_context/test_lowpan_context.h | 33 - test/nanostack/unittest/Makefile | 27 - test/nanostack/unittest/MakefileWorker.mk | 562 ---- .../ipv6_stack/ipv6_routing_table/Makefile | 27 - .../ipv6_routing_tabletest.cpp | 39 - .../ipv6_stack/ipv6_routing_table/main.cpp | 28 - .../test_ipv6_routing_table.c | 72 - .../test_ipv6_routing_table.h | 34 - .../ipv6_stack/protocol_ipv6/Makefile | 40 - .../ipv6_stack/protocol_ipv6/main.cpp | 28 - .../protocol_ipv6/protocol_ipv6test.cpp | 35 - .../protocol_ipv6/test_protocol_ipv6.c | 29 - .../protocol_ipv6/test_protocol_ipv6.h | 33 - .../libDHCPv6/dhcp_service_api/Makefile | 28 - .../dhcp_service_api/dhcp_service_apitest.cpp | 35 - .../libDHCPv6/dhcp_service_api/main.cpp | 28 - .../dhcp_service_api/test_dhcp_service_api.c | 29 - .../dhcp_service_api/test_dhcp_service_api.h | 33 - .../unittest/libDHCPv6/libdhcpv6/Makefile | 22 - .../libDHCPv6/libdhcpv6/libdhcpv6test.cpp | 35 - .../unittest/libDHCPv6/libdhcpv6/main.cpp | 28 - .../libDHCPv6/libdhcpv6/test_libdhcpv6.c | 26 - .../libDHCPv6/libdhcpv6/test_libdhcpv6.h | 33 - .../libDHCPv6/libdhcpv6_server/Makefile | 22 - .../libdhcpv6_server/libdhcpv6_servertest.cpp | 35 - .../libDHCPv6/libdhcpv6_server/main.cpp | 28 - .../libdhcpv6_server/test_libdhcpv6_server.c | 26 - .../libdhcpv6_server/test_libdhcpv6_server.h | 33 - test/nanostack/unittest/libNET/net/Makefile | 45 - test/nanostack/unittest/libNET/net/main.cpp | 28 - .../nanostack/unittest/libNET/net/nettest.cpp | 35 - test/nanostack/unittest/libNET/net/test_net.c | 26 - test/nanostack/unittest/libNET/net/test_net.h | 33 - .../libNET/net_6lowpan_parameter_api/Makefile | 19 - .../libNET/net_6lowpan_parameter_api/main.cpp | 28 - .../net_6lowpan_parameter_apitest.cpp | 35 - .../test_net_6lowpan_parameter_api.c | 28 - .../test_net_6lowpan_parameter_api.h | 33 - .../unittest/libNET/net_ipv6/Makefile | 22 - .../unittest/libNET/net_ipv6/main.cpp | 28 - .../unittest/libNET/net_ipv6/net_ipv6test.cpp | 35 - .../unittest/libNET/net_ipv6/test_net_ipv6.c | 26 - .../unittest/libNET/net_ipv6/test_net_ipv6.h | 33 - .../unittest/libNET/net_mle/Makefile | 22 - .../unittest/libNET/net_mle/main.cpp | 28 - .../unittest/libNET/net_mle/net_mletest.cpp | 35 - .../unittest/libNET/net_mle/test_net_mle.c | 29 - .../unittest/libNET/net_mle/test_net_mle.h | 33 - .../unittest/libNET/net_rpl/Makefile | 24 - .../unittest/libNET/net_rpl/main.cpp | 28 - .../unittest/libNET/net_rpl/net_rpltest.cpp | 35 - .../unittest/libNET/net_rpl/test_net_rpl.c | 28 - .../unittest/libNET/net_rpl/test_net_rpl.h | 33 - .../net_short_address_extension/Makefile | 20 - .../net_short_address_extension/main.cpp | 28 - .../net_short_address_extensiontest.cpp | 35 - .../test_net_short_address_extension.c | 26 - .../test_net_short_address_extension.h | 33 - .../unittest/libNET/socket_api/Makefile | 26 - .../unittest/libNET/socket_api/main.cpp | 27 - .../libNET/socket_api/socket_api_test.cpp | 1218 -------- .../unittest/mac/ethernet_mac_api/Makefile | 21 - .../ethernet_mac_api/ethernet_mac_apitest.cpp | 79 - .../unittest/mac/ethernet_mac_api/main.cpp | 28 - .../ethernet_mac_api/test_ethernet_mac_api.c | 538 ---- .../ethernet_mac_api/test_ethernet_mac_api.h | 51 - .../unittest/mac/fhss_callbacks/Makefile | 22 - .../mac/fhss_callbacks/fhss_callbackstest.cpp | 74 - .../unittest/mac/fhss_callbacks/main.cpp | 28 - .../mac/fhss_callbacks/test_fhss_callbacks.c | 268 -- .../mac/fhss_callbacks/test_fhss_callbacks.h | 48 - .../unittest/mac/mac_filter/Makefile | 21 - .../mac/mac_filter/mac_filtertest.cpp | 75 - .../unittest/mac/mac_filter/main.cpp | 28 - .../unittest/mac/mac_filter/test_mac_filter.c | 278 -- .../unittest/mac/mac_filter/test_mac_filter.h | 49 - .../mac/mac_header_helper_functions/Makefile | 19 - .../mac_header_helper_functionstest.cpp | 119 - .../mac/mac_header_helper_functions/main.cpp | 28 - .../test_mac_header_helper_functions.c | 547 ---- .../test_mac_header_helper_functions.h | 67 - .../unittest/mac/mac_indirect_data/Makefile | 23 - .../mac_indirect_datatest.cpp | 45 - .../unittest/mac/mac_indirect_data/main.cpp | 28 - .../test_mac_indirect_data.c | 214 -- .../test_mac_indirect_data.h | 37 - .../unittest/mac/mac_mcps_sap/Makefile | 35 - .../mac/mac_mcps_sap/mac_mcps_saptest.cpp | 115 - .../unittest/mac/mac_mcps_sap/main.cpp | 28 - .../mac/mac_mcps_sap/test_mac_mcps_sap.c | 2741 ----------------- .../mac/mac_mcps_sap/test_mac_mcps_sap.h | 65 - test/nanostack/unittest/mac/mac_mlme/Makefile | 36 - .../unittest/mac/mac_mlme/mac_mlmetest.cpp | 174 -- test/nanostack/unittest/mac/mac_mlme/main.cpp | 28 - .../unittest/mac/mac_mlme/test_mac_mlme.c | 1637 ---------- .../unittest/mac/mac_mlme/test_mac_mlme.h | 89 - .../unittest/mac/mac_pd_sap/Makefile | 33 - .../mac/mac_pd_sap/mac_pd_saptest.cpp | 50 - .../unittest/mac/mac_pd_sap/main.cpp | 28 - .../unittest/mac/mac_pd_sap/test_mac_pd_sap.c | 679 ---- .../unittest/mac/mac_pd_sap/test_mac_pd_sap.h | 39 - .../unittest/mac/mac_security_mib/Makefile | 20 - .../mac_security_mib/mac_security_mibtest.cpp | 85 - .../unittest/mac/mac_security_mib/main.cpp | 28 - .../mac_security_mib/test_mac_security_mib.c | 484 --- .../mac_security_mib/test_mac_security_mib.h | 53 - .../nanostack/unittest/mac/mac_timer/Makefile | 22 - .../unittest/mac/mac_timer/mac_timertest.cpp | 45 - .../nanostack/unittest/mac/mac_timer/main.cpp | 28 - .../unittest/mac/mac_timer/test_mac_timer.c | 49 - .../unittest/mac/mac_timer/test_mac_timer.h | 37 - .../unittest/mac/rf_driver_storage/Makefile | 25 - .../unittest/mac/rf_driver_storage/main.cpp | 28 - .../rf_driver_storagetest.cpp | 76 - .../test_rf_driver_storage.c | 311 -- .../test_rf_driver_storage.h | 49 - .../unittest/mac/serial_mac_api/Makefile | 23 - .../unittest/mac/serial_mac_api/main.cpp | 28 - .../mac/serial_mac_api/serial_mac_apitest.cpp | 69 - .../mac/serial_mac_api/test_serial_mac_api.c | 406 --- .../mac/serial_mac_api/test_serial_mac_api.h | 48 - test/nanostack/unittest/mac/sw_mac/Makefile | 27 - test/nanostack/unittest/mac/sw_mac/main.cpp | 28 - .../unittest/mac/sw_mac/sw_mactest.cpp | 118 - .../unittest/mac/sw_mac/test_sw_mac.c | 851 ----- .../unittest/mac/sw_mac/test_sw_mac.h | 67 - .../unittest/mac/virtual_rf_client/Makefile | 22 - .../unittest/mac/virtual_rf_client/main.cpp | 28 - .../test_virtual_rf_client.c | 167 - .../test_virtual_rf_client.h | 39 - .../virtual_rf_clienttest.cpp | 51 - .../unittest/mac/virtual_rf_driver/Makefile | 22 - .../unittest/mac/virtual_rf_driver/main.cpp | 28 - .../test_virtual_rf_driver.c | 192 -- .../test_virtual_rf_driver.h | 45 - .../virtual_rf_drivertest.cpp | 66 - test/nanostack/unittest/makefile_defines.txt | 55 - test/nanostack/unittest/mle/mle/Makefile | 30 - test/nanostack/unittest/mle/mle/main.cpp | 28 - test/nanostack/unittest/mle/mle/mle_test.cpp | 146 - test/nanostack/unittest/mle/mle/test_mle.c | 1060 ------- test/nanostack/unittest/mle/mle/test_mle.h | 59 - test/nanostack/unittest/mle/mle_tlv/Makefile | 20 - test/nanostack/unittest/mle/mle_tlv/main.cpp | 28 - .../unittest/mle/mle_tlv/mle_tlvtest.cpp | 35 - .../unittest/mle/mle_tlv/test_mle_tlv.c | 26 - .../unittest/mle/mle_tlv/test_mle_tlv.h | 33 - .../nwk_interface/protocol_core/Makefile | 54 - .../nwk_interface/protocol_core/main.cpp | 28 - .../protocol_core/protocol_coretest.cpp | 35 - .../protocol_core/test_protocol_core.c | 26 - .../protocol_core/test_protocol_core.h | 33 - .../protocol_core_sleep/Makefile | 25 - .../protocol_core_sleep/main.cpp | 28 - .../protocol_core_sleeptest.cpp | 35 - .../test_protocol_core_sleep.c | 26 - .../test_protocol_core_sleep.h | 33 - .../nwk_interface/protocol_stats/Makefile | 21 - .../nwk_interface/protocol_stats/main.cpp | 28 - .../protocol_stats/protocol_statstest.cpp | 41 - .../protocol_stats/test_protocol_stats.c | 30 - .../protocol_stats/test_protocol_stats.h | 35 - .../nwk_interface/protocol_timer/Makefile | 24 - .../nwk_interface/protocol_timer/main.cpp | 28 - .../protocol_timer/protocol_timertest.cpp | 35 - .../protocol_timer/test_protocol_timer.c | 26 - .../protocol_timer/test_protocol_timer.h | 33 - .../unittest/rpl/rpl_control/Makefile | 31 - .../unittest/rpl/rpl_control/main.cpp | 28 - .../rpl/rpl_control/rpl_controltest.cpp | 35 - .../rpl/rpl_control/test_rpl_control.c | 26 - .../rpl/rpl_control/test_rpl_control.h | 33 - test/nanostack/unittest/rpl/rpl_data/Makefile | 32 - test/nanostack/unittest/rpl/rpl_data/main.cpp | 28 - .../unittest/rpl/rpl_data/rpl_datatest.cpp | 35 - .../unittest/rpl/rpl_data/test_rpl_data.c | 26 - .../unittest/rpl/rpl_data/test_rpl_data.h | 33 - .../unittest/rpl/rpl_downward/Makefile | 33 - .../unittest/rpl/rpl_downward/main.cpp | 28 - .../rpl/rpl_downward/rpl_downwardtest.cpp | 35 - .../rpl/rpl_downward/test_rpl_downward.c | 30 - .../rpl/rpl_downward/test_rpl_downward.h | 33 - .../nanostack/unittest/rpl/rpl_mrhof/Makefile | 28 - .../nanostack/unittest/rpl/rpl_mrhof/main.cpp | 28 - .../unittest/rpl/rpl_mrhof/rpl_mrhoftest.cpp | 35 - .../unittest/rpl/rpl_mrhof/test_rpl_mrhof.c | 26 - .../unittest/rpl/rpl_mrhof/test_rpl_mrhof.h | 33 - .../unittest/rpl/rpl_objective/Makefile | 25 - .../unittest/rpl/rpl_objective/main.cpp | 28 - .../rpl/rpl_objective/rpl_objectivetest.cpp | 35 - .../rpl/rpl_objective/test_rpl_objective.c | 28 - .../rpl/rpl_objective/test_rpl_objective.h | 33 - test/nanostack/unittest/rpl/rpl_of0/Makefile | 28 - test/nanostack/unittest/rpl/rpl_of0/main.cpp | 28 - .../unittest/rpl/rpl_of0/rpl_of0test.cpp | 35 - .../unittest/rpl/rpl_of0/test_rpl_of0.c | 26 - .../unittest/rpl/rpl_of0/test_rpl_of0.h | 33 - .../unittest/rpl/rpl_policy/Makefile | 28 - .../unittest/rpl/rpl_policy/main.cpp | 28 - .../rpl/rpl_policy/rpl_policytest.cpp | 35 - .../unittest/rpl/rpl_policy/test_rpl_policy.c | 26 - .../unittest/rpl/rpl_policy/test_rpl_policy.h | 33 - .../unittest/rpl/rpl_upward/Makefile | 38 - .../unittest/rpl/rpl_upward/main.cpp | 28 - .../rpl/rpl_upward/rpl_upwardtest.cpp | 35 - .../unittest/rpl/rpl_upward/test_rpl_upward.c | 29 - .../unittest/rpl/rpl_upward/test_rpl_upward.h | 33 - .../nanostack/unittest/security/pana/Makefile | 42 - .../nanostack/unittest/security/pana/main.cpp | 28 - .../unittest/security/pana/panatest.cpp | 35 - .../unittest/security/pana/test_pana.c | 26 - .../unittest/security/pana/test_pana.h | 33 - .../security/pana_relay_table/Makefile | 18 - .../security/pana_relay_table/main.cpp | 28 - .../pana_relay_table/pana_relay_tabletest.cpp | 35 - .../pana_relay_table/test_pana_relay_table.c | 26 - .../pana_relay_table/test_pana_relay_table.h | 33 - .../unittest/security/security_lib/Makefile | 33 - .../unittest/security/security_lib/main.cpp | 28 - .../security_lib/security_libtest.cpp | 35 - .../security/security_lib/test_security_lib.c | 33 - .../security/security_lib/test_security_lib.h | 33 - .../unittest/security/tls_lib/Makefile | 32 - .../unittest/security/tls_lib/main.cpp | 28 - .../unittest/security/tls_lib/test_tls_lib.c | 26 - .../unittest/security/tls_lib/test_tls_lib.h | 33 - .../unittest/security/tls_lib/tls_libtest.cpp | 35 - .../unittest/service_libs/SHA256_Lib/Makefile | 21 - .../unittest/service_libs/SHA256_Lib/main.cpp | 28 - .../service_libs/SHA256_Lib/shalibtest.cpp | 46 - .../service_libs/SHA256_Lib/test_shalib.c | 816 ----- .../service_libs/SHA256_Lib/test_shalib.h | 36 - .../unittest/service_libs/blacklist/Makefile | 23 - .../service_libs/blacklist/blacklisttest.cpp | 47 - .../unittest/service_libs/blacklist/main.cpp | 28 - .../service_libs/blacklist/test_blacklist.c | 148 - .../service_libs/blacklist/test_blacklist.h | 35 - .../service_libs/channel_list/Makefile | 19 - .../service_libs/channel_list/channeltest.cpp | 55 - .../service_libs/channel_list/main.cpp | 28 - .../channel_list/test_channel_list.c | 144 - .../channel_list/test_channel_list.h | 43 - .../unittest/service_libs/etx/Makefile | 22 - .../unittest/service_libs/etx/etxtest.cpp | 112 - .../unittest/service_libs/etx/main.cpp | 28 - .../unittest/service_libs/etx/test_etx.c | 718 ----- .../unittest/service_libs/etx/test_etx.h | 49 - .../unittest/service_libs/fhss/Makefile | 33 - .../unittest/service_libs/fhss/fhsstest.cpp | 135 - .../unittest/service_libs/fhss/main.cpp | 28 - .../unittest/service_libs/fhss/test_fhss.c | 1001 ------ .../unittest/service_libs/fhss/test_fhss.h | 74 - .../service_libs/fhss_beacon/Makefile | 20 - .../fhss_beacon/fhssbeacontest.cpp | 55 - .../service_libs/fhss_beacon/main.cpp | 28 - .../fhss_beacon/test_fhss_beacon.c | 286 -- .../fhss_beacon/test_fhss_beacon.h | 36 - .../service_libs/fhss_beacon_tasklet/Makefile | 25 - .../fhssbeacontasklettest.cpp | 45 - .../service_libs/fhss_beacon_tasklet/main.cpp | 28 - .../test_fhss_beacon_tasklet.c | 106 - .../test_fhss_beacon_tasklet.h | 34 - .../service_libs/fhss_channel/Makefile | 24 - .../fhss_channel/fhsschanneltest.cpp | 80 - .../service_libs/fhss_channel/main.cpp | 28 - .../fhss_channel/test_fhss_channel.c | 493 --- .../fhss_channel/test_fhss_channel.h | 50 - .../service_libs/fhss_config/Makefile | 22 - .../fhss_config/fhssconfigtest.cpp | 45 - .../service_libs/fhss_config/main.cpp | 28 - .../fhss_config/test_fhss_config.c | 128 - .../fhss_config/test_fhss_config.h | 39 - .../service_libs/fhss_mac_interface/Makefile | 26 - .../fhss_mac_interface/fhssmaciftest.cpp | 85 - .../service_libs/fhss_mac_interface/main.cpp | 28 - .../test_fhss_mac_interface.c | 347 --- .../test_fhss_mac_interface.h | 53 - .../service_libs/fhss_statistics/Makefile | 19 - .../fhss_statistics/fhssstatisticstest.cpp | 35 - .../service_libs/fhss_statistics/main.cpp | 28 - .../fhss_statistics/test_fhss_statistics.c | 59 - .../fhss_statistics/test_fhss_statistics.h | 36 - .../service_libs/load_balance/Makefile | 20 - .../load_balance/loadbalance_test.cpp | 482 --- .../service_libs/load_balance/main.cpp | 27 - .../unittest/service_libs/mdns/Makefile | 24 - .../unittest/service_libs/mdns/main.cpp | 28 - .../unittest/service_libs/mdns/mdns_tests.cpp | 47 - .../service_libs/mdns/test_ns_mdns_api.c | 292 -- .../service_libs/mdns/test_ns_mdns_api.h | 36 - .../unittest/stub/6lowpan_iphc_stub.c | 57 - .../unittest/stub/6lowpan_mesh_stub.c | 69 - .../unittest/stub/adaptation_interface_stub.c | 88 - .../unittest/stub/adaptation_interface_stub.h | 37 - test/nanostack/unittest/stub/address_stub.c | 342 -- test/nanostack/unittest/stub/address_stub.h | 45 - .../unittest/stub/beacon_handler_stub.c | 47 - test/nanostack/unittest/stub/blacklist_stub.c | 57 - .../unittest/stub/border_router_stub.c | 115 - .../nanostack/unittest/stub/buffer_dyn_stub.c | 104 - .../nanostack/unittest/stub/buffer_dyn_stub.h | 38 - .../unittest/stub/ccm_security_stub.c | 35 - .../unittest/stub/ccm_security_stub.h | 38 - .../unittest/stub/channel_list_stub.c | 71 - .../unittest/stub/channel_list_stub.h | 37 - .../unittest/stub/cipv6_fragmenter_stub.c | 69 - .../unittest/stub/cipv6_fragmenter_stub.h | 38 - .../stub/coap_connection_handler_stub.c | 67 - .../stub/coap_connection_handler_stub.h | 48 - .../stub/coap_security_handler_stub.c | 88 - .../stub/coap_security_handler_stub.h | 37 - .../unittest/stub/coap_service_api_stub.c | 98 - .../unittest/stub/coap_service_api_stub.h | 46 - .../unittest/stub/common_functions_stub.c | 156 - .../unittest/stub/common_functions_stub.h | 43 - test/nanostack/unittest/stub/crc_stub.c | 29 - test/nanostack/unittest/stub/cudp_stub.c | 49 - .../unittest/stub/dhcp_service_api_stub.c | 171 - .../unittest/stub/eap_protocol_stub.c | 75 - test/nanostack/unittest/stub/ecc_stub.c | 66 - test/nanostack/unittest/stub/ecdsa_stub.c | 25 - test/nanostack/unittest/stub/etx_stub.c | 73 - test/nanostack/unittest/stub/event_stub.c | 101 - test/nanostack/unittest/stub/event_stub.h | 34 - .../unittest/stub/fhss_beacon_stub.c | 44 - .../unittest/stub/fhss_beacon_tasklet_stub.c | 51 - .../unittest/stub/fhss_beacon_tasklet_stub.h | 34 - .../unittest/stub/fhss_callbacks_stub.c | 70 - .../unittest/stub/fhss_callbacks_stub.h | 36 - .../unittest/stub/fhss_channel_stub.c | 55 - .../unittest/stub/fhss_channel_stub.h | 34 - .../unittest/stub/fhss_config_stub.c | 41 - .../unittest/stub/fhss_config_stub.h | 34 - .../unittest/stub/fhss_mac_interface_stub.c | 85 - .../unittest/stub/fhss_mac_interface_stub.h | 51 - .../unittest/stub/fhss_platform_stub.c | 50 - .../unittest/stub/fhss_platform_stub.h | 43 - .../unittest/stub/fhss_statistics_stub.c | 28 - test/nanostack/unittest/stub/fhss_stub.c | 187 -- test/nanostack/unittest/stub/fhss_stub.h | 44 - test/nanostack/unittest/stub/fnet_mdns_stub.c | 62 - test/nanostack/unittest/stub/fnet_mdns_stub.h | 39 - test/nanostack/unittest/stub/fnet_poll_stub.c | 22 - test/nanostack/unittest/stub/fnv_hash_stub.c | 29 - .../unittest/stub/icmpv6_prefix_stub.c | 40 - .../unittest/stub/icmpv6_radv_stub.c | 81 - test/nanostack/unittest/stub/icmpv6_stub.c | 169 - test/nanostack/unittest/stub/ip6tos_stub.c | 38 - test/nanostack/unittest/stub/ip_fsc_stub.c | 29 - .../unittest/stub/iphc_compress_stub.c | 41 - .../unittest/stub/iphc_decompress_stub.c | 40 - test/nanostack/unittest/stub/ipv6_flow_stub.c | 43 - .../unittest/stub/ipv6_fragmentation_stub.c | 63 - .../unittest/stub/ipv6_resolution_stub.c | 96 - .../unittest/stub/ipv6_resolution_stub.h | 43 - .../unittest/stub/ipv6_routing_table_stub.c | 259 -- test/nanostack/unittest/stub/ipv6_stub.c | 112 - test/nanostack/unittest/stub/isqrt_stub.c | 24 - .../unittest/stub/libDHCPv6_server_stub.c | 69 - test/nanostack/unittest/stub/libDHCPv6_stub.c | 229 -- .../unittest/stub/load_balance_stub.c | 60 - .../unittest/stub/lowpan_context_stub.c | 52 - .../unittest/stub/mac_data_poll_stub.c | 94 - .../nanostack/unittest/stub/mac_filter_stub.c | 78 - .../nanostack/unittest/stub/mac_filter_stub.h | 37 - .../stub/mac_header_helper_functions_stub.c | 133 - .../stub/mac_header_helper_functions_stub.h | 38 - .../nanostack/unittest/stub/mac_helper_stub.c | 254 -- .../nanostack/unittest/stub/mac_helper_stub.h | 43 - .../unittest/stub/mac_indirect_data_stub.c | 55 - .../unittest/stub/mac_indirect_data_stub.h | 38 - .../unittest/stub/mac_mcps_sap_stub.c | 148 - .../unittest/stub/mac_mcps_sap_stub.h | 42 - test/nanostack/unittest/stub/mac_mlme_stub.c | 175 -- test/nanostack/unittest/stub/mac_mlme_stub.h | 48 - .../unittest/stub/mac_pairwise_key_stub.c | 54 - .../nanostack/unittest/stub/mac_pd_sap_stub.c | 55 - .../unittest/stub/mac_response_handler_stub.c | 61 - .../stub/mac_security_interface_stub.c | 16 - .../unittest/stub/mac_security_mib_stub.c | 102 - .../unittest/stub/mac_security_mib_stub.h | 45 - test/nanostack/unittest/stub/mac_timer_stub.c | 35 - .../nanostack/unittest/stub/mbed_trace_stub.c | 121 - test/nanostack/unittest/stub/mbedtls_stub.c | 311 -- test/nanostack/unittest/stub/mbedtls_stub.h | 50 - test/nanostack/unittest/stub/mesh_stub.c | 90 - test/nanostack/unittest/stub/mesh_stub.h | 38 - test/nanostack/unittest/stub/mld_stub.c | 53 - .../unittest/stub/mle_service_buffer_stub.c | 130 - .../unittest/stub/mle_service_stub.c | 286 -- .../unittest/stub/mle_service_stub.h | 37 - test/nanostack/unittest/stub/mle_stub.c | 371 --- test/nanostack/unittest/stub/mle_stub.h | 39 - test/nanostack/unittest/stub/mle_tlv_stub.c | 158 - test/nanostack/unittest/stub/mle_tlv_stub.h | 38 - test/nanostack/unittest/stub/mpl_stub.c | 72 - .../unittest/stub/multicast_api_stub.c | 43 - test/nanostack/unittest/stub/nd_proxy.c | 33 - test/nanostack/unittest/stub/nd_proxy_stub.c | 69 - .../unittest/stub/nd_router_object_stub.c | 253 -- .../unittest/stub/neighbor_cache_stub.c | 62 - .../unittest/stub/net_load_balance_stub.c | 55 - test/nanostack/unittest/stub/net_mle_stub.c | 55 - test/nanostack/unittest/stub/net_rpl_stub.c | 83 - test/nanostack/unittest/stub/net_stub.c | 263 -- .../unittest/stub/network_lib_stub.c | 78 - .../unittest/stub/ns_file_system_stub.c | 34 - test/nanostack/unittest/stub/ns_list_stub.c | 22 - test/nanostack/unittest/stub/ns_sha256_stub.c | 69 - test/nanostack/unittest/stub/ns_timer_stub.c | 61 - test/nanostack/unittest/stub/ns_timer_stub.h | 36 - .../unittest/stub/nsdynmemLIB_stub.c | 69 - .../unittest/stub/nsdynmemLIB_stub.h | 37 - test/nanostack/unittest/stub/nwk_nvm_stub.c | 47 - .../unittest/stub/pan_blacklist_stub.c | 65 - test/nanostack/unittest/stub/pana_avp_stub.c | 53 - .../unittest/stub/pana_client_stub.c | 117 - test/nanostack/unittest/stub/pana_eap_stub.c | 53 - .../unittest/stub/pana_header_stub.c | 34 - .../unittest/stub/pana_relay_table_stub.c | 45 - .../unittest/stub/pana_server_stub.c | 140 - test/nanostack/unittest/stub/pana_stub.c | 284 -- .../unittest/stub/platform_nvm_stub.c | 102 - test/nanostack/unittest/stub/platform_stub.c | 24 - .../stub/protocol_6lowpan_bootstrap_stub.c | 242 -- .../stub/protocol_6lowpan_bootstrap_stub.h | 38 - .../stub/protocol_6lowpan_interface_stub.c | 77 - .../unittest/stub/protocol_6lowpan_stub.c | 192 -- .../unittest/stub/protocol_6lowpan_stub.h | 41 - .../unittest/stub/protocol_core_stub.c | 241 -- .../unittest/stub/protocol_core_stub.h | 41 - .../unittest/stub/protocol_ipv6_stub.c | 187 -- .../unittest/stub/protocol_stats_stub.c | 45 - .../unittest/stub/protocol_timer_stub.c | 59 - .../unittest/stub/protocol_tun_driver_stub.c | 45 - .../unittest/stub/protocol_tun_driver_stub.h | 38 - test/nanostack/unittest/stub/randLIB_stub.c | 65 - .../unittest/stub/rf_driver_storage_stub.c | 89 - .../unittest/stub/rf_driver_storage_stub.h | 41 - .../unittest/stub/routing_table_stub.c | 75 - .../unittest/stub/rpl_control_stub.c | 225 -- test/nanostack/unittest/stub/rpl_data_stub.c | 91 - test/nanostack/unittest/stub/rpl_data_stub.h | 37 - .../unittest/stub/rpl_downward_stub.c | 140 - test/nanostack/unittest/stub/rpl_mrhof_stub.c | 54 - .../unittest/stub/rpl_objective_stub.c | 34 - test/nanostack/unittest/stub/rpl_of0_stub.c | 46 - .../nanostack/unittest/stub/rpl_policy_stub.c | 168 - .../nanostack/unittest/stub/rpl_upward_stub.c | 453 --- .../unittest/stub/security_lib_stub.c | 194 -- test/nanostack/unittest/stub/shalib_stub.c | 45 - .../unittest/stub/sn_coap_builder_stub.c | 56 - .../unittest/stub/sn_coap_builder_stub.h | 28 - .../unittest/stub/sn_coap_parser_stub.h | 28 - .../unittest/stub/sn_coap_protocol_stub.h | 33 - test/nanostack/unittest/stub/sockbuf_stub.c | 66 - .../nanostack/unittest/stub/socket_api_stub.c | 153 - .../nanostack/unittest/stub/socket_api_stub.h | 45 - test/nanostack/unittest/stub/socket_stub.c | 246 -- test/nanostack/unittest/stub/socket_stub.h | 55 - test/nanostack/unittest/stub/sw_mac_stub.c | 76 - test/nanostack/unittest/stub/sw_mac_stub.h | 39 - .../unittest/stub/system_timer_stub.c | 69 - .../unittest/stub/system_timer_stub.h | 36 - test/nanostack/unittest/stub/tcp_stub.c | 146 - test/nanostack/unittest/stub/tcp_stub.h | 45 - .../thread_address_registration_client_stub.c | 68 - .../unittest/stub/thread_bbr_api_stub.c | 80 - .../unittest/stub/thread_beacon_stub.c | 37 - .../unittest/stub/thread_bootstrap_stub.c | 312 -- .../thread_border_router_api_internal_stub.c | 64 - .../stub/thread_border_router_api_stub.c | 73 - .../stub/thread_commissioning_if_stub.c | 95 - .../unittest/stub/thread_common_stub.c | 395 --- .../unittest/stub/thread_common_stub.h | 45 - .../unittest/stub/thread_dhcpv6_client_stub.c | 90 - .../unittest/stub/thread_discovery_stub.c | 139 - .../stub/thread_host_bootstrap_stub.c | 90 - .../stub/thread_joiner_application_stub.c | 408 --- .../stub/thread_leader_service_stub.c | 82 - .../stub/thread_management_api_stub.c | 62 - .../stub/thread_management_client_stub.c | 109 - .../unittest/stub/thread_management_if_stub.c | 321 -- .../stub/thread_management_server_stub.c | 69 - .../unittest/stub/thread_meshcop_lib_stub.c | 100 - .../unittest/stub/thread_meshcop_lib_stub.h | 44 - .../stub/thread_mle_message_handler_stub.c | 26 - test/nanostack/unittest/stub/thread_nd_stub.c | 108 - .../stub/thread_network_data_lib_stub.c | 67 - .../stub/thread_network_data_storage_stub.c | 350 --- .../unittest/stub/thread_network_synch_stub.c | 93 - .../unittest/stub/thread_nvm_store_stub.c | 64 - .../stub/thread_resolution_client_stub.c | 62 - .../stub/thread_router_bootstrap_stub.c | 157 - .../unittest/stub/thread_routing_stub.c | 175 -- .../unittest/stub/thread_test_api_stub.c | 82 - test/nanostack/unittest/stub/timeout_stub.c | 29 - .../unittest/stub/tls_ccm_crypt_stub.c | 41 - test/nanostack/unittest/stub/tls_lib_stub.c | 320 -- test/nanostack/unittest/stub/trickle_stub.c | 49 - test/nanostack/unittest/stub/udp_stub.c | 46 - .../nanostack/unittest/stub/whiteboard_stub.c | 84 - test/nanostack/unittest/stub/x509_stub.c | 67 - test/nanostack/unittest/thread/nvm/Makefile | 34 - test/nanostack/unittest/thread/nvm/main.cpp | 32 - .../thread/nvm/test_thread_nvm_store.c | 259 -- .../thread/nvm/test_thread_nvm_store.h | 39 - .../thread/nvm/thread_nvm_storetest.cpp | 81 - .../nanostack/unittest/thread/thread/Makefile | 62 - .../nanostack/unittest/thread/thread/main.cpp | 28 - .../unittest/thread/thread/test_thread.c | 27 - .../unittest/thread/thread/test_thread.h | 33 - .../unittest/thread/thread/threadtest.cpp | 35 - .../unittest/thread/thread_bootstrap/Makefile | 80 - .../unittest/thread/thread_bootstrap/main.cpp | 28 - .../thread_bootstrap/test_thread_bootstrap.c | 40 - .../thread_bootstrap/test_thread_bootstrap.h | 33 - .../thread_bootstrap/thread_bootstraptest.cpp | 34 - .../thread/thread_commissioning_api/Makefile | 30 - .../thread/thread_commissioning_api/main.cpp | 28 - .../test_thread_commissioning_api.c | 495 --- .../test_thread_commissioning_api.h | 44 - .../thread_commissioning_apitest.cpp | 93 - .../thread/thread_commissioning_if/Makefile | 32 - .../thread/thread_commissioning_if/main.cpp | 28 - .../test_thread_commissioning_if.c | 37 - .../test_thread_commissioning_if.h | 34 - .../thread_commissioning_iftest.cpp | 39 - .../thread/thread_lowpower_api/Makefile | 76 - .../thread/thread_lowpower_api/main.cpp | 28 - .../test_thread_lowpower_api.c | 47 - .../test_thread_lowpower_api.h | 33 - .../thread_lowpower_apitest.cpp | 34 - .../thread/thread_management_client/Makefile | 30 - .../thread/thread_management_client/main.cpp | 28 - .../test_thread_management_client.c | 41 - .../test_thread_management_client.h | 35 - .../thread_management_clienttest.cpp | 37 - .../thread/thread_management_server/Makefile | 40 - .../thread/thread_management_server/main.cpp | 27 - .../test_thread_management_server.cpp | 37 - .../test_thread_management_server.h | 32 - .../thread_management_server_test.cpp | 41 - unittest/header_test/Makefile | 19 - unittest/simulations/sim_address.c | 179 -- unittest/simulations/sim_address.h | 38 - unittest/simulations/sim_nanostack.c | 108 - unittest/simulations/sim_socket_api.c | 179 -- unittest/simulations/sim_socket_api.h | 37 - unittest/thread_dhcp/.cproject | 57 - unittest/thread_dhcp/.project | 26 - unittest/thread_dhcp/Test.c | 343 --- unittest/thread_dhcp/makefile | 45 - unittest/thread_dhcp_servers/.cproject | 40 - unittest/thread_dhcp_servers/.project | 27 - unittest/thread_dhcp_servers/Test.c | 384 --- unittest/thread_dhcp_servers/makefile | 46 - unittest/unity_improvement/unity_improved.c | 122 - unittest/unity_improvement/unity_improved.h | 67 - xsl_script.sh | 37 - 721 files changed, 59700 deletions(-) delete mode 100644 junit_xsl.xslt delete mode 100755 run_unit_tests.sh delete mode 100644 test/nanostack/unittest/6LoWPAN/Mesh/Makefile delete mode 100644 test/nanostack/unittest/6LoWPAN/Mesh/main.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/Mesh/mesh_test.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/Mesh/test_mesh.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/Mesh/test_mesh.h delete mode 100644 test/nanostack/unittest/6LoWPAN/NVM/Makefile delete mode 100644 test/nanostack/unittest/6LoWPAN/NVM/main.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/NVM/nwk_nvmtest.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/NVM/test_nwk_nvm.c delete mode 100644 test/nanostack/unittest/6LoWPAN/NVM/test_nwk_nvm.h delete mode 100644 test/nanostack/unittest/6LoWPAN/adaptation_interface/Makefile delete mode 100644 test/nanostack/unittest/6LoWPAN/adaptation_interface/adaptation_interfacetest.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/adaptation_interface/main.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.c delete mode 100644 test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.h delete mode 100644 test/nanostack/unittest/6LoWPAN/nd_router_object/Makefile delete mode 100644 test/nanostack/unittest/6LoWPAN/nd_router_object/main.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/nd_router_object/nd_router_objecttest.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/nd_router_object/test_nd_router_object.c delete mode 100644 test/nanostack/unittest/6LoWPAN/nd_router_object/test_nd_router_object.h delete mode 100644 test/nanostack/unittest/6LoWPAN/reassemly_interface/Makefile delete mode 100644 test/nanostack/unittest/6LoWPAN/reassemly_interface/main.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/reassemly_interface/reassembly_interfacetest.cpp delete mode 100644 test/nanostack/unittest/6LoWPAN/reassemly_interface/test_cipv6_reassembly_interface.c delete mode 100644 test/nanostack/unittest/6LoWPAN/reassemly_interface/test_cipv6_reassembly_interface.h delete mode 100644 test/nanostack/unittest/6lp_mac/beacon_handler/Makefile delete mode 100644 test/nanostack/unittest/6lp_mac/beacon_handler/beacon_handlertest.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/beacon_handler/main.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/beacon_handler/test_beacon_handler.c delete mode 100644 test/nanostack/unittest/6lp_mac/beacon_handler/test_beacon_handler.h delete mode 100644 test/nanostack/unittest/6lp_mac/mac_data_poll/Makefile delete mode 100644 test/nanostack/unittest/6lp_mac/mac_data_poll/mac_data_polltest.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/mac_data_poll/main.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/mac_data_poll/test_mac_data_poll.c delete mode 100644 test/nanostack/unittest/6lp_mac/mac_data_poll/test_mac_data_poll.h delete mode 100644 test/nanostack/unittest/6lp_mac/mac_helper/Makefile delete mode 100644 test/nanostack/unittest/6lp_mac/mac_helper/mac_helpertest.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/mac_helper/main.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/mac_helper/test_mac_helper.c delete mode 100644 test/nanostack/unittest/6lp_mac/mac_helper/test_mac_helper.h delete mode 100644 test/nanostack/unittest/6lp_mac/mac_pairwise_key/Makefile delete mode 100644 test/nanostack/unittest/6lp_mac/mac_pairwise_key/mac_pairwise_keytest.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/mac_pairwise_key/main.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/mac_pairwise_key/test_mac_pairwise_key.c delete mode 100644 test/nanostack/unittest/6lp_mac/mac_pairwise_key/test_mac_pairwise_key.h delete mode 100644 test/nanostack/unittest/6lp_mac/mac_response_handler/Makefile delete mode 100644 test/nanostack/unittest/6lp_mac/mac_response_handler/mac_response_handlertest.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/mac_response_handler/main.cpp delete mode 100644 test/nanostack/unittest/6lp_mac/mac_response_handler/test_mac_response_handler.c delete mode 100644 test/nanostack/unittest/6lp_mac/mac_response_handler/test_mac_response_handler.h delete mode 100644 test/nanostack/unittest/Bootstraps/network_lib/Makefile delete mode 100644 test/nanostack/unittest/Bootstraps/network_lib/main.cpp delete mode 100644 test/nanostack/unittest/Bootstraps/network_lib/network_libtest.cpp delete mode 100644 test/nanostack/unittest/Bootstraps/network_lib/test_network_lib.c delete mode 100644 test/nanostack/unittest/Bootstraps/network_lib/test_network_lib.h delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan/Makefile delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan/main.cpp delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan/protocol_6lowpantest.cpp delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan/test_protocol_6lowpan.c delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan/test_protocol_6lowpan.h delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/Makefile delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/main.cpp delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/protocol_6lowpan_bootstraptest.cpp delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/test_protocol_6lowpan_bootstrap.c delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/test_protocol_6lowpan_bootstrap.h delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/Makefile delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/main.cpp delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/protocol_6lowpan_interfacetest.cpp delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/test_protocol_6lowpan_interface.c delete mode 100644 test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/test_protocol_6lowpan_interface.h delete mode 100644 test/nanostack/unittest/BorderRouter/border_router/Makefile delete mode 100644 test/nanostack/unittest/BorderRouter/border_router/border_routertest.cpp delete mode 100644 test/nanostack/unittest/BorderRouter/border_router/main.cpp delete mode 100644 test/nanostack/unittest/BorderRouter/border_router/test_border_router.c delete mode 100644 test/nanostack/unittest/BorderRouter/border_router/test_border_router.h delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6/Makefile delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6/icmpv6test.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6/main.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6/test_icmpv6.c delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6/test_icmpv6.h delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_prefix/Makefile delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_prefix/icmpv6_prefixtest.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_prefix/main.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_prefix/test_icmpv6_prefix.c delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_prefix/test_icmpv6_prefix.h delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_radv/Makefile delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_radv/icmpv6_radvtest.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_radv/main.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_radv/test_icmpv6_radv.c delete mode 100644 test/nanostack/unittest/Common_Protocols/icmpv6_radv/test_icmpv6_radv.h delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6/Makefile delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6/ipv6test.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6/main.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6/test_ipv6.c delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6/test_ipv6.h delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_flow/Makefile delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_flow/ipv6_flowtest.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_flow/main.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_flow/test_ipv6_flow.c delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_flow/test_ipv6_flow.h delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/Makefile delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/ipv6_fragmentationtest.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/main.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/test_ipv6_fragmentation.c delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/test_ipv6_fragmentation.h delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_resolution/Makefile delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_resolution/ipv6_resolutiontest.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_resolution/main.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_resolution/test_ipv6_resolution.c delete mode 100644 test/nanostack/unittest/Common_Protocols/ipv6_resolution/test_ipv6_resolution.h delete mode 100644 test/nanostack/unittest/Common_Protocols/tcp/Makefile delete mode 100644 test/nanostack/unittest/Common_Protocols/tcp/main.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/tcp/tcptest.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/tcp/test_tcp.c delete mode 100644 test/nanostack/unittest/Common_Protocols/tcp/test_tcp.h delete mode 100644 test/nanostack/unittest/Common_Protocols/udp/Makefile delete mode 100644 test/nanostack/unittest/Common_Protocols/udp/main.cpp delete mode 100644 test/nanostack/unittest/Common_Protocols/udp/test_udp.c delete mode 100644 test/nanostack/unittest/Common_Protocols/udp/test_udp.h delete mode 100644 test/nanostack/unittest/Common_Protocols/udp/udptest.cpp delete mode 100644 test/nanostack/unittest/Core/address/Makefile delete mode 100644 test/nanostack/unittest/Core/address/addresstest.cpp delete mode 100644 test/nanostack/unittest/Core/address/main.cpp delete mode 100644 test/nanostack/unittest/Core/address/test_address.c delete mode 100644 test/nanostack/unittest/Core/address/test_address.h delete mode 100644 test/nanostack/unittest/Core/buffer_dyn/Makefile delete mode 100644 test/nanostack/unittest/Core/buffer_dyn/buffer_dyntest.cpp delete mode 100644 test/nanostack/unittest/Core/buffer_dyn/main.cpp delete mode 100644 test/nanostack/unittest/Core/buffer_dyn/test_buffer_dyn.c delete mode 100644 test/nanostack/unittest/Core/buffer_dyn/test_buffer_dyn.h delete mode 100644 test/nanostack/unittest/Core/socket/Makefile delete mode 100644 test/nanostack/unittest/Core/socket/main.cpp delete mode 100644 test/nanostack/unittest/Core/socket/sockettest.cpp delete mode 100644 test/nanostack/unittest/Core/socket/test_socket.c delete mode 100644 test/nanostack/unittest/Core/socket/test_socket.h delete mode 100644 test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/Makefile delete mode 100644 test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/dhcpv6_server_servicetest.cpp delete mode 100644 test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/main.cpp delete mode 100644 test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/test_dhcpv6_server_service.c delete mode 100644 test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/test_dhcpv6_server_service.h delete mode 100644 test/nanostack/unittest/IPHC/6lowpan_iphc/6lowpan_iphctest.cpp delete mode 100644 test/nanostack/unittest/IPHC/6lowpan_iphc/Makefile delete mode 100644 test/nanostack/unittest/IPHC/6lowpan_iphc/main.cpp delete mode 100644 test/nanostack/unittest/IPHC/6lowpan_iphc/test_6lowpan_iphc.c delete mode 100644 test/nanostack/unittest/IPHC/6lowpan_iphc/test_6lowpan_iphc.h delete mode 100644 test/nanostack/unittest/IPHC/iphc_compress/Makefile delete mode 100644 test/nanostack/unittest/IPHC/iphc_compress/iphc_compresstest.cpp delete mode 100644 test/nanostack/unittest/IPHC/iphc_compress/main.cpp delete mode 100644 test/nanostack/unittest/IPHC/iphc_compress/test_iphc_compress.c delete mode 100644 test/nanostack/unittest/IPHC/iphc_compress/test_iphc_compress.h delete mode 100644 test/nanostack/unittest/IPHC/iphc_decompress/Makefile delete mode 100644 test/nanostack/unittest/IPHC/iphc_decompress/iphc_decompresstest.cpp delete mode 100644 test/nanostack/unittest/IPHC/iphc_decompress/main.cpp delete mode 100644 test/nanostack/unittest/IPHC/iphc_decompress/test_iphc_decompress.c delete mode 100644 test/nanostack/unittest/IPHC/iphc_decompress/test_iphc_decompress.h delete mode 100644 test/nanostack/unittest/IPHC/lowpan_context/Makefile delete mode 100644 test/nanostack/unittest/IPHC/lowpan_context/lowpan_contexttest.cpp delete mode 100644 test/nanostack/unittest/IPHC/lowpan_context/main.cpp delete mode 100644 test/nanostack/unittest/IPHC/lowpan_context/test_lowpan_context.c delete mode 100644 test/nanostack/unittest/IPHC/lowpan_context/test_lowpan_context.h delete mode 100755 test/nanostack/unittest/Makefile delete mode 100755 test/nanostack/unittest/MakefileWorker.mk delete mode 100644 test/nanostack/unittest/ipv6_stack/ipv6_routing_table/Makefile delete mode 100644 test/nanostack/unittest/ipv6_stack/ipv6_routing_table/ipv6_routing_tabletest.cpp delete mode 100644 test/nanostack/unittest/ipv6_stack/ipv6_routing_table/main.cpp delete mode 100644 test/nanostack/unittest/ipv6_stack/ipv6_routing_table/test_ipv6_routing_table.c delete mode 100644 test/nanostack/unittest/ipv6_stack/ipv6_routing_table/test_ipv6_routing_table.h delete mode 100644 test/nanostack/unittest/ipv6_stack/protocol_ipv6/Makefile delete mode 100644 test/nanostack/unittest/ipv6_stack/protocol_ipv6/main.cpp delete mode 100644 test/nanostack/unittest/ipv6_stack/protocol_ipv6/protocol_ipv6test.cpp delete mode 100644 test/nanostack/unittest/ipv6_stack/protocol_ipv6/test_protocol_ipv6.c delete mode 100644 test/nanostack/unittest/ipv6_stack/protocol_ipv6/test_protocol_ipv6.h delete mode 100644 test/nanostack/unittest/libDHCPv6/dhcp_service_api/Makefile delete mode 100644 test/nanostack/unittest/libDHCPv6/dhcp_service_api/dhcp_service_apitest.cpp delete mode 100644 test/nanostack/unittest/libDHCPv6/dhcp_service_api/main.cpp delete mode 100644 test/nanostack/unittest/libDHCPv6/dhcp_service_api/test_dhcp_service_api.c delete mode 100644 test/nanostack/unittest/libDHCPv6/dhcp_service_api/test_dhcp_service_api.h delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6/Makefile delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6/libdhcpv6test.cpp delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6/main.cpp delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6/test_libdhcpv6.c delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6/test_libdhcpv6.h delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6_server/Makefile delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6_server/libdhcpv6_servertest.cpp delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6_server/main.cpp delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6_server/test_libdhcpv6_server.c delete mode 100644 test/nanostack/unittest/libDHCPv6/libdhcpv6_server/test_libdhcpv6_server.h delete mode 100644 test/nanostack/unittest/libNET/net/Makefile delete mode 100644 test/nanostack/unittest/libNET/net/main.cpp delete mode 100644 test/nanostack/unittest/libNET/net/nettest.cpp delete mode 100644 test/nanostack/unittest/libNET/net/test_net.c delete mode 100644 test/nanostack/unittest/libNET/net/test_net.h delete mode 100644 test/nanostack/unittest/libNET/net_6lowpan_parameter_api/Makefile delete mode 100644 test/nanostack/unittest/libNET/net_6lowpan_parameter_api/main.cpp delete mode 100644 test/nanostack/unittest/libNET/net_6lowpan_parameter_api/net_6lowpan_parameter_apitest.cpp delete mode 100644 test/nanostack/unittest/libNET/net_6lowpan_parameter_api/test_net_6lowpan_parameter_api.c delete mode 100644 test/nanostack/unittest/libNET/net_6lowpan_parameter_api/test_net_6lowpan_parameter_api.h delete mode 100644 test/nanostack/unittest/libNET/net_ipv6/Makefile delete mode 100644 test/nanostack/unittest/libNET/net_ipv6/main.cpp delete mode 100644 test/nanostack/unittest/libNET/net_ipv6/net_ipv6test.cpp delete mode 100644 test/nanostack/unittest/libNET/net_ipv6/test_net_ipv6.c delete mode 100644 test/nanostack/unittest/libNET/net_ipv6/test_net_ipv6.h delete mode 100644 test/nanostack/unittest/libNET/net_mle/Makefile delete mode 100644 test/nanostack/unittest/libNET/net_mle/main.cpp delete mode 100644 test/nanostack/unittest/libNET/net_mle/net_mletest.cpp delete mode 100644 test/nanostack/unittest/libNET/net_mle/test_net_mle.c delete mode 100644 test/nanostack/unittest/libNET/net_mle/test_net_mle.h delete mode 100644 test/nanostack/unittest/libNET/net_rpl/Makefile delete mode 100644 test/nanostack/unittest/libNET/net_rpl/main.cpp delete mode 100644 test/nanostack/unittest/libNET/net_rpl/net_rpltest.cpp delete mode 100644 test/nanostack/unittest/libNET/net_rpl/test_net_rpl.c delete mode 100644 test/nanostack/unittest/libNET/net_rpl/test_net_rpl.h delete mode 100644 test/nanostack/unittest/libNET/net_short_address_extension/Makefile delete mode 100644 test/nanostack/unittest/libNET/net_short_address_extension/main.cpp delete mode 100644 test/nanostack/unittest/libNET/net_short_address_extension/net_short_address_extensiontest.cpp delete mode 100644 test/nanostack/unittest/libNET/net_short_address_extension/test_net_short_address_extension.c delete mode 100644 test/nanostack/unittest/libNET/net_short_address_extension/test_net_short_address_extension.h delete mode 100644 test/nanostack/unittest/libNET/socket_api/Makefile delete mode 100644 test/nanostack/unittest/libNET/socket_api/main.cpp delete mode 100644 test/nanostack/unittest/libNET/socket_api/socket_api_test.cpp delete mode 100644 test/nanostack/unittest/mac/ethernet_mac_api/Makefile delete mode 100644 test/nanostack/unittest/mac/ethernet_mac_api/ethernet_mac_apitest.cpp delete mode 100644 test/nanostack/unittest/mac/ethernet_mac_api/main.cpp delete mode 100644 test/nanostack/unittest/mac/ethernet_mac_api/test_ethernet_mac_api.c delete mode 100644 test/nanostack/unittest/mac/ethernet_mac_api/test_ethernet_mac_api.h delete mode 100644 test/nanostack/unittest/mac/fhss_callbacks/Makefile delete mode 100644 test/nanostack/unittest/mac/fhss_callbacks/fhss_callbackstest.cpp delete mode 100644 test/nanostack/unittest/mac/fhss_callbacks/main.cpp delete mode 100644 test/nanostack/unittest/mac/fhss_callbacks/test_fhss_callbacks.c delete mode 100644 test/nanostack/unittest/mac/fhss_callbacks/test_fhss_callbacks.h delete mode 100644 test/nanostack/unittest/mac/mac_filter/Makefile delete mode 100644 test/nanostack/unittest/mac/mac_filter/mac_filtertest.cpp delete mode 100644 test/nanostack/unittest/mac/mac_filter/main.cpp delete mode 100644 test/nanostack/unittest/mac/mac_filter/test_mac_filter.c delete mode 100644 test/nanostack/unittest/mac/mac_filter/test_mac_filter.h delete mode 100644 test/nanostack/unittest/mac/mac_header_helper_functions/Makefile delete mode 100644 test/nanostack/unittest/mac/mac_header_helper_functions/mac_header_helper_functionstest.cpp delete mode 100644 test/nanostack/unittest/mac/mac_header_helper_functions/main.cpp delete mode 100644 test/nanostack/unittest/mac/mac_header_helper_functions/test_mac_header_helper_functions.c delete mode 100644 test/nanostack/unittest/mac/mac_header_helper_functions/test_mac_header_helper_functions.h delete mode 100644 test/nanostack/unittest/mac/mac_indirect_data/Makefile delete mode 100644 test/nanostack/unittest/mac/mac_indirect_data/mac_indirect_datatest.cpp delete mode 100644 test/nanostack/unittest/mac/mac_indirect_data/main.cpp delete mode 100644 test/nanostack/unittest/mac/mac_indirect_data/test_mac_indirect_data.c delete mode 100644 test/nanostack/unittest/mac/mac_indirect_data/test_mac_indirect_data.h delete mode 100644 test/nanostack/unittest/mac/mac_mcps_sap/Makefile delete mode 100644 test/nanostack/unittest/mac/mac_mcps_sap/mac_mcps_saptest.cpp delete mode 100644 test/nanostack/unittest/mac/mac_mcps_sap/main.cpp delete mode 100644 test/nanostack/unittest/mac/mac_mcps_sap/test_mac_mcps_sap.c delete mode 100644 test/nanostack/unittest/mac/mac_mcps_sap/test_mac_mcps_sap.h delete mode 100644 test/nanostack/unittest/mac/mac_mlme/Makefile delete mode 100644 test/nanostack/unittest/mac/mac_mlme/mac_mlmetest.cpp delete mode 100644 test/nanostack/unittest/mac/mac_mlme/main.cpp delete mode 100644 test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.c delete mode 100644 test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.h delete mode 100644 test/nanostack/unittest/mac/mac_pd_sap/Makefile delete mode 100644 test/nanostack/unittest/mac/mac_pd_sap/mac_pd_saptest.cpp delete mode 100644 test/nanostack/unittest/mac/mac_pd_sap/main.cpp delete mode 100644 test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.c delete mode 100644 test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.h delete mode 100644 test/nanostack/unittest/mac/mac_security_mib/Makefile delete mode 100644 test/nanostack/unittest/mac/mac_security_mib/mac_security_mibtest.cpp delete mode 100644 test/nanostack/unittest/mac/mac_security_mib/main.cpp delete mode 100644 test/nanostack/unittest/mac/mac_security_mib/test_mac_security_mib.c delete mode 100644 test/nanostack/unittest/mac/mac_security_mib/test_mac_security_mib.h delete mode 100644 test/nanostack/unittest/mac/mac_timer/Makefile delete mode 100644 test/nanostack/unittest/mac/mac_timer/mac_timertest.cpp delete mode 100644 test/nanostack/unittest/mac/mac_timer/main.cpp delete mode 100644 test/nanostack/unittest/mac/mac_timer/test_mac_timer.c delete mode 100644 test/nanostack/unittest/mac/mac_timer/test_mac_timer.h delete mode 100644 test/nanostack/unittest/mac/rf_driver_storage/Makefile delete mode 100644 test/nanostack/unittest/mac/rf_driver_storage/main.cpp delete mode 100644 test/nanostack/unittest/mac/rf_driver_storage/rf_driver_storagetest.cpp delete mode 100644 test/nanostack/unittest/mac/rf_driver_storage/test_rf_driver_storage.c delete mode 100644 test/nanostack/unittest/mac/rf_driver_storage/test_rf_driver_storage.h delete mode 100644 test/nanostack/unittest/mac/serial_mac_api/Makefile delete mode 100644 test/nanostack/unittest/mac/serial_mac_api/main.cpp delete mode 100644 test/nanostack/unittest/mac/serial_mac_api/serial_mac_apitest.cpp delete mode 100644 test/nanostack/unittest/mac/serial_mac_api/test_serial_mac_api.c delete mode 100644 test/nanostack/unittest/mac/serial_mac_api/test_serial_mac_api.h delete mode 100644 test/nanostack/unittest/mac/sw_mac/Makefile delete mode 100644 test/nanostack/unittest/mac/sw_mac/main.cpp delete mode 100644 test/nanostack/unittest/mac/sw_mac/sw_mactest.cpp delete mode 100644 test/nanostack/unittest/mac/sw_mac/test_sw_mac.c delete mode 100644 test/nanostack/unittest/mac/sw_mac/test_sw_mac.h delete mode 100644 test/nanostack/unittest/mac/virtual_rf_client/Makefile delete mode 100644 test/nanostack/unittest/mac/virtual_rf_client/main.cpp delete mode 100644 test/nanostack/unittest/mac/virtual_rf_client/test_virtual_rf_client.c delete mode 100644 test/nanostack/unittest/mac/virtual_rf_client/test_virtual_rf_client.h delete mode 100644 test/nanostack/unittest/mac/virtual_rf_client/virtual_rf_clienttest.cpp delete mode 100644 test/nanostack/unittest/mac/virtual_rf_driver/Makefile delete mode 100644 test/nanostack/unittest/mac/virtual_rf_driver/main.cpp delete mode 100644 test/nanostack/unittest/mac/virtual_rf_driver/test_virtual_rf_driver.c delete mode 100644 test/nanostack/unittest/mac/virtual_rf_driver/test_virtual_rf_driver.h delete mode 100644 test/nanostack/unittest/mac/virtual_rf_driver/virtual_rf_drivertest.cpp delete mode 100755 test/nanostack/unittest/makefile_defines.txt delete mode 100644 test/nanostack/unittest/mle/mle/Makefile delete mode 100644 test/nanostack/unittest/mle/mle/main.cpp delete mode 100644 test/nanostack/unittest/mle/mle/mle_test.cpp delete mode 100644 test/nanostack/unittest/mle/mle/test_mle.c delete mode 100644 test/nanostack/unittest/mle/mle/test_mle.h delete mode 100644 test/nanostack/unittest/mle/mle_tlv/Makefile delete mode 100644 test/nanostack/unittest/mle/mle_tlv/main.cpp delete mode 100644 test/nanostack/unittest/mle/mle_tlv/mle_tlvtest.cpp delete mode 100644 test/nanostack/unittest/mle/mle_tlv/test_mle_tlv.c delete mode 100644 test/nanostack/unittest/mle/mle_tlv/test_mle_tlv.h delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core/Makefile delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core/main.cpp delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core/protocol_coretest.cpp delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core/test_protocol_core.c delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core/test_protocol_core.h delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core_sleep/Makefile delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core_sleep/main.cpp delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core_sleep/protocol_core_sleeptest.cpp delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core_sleep/test_protocol_core_sleep.c delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_core_sleep/test_protocol_core_sleep.h delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_stats/Makefile delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_stats/main.cpp delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_stats/protocol_statstest.cpp delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_stats/test_protocol_stats.c delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_stats/test_protocol_stats.h delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_timer/Makefile delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_timer/main.cpp delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_timer/protocol_timertest.cpp delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_timer/test_protocol_timer.c delete mode 100644 test/nanostack/unittest/nwk_interface/protocol_timer/test_protocol_timer.h delete mode 100644 test/nanostack/unittest/rpl/rpl_control/Makefile delete mode 100644 test/nanostack/unittest/rpl/rpl_control/main.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_control/rpl_controltest.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_control/test_rpl_control.c delete mode 100644 test/nanostack/unittest/rpl/rpl_control/test_rpl_control.h delete mode 100644 test/nanostack/unittest/rpl/rpl_data/Makefile delete mode 100644 test/nanostack/unittest/rpl/rpl_data/main.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_data/rpl_datatest.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_data/test_rpl_data.c delete mode 100644 test/nanostack/unittest/rpl/rpl_data/test_rpl_data.h delete mode 100644 test/nanostack/unittest/rpl/rpl_downward/Makefile delete mode 100644 test/nanostack/unittest/rpl/rpl_downward/main.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_downward/rpl_downwardtest.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_downward/test_rpl_downward.c delete mode 100644 test/nanostack/unittest/rpl/rpl_downward/test_rpl_downward.h delete mode 100644 test/nanostack/unittest/rpl/rpl_mrhof/Makefile delete mode 100644 test/nanostack/unittest/rpl/rpl_mrhof/main.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_mrhof/rpl_mrhoftest.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_mrhof/test_rpl_mrhof.c delete mode 100644 test/nanostack/unittest/rpl/rpl_mrhof/test_rpl_mrhof.h delete mode 100644 test/nanostack/unittest/rpl/rpl_objective/Makefile delete mode 100644 test/nanostack/unittest/rpl/rpl_objective/main.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_objective/rpl_objectivetest.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_objective/test_rpl_objective.c delete mode 100644 test/nanostack/unittest/rpl/rpl_objective/test_rpl_objective.h delete mode 100644 test/nanostack/unittest/rpl/rpl_of0/Makefile delete mode 100644 test/nanostack/unittest/rpl/rpl_of0/main.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_of0/rpl_of0test.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_of0/test_rpl_of0.c delete mode 100644 test/nanostack/unittest/rpl/rpl_of0/test_rpl_of0.h delete mode 100644 test/nanostack/unittest/rpl/rpl_policy/Makefile delete mode 100644 test/nanostack/unittest/rpl/rpl_policy/main.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_policy/rpl_policytest.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_policy/test_rpl_policy.c delete mode 100644 test/nanostack/unittest/rpl/rpl_policy/test_rpl_policy.h delete mode 100644 test/nanostack/unittest/rpl/rpl_upward/Makefile delete mode 100644 test/nanostack/unittest/rpl/rpl_upward/main.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_upward/rpl_upwardtest.cpp delete mode 100644 test/nanostack/unittest/rpl/rpl_upward/test_rpl_upward.c delete mode 100644 test/nanostack/unittest/rpl/rpl_upward/test_rpl_upward.h delete mode 100644 test/nanostack/unittest/security/pana/Makefile delete mode 100644 test/nanostack/unittest/security/pana/main.cpp delete mode 100644 test/nanostack/unittest/security/pana/panatest.cpp delete mode 100644 test/nanostack/unittest/security/pana/test_pana.c delete mode 100644 test/nanostack/unittest/security/pana/test_pana.h delete mode 100644 test/nanostack/unittest/security/pana_relay_table/Makefile delete mode 100644 test/nanostack/unittest/security/pana_relay_table/main.cpp delete mode 100644 test/nanostack/unittest/security/pana_relay_table/pana_relay_tabletest.cpp delete mode 100644 test/nanostack/unittest/security/pana_relay_table/test_pana_relay_table.c delete mode 100644 test/nanostack/unittest/security/pana_relay_table/test_pana_relay_table.h delete mode 100644 test/nanostack/unittest/security/security_lib/Makefile delete mode 100644 test/nanostack/unittest/security/security_lib/main.cpp delete mode 100644 test/nanostack/unittest/security/security_lib/security_libtest.cpp delete mode 100644 test/nanostack/unittest/security/security_lib/test_security_lib.c delete mode 100644 test/nanostack/unittest/security/security_lib/test_security_lib.h delete mode 100644 test/nanostack/unittest/security/tls_lib/Makefile delete mode 100644 test/nanostack/unittest/security/tls_lib/main.cpp delete mode 100644 test/nanostack/unittest/security/tls_lib/test_tls_lib.c delete mode 100644 test/nanostack/unittest/security/tls_lib/test_tls_lib.h delete mode 100644 test/nanostack/unittest/security/tls_lib/tls_libtest.cpp delete mode 100644 test/nanostack/unittest/service_libs/SHA256_Lib/Makefile delete mode 100644 test/nanostack/unittest/service_libs/SHA256_Lib/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/SHA256_Lib/shalibtest.cpp delete mode 100644 test/nanostack/unittest/service_libs/SHA256_Lib/test_shalib.c delete mode 100644 test/nanostack/unittest/service_libs/SHA256_Lib/test_shalib.h delete mode 100644 test/nanostack/unittest/service_libs/blacklist/Makefile delete mode 100644 test/nanostack/unittest/service_libs/blacklist/blacklisttest.cpp delete mode 100644 test/nanostack/unittest/service_libs/blacklist/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/blacklist/test_blacklist.c delete mode 100644 test/nanostack/unittest/service_libs/blacklist/test_blacklist.h delete mode 100644 test/nanostack/unittest/service_libs/channel_list/Makefile delete mode 100644 test/nanostack/unittest/service_libs/channel_list/channeltest.cpp delete mode 100644 test/nanostack/unittest/service_libs/channel_list/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/channel_list/test_channel_list.c delete mode 100644 test/nanostack/unittest/service_libs/channel_list/test_channel_list.h delete mode 100644 test/nanostack/unittest/service_libs/etx/Makefile delete mode 100644 test/nanostack/unittest/service_libs/etx/etxtest.cpp delete mode 100644 test/nanostack/unittest/service_libs/etx/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/etx/test_etx.c delete mode 100644 test/nanostack/unittest/service_libs/etx/test_etx.h delete mode 100644 test/nanostack/unittest/service_libs/fhss/Makefile delete mode 100644 test/nanostack/unittest/service_libs/fhss/fhsstest.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss/test_fhss.c delete mode 100644 test/nanostack/unittest/service_libs/fhss/test_fhss.h delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon/Makefile delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon/fhssbeacontest.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon/test_fhss_beacon.c delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon/test_fhss_beacon.h delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon_tasklet/Makefile delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon_tasklet/fhssbeacontasklettest.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon_tasklet/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon_tasklet/test_fhss_beacon_tasklet.c delete mode 100644 test/nanostack/unittest/service_libs/fhss_beacon_tasklet/test_fhss_beacon_tasklet.h delete mode 100644 test/nanostack/unittest/service_libs/fhss_channel/Makefile delete mode 100644 test/nanostack/unittest/service_libs/fhss_channel/fhsschanneltest.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_channel/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_channel/test_fhss_channel.c delete mode 100644 test/nanostack/unittest/service_libs/fhss_channel/test_fhss_channel.h delete mode 100644 test/nanostack/unittest/service_libs/fhss_config/Makefile delete mode 100644 test/nanostack/unittest/service_libs/fhss_config/fhssconfigtest.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_config/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_config/test_fhss_config.c delete mode 100644 test/nanostack/unittest/service_libs/fhss_config/test_fhss_config.h delete mode 100644 test/nanostack/unittest/service_libs/fhss_mac_interface/Makefile delete mode 100644 test/nanostack/unittest/service_libs/fhss_mac_interface/fhssmaciftest.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_mac_interface/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_mac_interface/test_fhss_mac_interface.c delete mode 100644 test/nanostack/unittest/service_libs/fhss_mac_interface/test_fhss_mac_interface.h delete mode 100644 test/nanostack/unittest/service_libs/fhss_statistics/Makefile delete mode 100644 test/nanostack/unittest/service_libs/fhss_statistics/fhssstatisticstest.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_statistics/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/fhss_statistics/test_fhss_statistics.c delete mode 100644 test/nanostack/unittest/service_libs/fhss_statistics/test_fhss_statistics.h delete mode 100644 test/nanostack/unittest/service_libs/load_balance/Makefile delete mode 100644 test/nanostack/unittest/service_libs/load_balance/loadbalance_test.cpp delete mode 100644 test/nanostack/unittest/service_libs/load_balance/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/mdns/Makefile delete mode 100644 test/nanostack/unittest/service_libs/mdns/main.cpp delete mode 100644 test/nanostack/unittest/service_libs/mdns/mdns_tests.cpp delete mode 100644 test/nanostack/unittest/service_libs/mdns/test_ns_mdns_api.c delete mode 100644 test/nanostack/unittest/service_libs/mdns/test_ns_mdns_api.h delete mode 100644 test/nanostack/unittest/stub/6lowpan_iphc_stub.c delete mode 100644 test/nanostack/unittest/stub/6lowpan_mesh_stub.c delete mode 100644 test/nanostack/unittest/stub/adaptation_interface_stub.c delete mode 100644 test/nanostack/unittest/stub/adaptation_interface_stub.h delete mode 100644 test/nanostack/unittest/stub/address_stub.c delete mode 100644 test/nanostack/unittest/stub/address_stub.h delete mode 100644 test/nanostack/unittest/stub/beacon_handler_stub.c delete mode 100644 test/nanostack/unittest/stub/blacklist_stub.c delete mode 100644 test/nanostack/unittest/stub/border_router_stub.c delete mode 100644 test/nanostack/unittest/stub/buffer_dyn_stub.c delete mode 100644 test/nanostack/unittest/stub/buffer_dyn_stub.h delete mode 100644 test/nanostack/unittest/stub/ccm_security_stub.c delete mode 100644 test/nanostack/unittest/stub/ccm_security_stub.h delete mode 100644 test/nanostack/unittest/stub/channel_list_stub.c delete mode 100644 test/nanostack/unittest/stub/channel_list_stub.h delete mode 100644 test/nanostack/unittest/stub/cipv6_fragmenter_stub.c delete mode 100644 test/nanostack/unittest/stub/cipv6_fragmenter_stub.h delete mode 100644 test/nanostack/unittest/stub/coap_connection_handler_stub.c delete mode 100644 test/nanostack/unittest/stub/coap_connection_handler_stub.h delete mode 100644 test/nanostack/unittest/stub/coap_security_handler_stub.c delete mode 100644 test/nanostack/unittest/stub/coap_security_handler_stub.h delete mode 100644 test/nanostack/unittest/stub/coap_service_api_stub.c delete mode 100644 test/nanostack/unittest/stub/coap_service_api_stub.h delete mode 100644 test/nanostack/unittest/stub/common_functions_stub.c delete mode 100644 test/nanostack/unittest/stub/common_functions_stub.h delete mode 100644 test/nanostack/unittest/stub/crc_stub.c delete mode 100644 test/nanostack/unittest/stub/cudp_stub.c delete mode 100644 test/nanostack/unittest/stub/dhcp_service_api_stub.c delete mode 100644 test/nanostack/unittest/stub/eap_protocol_stub.c delete mode 100644 test/nanostack/unittest/stub/ecc_stub.c delete mode 100644 test/nanostack/unittest/stub/ecdsa_stub.c delete mode 100644 test/nanostack/unittest/stub/etx_stub.c delete mode 100644 test/nanostack/unittest/stub/event_stub.c delete mode 100644 test/nanostack/unittest/stub/event_stub.h delete mode 100644 test/nanostack/unittest/stub/fhss_beacon_stub.c delete mode 100644 test/nanostack/unittest/stub/fhss_beacon_tasklet_stub.c delete mode 100644 test/nanostack/unittest/stub/fhss_beacon_tasklet_stub.h delete mode 100644 test/nanostack/unittest/stub/fhss_callbacks_stub.c delete mode 100644 test/nanostack/unittest/stub/fhss_callbacks_stub.h delete mode 100644 test/nanostack/unittest/stub/fhss_channel_stub.c delete mode 100644 test/nanostack/unittest/stub/fhss_channel_stub.h delete mode 100644 test/nanostack/unittest/stub/fhss_config_stub.c delete mode 100644 test/nanostack/unittest/stub/fhss_config_stub.h delete mode 100644 test/nanostack/unittest/stub/fhss_mac_interface_stub.c delete mode 100644 test/nanostack/unittest/stub/fhss_mac_interface_stub.h delete mode 100644 test/nanostack/unittest/stub/fhss_platform_stub.c delete mode 100644 test/nanostack/unittest/stub/fhss_platform_stub.h delete mode 100644 test/nanostack/unittest/stub/fhss_statistics_stub.c delete mode 100644 test/nanostack/unittest/stub/fhss_stub.c delete mode 100644 test/nanostack/unittest/stub/fhss_stub.h delete mode 100644 test/nanostack/unittest/stub/fnet_mdns_stub.c delete mode 100644 test/nanostack/unittest/stub/fnet_mdns_stub.h delete mode 100644 test/nanostack/unittest/stub/fnet_poll_stub.c delete mode 100644 test/nanostack/unittest/stub/fnv_hash_stub.c delete mode 100644 test/nanostack/unittest/stub/icmpv6_prefix_stub.c delete mode 100644 test/nanostack/unittest/stub/icmpv6_radv_stub.c delete mode 100644 test/nanostack/unittest/stub/icmpv6_stub.c delete mode 100644 test/nanostack/unittest/stub/ip6tos_stub.c delete mode 100644 test/nanostack/unittest/stub/ip_fsc_stub.c delete mode 100644 test/nanostack/unittest/stub/iphc_compress_stub.c delete mode 100644 test/nanostack/unittest/stub/iphc_decompress_stub.c delete mode 100644 test/nanostack/unittest/stub/ipv6_flow_stub.c delete mode 100644 test/nanostack/unittest/stub/ipv6_fragmentation_stub.c delete mode 100644 test/nanostack/unittest/stub/ipv6_resolution_stub.c delete mode 100644 test/nanostack/unittest/stub/ipv6_resolution_stub.h delete mode 100644 test/nanostack/unittest/stub/ipv6_routing_table_stub.c delete mode 100644 test/nanostack/unittest/stub/ipv6_stub.c delete mode 100644 test/nanostack/unittest/stub/isqrt_stub.c delete mode 100644 test/nanostack/unittest/stub/libDHCPv6_server_stub.c delete mode 100644 test/nanostack/unittest/stub/libDHCPv6_stub.c delete mode 100644 test/nanostack/unittest/stub/load_balance_stub.c delete mode 100644 test/nanostack/unittest/stub/lowpan_context_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_data_poll_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_filter_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_filter_stub.h delete mode 100644 test/nanostack/unittest/stub/mac_header_helper_functions_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_header_helper_functions_stub.h delete mode 100644 test/nanostack/unittest/stub/mac_helper_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_helper_stub.h delete mode 100644 test/nanostack/unittest/stub/mac_indirect_data_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_indirect_data_stub.h delete mode 100644 test/nanostack/unittest/stub/mac_mcps_sap_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_mcps_sap_stub.h delete mode 100644 test/nanostack/unittest/stub/mac_mlme_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_mlme_stub.h delete mode 100644 test/nanostack/unittest/stub/mac_pairwise_key_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_pd_sap_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_response_handler_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_security_interface_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_security_mib_stub.c delete mode 100644 test/nanostack/unittest/stub/mac_security_mib_stub.h delete mode 100644 test/nanostack/unittest/stub/mac_timer_stub.c delete mode 100644 test/nanostack/unittest/stub/mbed_trace_stub.c delete mode 100644 test/nanostack/unittest/stub/mbedtls_stub.c delete mode 100644 test/nanostack/unittest/stub/mbedtls_stub.h delete mode 100644 test/nanostack/unittest/stub/mesh_stub.c delete mode 100644 test/nanostack/unittest/stub/mesh_stub.h delete mode 100644 test/nanostack/unittest/stub/mld_stub.c delete mode 100644 test/nanostack/unittest/stub/mle_service_buffer_stub.c delete mode 100644 test/nanostack/unittest/stub/mle_service_stub.c delete mode 100644 test/nanostack/unittest/stub/mle_service_stub.h delete mode 100644 test/nanostack/unittest/stub/mle_stub.c delete mode 100644 test/nanostack/unittest/stub/mle_stub.h delete mode 100644 test/nanostack/unittest/stub/mle_tlv_stub.c delete mode 100644 test/nanostack/unittest/stub/mle_tlv_stub.h delete mode 100644 test/nanostack/unittest/stub/mpl_stub.c delete mode 100644 test/nanostack/unittest/stub/multicast_api_stub.c delete mode 100644 test/nanostack/unittest/stub/nd_proxy.c delete mode 100644 test/nanostack/unittest/stub/nd_proxy_stub.c delete mode 100644 test/nanostack/unittest/stub/nd_router_object_stub.c delete mode 100644 test/nanostack/unittest/stub/neighbor_cache_stub.c delete mode 100644 test/nanostack/unittest/stub/net_load_balance_stub.c delete mode 100644 test/nanostack/unittest/stub/net_mle_stub.c delete mode 100644 test/nanostack/unittest/stub/net_rpl_stub.c delete mode 100644 test/nanostack/unittest/stub/net_stub.c delete mode 100644 test/nanostack/unittest/stub/network_lib_stub.c delete mode 100644 test/nanostack/unittest/stub/ns_file_system_stub.c delete mode 100644 test/nanostack/unittest/stub/ns_list_stub.c delete mode 100644 test/nanostack/unittest/stub/ns_sha256_stub.c delete mode 100644 test/nanostack/unittest/stub/ns_timer_stub.c delete mode 100644 test/nanostack/unittest/stub/ns_timer_stub.h delete mode 100644 test/nanostack/unittest/stub/nsdynmemLIB_stub.c delete mode 100644 test/nanostack/unittest/stub/nsdynmemLIB_stub.h delete mode 100644 test/nanostack/unittest/stub/nwk_nvm_stub.c delete mode 100644 test/nanostack/unittest/stub/pan_blacklist_stub.c delete mode 100644 test/nanostack/unittest/stub/pana_avp_stub.c delete mode 100644 test/nanostack/unittest/stub/pana_client_stub.c delete mode 100644 test/nanostack/unittest/stub/pana_eap_stub.c delete mode 100644 test/nanostack/unittest/stub/pana_header_stub.c delete mode 100644 test/nanostack/unittest/stub/pana_relay_table_stub.c delete mode 100644 test/nanostack/unittest/stub/pana_server_stub.c delete mode 100644 test/nanostack/unittest/stub/pana_stub.c delete mode 100644 test/nanostack/unittest/stub/platform_nvm_stub.c delete mode 100644 test/nanostack/unittest/stub/platform_stub.c delete mode 100644 test/nanostack/unittest/stub/protocol_6lowpan_bootstrap_stub.c delete mode 100644 test/nanostack/unittest/stub/protocol_6lowpan_bootstrap_stub.h delete mode 100644 test/nanostack/unittest/stub/protocol_6lowpan_interface_stub.c delete mode 100644 test/nanostack/unittest/stub/protocol_6lowpan_stub.c delete mode 100644 test/nanostack/unittest/stub/protocol_6lowpan_stub.h delete mode 100644 test/nanostack/unittest/stub/protocol_core_stub.c delete mode 100644 test/nanostack/unittest/stub/protocol_core_stub.h delete mode 100644 test/nanostack/unittest/stub/protocol_ipv6_stub.c delete mode 100644 test/nanostack/unittest/stub/protocol_stats_stub.c delete mode 100644 test/nanostack/unittest/stub/protocol_timer_stub.c delete mode 100644 test/nanostack/unittest/stub/protocol_tun_driver_stub.c delete mode 100644 test/nanostack/unittest/stub/protocol_tun_driver_stub.h delete mode 100644 test/nanostack/unittest/stub/randLIB_stub.c delete mode 100644 test/nanostack/unittest/stub/rf_driver_storage_stub.c delete mode 100644 test/nanostack/unittest/stub/rf_driver_storage_stub.h delete mode 100644 test/nanostack/unittest/stub/routing_table_stub.c delete mode 100644 test/nanostack/unittest/stub/rpl_control_stub.c delete mode 100644 test/nanostack/unittest/stub/rpl_data_stub.c delete mode 100644 test/nanostack/unittest/stub/rpl_data_stub.h delete mode 100644 test/nanostack/unittest/stub/rpl_downward_stub.c delete mode 100644 test/nanostack/unittest/stub/rpl_mrhof_stub.c delete mode 100644 test/nanostack/unittest/stub/rpl_objective_stub.c delete mode 100644 test/nanostack/unittest/stub/rpl_of0_stub.c delete mode 100644 test/nanostack/unittest/stub/rpl_policy_stub.c delete mode 100644 test/nanostack/unittest/stub/rpl_upward_stub.c delete mode 100644 test/nanostack/unittest/stub/security_lib_stub.c delete mode 100644 test/nanostack/unittest/stub/shalib_stub.c delete mode 100644 test/nanostack/unittest/stub/sn_coap_builder_stub.c delete mode 100644 test/nanostack/unittest/stub/sn_coap_builder_stub.h delete mode 100644 test/nanostack/unittest/stub/sn_coap_parser_stub.h delete mode 100644 test/nanostack/unittest/stub/sn_coap_protocol_stub.h delete mode 100644 test/nanostack/unittest/stub/sockbuf_stub.c delete mode 100644 test/nanostack/unittest/stub/socket_api_stub.c delete mode 100644 test/nanostack/unittest/stub/socket_api_stub.h delete mode 100644 test/nanostack/unittest/stub/socket_stub.c delete mode 100644 test/nanostack/unittest/stub/socket_stub.h delete mode 100644 test/nanostack/unittest/stub/sw_mac_stub.c delete mode 100644 test/nanostack/unittest/stub/sw_mac_stub.h delete mode 100644 test/nanostack/unittest/stub/system_timer_stub.c delete mode 100644 test/nanostack/unittest/stub/system_timer_stub.h delete mode 100644 test/nanostack/unittest/stub/tcp_stub.c delete mode 100644 test/nanostack/unittest/stub/tcp_stub.h delete mode 100644 test/nanostack/unittest/stub/thread_address_registration_client_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_bbr_api_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_beacon_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_bootstrap_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_border_router_api_internal_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_border_router_api_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_commissioning_if_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_common_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_common_stub.h delete mode 100644 test/nanostack/unittest/stub/thread_dhcpv6_client_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_discovery_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_host_bootstrap_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_joiner_application_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_leader_service_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_management_api_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_management_client_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_management_if_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_management_server_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_meshcop_lib_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_meshcop_lib_stub.h delete mode 100644 test/nanostack/unittest/stub/thread_mle_message_handler_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_nd_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_network_data_lib_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_network_data_storage_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_network_synch_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_nvm_store_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_resolution_client_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_router_bootstrap_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_routing_stub.c delete mode 100644 test/nanostack/unittest/stub/thread_test_api_stub.c delete mode 100644 test/nanostack/unittest/stub/timeout_stub.c delete mode 100644 test/nanostack/unittest/stub/tls_ccm_crypt_stub.c delete mode 100644 test/nanostack/unittest/stub/tls_lib_stub.c delete mode 100644 test/nanostack/unittest/stub/trickle_stub.c delete mode 100644 test/nanostack/unittest/stub/udp_stub.c delete mode 100644 test/nanostack/unittest/stub/whiteboard_stub.c delete mode 100644 test/nanostack/unittest/stub/x509_stub.c delete mode 100644 test/nanostack/unittest/thread/nvm/Makefile delete mode 100644 test/nanostack/unittest/thread/nvm/main.cpp delete mode 100644 test/nanostack/unittest/thread/nvm/test_thread_nvm_store.c delete mode 100644 test/nanostack/unittest/thread/nvm/test_thread_nvm_store.h delete mode 100644 test/nanostack/unittest/thread/nvm/thread_nvm_storetest.cpp delete mode 100644 test/nanostack/unittest/thread/thread/Makefile delete mode 100644 test/nanostack/unittest/thread/thread/main.cpp delete mode 100644 test/nanostack/unittest/thread/thread/test_thread.c delete mode 100644 test/nanostack/unittest/thread/thread/test_thread.h delete mode 100644 test/nanostack/unittest/thread/thread/threadtest.cpp delete mode 100644 test/nanostack/unittest/thread/thread_bootstrap/Makefile delete mode 100644 test/nanostack/unittest/thread/thread_bootstrap/main.cpp delete mode 100644 test/nanostack/unittest/thread/thread_bootstrap/test_thread_bootstrap.c delete mode 100644 test/nanostack/unittest/thread/thread_bootstrap/test_thread_bootstrap.h delete mode 100644 test/nanostack/unittest/thread/thread_bootstrap/thread_bootstraptest.cpp delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_api/Makefile delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_api/main.cpp delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_api/test_thread_commissioning_api.c delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_api/test_thread_commissioning_api.h delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_api/thread_commissioning_apitest.cpp delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_if/Makefile delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_if/main.cpp delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_if/test_thread_commissioning_if.c delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_if/test_thread_commissioning_if.h delete mode 100644 test/nanostack/unittest/thread/thread_commissioning_if/thread_commissioning_iftest.cpp delete mode 100644 test/nanostack/unittest/thread/thread_lowpower_api/Makefile delete mode 100644 test/nanostack/unittest/thread/thread_lowpower_api/main.cpp delete mode 100644 test/nanostack/unittest/thread/thread_lowpower_api/test_thread_lowpower_api.c delete mode 100644 test/nanostack/unittest/thread/thread_lowpower_api/test_thread_lowpower_api.h delete mode 100644 test/nanostack/unittest/thread/thread_lowpower_api/thread_lowpower_apitest.cpp delete mode 100644 test/nanostack/unittest/thread/thread_management_client/Makefile delete mode 100644 test/nanostack/unittest/thread/thread_management_client/main.cpp delete mode 100644 test/nanostack/unittest/thread/thread_management_client/test_thread_management_client.c delete mode 100644 test/nanostack/unittest/thread/thread_management_client/test_thread_management_client.h delete mode 100644 test/nanostack/unittest/thread/thread_management_client/thread_management_clienttest.cpp delete mode 100644 test/nanostack/unittest/thread/thread_management_server/Makefile delete mode 100644 test/nanostack/unittest/thread/thread_management_server/main.cpp delete mode 100644 test/nanostack/unittest/thread/thread_management_server/test_thread_management_server.cpp delete mode 100644 test/nanostack/unittest/thread/thread_management_server/test_thread_management_server.h delete mode 100644 test/nanostack/unittest/thread/thread_management_server/thread_management_server_test.cpp delete mode 100644 unittest/header_test/Makefile delete mode 100644 unittest/simulations/sim_address.c delete mode 100644 unittest/simulations/sim_address.h delete mode 100644 unittest/simulations/sim_nanostack.c delete mode 100644 unittest/simulations/sim_socket_api.c delete mode 100644 unittest/simulations/sim_socket_api.h delete mode 100644 unittest/thread_dhcp/.cproject delete mode 100644 unittest/thread_dhcp/.project delete mode 100644 unittest/thread_dhcp/Test.c delete mode 100644 unittest/thread_dhcp/makefile delete mode 100644 unittest/thread_dhcp_servers/.cproject delete mode 100644 unittest/thread_dhcp_servers/.project delete mode 100644 unittest/thread_dhcp_servers/Test.c delete mode 100644 unittest/thread_dhcp_servers/makefile delete mode 100644 unittest/unity_improvement/unity_improved.c delete mode 100644 unittest/unity_improvement/unity_improved.h delete mode 100755 xsl_script.sh diff --git a/junit_xsl.xslt b/junit_xsl.xslt deleted file mode 100644 index 3e944a63510a..000000000000 --- a/junit_xsl.xslt +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - -

- Unittest report -

- -

- -Total tests run , failures: - - - - - - - -

-
- - -

- -

- - - - - - - - - - - -
Tests runTests failOther errors
-
- - - - - - - - -
Tests namePASS/FAILFailing caseReason
-
- - - - - - - - - - - PASS - - - - - - - FAILED - - - - - - - - - - - - - - - - FAILED - - - - - - - - - - - - - -
diff --git a/run_unit_tests.sh b/run_unit_tests.sh deleted file mode 100755 index f6ceee78bf5d..000000000000 --- a/run_unit_tests.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Copyright (c) 2015-2017, 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. - -make test diff --git a/test/nanostack/unittest/6LoWPAN/Mesh/Makefile b/test/nanostack/unittest/6LoWPAN/Mesh/Makefile deleted file mode 100644 index 3b5a9de62542..000000000000 --- a/test/nanostack/unittest/6LoWPAN/Mesh/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = 6lowpan_mesh_unit -SRC_FILES = \ - ../../../../../source/6LoWPAN/Mesh/mesh.c \ - -TEST_SRC_FILES = \ - main.cpp \ - test_mesh.cpp \ - mesh_test.cpp \ - ../../stub/6lowpan_mesh_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/socket_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT diff --git a/test/nanostack/unittest/6LoWPAN/Mesh/main.cpp b/test/nanostack/unittest/6LoWPAN/Mesh/main.cpp deleted file mode 100644 index a7b9c0f1b16f..000000000000 --- a/test/nanostack/unittest/6LoWPAN/Mesh/main.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} diff --git a/test/nanostack/unittest/6LoWPAN/Mesh/mesh_test.cpp b/test/nanostack/unittest/6LoWPAN/Mesh/mesh_test.cpp deleted file mode 100644 index 20d70f0ffe54..000000000000 --- a/test/nanostack/unittest/6LoWPAN/Mesh/mesh_test.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/TestHarness.h" -#include "test_mesh.h" - -TEST_GROUP(6lowpan_mesh) -{ - test_6lowpan_mesh *unit = NULL; - - void setup() { - unit = new test_6lowpan_mesh(); - } - - void teardown() { - delete unit; - } -}; - -TEST(6lowpan_mesh, Create) -{ - CHECK(unit != NULL); -} - -TEST(6lowpan_mesh, test_mesh_supports_multicast) -{ - unit->test_mesh_supports_multicast(); -} - -TEST(6lowpan_mesh, test_mesh_short_address_is_multicast) -{ - unit->test_mesh_short_address_is_multicast(); -} - -TEST(6lowpan_mesh, test_mesh_short_address_is_broadcast_or_multicast) -{ - unit->test_mesh_short_address_is_broadcast_or_multicast(); -} - -TEST(6lowpan_mesh, test_mesh_up) -{ - unit->test_mesh_up(); -} - -TEST(6lowpan_mesh, test_mesh_forwardable_address) -{ - unit->test_mesh_forwardable_address(); -} - -TEST(6lowpan_mesh, test_mesh_address_map) -{ - unit->test_mesh_address_map(); -} - -TEST(6lowpan_mesh, test_mesh_header_needed) -{ - unit->test_mesh_header_needed(); -} - -TEST(6lowpan_mesh, test_mesh_header_size) -{ - unit->test_mesh_header_size(); -} - -TEST(6lowpan_mesh, test_mesh_header_len_from_type_byte) -{ - unit->test_mesh_header_len_from_type_byte(); -} - -TEST(6lowpan_mesh, test_mesh_header_len_from_buffer_type_byte) -{ - unit->test_mesh_header_len_from_buffer_type_byte(); -} - -TEST(6lowpan_mesh, test_mesh_rewrite_bc0_header) -{ - unit->test_mesh_rewrite_bc0_header(); -} - -TEST(6lowpan_mesh, test_mesh_down) -{ - unit->test_mesh_down(); -} diff --git a/test/nanostack/unittest/6LoWPAN/Mesh/test_mesh.cpp b/test/nanostack/unittest/6LoWPAN/Mesh/test_mesh.cpp deleted file mode 100644 index ced0af2a56b7..000000000000 --- a/test/nanostack/unittest/6LoWPAN/Mesh/test_mesh.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "CppUTest/TestHarness.h" -#include "test_mesh.h" -#include -#include -#include "Core/include/ns_buffer.h" - -test_6lowpan_mesh::test_6lowpan_mesh() -{ -} - -test_6lowpan_mesh::~test_6lowpan_mesh() -{ -} - -void test_6lowpan_mesh::test_mesh_supports_multicast() -{ - bool supports = false; - mesh_all_addresses_unicast(supports); - CHECK(mesh_supports_multicast() != supports); - supports = true; - mesh_all_addresses_unicast(supports); - CHECK(mesh_supports_multicast() != supports); -} - -void test_6lowpan_mesh::test_mesh_short_address_is_multicast() -{ - mesh_all_addresses_unicast(true); - //CHECK(mesh_short_address_is_multicast(0)==false); -} - -void test_6lowpan_mesh::test_mesh_short_address_is_broadcast_or_multicast() -{ - mesh_all_addresses_unicast(true); - //CHECK(mesh_short_address_is_broadcast_or_multicast(0)==false); -} - -void test_6lowpan_mesh::test_mesh_up() -{ - buffer_t buf = {}; - CHECK(mesh_up(&buf) == NULL); -} - -void test_6lowpan_mesh::test_mesh_forwardable_address() -{ - protocol_interface_info_entry_t et = {}; - addrtype_t addr; - uint8_t some = 2; - CHECK(mesh_forwardable_address(&et, addr, &some) == false); -} - -void test_6lowpan_mesh::test_mesh_address_map() -{ - protocol_interface_info_entry_t et = {}; - addrtype_t addr; - uint8_t some = 2; - CHECK(mesh_address_map(&et, &addr, &some) == true); -} - -void test_6lowpan_mesh::test_mesh_header_needed() -{ - buffer_t buf = {}; - CHECK(mesh_header_needed(&buf) == false); -} - -void test_6lowpan_mesh::test_mesh_header_size() -{ - buffer_t buf = {}; - CHECK(mesh_header_size(&buf) == 0); -} - -void test_6lowpan_mesh::test_mesh_header_len_from_type_byte() -{ - CHECK(mesh_header_len_from_type_byte(0) == 0); -} - -void test_6lowpan_mesh::test_mesh_header_len_from_buffer_type_byte() -{ - buffer_t buf = {}; - CHECK(mesh_header_len_from_buffer_type_byte(&buf) == 0); -} - -void test_6lowpan_mesh::test_mesh_rewrite_bc0_header() -{ - uint8_t val = 0; - mesh_rewrite_bc0_header(&val); -} - -void test_6lowpan_mesh::test_mesh_down() -{ - buffer_t buf = {}; - CHECK(mesh_down(&buf) == NULL); -} diff --git a/test/nanostack/unittest/6LoWPAN/Mesh/test_mesh.h b/test/nanostack/unittest/6LoWPAN/Mesh/test_mesh.h deleted file mode 100644 index 03fb69a0e7bf..000000000000 --- a/test/nanostack/unittest/6LoWPAN/Mesh/test_mesh.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 TEST_6LOWPAN_MESH_H -#define TEST_6LOWPAN_MESH_H - -#include "nsconfig.h" -#include -#include -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#include "mesh.h" - - -class test_6lowpan_mesh -{ -public: - test_6lowpan_mesh(); - virtual ~test_6lowpan_mesh(); - void test_mesh_supports_multicast(); - void test_mesh_short_address_is_multicast(); - void test_mesh_short_address_is_broadcast_or_multicast(); - void test_mesh_up(); - void test_mesh_forwardable_address(); - void test_mesh_address_map(); - void test_mesh_header_needed(); - void test_mesh_header_size(); - void test_mesh_header_len_from_type_byte(); - void test_mesh_header_len_from_buffer_type_byte(); - void test_mesh_rewrite_bc0_header(); - void test_mesh_down(); -}; - -#endif diff --git a/test/nanostack/unittest/6LoWPAN/NVM/Makefile b/test/nanostack/unittest/6LoWPAN/NVM/Makefile deleted file mode 100644 index c8442ce31afe..000000000000 --- a/test/nanostack/unittest/6LoWPAN/NVM/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = nwk_nvm_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/NVM/nwk_nvm.c - -TEST_SRC_FILES = \ - main.cpp \ - nwk_nvmtest.cpp \ - test_nwk_nvm.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/address_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/mesh_stub.c \ - ../../stub/iphc_decompress_stub.c \ - ../../stub/rpl_data_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/6LoWPAN/NVM/main.cpp b/test/nanostack/unittest/6LoWPAN/NVM/main.cpp deleted file mode 100644 index 161682239450..000000000000 --- a/test/nanostack/unittest/6LoWPAN/NVM/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(nwk_nvm); - diff --git a/test/nanostack/unittest/6LoWPAN/NVM/nwk_nvmtest.cpp b/test/nanostack/unittest/6LoWPAN/NVM/nwk_nvmtest.cpp deleted file mode 100644 index 7c0db68875f5..000000000000 --- a/test/nanostack/unittest/6LoWPAN/NVM/nwk_nvmtest.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_nwk_nvm.h" - -TEST_GROUP(nwk_nvm) -{ - void setup() - { - } - - void teardown() - { - } -}; - - -TEST(nwk_nvm, test_net_nvm_wpan_params_storage_enable) -{ - CHECK(test_net_nvm_wpan_params_storage_enable()); -} - -TEST(nwk_nvm, test_net_nvm_wpan_params_storage_disable) -{ - CHECK(test_net_nvm_wpan_params_storage_disable()); -} - -TEST(nwk_nvm, test_net_nvm_wpan_params_storage_reset) -{ - CHECK(test_net_nvm_wpan_params_storage_reset()); -} - -TEST(nwk_nvm, test_net_nvm_usage) -{ - CHECK(test_net_nvm_usage()); -} diff --git a/test/nanostack/unittest/6LoWPAN/NVM/test_nwk_nvm.c b/test/nanostack/unittest/6LoWPAN/NVM/test_nwk_nvm.c deleted file mode 100644 index 3bca6e402ff2..000000000000 --- a/test/nanostack/unittest/6LoWPAN/NVM/test_nwk_nvm.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "test_nwk_nvm.h" -#include -#include "ns_types.h" -#include "eventOS_event.h" -#include "ns_trace.h" -#include "string.h" -#include "randLIB.h" -#include "nsdynmemLIB.h" -#include "net_nvm_api.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "6LoWPAN/NVM/nwk_nvm.h" -#include "Service_Libs/mle_service/mle_service_api.h" - -#include "address_stub.h" -#include "protocol_core_stub.h" -#include "mac_helper_stub.h" -#include "mesh_stub.h" -#include "nsdynmemLIB_stub.h" -#include "buffer_dyn_stub.h" -#include "common_functions_stub.h" - -#define C_CHECK(condition) \ - do { if (!(condition)) { printf("ERROR: %s at file %s on line %d\n", #condition, __FILE__, __LINE__); return false; } } while(0) - -//Stubbed test data -wpan_nvm_params_t test_params; - - -static void test_wpan_params_updated(wpan_nvm_params_t *parameters) -{ - test_params = *parameters; -} - -static bool test_wpan_params_get(wpan_nvm_params_t *parameters) -{ - if (parameters->pan_id == test_params.pan_id) { - *parameters = test_params; - return true; - } - return false; -} - -static void test_params_set(uint16_t pan_id, uint32_t mac_counter, uint32_t mle_counter) -{ - test_params.pan_id = pan_id; - test_params.mac_security_frame_counter = mac_counter; - test_params.mle_securit_counter = mle_counter; -} - -bool test_net_nvm_wpan_params_storage_enable(void) -{ - protocol_interface_info_entry_t interface; - memset(&interface, 0, sizeof(protocol_interface_info_entry_t)); - protocol_core_stub.entry_ptr = &interface; - nsdynmemlib_stub.returnCounter = 0; - int8_t ret = net_nvm_wpan_params_storage_enable(0, NULL, NULL); - C_CHECK( ret == -1 ); - - protocol_core_stub.entry_ptr = NULL; - ret = net_nvm_wpan_params_storage_enable(0, test_wpan_params_updated, test_wpan_params_get); - C_CHECK( ret == -1 ); - protocol_core_stub.entry_ptr = &interface; - ret = net_nvm_wpan_params_storage_enable(0, test_wpan_params_updated, test_wpan_params_get); - C_CHECK( ret == -2 ); - nsdynmemlib_stub.returnCounter = 1; - ret = net_nvm_wpan_params_storage_enable(0, test_wpan_params_updated, test_wpan_params_get); - C_CHECK( ret == 0 ); - - ret = net_nvm_wpan_params_storage_enable(0, test_wpan_params_updated, test_wpan_params_get); - C_CHECK( ret == 0 ); - - net_nvm_wpan_params_storage_disable(0); - return true; -} - -bool test_net_nvm_wpan_params_storage_disable(void) -{ - protocol_interface_info_entry_t interface; - memset(&interface, 0, sizeof(protocol_interface_info_entry_t)); - protocol_core_stub.entry_ptr = NULL; - nsdynmemlib_stub.returnCounter = 1; - int8_t ret = net_nvm_wpan_params_storage_disable(0); - - protocol_core_stub.entry_ptr = &interface; - ret = net_nvm_wpan_params_storage_disable(0); - C_CHECK( ret == -1 ); - net_nvm_wpan_params_storage_enable(0, test_wpan_params_updated, test_wpan_params_get); - ret = net_nvm_wpan_params_storage_disable(0); - C_CHECK( ret == 0 ); - return true; -} - -bool test_net_nvm_wpan_params_storage_reset(void) -{ - protocol_interface_info_entry_t interface; - memset(&interface, 0, sizeof(protocol_interface_info_entry_t)); - protocol_core_stub.entry_ptr = NULL; - nsdynmemlib_stub.returnCounter = 1; - int8_t ret = net_nvm_wpan_params_storage_reset(0); - C_CHECK( ret == -1 ); - protocol_core_stub.entry_ptr = &interface; - ret = net_nvm_wpan_params_storage_reset(0); - C_CHECK( ret == -1 ); - - net_nvm_wpan_params_storage_enable(0, test_wpan_params_updated, test_wpan_params_get); - ret = net_nvm_wpan_params_storage_reset(0); - C_CHECK( ret == 0 ); - - net_nvm_wpan_params_storage_disable(0); - - return true; -} - -bool test_net_nvm_usage(void) -{ - protocol_interface_info_entry_t interface; - memset(&interface, 0, sizeof(protocol_interface_info_entry_t)); - nsdynmemlib_stub.returnCounter = 1; - protocol_core_stub.entry_ptr = &interface; - net_nvm_wpan_params_storage_enable(0, test_wpan_params_updated, test_wpan_params_get); - C_CHECK( interface.nwk_wpan_nvm_api); - //Now lets start using and testing from stack and APP function callbacks - //Test GET all possible - test_params_set(0xface, 100, 101); - - interface.nwk_wpan_nvm_api->nvm_params_update_cb(interface.nwk_wpan_nvm_api, false); - - //Test that we load from NVM and start using updated frame counters - wpan_nvm_params_t *result = interface.nwk_wpan_nvm_api->nvm_params_get_cb(interface.nwk_wpan_nvm_api,0xface); - C_CHECK( interface.nwk_wpan_nvm_api->params.mac_security_frame_counter == (100+1000)); - C_CHECK( interface.nwk_wpan_nvm_api->params.mle_securit_counter == (101+1000)); - C_CHECK( test_params.mac_security_frame_counter == (100+1000)); - C_CHECK( test_params.mle_securit_counter == (101+1000)); - - result = interface.nwk_wpan_nvm_api->nvm_params_get_cb(interface.nwk_wpan_nvm_api, 0xbabe); - C_CHECK( interface.nwk_wpan_nvm_api->params.mac_security_frame_counter == (0)); - C_CHECK( interface.nwk_wpan_nvm_api->params.mle_securit_counter == (0)); - C_CHECK( test_params.mac_security_frame_counter == (0)); - C_CHECK( test_params.mle_securit_counter == (0)); - - - mac_helper_link_frame_counter_set(0,900); - - interface.nwk_wpan_nvm_api->nvm_params_update_cb(interface.nwk_wpan_nvm_api, false); - result = interface.nwk_wpan_nvm_api->nvm_params_get_cb(interface.nwk_wpan_nvm_api, 0xbabe); - C_CHECK( interface.nwk_wpan_nvm_api->params.mac_security_frame_counter == (0)); - C_CHECK( interface.nwk_wpan_nvm_api->params.mle_securit_counter == (0)); - C_CHECK( test_params.mac_security_frame_counter == (0)); - C_CHECK( test_params.mle_securit_counter == (0)); - mac_helper_link_frame_counter_set(0, 951); - interface.nwk_wpan_nvm_api->nvm_params_update_cb(interface.nwk_wpan_nvm_api, false); - result = interface.nwk_wpan_nvm_api->nvm_params_get_cb(interface.nwk_wpan_nvm_api, 0xbabe); - C_CHECK( interface.nwk_wpan_nvm_api->params.mac_security_frame_counter == (951)); - C_CHECK( interface.nwk_wpan_nvm_api->params.mle_securit_counter == (0)); - C_CHECK( test_params.mac_security_frame_counter == (951)); - C_CHECK( test_params.mle_securit_counter == (0)); - mac_helper_link_frame_counter_set(0, 1030); - interface.nwk_wpan_nvm_api->nvm_params_update_cb(interface.nwk_wpan_nvm_api, true); - result = interface.nwk_wpan_nvm_api->nvm_params_get_cb(interface.nwk_wpan_nvm_api, 0xbabe); - C_CHECK( interface.nwk_wpan_nvm_api->params.mac_security_frame_counter == (1030)); - C_CHECK( interface.nwk_wpan_nvm_api->params.mle_securit_counter == (0)); - C_CHECK( test_params.mac_security_frame_counter == (951)); - C_CHECK( test_params.mle_securit_counter == (0)); - net_nvm_wpan_params_storage_reset(0); - result = interface.nwk_wpan_nvm_api->nvm_params_get_cb(interface.nwk_wpan_nvm_api, 0xbabe); - C_CHECK( interface.nwk_wpan_nvm_api->params.mac_security_frame_counter == (1951)); - C_CHECK( interface.nwk_wpan_nvm_api->params.mle_securit_counter == (1000)); - C_CHECK( test_params.mac_security_frame_counter == (1951)); - C_CHECK( test_params.mle_securit_counter == (1000)); - - net_nvm_wpan_params_storage_disable(0); - return true; -} diff --git a/test/nanostack/unittest/6LoWPAN/NVM/test_nwk_nvm.h b/test/nanostack/unittest/6LoWPAN/NVM/test_nwk_nvm.h deleted file mode 100644 index 99bf815d59be..000000000000 --- a/test/nanostack/unittest/6LoWPAN/NVM/test_nwk_nvm.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2017, 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 TEST_NWK_NVM_H -#define TEST_NWK_NVM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_net_nvm_wpan_params_storage_enable(void); -bool test_net_nvm_wpan_params_storage_disable(void); -bool test_net_nvm_wpan_params_storage_reset(void); -bool test_net_nvm_usage(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/test/nanostack/unittest/6LoWPAN/adaptation_interface/Makefile b/test/nanostack/unittest/6LoWPAN/adaptation_interface/Makefile deleted file mode 100644 index c853fa5ff433..000000000000 --- a/test/nanostack/unittest/6LoWPAN/adaptation_interface/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = adaptation_interface_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/adaptation_interface.c - -TEST_SRC_FILES = \ - main.cpp \ - adaptation_interfacetest.cpp \ - test_adaptation_interface.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/address_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/mesh_stub.c \ - ../../stub/iphc_decompress_stub.c \ - ../../stub/rpl_data_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/6LoWPAN/adaptation_interface/adaptation_interfacetest.cpp b/test/nanostack/unittest/6LoWPAN/adaptation_interface/adaptation_interfacetest.cpp deleted file mode 100644 index 23e1a44ffef3..000000000000 --- a/test/nanostack/unittest/6LoWPAN/adaptation_interface/adaptation_interfacetest.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_adaptation_interface.h" - -TEST_GROUP(adaptation_interface) -{ - void setup() - { - } - - void teardown() - { - } -}; - - -TEST(adaptation_interface, test_lowpan_adaptation_interface_init) -{ - CHECK(test_lowpan_adaptation_interface_init()); -} - -TEST(adaptation_interface, test_lowpan_adaptation_interface_free) -{ - CHECK(test_lowpan_adaptation_interface_free()); -} - - -TEST(adaptation_interface, test_lowpan_adaptation_interface_reset) -{ - CHECK(test_lowpan_adaptation_interface_reset()); -} - -TEST(adaptation_interface, test_lowpan_adapatation_data_process_tx_preprocess) -{ - CHECK(test_lowpan_adapatation_data_process_tx_preprocess()); -} - -TEST(adaptation_interface, test_lowpan_adaptation_indirect_purge) -{ - CHECK(test_lowpan_adaptation_indirect_purge()); -} - -TEST(adaptation_interface, test_lowpan_adaptation_interface_tx) -{ - CHECK(test_lowpan_adaptation_interface_tx()); -} - -TEST(adaptation_interface, test_lowpan_adaptation_interface_tx_confirm) -{ - CHECK(test_lowpan_adaptation_interface_tx_confirm()); -} - - -TEST(adaptation_interface, test_lowpan_adaptation_tx_active) -{ - CHECK(test_lowpan_adaptation_tx_active()); -} - - - - - - - - - - - diff --git a/test/nanostack/unittest/6LoWPAN/adaptation_interface/main.cpp b/test/nanostack/unittest/6LoWPAN/adaptation_interface/main.cpp deleted file mode 100644 index 386da7081219..000000000000 --- a/test/nanostack/unittest/6LoWPAN/adaptation_interface/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(adaptation_interface); - diff --git a/test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.c b/test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.c deleted file mode 100644 index 588a63c97988..000000000000 --- a/test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.c +++ /dev/null @@ -1,920 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_adaptation_interface.h" -#include -#include "6LoWPAN/lowpan_adaptation_interface.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "MAC/rf_driver_storage.h" -#include "ns_error_types.h" -#include "mle.h" -#include "mlme.h" -#include "mac_api.h" - -#include "address_stub.h" -#include "mle_stub.h" -#include "protocol_core_stub.h" -#include "mac_helper_stub.h" -#include "socket_stub.h" -#include "mesh_stub.h" -#include "rpl_data_stub.h" -#include "nsdynmemLIB_stub.h" -#include "buffer_dyn_stub.h" -#include "common_functions_stub.h" - -static void mcps_data_req_cb(const mac_api_t* api, const mcps_data_req_t *data) -{ - -} - -bool test_lowpan_adaptation_interface_init() -{ - if (-2 != lowpan_adaptation_interface_init(0, 0)) { - return false; - } - - if (-1 != lowpan_adaptation_interface_init(0, 127)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 0; - - if (-1 != lowpan_adaptation_interface_init(0, 127)) { - return false; - } - nsdynmemlib_stub.returnCounter = 1; - if (-1 != lowpan_adaptation_interface_init(0, 127)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - if (0 != lowpan_adaptation_interface_init(0, 127)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - if (0 != lowpan_adaptation_interface_init(0, 127)) { - return false; - } - - lowpan_adaptation_interface_free(0); - - return true; -} - -bool test_lowpan_adaptation_interface_free() -{ - if (-1 != lowpan_adaptation_interface_free(0)) { - return false; - } - nsdynmemlib_stub.returnCounter = 2; - lowpan_adaptation_interface_init(0, 127); - - if (-1 != lowpan_adaptation_interface_free(1)) { - return false; - } - - if (0 != lowpan_adaptation_interface_free(0)) { - return false; - } - - return true; -} - -bool test_lowpan_adaptation_interface_reset() -{ - - mac_api_t api; - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(entry)); - arm_15_4_mac_parameters_t params; - params.mac_next_key_index = 1; - entry.mac_parameters = ¶ms; - entry.mac_api = &api; - api.mcps_data_req = &mcps_data_req_cb; - buffer_dyn_stub.buffer_ptr = NULL; - - buffer_t buf; - memset(&buf, 0, sizeof(buf)); - buffer_dyn_stub.buffer_ptr = &buf; - buf.dst_sa.addr_type = ADDR_802_15_4_SHORT; - protocol_core_stub.entry_ptr = &entry; - buf.buf_ptr = 10; - buf.buf_end = 80; - - if (-1 != lowpan_adaptation_interface_reset(0)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - lowpan_adaptation_interface_init(0, 127); - - //Set 2 direct and 2 indirect buffer - buf.link_specific.ieee802_15_4.indirectTxProcess = false; - lowpan_adaptation_interface_tx(&entry, &buf); - lowpan_adaptation_interface_tx(&entry, &buf); - lowpan_adaptation_interface_tx(&entry, &buf); - buf.link_specific.ieee802_15_4.indirectTxProcess = true; - nsdynmemlib_stub.returnCounter = 2; - lowpan_adaptation_interface_tx(&entry, &buf); - lowpan_adaptation_interface_tx(&entry, &buf); - - if (0 != lowpan_adaptation_interface_reset(0)) { - return false; - } - lowpan_adaptation_interface_free(0); - - return true; -} - -bool test_lowpan_adapatation_data_process_tx_preprocess() -{ - mac_api_t api; - protocol_interface_info_entry_t entry; - arm_15_4_mac_parameters_t params; - params.mac_next_key_index = 1; - entry.mac_parameters = ¶ms; - entry.mac_api = &api; - entry.id = 0; - api.mcps_data_req = &mcps_data_req_cb; - mle_stub.mle_neigh_table_entry_ptr = NULL; - - buffer_t buf; - memset(&buf, 0, sizeof(buf)); - buf.dst_sa.addr_type = ADDR_NONE; - protocol_core_stub.entry_ptr = &entry; - buffer_dyn_stub.buffer_ptr = &buf; - buf.buf_ptr = 10; - buf.buf_end = 80; - socket_stub.buffer_ptr = NULL; - if (lowpan_adaptation_data_process_tx_preprocess(&entry, &buf)) { - return false; - } - - mle_neigh_table_entry_t mle; - mle_stub.mle_neigh_table_entry_ptr = &mle; - mle.mode = 8; - mle.handshakeReady = false; - mle.thread_commission = false; - buf.dst_sa.addr_type = ADDR_802_15_4_SHORT; - buf.options.ll_security_bypass_tx = false; - socket_stub.buffer_ptr = &buf; - if (lowpan_adaptation_data_process_tx_preprocess(&entry, &buf)) { - return false; - } - - //Test Broadcast - buf.dst_sa.addr_type = ADDR_802_15_4_SHORT; - mle.handshakeReady = true; - address_stub.uint8_value = 0; - if (!lowpan_adaptation_data_process_tx_preprocess(&entry, &buf)) { - return false; - } - - if (buf.link_specific.ieee802_15_4.indirectTxProcess - || buf.link_specific.ieee802_15_4.requestAck) { - - return false; - } - - address_stub.uint8_value = 2; - buf.dst_sa.addr_type = ADDR_802_15_4_LONG; - buf.link_specific.ieee802_15_4.key_id_mode = B_SECURITY_KEY_ID_MODE_DEFAULT; - - mle_stub.mle_neigh_table_entry_ptr = NULL; - if (!lowpan_adaptation_data_process_tx_preprocess(&entry, &buf)) { - return false; - } - - if (buf.link_specific.ieee802_15_4.indirectTxProcess - || !buf.link_specific.ieee802_15_4.requestAck - || buf.link_specific.ieee802_15_4.key_id_mode - == B_SECURITY_KEY_ID_MODE_DEFAULT) { - return false; - } - - mle_stub.mle_neigh_table_entry_ptr = &mle; - - if (!lowpan_adaptation_data_process_tx_preprocess(&entry, &buf)) { - return false; - } - - if (buf.link_specific.ieee802_15_4.indirectTxProcess - || !buf.link_specific.ieee802_15_4.requestAck - || !buf.link_specific.ieee802_15_4.key_id_mode - == B_SECURITY_KEY_ID_MODE_DEFAULT) { - return false; - } - mle.mode = 0; - - if (!lowpan_adaptation_data_process_tx_preprocess(&entry, &buf)) { - return false; - } - - if (!buf.link_specific.ieee802_15_4.indirectTxProcess - || !buf.link_specific.ieee802_15_4.requestAck - || !buf.link_specific.ieee802_15_4.key_id_mode - == B_SECURITY_KEY_ID_MODE_DEFAULT) { - return false; - } - - return true; -} - -static void tester_mcps_purge_request(const mac_api_t* api, - const mcps_purge_t *data) -{ - (void) api; - (void) data; -} - -bool test_lowpan_adaptation_indirect_purge() -{ - mac_api_t api; - protocol_interface_info_entry_t entry; - arm_15_4_mac_parameters_t params; - params.mac_next_key_index = 1; - params.mac_channel = 11; - entry.mac_parameters = ¶ms; - entry.mac_api = &api; - entry.id = 0; - api.mcps_data_req = &mcps_data_req_cb; - api.mcps_purge_req = &tester_mcps_purge_request; - mle_stub.mle_neigh_table_entry_ptr = NULL; - - buffer_t *test_buf = malloc(sizeof(buffer_t) + 2100); - memset(test_buf, 0, sizeof(buffer_t)); - - test_buf->dst_sa.addr_type = ADDR_802_15_4_SHORT; - protocol_core_stub.entry_ptr = &entry; - buffer_dyn_stub.buffer_ptr = test_buf; - test_buf->buf_ptr = 10; - test_buf->buf_end = 70; - - socket_stub.buffer_ptr = test_buf; - - entry.mac_api = &api; - entry.id = 0; - api.mcps_data_req = &mcps_data_req_cb; - - //Test Indirect data allocation fail - nsdynmemlib_stub.returnCounter = 2; - lowpan_adaptation_interface_init(0, 127); - - test_buf->link_specific.ieee802_15_4.indirectTxProcess = true; - nsdynmemlib_stub.returnCounter = 2; - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - buffer_t *test_buf2 = malloc(sizeof(buffer_t) + 2100); - memset(test_buf2, 0, sizeof(buffer_t)); - test_buf2->buf_ptr = 10; - test_buf2->buf_end = 70; - - test_buf2->dst_sa.addr_type = ADDR_802_15_4_LONG; - test_buf2->link_specific.ieee802_15_4.indirectTxProcess = true; - nsdynmemlib_stub.returnCounter = 2; - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf2)) { - return false; - } - entry.id = 2; - if (-1 - != lowpan_adaptation_indirect_free_messages_from_queues_by_address( - &entry, test_buf->dst_sa.address, - test_buf->dst_sa.addr_type)) { - return false; - } - entry.id = 0; - if (-0 - != lowpan_adaptation_indirect_free_messages_from_queues_by_address( - &entry, test_buf->dst_sa.address, - test_buf->dst_sa.addr_type)) { - return false; - } - - if (-0 - != lowpan_adaptation_indirect_free_messages_from_queues_by_address( - &entry, test_buf2->dst_sa.address, ADDR_NONE)) { - return false; - } - - // purge with addr none - test_buf2->dst_sa.addr_type = ADDR_NONE; - if (-0 - != lowpan_adaptation_indirect_free_messages_from_queues_by_address( - &entry, test_buf2->dst_sa.address, ADDR_NONE)) { - return false; - } - - test_buf2->dst_sa.addr_type = ADDR_802_15_4_LONG; - - test_buf2->dst_sa.address[2] = 2; - if (-0 - != lowpan_adaptation_indirect_free_messages_from_queues_by_address( - &entry, test_buf2->dst_sa.address, - test_buf2->dst_sa.addr_type)) { - return false; - } - - test_buf2->dst_sa.address[2] = 0; - - if (-0 - != lowpan_adaptation_indirect_free_messages_from_queues_by_address( - &entry, test_buf2->dst_sa.address, - test_buf2->dst_sa.addr_type)) { - return false; - } - - lowpan_adaptation_interface_free(0); - - nsdynmemlib_stub.returnCounter = 0; - free(test_buf); - free(test_buf2); - return true; - -} - -bool test_lowpan_adaptation_interface_tx() -{ - mac_api_t api; - protocol_interface_info_entry_t entry; - arm_15_4_mac_parameters_t params; - params.mac_next_key_index = 1; - params.mac_channel = 11; - entry.mac_parameters = ¶ms; - entry.mac_api = &api; - entry.id = 0; - api.mcps_data_req = &mcps_data_req_cb; - api.mcps_purge_req = &tester_mcps_purge_request; - mle_stub.mle_neigh_table_entry_ptr = NULL; - - buffer_t *test_buf = malloc(sizeof(buffer_t) + 2100); - memset(test_buf, 0, sizeof(buffer_t) + 2100); - - test_buf->dst_sa.addr_type = ADDR_802_15_4_SHORT; - protocol_core_stub.entry_ptr = &entry; - buffer_dyn_stub.buffer_ptr = test_buf; - test_buf->buf_ptr = 10; - test_buf->buf_end = 70; - - socket_stub.buffer_ptr = NULL; - - if (-1 != lowpan_adaptation_interface_tx(&entry, NULL)) { - return false; - } - - if (-1 != lowpan_adaptation_interface_tx(NULL, test_buf)) { - return false; - } - - entry.mac_api = NULL; - socket_stub.buffer_ptr = test_buf; - if (-1 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - entry.mac_api = &api; - api.mcps_data_req = NULL; - socket_stub.buffer_ptr = NULL; - if (-1 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - entry.id = 0; - api.mcps_data_req = &mcps_data_req_cb; - if (-1 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - //Test Indirect data allocation fail - nsdynmemlib_stub.returnCounter = 2; - lowpan_adaptation_interface_init(0, 127); - - if (0 != lowpan_adaptation_indirect_queue_params_set(&entry, 106, 1, 2)) { - return false; - } - - test_buf->link_specific.ieee802_15_4.indirectTxProcess = true; - if (-1 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - test_buf->buf_end = 2100; - nsdynmemlib_stub.returnCounter = 1; - test_buf->link_specific.ieee802_15_4.indirectTxProcess = true; - if (-1 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - //Fragmented - mac_helper_stub.uint16_value = 69; - if (-1 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - test_buf->buf_end = 300; - - uint8_t *ptr = test_buf->buf + test_buf->buf_ptr; - *ptr = 0x80; - ptr += 4; - *ptr = 0x50; - mesh_stub.uint8_value = 66; - - nsdynmemlib_stub.returnCounter = 2; - if (-1 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - mesh_stub.uint8_value = 4; - - test_buf->buf_ptr = 10; - nsdynmemlib_stub.returnCounter = 2; - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - if (test_buf->buf_ptr != 16) { - return false; - } - - // check force security on fragmented packets - test_buf->options.ll_security_bypass_tx = true; - test_buf->options.ll_sec_bypass_frag_deny = true; - test_buf->buf_end = 300; - nsdynmemlib_stub.returnCounter = 2; - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - if (test_buf->options.ll_security_bypass_tx) { - return false; - } - - //Not fragmented - test_buf->link_specific.ieee802_15_4.requestAck = true; - mac_helper_stub.uint16_value = 110; - test_buf->buf_end = 90; - nsdynmemlib_stub.returnCounter = 1; - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - mac_helper_stub.uint8_value = 4; - test_buf->link_specific.ieee802_15_4.key_id_mode = - B_SECURITY_KEY_ID_IMPLICIT; - nsdynmemlib_stub.returnCounter = 1; - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - test_buf->link_specific.ieee802_15_4.key_id_mode = - B_SECURITY_KEY_ID_MODE_DEFAULT; - nsdynmemlib_stub.returnCounter = 1; - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - test_buf->link_specific.ieee802_15_4.key_id_mode = B_SECURITY_KEY_ID_2; - nsdynmemlib_stub.returnCounter = 1; - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - test_buf->link_specific.ieee802_15_4.useDefaultPanId = false; - test_buf->link_specific.ieee802_15_4.dstPanId = 0xffff; - test_buf->link_specific.ieee802_15_4.requestAck = false; - test_buf->link_specific.ieee802_15_4.indirectTxProcess = false; - test_buf->link_specific.ieee802_15_4.rf_channel_switch = true; - test_buf->link_specific.ieee802_15_4.selected_channel = 12; - - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf) - && test_buf->link_specific.ieee802_15_4.selected_channel == 12) { - return false; - } - - test_buf->link_specific.ieee802_15_4.useDefaultPanId = true; - test_buf->link_specific.ieee802_15_4.requestAck = true; - - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf)) { - return false; - } - - buffer_t *test_buf2 = malloc(sizeof(buffer_t) + 2100); - memset(test_buf2, 0, sizeof(buffer_t)); - - test_buf2->dst_sa.addr_type = ADDR_802_15_4_SHORT; - - test_buf2->link_specific.ieee802_15_4.useDefaultPanId = true; - test_buf2->link_specific.ieee802_15_4.requestAck = true; - test_buf2->link_specific.ieee802_15_4.indirectTxProcess = false; - test_buf2->link_specific.ieee802_15_4.rf_channel_switch = true; - test_buf2->link_specific.ieee802_15_4.selected_channel = 12; - test_buf2->buf_end = 90; - test_buf2->priority = QOS_HIGH; - - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf2)) { - return false; - } - - buffer_t *test_buf3 = malloc(sizeof(buffer_t) + 2100); - memset(test_buf3, 0, sizeof(buffer_t) + 2100); - - test_buf3->dst_sa.addr_type = ADDR_802_15_4_SHORT; - - test_buf3->link_specific.ieee802_15_4.requestAck = true; - test_buf3->buf_end = 90; - test_buf3->priority = QOS_HIGH; - - if (0 != lowpan_adaptation_interface_tx(&entry, test_buf3)) { - return false; - } - - lowpan_adaptation_interface_free(0); - nsdynmemlib_stub.returnCounter = 0; - free(test_buf); - free(test_buf2); - free(test_buf3); - return true; -} - -bool test_lowpan_adaptation_interface_tx_confirm() -{ - mac_api_t api; - mcps_data_conf_t data_confirm; - protocol_interface_info_entry_t entry; - arm_15_4_mac_parameters_t params; - params.mac_next_key_index = 1; - params.mac_channel = 11; - memset(&entry, 0, sizeof(entry)); - entry.mac_parameters = ¶ms; - entry.mac_api = &api; - entry.id = 0; - api.mcps_data_req = &mcps_data_req_cb; - mle_stub.mle_neigh_table_entry_ptr = NULL; - - mac_helper_stub.uint16_value = 110; - mac_helper_stub.uint8_value = 4; - - memset(&data_confirm, 0, sizeof(mcps_data_conf_t)); - - buffer_t *test_buf = malloc(sizeof(buffer_t) + 2100); - memset(test_buf, 0, sizeof(buffer_t) + 2100); - - entry.mac_parameters->mac_in_direct_entry_timeout = 14000; - test_buf->link_specific.ieee802_15_4.useDefaultPanId = true; - test_buf->dst_sa.addr_type = ADDR_802_15_4_SHORT; - protocol_core_stub.entry_ptr = &entry; - buffer_dyn_stub.buffer_ptr = test_buf; - test_buf->buf_ptr = 10; - test_buf->buf_end = 70; - test_buf->link_specific.ieee802_15_4.requestAck = true; - test_buf->link_specific.ieee802_15_4.key_id_mode = - B_SECURITY_KEY_ID_MODE_DEFAULT; - test_buf->link_specific.ieee802_15_4.rf_channel_switch = true; - test_buf->link_specific.ieee802_15_4.selected_channel = 11; - - buffer_t *test_buf2 = malloc(sizeof(buffer_t) + 2100); - memset(test_buf2, 0, sizeof(buffer_t) + 2100); - test_buf2->dst_sa.addr_type = ADDR_802_15_4_SHORT; - test_buf2->buf_ptr = 10; - test_buf2->buf_end = 70; - test_buf2->link_specific.ieee802_15_4.requestAck = true; - test_buf2->link_specific.ieee802_15_4.rf_channel_switch = true; - test_buf2->link_specific.ieee802_15_4.selected_channel = 12; - - buffer_t *test_buf3 = malloc(sizeof(buffer_t) + 2100); - memset(test_buf3, 0, sizeof(buffer_t) + 2100); - test_buf3->dst_sa.addr_type = ADDR_802_15_4_SHORT; - test_buf3->buf_ptr = 10; - test_buf3->buf_end = 70; - test_buf3->link_specific.ieee802_15_4.requestAck = true; - test_buf3->link_specific.ieee802_15_4.indirectTxProcess = true; - - entry.mac_api = &api; - - entry.id = 0; - api.mcps_data_req = &mcps_data_req_cb; - - if (-1 != lowpan_adaptation_interface_tx_confirm(NULL, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - if (-1 != lowpan_adaptation_interface_tx_confirm(&entry, NULL)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - if (-1 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - nsdynmemlib_stub.returnCounter = 2; - lowpan_adaptation_interface_init(0, 127); - - if (-1 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - test_buf2->ip_routed_up = true; - - lowpan_adaptation_interface_tx(&entry, test_buf); - lowpan_adaptation_interface_tx(&entry, test_buf2); - nsdynmemlib_stub.returnCounter = 2; - lowpan_adaptation_interface_tx(&entry, test_buf3); - - data_confirm.msduHandle = 10; - if (-1 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - data_confirm.msduHandle = test_buf->seq; - data_confirm.status = MLME_SUCCESS; - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - data_confirm.msduHandle = test_buf2->seq; - data_confirm.status = MLME_BUSY_CHAN; - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - data_confirm.msduHandle = test_buf2->seq; - data_confirm.status = MLME_SUCCESS; - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - data_confirm.msduHandle = test_buf3->seq; - data_confirm.status = MLME_TRANSACTION_EXPIRED; - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - data_confirm.msduHandle = test_buf3->seq; - data_confirm.status = MLME_SUCCESS; - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - buffer_routing_info_t buf_route; - test_buf2->route = &buf_route; - rpl_data_stub.bool_value = true; - lowpan_adaptation_interface_tx(&entry, test_buf2); - data_confirm.msduHandle = test_buf2->seq; - data_confirm.status = MLME_TX_NO_ACK; - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - test_buf2->buf_end = 200; - test_buf2->ip_routed_up = false; - lowpan_adaptation_interface_tx(&entry, test_buf2); - data_confirm.msduHandle = test_buf2->seq; - data_confirm.status = MLME_SUCCESS; - - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - if (test_buf2->buf_end != test_buf2->buf_ptr) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - if (-1 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - //Test Fragmentation fail - test_buf2->buf_ptr = 10; - test_buf2->buf_end = 200; - socket_stub.buffer_ptr = test_buf2; - lowpan_adaptation_interface_tx(&entry, test_buf2); - data_confirm.msduHandle = test_buf2->seq; - data_confirm.status = MLME_SUCCESS; - - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - data_confirm.status = MLME_TX_NO_ACK; - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - socket_stub.buffer_ptr = NULL; - - test_buf3->buf_end = 300; - nsdynmemlib_stub.returnCounter = 2; - lowpan_adaptation_interface_tx(&entry, test_buf3); - data_confirm.msduHandle = test_buf3->seq; - data_confirm.status = MLME_SUCCESS; - - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - data_confirm.status = MLME_BUSY_CHAN; - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - data_confirm.status = MLME_SUCCESS; - - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - // check route_up with fragmentation - nsdynmemlib_stub.returnCounter = 2; - test_buf3->buf_end += 200; - test_buf3->ip_routed_up = true; - lowpan_adaptation_interface_tx(&entry, test_buf3); - data_confirm.msduHandle = test_buf3->seq; - data_confirm.status = MLME_SUCCESS; - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - if (0 != lowpan_adaptation_interface_tx_confirm(&entry, &data_confirm)) { - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return false; - } - - lowpan_adaptation_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - return true; - -} - -static buffer_t * test_fragment_first_96(buffer_t *buf, uint8_t index) -{ - common_functions_stub.readuint16_from_queue = 2; - common_functions_stub.uint16_value_queue[1] = 232; - common_functions_stub.uint16_value_queue[0] = 100 + index; - buf->buf_ptr = 0; - buf->buf_end = 100; - - uint8_t *ptr = buf->buf + buf->buf_ptr; - *ptr = 0xc0; //first sequency - return buf; - -} - -static buffer_t * test_fragment_last_96(buffer_t *buf, uint8_t index) -{ - common_functions_stub.readuint16_from_queue = 2; - common_functions_stub.uint16_value_queue[1] = 232; - common_functions_stub.uint16_value_queue[0] = 100 + index; - buf->buf_ptr = 0; - buf->buf_end = 101; - - uint8_t *ptr = buf->buf + buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40) / 8; //Set offset - return buf; - -} - -bool test_lowpan_adaptation_tx_active() -{ - mac_api_t api; - protocol_interface_info_entry_t entry; - arm_15_4_mac_parameters_t params; - params.mac_next_key_index = 1; - entry.mac_parameters = ¶ms; - entry.mac_api = &api; - entry.id = 0; - api.mcps_data_req = &mcps_data_req_cb; - if (lowpan_adaptation_tx_active(0)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - lowpan_adaptation_interface_init(0, 127); - if (lowpan_adaptation_tx_active(0)) { - return false; - } - buffer_t buf; - memset(&buf, 0, sizeof(buf)); - buffer_dyn_stub.buffer_ptr = &buf; - buf.dst_sa.addr_type = ADDR_802_15_4_SHORT; - protocol_core_stub.entry_ptr = &entry; - buf.buf_ptr = 10; - buf.buf_end = 80; - buf.link_specific.ieee802_15_4.indirectTxProcess = false; - lowpan_adaptation_interface_tx(&entry, &buf); - if (!lowpan_adaptation_tx_active(0)) { - return false; - } - - lowpan_adaptation_interface_free(0); - return true; -} diff --git a/test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.h b/test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.h deleted file mode 100644 index 878f451057e2..000000000000 --- a/test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_ADAPTATION_INTERFACE_H -#define TEST_ADAPTATION_INTERFACE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_lowpan_adaptation_interface_init(); - -bool test_lowpan_adaptation_interface_free(); - -bool test_lowpan_adaptation_interface_reset(); - -bool test_lowpan_adapatation_data_process_tx_preprocess(); - -bool test_lowpan_adaptation_interface_tx(); - -bool test_lowpan_adaptation_interface_tx_confirm(); - -bool test_lowpan_adaptation_tx_active(); - -bool test_lowpan_adaptation_indirect_purge(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_ADAPTATION_INTERFACE_H - diff --git a/test/nanostack/unittest/6LoWPAN/nd_router_object/Makefile b/test/nanostack/unittest/6LoWPAN/nd_router_object/Makefile deleted file mode 100644 index bc6d62e8b824..000000000000 --- a/test/nanostack/unittest/6LoWPAN/nd_router_object/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = nd_router_object_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/ND/nd_router_object.c - -TEST_SRC_FILES = \ - main.cpp \ - nd_router_objecttest.cpp \ - test_nd_router_object.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/icmpv6_radv_stub.c \ - ../../stub/icmpv6_prefix_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/address_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/whiteboard_stub.c \ - ../../stub/lowpan_context_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/rpl_data_stub.c \ - ../../stub/border_router_stub.c \ - ../../stub/pan_blacklist_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_6LOWPAN_ND - diff --git a/test/nanostack/unittest/6LoWPAN/nd_router_object/main.cpp b/test/nanostack/unittest/6LoWPAN/nd_router_object/main.cpp deleted file mode 100644 index 9519b17ee350..000000000000 --- a/test/nanostack/unittest/6LoWPAN/nd_router_object/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(nd_router_object); - diff --git a/test/nanostack/unittest/6LoWPAN/nd_router_object/nd_router_objecttest.cpp b/test/nanostack/unittest/6LoWPAN/nd_router_object/nd_router_objecttest.cpp deleted file mode 100644 index 4df34652b71d..000000000000 --- a/test/nanostack/unittest/6LoWPAN/nd_router_object/nd_router_objecttest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_nd_router_object.h" - -TEST_GROUP(nd_router_object) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(nd_router_object, test_icmp_nd_routers_init) -{ - CHECK(test_icmp_nd_routers_init()); -} - diff --git a/test/nanostack/unittest/6LoWPAN/nd_router_object/test_nd_router_object.c b/test/nanostack/unittest/6LoWPAN/nd_router_object/test_nd_router_object.c deleted file mode 100644 index fbd9fc3f24d2..000000000000 --- a/test/nanostack/unittest/6LoWPAN/nd_router_object/test_nd_router_object.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_nd_router_object.h" -#include - - -bool test_icmp_nd_routers_init() -{ - icmp_nd_routers_init(); - return true; -} - diff --git a/test/nanostack/unittest/6LoWPAN/nd_router_object/test_nd_router_object.h b/test/nanostack/unittest/6LoWPAN/nd_router_object/test_nd_router_object.h deleted file mode 100644 index e20e15597d98..000000000000 --- a/test/nanostack/unittest/6LoWPAN/nd_router_object/test_nd_router_object.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_ND_ROUTER_OBJECT_H -#define TEST_ND_ROUTER_OBJECT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_icmp_nd_routers_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_ND_ROUTER_OBJECT_H - diff --git a/test/nanostack/unittest/6LoWPAN/reassemly_interface/Makefile b/test/nanostack/unittest/6LoWPAN/reassemly_interface/Makefile deleted file mode 100644 index 90a1a3ab9144..000000000000 --- a/test/nanostack/unittest/6LoWPAN/reassemly_interface/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = reassembly_interface_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Fragmentation/cipv6_fragmenter.c - -TEST_SRC_FILES = \ - main.cpp \ - reassembly_interfacetest.cpp \ - test_cipv6_reassembly_interface.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/address_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/mesh_stub.c \ - ../../stub/iphc_decompress_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/6LoWPAN/reassemly_interface/main.cpp b/test/nanostack/unittest/6LoWPAN/reassemly_interface/main.cpp deleted file mode 100644 index eb270a875d81..000000000000 --- a/test/nanostack/unittest/6LoWPAN/reassemly_interface/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(reassembly_interface); - diff --git a/test/nanostack/unittest/6LoWPAN/reassemly_interface/reassembly_interfacetest.cpp b/test/nanostack/unittest/6LoWPAN/reassemly_interface/reassembly_interfacetest.cpp deleted file mode 100644 index dd79b0cf7160..000000000000 --- a/test/nanostack/unittest/6LoWPAN/reassemly_interface/reassembly_interfacetest.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_cipv6_reassembly_interface.h" - -TEST_GROUP(reassembly_interface) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(reassembly_interface, test_reassembly_interface_init) -{ - CHECK(test_reassembly_interface_init()); -} - -TEST(reassembly_interface, test_reassembly_interface_reset) -{ - CHECK(test_reassembly_interface_reset()); -} - -TEST(reassembly_interface, test_reassembly_interface_free) -{ - CHECK(test_reassembly_interface_free()); -} - -TEST(reassembly_interface, test_cipv6_frag_timer) -{ - CHECK(test_cipv6_frag_timer()); -} - -TEST(reassembly_interface, test_cipv6_frag_reassembly) -{ - CHECK(test_cipv6_frag_reassembly()); -} - - - - - diff --git a/test/nanostack/unittest/6LoWPAN/reassemly_interface/test_cipv6_reassembly_interface.c b/test/nanostack/unittest/6LoWPAN/reassemly_interface/test_cipv6_reassembly_interface.c deleted file mode 100644 index e7cc9b46313f..000000000000 --- a/test/nanostack/unittest/6LoWPAN/reassemly_interface/test_cipv6_reassembly_interface.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include "6LoWPAN/Fragmentation/cipv6_fragmenter.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "MAC/rf_driver_storage.h" -#include "ns_error_types.h" -#include "mle.h" -#include "mlme.h" -#include "mac_api.h" - -#include "address_stub.h" -#include "mle_stub.h" -#include "protocol_core_stub.h" -#include "mac_helper_stub.h" -#include "socket_stub.h" -#include "mesh_stub.h" -#include "rpl_data_stub.h" -#include "nsdynmemLIB_stub.h" -#include "buffer_dyn_stub.h" -#include "common_functions_stub.h" - - -bool test_reassembly_interface_init() -{ - - if (-2 != reassembly_interface_init(0, 0, 5) ) { - return false; - } - - if (-2 != reassembly_interface_init(0, 8, 0) ) { - return false; - } - - nsdynmemlib_stub.returnCounter = 0; - - if (-1 != reassembly_interface_init(0, 8, 5) ) { - return false; - } - nsdynmemlib_stub.returnCounter = 1; - if (-1 != reassembly_interface_init(0, 8, 5) ) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - if (0 != reassembly_interface_init(0, 8, 5) ) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - if (0 != reassembly_interface_init(0, 8, 5) ) { - return false; - } - - reassembly_interface_free(0); - return true; -} - -bool test_reassembly_interface_free() -{ - if (-1 != reassembly_interface_free(0) ) { - return false; - } - nsdynmemlib_stub.returnCounter = 2; - reassembly_interface_init(0, 8, 5); - - if (-1 != reassembly_interface_free(1) ) { - return false; - } - - if (0 != reassembly_interface_free(0) ) { - return false; - } - - return true; -} - -static buffer_t * test_fragment_first_96(buffer_t *buf, uint8_t index) -{ - common_functions_stub.readuint16_from_queue = 2; - common_functions_stub.uint16_value_queue[1] = 232; - common_functions_stub.uint16_value_queue[0] = 100 + index; - buf->buf_ptr = 0; - buf->buf_end = 100; - - uint8_t *ptr = buf->buf + buf->buf_ptr; - *ptr = 0xc0; //first sequency - return buf; - -} - - -static buffer_t * test_fragment_last_96(buffer_t *buf, uint8_t index) -{ - common_functions_stub.readuint16_from_queue = 2; - common_functions_stub.uint16_value_queue[1] = 232; - common_functions_stub.uint16_value_queue[0] = 100 + index; - buf->buf_ptr = 0; - buf->buf_end = 101; - - uint8_t *ptr = buf->buf + buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40) / 8; //Set offset - return buf; - -} - -static buffer_t *test_buffer_get(uint16_t size) -{ - buffer_t *buf = malloc(sizeof (buffer_t) + size); - memset(buf, 0, sizeof(buffer_t)); - return buf; - -} - - - -bool test_reassembly_interface_reset() -{ - - if (-1 != reassembly_interface_reset(0) ) { - return false; - } - - - nsdynmemlib_stub.returnCounter = 2; - reassembly_interface_init(0, 8, 5); - buffer_t *reassembly_buf = test_buffer_get(127); - buffer_t *test_buf = test_buffer_get(1500); - buffer_dyn_stub.buffer_ptr = test_buf; - reassembly_buf = test_fragment_first_96(reassembly_buf, 0); - - cipv6_frag_reassembly(0, reassembly_buf); - reassembly_buf = test_fragment_first_96(reassembly_buf, 1); - cipv6_frag_reassembly(0, reassembly_buf); - - if (0 != reassembly_interface_reset(0) ) { - return false; - } - reassembly_interface_free(0); - free(test_buf); - free(reassembly_buf); - return true; -} - - -bool test_cipv6_frag_reassembly() -{ - - - buffer_t *reassembly_buf = test_buffer_get(127); - buffer_t *test_buf = test_buffer_get(1500); - buffer_t *test_buf2 = test_buffer_get(1500); - buffer_t *test_buf3 = test_buffer_get(1500); - buffer_t *test_buf4 = test_buffer_get(1500); - buffer_t *test_buf5 = test_buffer_get(1500); - buffer_t *test_buf6 = test_buffer_get(1500); - buffer_t *test_buf7 = test_buffer_get(1500); - buffer_t *test_buf8 = test_buffer_get(1500); - buffer_t *test_buf9 = test_buffer_get(1500); - - - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - reassembly_interface_init(0, 8, 5); - common_functions_stub.readuint16_from_queue = 0; - common_functions_stub.uint16_value = 0; - - - //Test Size zero drop - - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - reassembly_buf->buf_end = 96; - //Test buffer allocation fail - buffer_dyn_stub.buffer_ptr = NULL; - common_functions_stub.readuint16_from_queue = 2; - common_functions_stub.uint16_value_queue[1] = 200; - common_functions_stub.uint16_value_queue[0] = 100; - - uint8_t *ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - - *ptr = 0xc0; //First fragment - - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - //Test frag out of range - address_stub.uint8_value = 2; - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 96; - //Test buffer allocation fail - common_functions_stub.readuint16_from_queue = 2; - common_functions_stub.uint16_value_queue[1] = 160; - common_functions_stub.uint16_value_queue[0] = 100; - buffer_dyn_stub.buffer_ptr = test_buf; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 96; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = 96 / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - common_functions_stub.uint16_value_queue[1] = 160; - common_functions_stub.uint16_value_queue[0] = 100; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - reassembly_interface_reset(0); - - - //Test succesfully fragment push - reassembly_buf = test_fragment_first_96(reassembly_buf, 0); - buffer_dyn_stub.buffer_ptr = test_buf; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - reassembly_buf = test_fragment_last_96(reassembly_buf, 0); - - buffer_t *reassemled_buffer = cipv6_frag_reassembly(0, reassembly_buf); - if (!reassemled_buffer || (reassemled_buffer->buf_end - reassemled_buffer->buf_ptr) != 192) { - return false; - } - - //Receive inversr order - - reassembly_buf = test_fragment_last_96(reassembly_buf, 0); - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf = test_fragment_first_96(reassembly_buf, 0); - reassemled_buffer = cipv6_frag_reassembly(0, reassembly_buf); - if (!reassemled_buffer || (reassemled_buffer->buf_end - reassemled_buffer->buf_ptr) != 192) { - return false; - } - - //Receive 2., 3. & 1. - common_functions_stub.uint16_value_queue[1] = 328; - common_functions_stub.uint16_value_queue[0] = 100; - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40 + 96) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 100; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0xc0; //sub sequency - - common_functions_stub.readuint16_from_queue = 2; - reassemled_buffer = cipv6_frag_reassembly(0, reassembly_buf); - if (!reassemled_buffer || (reassemled_buffer->buf_end - reassemled_buffer->buf_ptr) != 192 + 96) { - return false; - } - - //First , last, middle 1., 3. 2. - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 100; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0xc0; //sub sequency - - common_functions_stub.readuint16_from_queue = 2; - - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency Last - ptr += 4; - *ptr = (96 + 40 + 96) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - - reassemled_buffer = cipv6_frag_reassembly(0, reassembly_buf); - if (!reassemled_buffer || (reassemled_buffer->buf_end - reassemled_buffer->buf_ptr) != 192 + 96) { - return false; - } - - - //3., 2., 1. - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency Last - ptr += 4; - *ptr = (96 + 40 + 96) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 100; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0xc0; //sub sequency - common_functions_stub.readuint16_from_queue = 2; - reassemled_buffer = cipv6_frag_reassembly(0, reassembly_buf); - if (!reassemled_buffer || (reassemled_buffer->buf_end - reassemled_buffer->buf_ptr) != 192 + 96) { - return false; - } - - - //Test 2., 1. and 3. - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 100; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0xc0; //first sequency - common_functions_stub.readuint16_from_queue = 2; - - - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40 + 96) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - reassemled_buffer = cipv6_frag_reassembly(0, reassembly_buf); - if (!reassemled_buffer || (reassemled_buffer->buf_end - reassemled_buffer->buf_ptr) != 192 + 96) { - return false; - } - - //Test overlap last - common_functions_stub.uint16_value_queue[1] = 328; - common_functions_stub.uint16_value_queue[0] = 101; - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 100; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0xc0; //first sequency - common_functions_stub.readuint16_from_queue = 2; - - - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 102; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40 + 96) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf)) { - return false; - } - - //Overflow first fragment - common_functions_stub.uint16_value_queue[1] = 328; - common_functions_stub.uint16_value_queue[0] = 102; - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency Last - ptr += 4; - *ptr = (96 + 40 + 96) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0xc0; //sub sequency - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - //Overflow middle of - common_functions_stub.uint16_value_queue[1] = 328; - common_functions_stub.uint16_value_queue[0] = 103; - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 100; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0xc0; //first sequency - common_functions_stub.readuint16_from_queue = 2; - - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 101; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40 + 96) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_buf->buf_ptr = 0; - reassembly_buf->buf_end = 102; - ptr = reassembly_buf->buf + reassembly_buf->buf_ptr; - *ptr = 0x20; //sub sequency - ptr += 4; - *ptr = (96 + 40) / 8; //Set offset - common_functions_stub.readuint16_from_queue = 2; - if (cipv6_frag_reassembly(0, reassembly_buf) ) { - return false; - } - - reassembly_interface_reset(0); - - //Test reassembly overflow start 9 tx proces which 1 should fail and 8 other success - memset(test_buf, 0, sizeof(buffer_t)); - reassembly_buf = test_fragment_first_96(reassembly_buf, 0); - buffer_dyn_stub.buffer_ptr = test_buf; - cipv6_frag_reassembly(0, reassembly_buf); - - buffer_dyn_stub.buffer_ptr = test_buf2; - reassembly_buf = test_fragment_first_96(reassembly_buf, 1); - cipv6_frag_reassembly(0, reassembly_buf); - - buffer_dyn_stub.buffer_ptr = test_buf3; - reassembly_buf = test_fragment_first_96(reassembly_buf, 2); - cipv6_frag_reassembly(0, reassembly_buf); - - buffer_dyn_stub.buffer_ptr = test_buf4; - reassembly_buf = test_fragment_first_96(reassembly_buf, 3); - cipv6_frag_reassembly(0, reassembly_buf); - - buffer_dyn_stub.buffer_ptr = test_buf5; - reassembly_buf = test_fragment_first_96(reassembly_buf, 4); - cipv6_frag_reassembly(0, reassembly_buf); - - buffer_dyn_stub.buffer_ptr = test_buf6; - reassembly_buf = test_fragment_first_96(reassembly_buf, 5); - cipv6_frag_reassembly(0, reassembly_buf); - - buffer_dyn_stub.buffer_ptr = test_buf7; - reassembly_buf = test_fragment_first_96(reassembly_buf, 6); - cipv6_frag_reassembly(0, reassembly_buf); - - buffer_dyn_stub.buffer_ptr = test_buf8; - reassembly_buf = test_fragment_first_96(reassembly_buf, 7); - cipv6_frag_reassembly(0, reassembly_buf); - - buffer_dyn_stub.buffer_ptr = test_buf9; - reassembly_buf = test_fragment_first_96(reassembly_buf, 8); - cipv6_frag_reassembly(0, reassembly_buf); - - //Start testing - for (uint8_t i= 0; i< 9;i++) { - reassembly_buf = test_fragment_last_96(reassembly_buf, i); - buffer_t *fully_buffer = cipv6_frag_reassembly(0, reassembly_buf); - if (i == 8) { - if (fully_buffer) { - return false; - } - - } else { - - if (!fully_buffer || (fully_buffer->buf_end - fully_buffer->buf_ptr) != 192) { - return false; - } - } - } - - reassembly_interface_free(0); - free(test_buf); - free(test_buf2); - free(test_buf3); - free(test_buf4); - free(test_buf5); - free(test_buf6); - free(test_buf7); - free(test_buf8); - free(test_buf9); - free(reassembly_buf); - common_functions_stub.readuint16_from_queue = 0; - return true; -} - -bool test_cipv6_frag_timer() -{ - buffer_t *reassembly_buf = test_buffer_get(127); - buffer_t *test_buf = test_buffer_get(1500); - buffer_t *test_buf2 = test_buffer_get(1500); - - reassembly_buf->dst_sa.addr_type = ADDR_802_15_4_SHORT; - - - reassembly_buf = test_fragment_first_96(reassembly_buf, 0); - - - buffer_dyn_stub.buffer_ptr = test_buf; - - - nsdynmemlib_stub.returnCounter = 2; - reassembly_interface_init(0, 8, 5); - - address_stub.uint8_value = 2; - cipv6_frag_reassembly(0, reassembly_buf); - - cipv6_frag_timer(1); - reassembly_buf = test_fragment_first_96(reassembly_buf, 1); - buffer_dyn_stub.buffer_ptr = test_buf2; - cipv6_frag_reassembly(0, reassembly_buf); - - - //Push 2 buffer to queue and time out them - buffer_dyn_stub.buffer_ptr = test_buf; - cipv6_frag_timer(4); - buffer_dyn_stub.buffer_ptr = test_buf2; - socket_stub.buffer_ptr = test_buf2; - cipv6_frag_timer(4); - reassembly_interface_free(0); - free(reassembly_buf); - free(test_buf); - free(test_buf2); - return true; -} - - diff --git a/test/nanostack/unittest/6LoWPAN/reassemly_interface/test_cipv6_reassembly_interface.h b/test/nanostack/unittest/6LoWPAN/reassemly_interface/test_cipv6_reassembly_interface.h deleted file mode 100644 index 52cd95ea56bd..000000000000 --- a/test/nanostack/unittest/6LoWPAN/reassemly_interface/test_cipv6_reassembly_interface.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_CIPV6_REASSEMBLY_INTERFACE_H -#define TEST_CIPV6_REASSEMBLY_INTERFACE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_reassembly_interface_init(); - -bool test_reassembly_interface_reset(); - -bool test_reassembly_interface_free(); - -bool test_cipv6_frag_reassembly(); - -bool test_cipv6_frag_timer(); - - -#ifdef __cplusplus -} -#endif - -#endif // TEST_CIPV6_REASSEMBLY_INTERFACE_H - diff --git a/test/nanostack/unittest/6lp_mac/beacon_handler/Makefile b/test/nanostack/unittest/6lp_mac/beacon_handler/Makefile deleted file mode 100644 index 1d7f8987744c..000000000000 --- a/test/nanostack/unittest/6lp_mac/beacon_handler/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = beacon_handler_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/MAC/beacon_handler.c - -TEST_SRC_FILES = \ - main.cpp \ - beacon_handlertest.cpp \ - test_beacon_handler.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/pan_blacklist_stub.c \ - ../../stub/common_functions_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/6lp_mac/beacon_handler/beacon_handlertest.cpp b/test/nanostack/unittest/6lp_mac/beacon_handler/beacon_handlertest.cpp deleted file mode 100644 index f16b87f010b6..000000000000 --- a/test/nanostack/unittest/6lp_mac/beacon_handler/beacon_handlertest.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_beacon_handler.h" - -TEST_GROUP(beacon_handler) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(beacon_handler, test_beacon_received) -{ - CHECK(test_beacon_received()); -} - -TEST(beacon_handler, test_mac_beacon_link_beacon_compare_rx_callback_set) -{ - CHECK(test_mac_beacon_link_beacon_compare_rx_callback_set()); -} - -TEST(beacon_handler, test_beacon_join_priority_update) -{ - CHECK(test_beacon_join_priority_update()); -} - -TEST(beacon_handler, test_mac_beacon_link_beacon_join_priority_tx_callback_set) -{ - CHECK(test_mac_beacon_link_beacon_join_priority_tx_callback_set()); -} - - diff --git a/test/nanostack/unittest/6lp_mac/beacon_handler/main.cpp b/test/nanostack/unittest/6lp_mac/beacon_handler/main.cpp deleted file mode 100644 index 896a23d0bee8..000000000000 --- a/test/nanostack/unittest/6lp_mac/beacon_handler/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(beacon_handler); - diff --git a/test/nanostack/unittest/6lp_mac/beacon_handler/test_beacon_handler.c b/test/nanostack/unittest/6lp_mac/beacon_handler/test_beacon_handler.c deleted file mode 100644 index f6ff6cfcc70d..000000000000 --- a/test/nanostack/unittest/6lp_mac/beacon_handler/test_beacon_handler.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_beacon_handler.h" -#include "beacon_handler.h" -#include - -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" - -#include "protocol_core_stub.h" -#include "nsdynmemLIB_stub.h" -#include "mac_helper_stub.h" -#include "protocol_6lowpan_stub.h" -#include "load_balance_api.h" - -uint8_t *beacon_optional_tlv_field_get(uint8_t len, uint8_t *ptr, uint8_t offset, uint8_t type); - -static uint8_t *beacon_ind_cb(uint8_t *ptr, uint8_t len, protocol_interface_info_entry_t *cur) -{ - return 0; -} - -static uint8_t compare_cb(int8_t interface_id, uint8_t join_priority, uint8_t link_quality) -{ - return 1; -} - -void lb_beac_notify(const load_balance_api_t* api, const struct mlme_beacon_ind_s *beacon_ind, uint8_t priority) -{ - (void)api; - (void)beacon_ind; - (void)priority; -} - -uint8_t beac_ind(uint8_t *ptr, uint8_t len, protocol_interface_info_entry_t *cur) -{ - return 1; -} - -bool test_beacon_received() -{ - //These test cases just confirms that there are no crashes or mem leaks. - beacon_received(0, NULL); - - protocol_core_stub.entry_ptr = NULL; - mlme_beacon_ind_t ind; - beacon_received(0, &ind); - - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - struct load_balance_api api; - memset(&api, 0, sizeof(struct load_balance_api)); - api.lb_beacon_notify = &lb_beac_notify; - entry.lb_api = &api; - arm_15_4_mac_parameters_t params; - memset(¶ms, 0, sizeof(arm_15_4_mac_parameters_t)); - params.beacon_ind = &beac_ind; - entry.mac_parameters = ¶ms; - protocol_core_stub.entry_ptr = &entry; - - uint8_t beacon_data_in_3[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0xc1,0x05}; - ind.beacon_data = malloc(20); - memcpy(ind.beacon_data, beacon_data_in_3, sizeof(beacon_data_in_3)); - ind.beacon_data_length = 20; - - ind.PANDescriptor.CoordPANId = 6; - - beacon_received(0, &ind); - - free(ind.beacon_data); - ind.beacon_data = NULL; - - entry.lb_api = NULL; - - params.nwk_scan_params.active_scan_active = true; - params.nwk_filter_params.net_pan_id_filter = 1; - ind.beacon_data_length = 40; - ind.PANDescriptor.CoordPANId = 2; - beacon_received(0, &ind); - - ind.PANDescriptor.CoordPANId = 1; - params.nwk_filter_params.nwk_active_scan_level = 1; - entry.mac_parameters->beacon_ind = &beacon_ind_cb; - ind.beacon_data_length = 1; - - beacon_received(0, &ind); - - ind.beacon_data_length = 0; - - beacon_received(0, &ind); - - params.nwk_filter_params.nwk_active_scan_level = 0; - - beacon_received(0, &ind); //ns_dyn_mem_alloc fails - - //Test beacon_join_priority_tlv_val_get here --> - params.beacon_compare_rx_cb_ptr = &compare_cb; - ind.beacon_data_length = PLAIN_BEACON_PAYLOAD_SIZE+6; - uint8_t dat[PLAIN_BEACON_PAYLOAD_SIZE+6]; - dat[PLAIN_BEACON_PAYLOAD_SIZE] = 0x00; - - ind.beacon_data = &dat; - nsdynmemlib_stub.returnCounter = 1; - - //Test scan_params->nwk_response_info ==NULL here --> - //Test beacon_optional_tlv_field_get here --> - beacon_received(0, &ind); //just end delimiter - - dat[PLAIN_BEACON_PAYLOAD_SIZE] = 0x01; //len - dat[PLAIN_BEACON_PAYLOAD_SIZE+1] = 0x08; //val - dat[PLAIN_BEACON_PAYLOAD_SIZE+2] = (BEACON_OPTION_JOIN_PRIORITY_TYPE << 4 & 0xf0) +2; - - nsdynmemlib_stub.returnCounter = 2; - beacon_received(0, &ind); //BEACON_OPTION_JOIN_PRIORITY_TYPE - - dat[PLAIN_BEACON_PAYLOAD_SIZE+2] = (BEACON_OPTION_JOIN_PRIORITY_TYPE << 4 & 0xf0) + 12; - - //Test duplicate_pan_descriptor here --> - nsdynmemlib_stub.returnCounter = 3; - beacon_received(0, &ind); //BEACON_OPTION_JOIN_PRIORITY_TYPE - - nsdynmemlib_stub.returnCounter = 4; - beacon_received(0, &ind); //BEACON_OPTION_JOIN_PRIORITY_TYPE - - ns_dyn_mem_free(params.nwk_scan_params.nwk_response_info->pan_descriptor); - ns_dyn_mem_free(params.nwk_scan_params.nwk_response_info->beacon_payload); - ns_dyn_mem_free(params.nwk_scan_params.nwk_response_info); - //<-- Test duplicate_pan_descriptor here - //<-- Test beacon_optional_tlv_field_get here - //<-- Test beacon_join_priority_tlv_val_get here - //<--Test scan_params->nwk_response_info ==NULL here - - //Test scan_params->nwk_response_info != NULL here --> - dat[PLAIN_BEACON_PAYLOAD_SIZE] = 0x00; - - nwk_pan_descriptor_t info; - memset(&info, 0, sizeof(nwk_pan_descriptor_t)); - mlme_pan_descriptor_t pan; - info.pan_descriptor = &pan; - pan.LogicalChannel = 1; - ind.PANDescriptor.LogicalChannel = 2; - - params.nwk_scan_params.nwk_response_info = &info; - nsdynmemlib_stub.returnCounter = 1; - beacon_received(0, &ind); - - nsdynmemlib_stub.returnCounter = 3; - beacon_received(0, &ind); - - nsdynmemlib_stub.returnCounter = 4; - beacon_received(0, &ind); - ns_dyn_mem_free(info.next->pan_descriptor); - ns_dyn_mem_free(info.next->beacon_payload); - ns_dyn_mem_free(info.next); - - mlme_pan_descriptor_t pan2; - nwk_pan_descriptor_t info2; - info2.pan_descriptor = &pan2; - pan2.LogicalChannel = 2; - pan2.CoordPANId = 2; - ind.PANDescriptor.CoordPANId = 2; - info2.pan_descriptor->LinkQuality = 110; - info2.alternative_parent.CoordAddrMode = MAC_ADDR_MODE_NONE; - info.next = &info2; - - mlme_pan_descriptor_t pan3; - nwk_pan_descriptor_t info3; - info3.pan_descriptor = &pan3; - pan3.LogicalChannel = 3; - info2.next = &info3; - info3.next = NULL; - - info2.beacon_length = 0; - info2.beacon_payload = NULL; - - ind.beacon_data_length = 0; - params.nwk_filter_params.net_pan_id_filter = 2; - - nsdynmemlib_stub.returnCounter = 1; - ind.PANDescriptor.LinkQuality = 0; - beacon_received(0, &ind); - - info2.pan_descriptor->LinkQuality = 0; - ind.PANDescriptor.LinkQuality = 10; - nsdynmemlib_stub.returnCounter = 1; - info2.beacon_payload = ns_dyn_mem_alloc(2); - info2.beacon_length = 2; - nsdynmemlib_stub.returnCounter = 1; - beacon_received(0, &ind); - - info2.pan_descriptor->LinkQuality = 0; - ind.beacon_data_length = PLAIN_BEACON_PAYLOAD_SIZE+6; - nsdynmemlib_stub.returnCounter = 1; - beacon_received(0, &ind); - - info2.pan_descriptor->LinkQuality = 0; - nsdynmemlib_stub.returnCounter = 2; - beacon_received(0, &ind); - ns_dyn_mem_free( info2.beacon_payload ); - - //<--Test scan_params->nwk_response_info != NULL here - - return true; -} - -bool test_mac_beacon_link_beacon_compare_rx_callback_set() -{ - if( -1 != mac_beacon_link_beacon_compare_rx_callback_set(0, NULL) ){ - return false; - } - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - memset(¶ms, 0, sizeof(arm_15_4_mac_parameters_t)); - entry.mac_parameters = ¶ms; - protocol_core_stub.entry_ptr = &entry; - - //It is okay to set NULL for callback - if( 0 != mac_beacon_link_beacon_compare_rx_callback_set(0, NULL) ){ - return false; - } - - protocol_core_stub.entry_ptr = NULL; - -} - -bool test_beacon_join_priority_update() -{ - //These test cases just confirms that there are no crashes or mem leaks. - beacon_join_priority_update(0x00); - - mlme_beacon_ind_t ind; - beacon_join_priority_update(0x00); - - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - memset(¶ms, 0, sizeof(arm_15_4_mac_parameters_t)); - entry.mac_parameters = ¶ms; - protocol_core_stub.entry_ptr = &entry; - - beacon_join_priority_update(0x00); - - // Uses real storing of beacon payload data - mac_helper_stub.enable_storing = true; - - // Sets join priority - protocol_6lowpan_stub.uint8_value = 0xe1; - entry.mac_parameters->beacon_join_priority_tx_cb_ptr = protocol_6lowpan_beacon_join_priority_tx; - - - // Test: TLV does not exists. - - // Sets input data - uint8_t beacon_data_in_1[18] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; - entry.mac_parameters->mac_beacon_payload = malloc(18); - memcpy(entry.mac_parameters->mac_beacon_payload, beacon_data_in_1, sizeof(beacon_data_in_1)); - entry.mac_parameters->mac_beacon_payload_size = 18; - - beacon_join_priority_update(0x00); - - // Check output data - if (entry.mac_parameters->mac_beacon_payload_size != 20) { - return false; - } - uint8_t beacon_data_out_1[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0xc1,0xe1}; - if (memcmp(entry.mac_parameters->mac_beacon_payload, beacon_data_out_1, 20) != 0) { - return false; - } - free(entry.mac_parameters->mac_beacon_payload); - - - // Test: TLV does not exists. Delimiter 0x00 in the end of the beacon. - - uint8_t beacon_data_in_2[19] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0x00}; - entry.mac_parameters->mac_beacon_payload = malloc(19); - memcpy(entry.mac_parameters->mac_beacon_payload, beacon_data_in_2, sizeof(beacon_data_in_2)); - entry.mac_parameters->mac_beacon_payload_size = 19; - - beacon_join_priority_update(0x00); - - // Check output data - if (entry.mac_parameters->mac_beacon_payload_size != 21) { - return false; - } - uint8_t beacon_data_out_2[21] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0xc1,0xe1,0x00}; - if (memcmp(entry.mac_parameters->mac_beacon_payload, beacon_data_out_2, 21) != 0) { - return false; - } - free(entry.mac_parameters->mac_beacon_payload); - - - // Test: join priority TLV in the end of the beacon. - - uint8_t beacon_data_in_3[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0xc1,0x05}; - entry.mac_parameters->mac_beacon_payload = malloc(20); - memcpy(entry.mac_parameters->mac_beacon_payload, beacon_data_in_3, sizeof(beacon_data_in_3)); - entry.mac_parameters->mac_beacon_payload_size = 20; - - beacon_join_priority_update(0x00); - - // Check output data - if (entry.mac_parameters->mac_beacon_payload_size != 20) { - return false; - } - uint8_t beacon_data_out_3[21] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0xc1,0xe1}; - if (memcmp(entry.mac_parameters->mac_beacon_payload, beacon_data_out_3, 20) != 0) { - return false; - } - free(entry.mac_parameters->mac_beacon_payload); - - - // Test: two TLVs and after that delimiter and data in the end of the beacon. Second TLV is join priority. - - uint8_t beacon_data_in_4[27] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0xa2,0x03,0x04,0xc1,0x05,0x00,1,2,3}; - entry.mac_parameters->mac_beacon_payload = malloc(27); - memcpy(entry.mac_parameters->mac_beacon_payload, beacon_data_in_4, sizeof(beacon_data_in_4)); - entry.mac_parameters->mac_beacon_payload_size = 27; - - beacon_join_priority_update(0x00); - - // Check output data - if (entry.mac_parameters->mac_beacon_payload_size != 27) { - return false; - } - uint8_t beacon_data_out_4[27] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0xa2,0x03,0x04,0xc1,0xe1,0x00,1,2,3}; - if (memcmp(entry.mac_parameters->mac_beacon_payload, beacon_data_out_4, 27) != 0) { - return false; - } - free(entry.mac_parameters->mac_beacon_payload); - - - // Test: TLV in the end of the beacon. TLV length is too long. - - uint8_t beacon_data_in_5[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0xc2,0x05}; - entry.mac_parameters->mac_beacon_payload = malloc(20); - memcpy(entry.mac_parameters->mac_beacon_payload, beacon_data_in_5, sizeof(beacon_data_in_5)); - entry.mac_parameters->mac_beacon_payload_size = 20; - - beacon_join_priority_update(0x00); - - // Check output data - if (entry.mac_parameters->mac_beacon_payload_size != 22) { - return false; - } - uint8_t beacon_data_out_5[22] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0xc1,0xe1,0xc2,0x05}; - if (memcmp(entry.mac_parameters->mac_beacon_payload, beacon_data_out_5, 22) != 0) { - return false; - } - free(entry.mac_parameters->mac_beacon_payload); - - - - // Reset stub values - protocol_core_stub.entry_ptr = NULL; - protocol_6lowpan_stub.uint8_value = 0; - mac_helper_stub.enable_storing = false; - mac_helper_stub.uint8_ptr = 0; - mac_helper_stub.uint8_value = 0; - - -} - - -static uint8_t tester_beacon_join_priority_tx_cb(int8_t interface_id) -{ - return 0; -} - -bool test_mac_beacon_link_beacon_join_priority_tx_callback_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - memset(¶ms, 0, sizeof(arm_15_4_mac_parameters_t)); - - - if (mac_beacon_link_beacon_join_priority_tx_callback_set(0,&tester_beacon_join_priority_tx_cb) != -1) { - return false; - } - protocol_core_stub.entry_ptr = &entry; - - if (mac_beacon_link_beacon_join_priority_tx_callback_set(0,&tester_beacon_join_priority_tx_cb) != -1) { - return false; - } - - entry.mac_parameters = ¶ms; - if (mac_beacon_link_beacon_join_priority_tx_callback_set(0,&tester_beacon_join_priority_tx_cb) != 0) { - return false; - } - - if (!entry.mac_parameters->beacon_join_priority_tx_cb_ptr) { - return false; - } - - // Reset stub values - protocol_core_stub.entry_ptr = NULL; - protocol_6lowpan_stub.uint8_value = 0; - mac_helper_stub.enable_storing = false; - mac_helper_stub.uint8_ptr = 0; - mac_helper_stub.uint8_value = 0; - - return true; -} - - - diff --git a/test/nanostack/unittest/6lp_mac/beacon_handler/test_beacon_handler.h b/test/nanostack/unittest/6lp_mac/beacon_handler/test_beacon_handler.h deleted file mode 100644 index 15beed0eebf0..000000000000 --- a/test/nanostack/unittest/6lp_mac/beacon_handler/test_beacon_handler.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_BEACON_HANDLER_H -#define TEST_BEACON_HANDLER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_beacon_received(); - -bool test_mac_beacon_link_beacon_compare_rx_callback_set(); - -bool test_beacon_join_priority_update(); - -bool test_mac_beacon_link_beacon_join_priority_tx_callback_set(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_BEACON_HANDLER_H - diff --git a/test/nanostack/unittest/6lp_mac/mac_data_poll/Makefile b/test/nanostack/unittest/6lp_mac/mac_data_poll/Makefile deleted file mode 100644 index 3c0ca247643d..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_data_poll/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_data_poll_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/MAC/mac_data_poll.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_data_polltest.cpp \ - test_mac_data_poll.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/system_timer_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/thread_bootstrap_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/network_lib_stub.c \ - ../../stub/event_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD -DHAVE_6LOWPAN_ND - diff --git a/test/nanostack/unittest/6lp_mac/mac_data_poll/mac_data_polltest.cpp b/test/nanostack/unittest/6lp_mac/mac_data_poll/mac_data_polltest.cpp deleted file mode 100644 index 32d41db16c06..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_data_poll/mac_data_polltest.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_data_poll.h" - -TEST_GROUP(mac_data_poll) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_data_poll, test_mac_poll_timer_trig) -{ - CHECK(test_mac_poll_timer_trig()); -} - -TEST(mac_data_poll, test_mac_mlme_poll_confirm) -{ - CHECK(test_mac_mlme_poll_confirm()); -} - - - -TEST(mac_data_poll, test_mac_data_poll_disable) -{ - CHECK(test_mac_data_poll_disable()); -} - -TEST(mac_data_poll, test_mac_data_poll_init_protocol_poll) -{ - CHECK(test_mac_data_poll_init_protocol_poll()); -} - -TEST(mac_data_poll, test_mac_data_poll_host_poll_time_max) -{ - CHECK(test_mac_data_poll_host_poll_time_max()); -} - -TEST(mac_data_poll, test_mac_data_poll_host_timeout) -{ - CHECK(test_mac_data_poll_host_timeout()); -} - -TEST(mac_data_poll, test_mac_data_poll_protocol_poll_mode_decrement) -{ - CHECK(test_mac_data_poll_protocol_poll_mode_decrement()); -} - -TEST(mac_data_poll, test_mac_data_poll_protocol_poll_mode_disable) -{ - CHECK(test_mac_data_poll_protocol_poll_mode_disable()); -} - -TEST(mac_data_poll, test_mac_data_poll_enable_check) -{ - CHECK(test_mac_data_poll_enable_check()); -} - -TEST(mac_data_poll, test_mac_data_poll_host_mode_get) -{ - CHECK(test_mac_data_poll_host_mode_get()); -} - -TEST(mac_data_poll, test_mac_data_poll_host_mode_set) -{ - CHECK(test_mac_data_poll_host_mode_set()); -} - -TEST(mac_data_poll, test_mac_data_poll_init) -{ - CHECK(test_mac_data_poll_init()); -} - -TEST(mac_data_poll, test_mac_data_poll_get_max_sleep_period) -{ - CHECK(test_mac_data_poll_get_max_sleep_period()); -} diff --git a/test/nanostack/unittest/6lp_mac/mac_data_poll/main.cpp b/test/nanostack/unittest/6lp_mac/mac_data_poll/main.cpp deleted file mode 100644 index 89abdf70fe70..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_data_poll/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_data_poll); - diff --git a/test/nanostack/unittest/6lp_mac/mac_data_poll/test_mac_data_poll.c b/test/nanostack/unittest/6lp_mac/mac_data_poll/test_mac_data_poll.c deleted file mode 100644 index d620a8575579..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_data_poll/test_mac_data_poll.c +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_mac_data_poll.h" -#include - -#include "mac_data_poll.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "mac_api.h" - -#include "system_timer_stub.h" -#include "protocol_6lowpan_bootstrap_stub.h" -#include "nsdynmemLIB_stub.h" -#include "event_stub.h" -#include "protocol_core_stub.h" -#include "mac_helper_stub.h" - -bool visited = false; - -void poll_fail(int8_t nwk_interface_id) -{ - visited = true; -} - -void buffer_handler(buffer_t *a) -{ - -} - -void mlme_req_cb(const mac_api_t* api, mlme_primitive id, const void *data) -{ - -} - -bool test_mac_data_poll_disable() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - mac_data_poll_disable(NULL); - - mac_data_poll_disable(&entry); - - entry.rfd_poll_info = &rf_ptr; - rf_ptr.protocol_poll = 2; - mac_data_poll_disable(&entry); - if (rf_ptr.protocol_poll) { - return false; - } - return true; -} - -bool test_mac_poll_timer_trig() -{ - //void mac_poll_timer_trig(uint32_t poll_time, protocol_interface_info_entry_t *cur) - mac_poll_timer_trig(0, NULL); - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - - entry.lowpan_info = 64; - system_timer_stub.int8_value = -1; - - mac_poll_timer_trig(100, &entry); - - mac_poll_timer_trig(10, &entry); - - return true; -} - -bool test_mac_mlme_poll_confirm() -{ - mac_mlme_poll_confirm(NULL, NULL); - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - mlme_poll_conf_t conf; - - mac_mlme_poll_confirm(&entry, &conf); - - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = &rf_ptr; - - conf.status = MLME_SUCCESS; - mac_mlme_poll_confirm(&entry, &conf); - - conf.status = MLME_NO_DATA; - rf_ptr.protocol_poll = 0; - mac_mlme_poll_confirm(&entry, &conf); - - rf_ptr.protocol_poll = 1; - mac_mlme_poll_confirm(&entry, &conf); - - conf.status = MLME_INVALID_ADDRESS; - mac_mlme_poll_confirm(&entry, &conf); - - visited = false; - rf_ptr.pollFailCb = poll_fail; - rf_ptr.nwk_parent_poll_fail = 5; - mac_mlme_poll_confirm(&entry, &conf); - if( !visited ){ - return false; - } - - return true; -} - -bool test_mac_data_poll_init_protocol_poll() -{ - - mac_data_poll_init_protocol_poll(NULL); - - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = &rf_ptr; - entry.lowpan_info = 64; - - rf_ptr.protocol_poll = 0; - rf_ptr.host_mode = NET_HOST_SLOW_POLL_MODE; - rf_ptr.pollActive = false; - mac_data_poll_init_protocol_poll(&entry); - - return true; -} - -bool test_mac_data_poll_host_poll_time_max() -{ - if( 0 != mac_data_poll_host_poll_time_max(NULL) ){ - return false; - } - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - nwk_rfd_poll_setups_s info; - info.slow_poll_rate_seconds = 2; - entry.rfd_poll_info = &info; - if( 2 != mac_data_poll_host_poll_time_max(&entry) ){ - return false; - } - return true; -} - -bool test_mac_data_poll_host_timeout() -{ - if( 0 != mac_data_poll_host_timeout(NULL) ){ - return false; - } - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = &rf_ptr; - rf_ptr.timeOutInSeconds = 6; - - if( 6 != mac_data_poll_host_timeout(&entry) ){ - return false; - } - return true; -} - -bool test_mac_data_poll_protocol_poll_mode_decrement() -{ - mac_data_poll_protocol_poll_mode_decrement(NULL); - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = &rf_ptr; - entry.lowpan_info = 1; - mac_data_poll_protocol_poll_mode_decrement(&entry); - - //Test mac_data_poll_protocol_poll_internal_cancel here --> - entry.lowpan_info = 64; - mac_data_poll_protocol_poll_mode_decrement(&entry); - - rf_ptr.protocol_poll = 0; - mac_data_poll_protocol_poll_mode_decrement(&entry); - - rf_ptr.protocol_poll = 1; - rf_ptr.pollActive = false; - rf_ptr.nwk_app_poll_time = 1; - mac_data_poll_protocol_poll_mode_decrement(&entry); - - rf_ptr.protocol_poll = 1; - rf_ptr.pollActive = false; - rf_ptr.nwk_app_poll_time = 0; - mac_data_poll_protocol_poll_mode_decrement(&entry); - // <-- Test mac_data_poll_protocol_poll_internal_cancel here - - return true; -} - -bool test_mac_data_poll_protocol_poll_mode_disable() -{ - mac_data_poll_protocol_poll_mode_disable(NULL); - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = &rf_ptr; - entry.lowpan_info = 1; - mac_data_poll_protocol_poll_mode_disable(&entry); - - entry.lowpan_info = 64; - mac_data_poll_protocol_poll_mode_disable(&entry); - return true; -} - -bool test_mac_data_poll_enable_check() -{ - mac_data_poll_enable_check(NULL); - - protocol_interface_info_entry_t entry; - protocol_core_stub.entry_ptr = &entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = &rf_ptr; - entry.lowpan_info = 1; - mac_data_poll_enable_check(&entry); - - //Test mac_data_poll_protocol_internal here --> - entry.lowpan_info = 64; - rf_ptr.protocol_poll = 0; - rf_ptr.host_mode = NET_HOST_SLOW_POLL_MODE; - rf_ptr.pollActive = false; - mac_data_poll_enable_check(&entry); - - //<-- Test mac_data_poll_protocol_internal here - - return true; -} - -bool test_mac_data_poll_host_mode_get() -{ - mac_data_poll_host_mode_get(NULL, NULL); - net_host_mode_t mode; - protocol_interface_info_entry_t entry; - - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = &rf_ptr; - entry.rfd_poll_info->host_mode = NET_HOST_MODE_NOT_ACTIVE; - - mac_data_poll_host_mode_get(&entry, &mode); - if( NET_HOST_MODE_NOT_ACTIVE != mode ){ - return false; - } - return true; -} - -bool test_mac_data_poll_host_mode_set() -{ - if( -1 != mac_data_poll_host_mode_set(NULL, 0, 0) ){ - return false; - } - protocol_interface_info_entry_t entry; - protocol_core_stub.entry_ptr = NULL; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t mac; - memset(&mac, 0, sizeof(arm_15_4_mac_parameters_t)); - entry.mac_parameters = &mac; - if( -1 != mac_data_poll_host_mode_set(&entry, 0, 0) ){ - return false; - } - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = &rf_ptr; - - entry.lowpan_info = INTERFACE_NWK_ROUTER_DEVICE; - if( -3 != mac_data_poll_host_mode_set(&entry, 0, 0) ){ - return false; - } - - entry.lowpan_info = 8; - - if( -2 != mac_data_poll_host_mode_set(&entry, NET_HOST_SLOW_POLL_MODE, 0) ){ - return false; - } - - protocol_core_stub.entry_ptr = &entry; - rf_ptr.host_mode = NET_HOST_RX_ON_IDLE; - if( 0 != mac_data_poll_host_mode_set(&entry, NET_HOST_SLOW_POLL_MODE, 1) ){ - return false; - } - - protocol_6lowpan_bootstrap_stub.int_value = -1; - rf_ptr.host_mode = NET_HOST_RX_ON_IDLE; - if( -3 != mac_data_poll_host_mode_set(&entry, NET_HOST_SLOW_POLL_MODE, 1) ){ - return false; - } - - rf_ptr.host_mode = NET_HOST_RX_ON_IDLE; - protocol_6lowpan_bootstrap_stub.int_value = 0; - if( 0 != mac_data_poll_host_mode_set(&entry, NET_HOST_FAST_POLL_MODE, 0) ){ - return false; - } - - rf_ptr.host_mode = NET_HOST_RX_ON_IDLE; - protocol_6lowpan_bootstrap_stub.int_value = -1; - if( -3 != mac_data_poll_host_mode_set(&entry, NET_HOST_FAST_POLL_MODE, 0) ){ - return false; - } - - // Test host_link_configuration rx_on_idle == true here --> - protocol_6lowpan_bootstrap_stub.int_value = -1; - rf_ptr.host_mode = NET_HOST_SLOW_POLL_MODE; - if( -3 != mac_data_poll_host_mode_set(&entry, NET_HOST_RX_ON_IDLE, 0) ){ - return false; - } - - mac.RxOnWhenIdle = true; - rf_ptr.host_mode = NET_HOST_SLOW_POLL_MODE; - if( -3 != mac_data_poll_host_mode_set(&entry, NET_HOST_RX_ON_IDLE, 0) ){ - return false; - } - - thread_info_t info; - entry.thread_info = &info; - rf_ptr.host_mode = NET_HOST_SLOW_POLL_MODE; - mac.RxOnWhenIdle = false; - if( 0 != mac_data_poll_host_mode_set(&entry, NET_HOST_RX_ON_IDLE, 0) ){ - return false; - } - mac.RxOnWhenIdle = true; - - entry.thread_info = NULL; - protocol_6lowpan_bootstrap_stub.int_value = 0; - rf_ptr.host_mode = NET_HOST_SLOW_POLL_MODE; - if( 0 != mac_data_poll_host_mode_set(&entry, NET_HOST_RX_ON_IDLE, 0) ){ - return false; - } - - // <-- Test host_link_configuration here - - //default case: - if( -1 != mac_data_poll_host_mode_set(&entry, 50, 0) ){ - return false; - } - - return true; -} - -bool test_mac_data_poll_init() -{ - mac_data_poll_init(NULL); - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t mac; - memset(&mac, 0, sizeof(arm_15_4_mac_parameters_t)); - entry.mac_parameters = &mac; - nsdynmemlib_stub.returnCounter = 1; - nwk_rfd_poll_setups_s *rf_ptr = ns_dyn_mem_alloc(sizeof(nwk_rfd_poll_setups_s)); - memset(rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = rf_ptr; - - entry.lowpan_info = INTERFACE_NWK_ROUTER_DEVICE; - mac_data_poll_init(&entry); - - entry.lowpan_info = 1; //!INTERFACE_NWK_ROUTER_DEVICE - entry.rfd_poll_info = NULL; - event_stub.int8_value = -1; - mac_data_poll_init(&entry); - - event_stub.int8_value = 0; - mac_data_poll_init(&entry); - - //Test mac_data_poll_cb here --> - if( event_stub.func_ptr ){ - arm_event_s event; - //Test mac_data_poll_cb_run here --> - event.event_type = 1; - protocol_core_stub.entry_ptr = NULL; - event_stub.func_ptr(&event); - protocol_interface_info_entry_t entry2; - memset(&entry2, 0, sizeof(protocol_interface_info_entry_t)); - protocol_core_stub.entry_ptr = &entry2; - event_stub.func_ptr(&event); - - nwk_rfd_poll_setups_s rf_ptr2; - memset(&rf_ptr2, 0, sizeof(nwk_rfd_poll_setups_s)); - entry2.rfd_poll_info = &rf_ptr2; - mac_helper_stub.uint8_value = MAC_ADDR_MODE_NONE; - event_stub.func_ptr(&event); - - mac_helper_stub.uint8_value = MAC_ADDR_MODE_16_BIT; - event_stub.func_ptr(&event); - - mac_api_t api; - memset(&api, 0, sizeof(mac_api_t) ); - entry2.mac_api = &api; - api.mlme_req = &mlme_req_cb; - event_stub.func_ptr(&event); - //<-- Test mac_data_poll_cb_run here - - event.event_type = 3; - event_stub.func_ptr(&event); - } - - //<-- Test mac_data_poll_cb here - - nsdynmemlib_stub.returnCounter = 1; - mac_data_poll_init(&entry); - - mac.RxOnWhenIdle = true; - mac_data_poll_init(&entry); - - mac.RxOnWhenIdle = false; - mac_data_poll_init(&entry); - - ns_dyn_mem_free(entry.rfd_poll_info); - - return true; -} - - -bool test_mac_data_poll_get_max_sleep_period() -{ - if( 0 != mac_data_poll_get_max_sleep_period(NULL) ){ - return false; - } - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - nwk_rfd_poll_setups_s rf_ptr; - memset(&rf_ptr, 0, sizeof(nwk_rfd_poll_setups_s)); - entry.rfd_poll_info = &rf_ptr; - entry.if_stack_buffer_handler = &buffer_handler; - rf_ptr.pollActive = false; - rf_ptr.protocol_poll = 1; - if( 300 != mac_data_poll_get_max_sleep_period(&entry) ){ - return false; - } - rf_ptr.protocol_poll = 0; - rf_ptr.nwk_app_poll_time = 400; - if( 400 != mac_data_poll_get_max_sleep_period(&entry) ){ - return false; - } - return true; -} diff --git a/test/nanostack/unittest/6lp_mac/mac_data_poll/test_mac_data_poll.h b/test/nanostack/unittest/6lp_mac/mac_data_poll/test_mac_data_poll.h deleted file mode 100644 index 45f7bfb7965c..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_data_poll/test_mac_data_poll.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_DATA_POLL_H -#define TEST_MAC_DATA_POLL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_poll_timer_trig(); - -bool test_mac_mlme_poll_confirm(); - -bool test_mac_data_poll_disable(); - -bool test_mac_data_poll_init_protocol_poll(); - -bool test_mac_data_poll_host_poll_time_max(); - -bool test_mac_data_poll_host_timeout(); - -bool test_mac_data_poll_protocol_poll_mode_decrement(); - -bool test_mac_data_poll_protocol_poll_mode_disable(); - -bool test_mac_data_poll_enable_check(); - -bool test_mac_data_poll_host_mode_get(); - -bool test_mac_data_poll_host_mode_set(); - -bool test_mac_data_poll_init(); - -bool test_mac_data_poll_get_max_sleep_period(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_DATA_POLL_H - diff --git a/test/nanostack/unittest/6lp_mac/mac_helper/Makefile b/test/nanostack/unittest/6lp_mac/mac_helper/Makefile deleted file mode 100644 index 4d95fa25d51d..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_helper/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_helper_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/MAC/mac_helper.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_helpertest.cpp \ - test_mac_helper.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/common_functions_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/6lp_mac/mac_helper/mac_helpertest.cpp b/test/nanostack/unittest/6lp_mac/mac_helper/mac_helpertest.cpp deleted file mode 100644 index 1499f112018d..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_helper/mac_helpertest.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_mac_helper.h" - -TEST_GROUP(mac_helper) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_helper, test_mac_create_scan_request) -{ - CHECK(test_mac_create_scan_request()); -} - -TEST(mac_helper, test_mac_helper_select_best_lqi) -{ - CHECK(test_mac_helper_select_best_lqi()); -} - -TEST(mac_helper, test_mac_helper_drop_selected_from_the_scanresult) -{ - CHECK(test_mac_helper_drop_selected_from_the_scanresult()); -} - -TEST(mac_helper, test_mac_helper_free_scan_confirm) -{ - CHECK(test_mac_helper_free_scan_confirm()); -} - -TEST(mac_helper, test_mac_helper_free_pan_descriptions) -{ - CHECK(test_mac_helper_free_pan_descriptions()); -} - -TEST(mac_helper, test_mac_helper_nwk_id_filter_set) -{ - CHECK(test_mac_helper_nwk_id_filter_set()); -} - -TEST(mac_helper, test_mac_helper_panid_set) -{ - CHECK(test_mac_helper_panid_set()); -} - -TEST(mac_helper, test_mac_helper_mac16_address_set) -{ - CHECK(test_mac_helper_mac16_address_set()); -} - -TEST(mac_helper, test_mac_helper_mac16_address_get) -{ - CHECK(test_mac_helper_mac16_address_get()); -} - - -TEST(mac_helper, test_mac_helper_panid_get) -{ - CHECK(test_mac_helper_panid_get()); -} - -TEST(mac_helper, test_mac_helper_set_default_key_source) -{ - CHECK(test_mac_helper_set_default_key_source()); -} - -TEST(mac_helper, test_mac_helper_default_security_level_set) -{ - CHECK(test_mac_helper_default_security_level_set()); -} - -TEST(mac_helper, test_mac_helper_default_security_level_get) -{ - CHECK(test_mac_helper_default_security_level_get()); -} - -TEST(mac_helper, test_mac_helper_default_security_key_id_mode_set) -{ - CHECK(test_mac_helper_default_security_key_id_mode_set()); -} - - -TEST(mac_helper, test_mac_helper_default_security_key_id_mode_get) -{ - CHECK(test_mac_helper_default_security_key_id_mode_get()); -} - -TEST(mac_helper, test_mac_helper_default_key_index_set) -{ - CHECK(test_mac_helper_default_key_index_set()); -} - -TEST(mac_helper, test_mac_helper_default_key_index_get) -{ - CHECK(test_mac_helper_default_key_index_get()); -} - -TEST(mac_helper, test_mac_helper_security_default_key_set) -{ - CHECK(test_mac_helper_security_default_key_set()); -} - -TEST(mac_helper, test_mac_helper_security_pairwisekey_set) -{ - CHECK(test_mac_helper_security_pairwisekey_set()); -} - -TEST(mac_helper, test_mac_helper_security_next_key_set) -{ - CHECK(test_mac_helper_security_next_key_set()); -} - -TEST(mac_helper, test_mac_helper_security_prev_key_set) -{ - CHECK(test_mac_helper_security_prev_key_set()); -} - -TEST(mac_helper, test_mac_helper_security_key_swap_next_to_default) -{ - CHECK(test_mac_helper_security_key_swap_next_to_default()); -} - -TEST(mac_helper, test_mac_helper_security_key_clean) -{ - CHECK(test_mac_helper_security_key_clean()); -} - -TEST(mac_helper, test_mac_helper_coordinator_address_set) -{ - CHECK(test_mac_helper_coordinator_address_set()); -} - -TEST(mac_helper, test_mac_helper_coordinator_address_get) -{ - CHECK(test_mac_helper_coordinator_address_get()); -} - -TEST(mac_helper, test_mac_helper_beacon_payload_reallocate) -{ - CHECK(test_mac_helper_beacon_payload_reallocate()); -} - -TEST(mac_helper, test_mac_helper_beacon_payload_register) -{ - CHECK(test_mac_helper_beacon_payload_register()); -} - -TEST(mac_helper, test_mac_helper_beacon_payload_pointer_get) -{ - CHECK(test_mac_helper_beacon_payload_pointer_get()); -} - -TEST(mac_helper, test_mac_helper_beacon_payload_length_get) -{ - CHECK(test_mac_helper_beacon_payload_length_get()); -} - -TEST(mac_helper, test_mac_helper_pib_boolean_set) -{ - CHECK(test_mac_helper_pib_boolean_set()); -} - -TEST(mac_helper, test_mac_helper_mac_channel_set) -{ - CHECK(test_mac_helper_mac_channel_set()); -} - -TEST(mac_helper, test_mac_helper_write_our_addr) -{ - CHECK(test_mac_helper_write_our_addr()); -} - -TEST(mac_helper, test_mac_helper_mac64_set) -{ - CHECK(test_mac_helper_mac64_set()); -} - - -TEST(mac_helper, test_mac_helper_max_payload_size) -{ - CHECK(test_mac_helper_max_payload_size()); -} - -TEST(mac_helper, test_mac_helper_frame_overhead) -{ - CHECK(test_mac_helper_frame_overhead()); -} - -TEST(mac_helper, test_mac_helper_link_frame_counter_read) -{ - CHECK(test_mac_helper_link_frame_counter_read()); -} - -TEST(mac_helper, test_mac_helper_link_frame_counter_set) -{ - CHECK(test_mac_helper_link_frame_counter_set()); -} - -TEST(mac_helper, test_mac_helper_mac_mlme_max_retry_set) -{ - CHECK(test_mac_helper_mac_mlme_max_retry_set()); -} - - - -TEST(mac_helper, test_mac_helper_devicetable_remove) -{ - CHECK(test_mac_helper_devicetable_remove()); -} - -TEST(mac_helper, test_mac_helper_devicetable_set) -{ - CHECK(test_mac_helper_devicetable_set()); -} - - - - - - - - - - diff --git a/test/nanostack/unittest/6lp_mac/mac_helper/main.cpp b/test/nanostack/unittest/6lp_mac/mac_helper/main.cpp deleted file mode 100644 index c43044bdf4e6..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_helper/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_helper); - diff --git a/test/nanostack/unittest/6lp_mac/mac_helper/test_mac_helper.c b/test/nanostack/unittest/6lp_mac/mac_helper/test_mac_helper.c deleted file mode 100644 index 18f8fb206073..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_helper/test_mac_helper.c +++ /dev/null @@ -1,869 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_mac_helper.h" -#include "mac_helper.h" -#include -#include "mlme.h" -#include "mac_api.h" -#include "mac_common_defines.h" -#include "net_nwk_scan.h" -#include "MLE/mle.h" -#include "NWK_INTERFACE/Include/protocol.h" - -#include "nsdynmemLIB_stub.h" -#include "protocol_core_stub.h" - -static void mlme_req(const mac_api_t* api, mlme_primitive id, const void *data) -{ - -} - -static int8_t mac_set( const mac_api_t* api, const uint8_t *mac64) -{ - -} - -static int8_t mac_get( const mac_api_t* api, mac_extended_address_type type, uint8_t *mac64_buf) -{ - -} - -bool test_mac_create_scan_request() -{ - mac_create_scan_request(0, NULL, 0, NULL); - mlme_scan_t scan; - channel_list_s list; - - mac_create_scan_request(0, &list, 0, &scan); - - return true; -} - -bool test_mac_helper_select_best_lqi() -{ - if( mac_helper_select_best_lqi(NULL) ){ - return false; - } - nwk_pan_descriptor_t pan; - mlme_pan_descriptor_t desc; - pan.pan_descriptor = &desc; - nwk_pan_descriptor_t pan2; - mlme_pan_descriptor_t desc2; - pan2.pan_descriptor = &desc2; - desc.LinkQuality = 10; - desc2.LinkQuality = 100; - pan.next = &pan2; - pan2.next = NULL; - - if( !mac_helper_select_best_lqi(&pan) ){ - return false; - } - return true; -} - -bool test_mac_helper_drop_selected_from_the_scanresult() -{ - mac_helper_drop_selected_from_the_scanresult(NULL, NULL); - nwk_scan_params_t scan; - nwk_pan_descriptor_t pan; - nwk_pan_descriptor_t pan2; - - scan.nwk_response_info = NULL; - mac_helper_drop_selected_from_the_scanresult(&scan, &pan); - - pan.next = NULL; - scan.nwk_response_info = &pan; - mac_helper_drop_selected_from_the_scanresult(&scan, &pan); - - pan.next = &pan2; - pan2.next = NULL; - scan.nwk_response_info = &pan; - scan.nwk_scan_res_size = 2; - mac_helper_drop_selected_from_the_scanresult(&scan, &pan2); - if( 1 != scan.nwk_scan_res_size ){ - return false; - } - - return true; -} - -bool test_mac_helper_free_scan_confirm() -{ - mac_helper_free_scan_confirm(NULL); - nwk_scan_params_t scan; - nsdynmemlib_stub.returnCounter = 1; - nwk_pan_descriptor_t *pan = ns_dyn_mem_alloc(sizeof(nwk_pan_descriptor_t)); - memset(pan, 0, sizeof(nwk_pan_descriptor_t)); - pan->next = NULL; - scan.nwk_response_info = pan; - scan.nwk_scan_res_size = 1; - scan.nwk_cur_active = NULL; - mac_helper_free_scan_confirm(&scan); - - return true; -} - -bool test_mac_helper_free_pan_descriptions() -{ - if( mac_helper_free_pan_descriptions(NULL) ){ - return false; - } - nsdynmemlib_stub.returnCounter = 1; - nwk_pan_descriptor_t *pan = ns_dyn_mem_alloc(sizeof(nwk_pan_descriptor_t)); - memset(pan, 0, sizeof(nwk_pan_descriptor_t)); - pan->next = NULL; - if( mac_helper_free_pan_descriptions(pan) ){ - return false; - } - return true; -} - -bool test_mac_helper_nwk_id_filter_set() -{ - nsdynmemlib_stub.returnCounter = 0; - if( -1 != mac_helper_nwk_id_filter_set(NULL, NULL) ){ - return false; - } - nwk_filter_params_s filt; - filt.beacon_nwk_id_filter = NULL; - if( 0 != mac_helper_nwk_id_filter_set(NULL, &filt) ){ - return false; - } - - uint8_t data[16]; - if( -1 != mac_helper_nwk_id_filter_set(&data, &filt) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if( 0 != mac_helper_nwk_id_filter_set(&data, &filt) ){ - return false; - } - ns_dyn_mem_free(filt.beacon_nwk_id_filter); - return true; -} - -bool test_mac_helper_panid_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - mac_helper_panid_set(&entry, 0); - return true; -} - -bool test_mac_helper_mac16_address_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - mac_helper_mac16_address_set(&entry, 0); - - mac_helper_mac16_address_set(&entry, 0xffff); - return true; -} - -bool test_mac_helper_mac16_address_get() -{ - uint16_t check = 0xfffe; - if( check != mac_helper_mac16_address_get(NULL)){ - return false; - } - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - params.mac_short_address = 3; - - if( 3 != mac_helper_mac16_address_get(&entry) ){ - return false; - } - return true; -} - -bool test_mac_helper_panid_get() -{ - uint16_t check = 0xffff; - if( check != mac_helper_panid_get(NULL)){ - return false; - } - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - params.pan_id = 3; - - if( 3 != mac_helper_panid_get(&entry) ){ - return false; - } - return true; -} - -bool test_mac_helper_set_default_key_source() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - mac_helper_set_default_key_source(&entry); - - return true; -} - -bool test_mac_helper_default_security_level_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - mac_helper_default_security_level_set(&entry, 0); - - mac_helper_default_security_level_set(&entry, 1); - - return true; -} - -bool test_mac_helper_default_security_level_get() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - params.mac_security_level = 5; - entry.mac_parameters = ¶ms; - if( 5 != mac_helper_default_security_level_get(&entry) ){ - return false; - } - - return true; -} - -bool test_mac_helper_default_security_key_id_mode_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - mac_helper_default_security_key_id_mode_set(&entry, 3); - - return true; -} - -bool test_mac_helper_default_security_key_id_mode_get() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - params.mac_key_id_mode = 2; - - if( 2 != mac_helper_default_security_key_id_mode_get(&entry) ){ - return false; - } - - return true; -} - -bool test_mac_helper_default_key_index_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - mac_helper_default_key_index_set(&entry, 3); - return true; -} - -bool test_mac_helper_default_key_index_get() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - params.mac_default_key_index = 4; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - if( 4 != mac_helper_default_key_index_get(&entry) ){ - return false; - } - return true; -} - -bool test_mac_helper_security_default_key_set() -{ - uint8_t key[16]; - - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - - entry.mac_api = &api; - - if( -1 != mac_helper_security_default_key_set(&entry, &key, 0, 1)){ - return false; - } - - if( 0 != mac_helper_security_default_key_set(&entry, &key, 1, 1)){ - return false; - } - - return true; -} - -bool test_mac_helper_security_pairwisekey_set() -{ - uint8_t key; - uint8_t mac; - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - - //test mac_helper_keytable_pairwise_descriptor_set here --> - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - if( -1 != mac_helper_security_pairwisekey_set(&entry, &key, NULL, 0) ){ - return false; - } - - if( 0 != mac_helper_security_pairwisekey_set(&entry, &key, &mac, 0) ){ - return false; - } - - if( 0 != mac_helper_security_pairwisekey_set(&entry, NULL, &mac, 0) ){ - return false; - } - - //<-- test mac_helper_keytable_pairwise_descriptor_set here -} - -bool test_mac_helper_security_next_key_set() -{ - - uint8_t key[16]; - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - if( -1 != mac_helper_security_next_key_set(&entry, &key, 0, 1)){ - return false; - } - - - if( 0 != mac_helper_security_next_key_set(&entry, &key, 1, 1)){ - return false; - } - return true; -} - -bool test_mac_helper_security_prev_key_set() -{ - - uint8_t key[16]; - - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - if( -1 != mac_helper_security_prev_key_set(&entry, &key, 0, 1)){ - return false; - } - - if( 0 != mac_helper_security_prev_key_set(&entry, &key, 1, 1)){ - return false; - } - return true; -} - -bool test_mac_helper_security_key_swap_next_to_default() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - mac_helper_security_key_swap_next_to_default(&entry); - - return true; -} - -bool test_mac_helper_security_key_clean() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - mac_helper_security_key_clean(&entry); - return true; -} - -bool test_mac_helper_coordinator_address_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - uint8_t buf[8]; - mac_helper_coordinator_address_set(&entry, ADDR_802_15_4_SHORT, &buf); - - mac_helper_coordinator_address_set(&entry, ADDR_802_15_4_LONG, &buf); - return true; -} - -bool test_mac_helper_coordinator_address_get() -{ - if( 0 != mac_helper_coordinator_address_get(NULL, NULL) ){ - return false; - } - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - uint8_t buf[8]; - params.mac_cordinator_info.cord_adr_mode = MAC_ADDR_MODE_16_BIT; - if( ADDR_802_15_4_SHORT != mac_helper_coordinator_address_get(&entry, &buf) ){ - return false; - } - - params.mac_cordinator_info.cord_adr_mode = MAC_ADDR_MODE_64_BIT; - if( ADDR_802_15_4_LONG != mac_helper_coordinator_address_get(&entry, &buf) ){ - return false; - } - return true; -} - -bool test_mac_helper_beacon_payload_reallocate() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - params.mac_beacon_payload_size = 0; - params.mac_beacon_payload = NULL; - if( mac_helper_beacon_payload_reallocate(&entry, 0) ){ - return false; - } - params.mac_beacon_payload_size = 5; - nsdynmemlib_stub.returnCounter = 1; - params.mac_beacon_payload = ns_dyn_mem_alloc(5); - if( mac_helper_beacon_payload_reallocate(&entry, 0) ){ - return false; - } - - params.mac_beacon_payload_size = 5; - nsdynmemlib_stub.returnCounter = 1; - params.mac_beacon_payload = ns_dyn_mem_alloc(5); - if( mac_helper_beacon_payload_reallocate(&entry, 15) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if( !mac_helper_beacon_payload_reallocate(&entry, 15) ){ - return false; - } - ns_dyn_mem_free(params.mac_beacon_payload); - - return true; -} - -bool test_mac_helper_beacon_payload_register() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - if( 0 != mac_helper_beacon_payload_register(&entry) ){ - return false; - } - - return true; -} - -bool test_mac_helper_beacon_payload_pointer_get() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - uint8_t buf[4]; - params.mac_beacon_payload = &buf; - if( !mac_helper_beacon_payload_pointer_get(&entry) ){ - return false; - } - return true; -} - -bool test_mac_helper_beacon_payload_length_get() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - params.mac_beacon_payload_size = 5; - if( 5 != mac_helper_beacon_payload_length_get(&entry) ){ - return false; - } - return true; -} - -bool test_mac_helper_pib_boolean_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - if( 0 != mac_helper_pib_boolean_set(&entry, macSecurityEnabled, false) ){ - return false; - } - - if( 0 != mac_helper_pib_boolean_set(&entry, macRxOnWhenIdle, false) ){ - return false; - } - - if( 0 != mac_helper_pib_boolean_set(&entry, macPromiscuousMode, false) ){ - return false; - } - - if( 0 != mac_helper_pib_boolean_set(&entry, macGTSPermit, false) ){ - return false; - } - - if( 0 != mac_helper_pib_boolean_set(&entry, macAssociationPermit, false) ){ - return false; - } - - if( 0 != mac_helper_pib_boolean_set(&entry, macAssociatedPANCoord, false) ){ - return false; - } - - if( 0 != mac_helper_pib_boolean_set(&entry, macTimestampSupported, false) ){ - return false; - } - - if( 0 != mac_helper_pib_boolean_set(&entry, macBattLifeExt, false) ){ - return false; - } - - if( 0 != mac_helper_pib_boolean_set(&entry, macAutoRequest, false) ){ - return false; - } - - if( 0 != mac_helper_pib_boolean_set(&entry, macThreadForceLongAddressForBeacon, false) ){ - return false; - } - - if( -1 != mac_helper_pib_boolean_set(&entry, 0xfd, false) ){ - return false; - } - - return true; -} - -bool test_mac_helper_mac_channel_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - if( 0 != mac_helper_mac_channel_set(&entry, 8) ){ - return false; - } - - return true; -} - -bool test_mac_helper_write_our_addr() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - sockaddr_t addr; - addr.addr_type = ADDR_NONE; - params.shortAdressValid = false; - - if( !mac_helper_write_our_addr(&entry, &addr) ){ - return false; - } - - params.shortAdressValid = true; - addr.addr_type = ADDR_NONE; - if( !mac_helper_write_our_addr(&entry, &addr) ){ - return false; - } - - return true; -} - -bool test_mac_helper_mac64_set() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mac64_set = &mac_set; - entry.mac_api = &api; - - uint8_t buf[8]; - if( 0 != mac_helper_mac64_set(&entry, &buf) ){ - return false; - } - - return true; -} - -bool test_mac_helper_max_payload_size() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - mac_api_t api; - api.mac64_set = &mac_set; - entry.mac_api = &api; - api.phyMTU = MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE; - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - params.MacUnsusecured_2003_cab = true; - - if( MAC_IEEE_802_15_4_MAX_MAC_SAFE_PAYLOAD_SIZE != mac_helper_max_payload_size(&entry, 1) ){ - return false; - } - - params.MacUnsusecured_2003_cab = false; - if( MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE - 13 != mac_helper_max_payload_size(&entry, 13) ){ - return false; - } - return true; -} - -bool test_mac_helper_frame_overhead() -{ - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - params.mac_security_level = 1; - params.shortAdressValid = true; - params.mac_key_id_mode = MAC_KEY_ID_MODE_SRC8_IDX; - uint8_t ret; - - buffer_t buf; - memset(&buf, 0, sizeof(buffer_t)); - buf.src_sa.addr_type = ADDR_NONE; - buf.dst_sa.addr_type = ADDR_802_15_4_LONG; //17 - buf.options.ll_security_bypass_tx = false; - - ret = mac_helper_frame_overhead(&entry, &buf); // +14 + 4 - if( 35 != ret ){ - return false; - } - - buf.src_sa.addr_type = ADDR_802_15_4_SHORT; - buf.dst_sa.addr_type = ADDR_BROADCAST; //11 - params.mac_key_id_mode = 0; - params.mac_security_level = 2; - ret = mac_helper_frame_overhead(&entry, &buf); // +5 +8 - if( 24 != ret ){ - return false; - } - - params.mac_security_level = 3; - ret = mac_helper_frame_overhead(&entry, &buf); // +5 +16 - if( 32 != ret ){ - return false; - } - - params.mac_security_level = 4; - ret = mac_helper_frame_overhead(&entry, &buf); // +5 +0 - if( 16 != ret ){ - return false; - } - - return true; -} - -bool test_mac_helper_link_frame_counter_read() -{ - if( -1 != mac_helper_link_frame_counter_read(0, NULL) ){ - return false; - } - - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - protocol_core_stub.entry_ptr = &entry; - uint32_t buf; - if( 0 != mac_helper_link_frame_counter_read(0, &buf) ){ - return false; - } - return true; -} - -bool test_mac_helper_link_frame_counter_set() -{ - protocol_core_stub.entry_ptr = NULL; - int8_t ret = mac_helper_link_frame_counter_set(0, 0); - if( ret != -1 ){ - return false; - } - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - protocol_core_stub.entry_ptr = &entry; - - ret = mac_helper_link_frame_counter_set(0, 0); - if( ret != 0 ){ - return false; - } - return true; -} - -bool test_mac_helper_mac_mlme_max_retry_set() -{ - protocol_core_stub.entry_ptr = NULL; - int8_t ret = mac_helper_mac_mlme_max_retry_set(0, 4); - if( ret != -1 ){ - return false; - } - protocol_interface_info_entry_t entry; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - protocol_core_stub.entry_ptr = &entry; - - ret = mac_helper_mac_mlme_max_retry_set(0, 4); - if( ret != 0 ){ - return false; - } - return true; -} - -bool test_mac_helper_devicetable_remove() -{ - mac_api_t api; - api.mlme_req = &mlme_req; - - mac_helper_devicetable_remove(NULL, 0); - - mac_helper_devicetable_remove(&api, 0); - return true; -} - -bool test_mac_helper_devicetable_set() -{ - protocol_interface_info_entry_t entry; - mle_neigh_table_entry_t entry_temp; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - api.mlme_req = &mlme_req; - entry.mac_api = &api; - - entry.mac_parameters->SecurityEnabled = false; - - mac_helper_devicetable_set(&entry_temp, &entry, 10, 1); - - entry.mac_parameters->SecurityEnabled = true; - entry.mac_parameters->mac_default_key_index = 2; - - mac_helper_devicetable_set(&entry_temp, &entry, 10, 1); - - - return true; -} - - diff --git a/test/nanostack/unittest/6lp_mac/mac_helper/test_mac_helper.h b/test/nanostack/unittest/6lp_mac/mac_helper/test_mac_helper.h deleted file mode 100644 index 5ec94a7d5d06..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_helper/test_mac_helper.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_MAC_HELPER_H -#define TEST_MAC_HELPER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_create_scan_request(); - -bool test_mac_helper_select_best_lqi(); - -bool test_mac_helper_drop_selected_from_the_scanresult(); - -bool test_mac_helper_free_scan_confirm(); - -bool test_mac_helper_free_pan_descriptions(); - -bool test_mac_helper_nwk_id_filter_set(); - -bool test_mac_helper_panid_set(); - -bool test_mac_helper_mac16_address_set(); - -bool test_mac_helper_mac16_address_get(); - -bool test_mac_helper_panid_get(); - -bool test_mac_helper_set_default_key_source(); - -bool test_mac_helper_default_security_level_set(); - -bool test_mac_helper_default_security_level_get(); - -bool test_mac_helper_default_security_key_id_mode_set(); - -bool test_mac_helper_default_security_key_id_mode_get(); - -bool test_mac_helper_default_key_index_set(); - -bool test_mac_helper_default_key_index_get(); - -bool test_mac_helper_security_default_key_set(); - -bool test_mac_helper_security_pairwisekey_set(); - -bool test_mac_helper_security_next_key_set(); - -bool test_mac_helper_security_prev_key_set(); - -bool test_mac_helper_security_key_swap_next_to_default(); - -bool test_mac_helper_security_key_clean(); - -bool test_mac_helper_coordinator_address_set(); - -bool test_mac_helper_coordinator_address_get(); - -bool test_mac_helper_beacon_payload_reallocate(); - -bool test_mac_helper_beacon_payload_register(); - -bool test_mac_helper_beacon_payload_pointer_get(); - -bool test_mac_helper_beacon_payload_length_get(); - -bool test_mac_helper_pib_boolean_set(); - -bool test_mac_helper_mac_channel_set(); - -bool test_mac_helper_write_our_addr(); - -bool test_mac_helper_mac64_set(); - -bool test_mac_helper_max_payload_size(); - -bool test_mac_helper_frame_overhead(); - -bool test_mac_helper_link_frame_counter_read(); - -bool test_mac_helper_link_frame_counter_set(); - -bool test_mac_helper_devicetable_remove(); - -bool test_mac_helper_devicetable_set(); - -bool test_mac_helper_mac_mlme_max_retry_set(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_HELPER_H - diff --git a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/Makefile b/test/nanostack/unittest/6lp_mac/mac_pairwise_key/Makefile deleted file mode 100644 index dbb5a5bb8fe3..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_pairwise_key_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/MAC/mac_pairwise_key.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_pairwise_keytest.cpp \ - test_mac_pairwise_key.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/ns_list_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/mac_pairwise_keytest.cpp b/test/nanostack/unittest/6lp_mac/mac_pairwise_key/mac_pairwise_keytest.cpp deleted file mode 100644 index bed5393c6d1a..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/mac_pairwise_keytest.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_pairwise_key.h" - -TEST_GROUP(mac_pairwise_key) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_pairwise_key, test_mac_pairwise_key_add) -{ - CHECK(test_mac_pairwise_key_add()); -} - -TEST(mac_pairwise_key, test_mac_pairwise_key_del) -{ - CHECK(test_mac_pairwise_key_del()); -} - -TEST(mac_pairwise_key, test_mac_pairwise_key_flush_list) -{ - CHECK(test_mac_pairwise_key_flush_list()); -} - -TEST(mac_pairwise_key, test_mac_pairwise_key_interface_unregister) -{ - CHECK(test_mac_pairwise_key_interface_unregister()); -} - -TEST(mac_pairwise_key, test_mac_pairwise_key_interface_register) -{ - CHECK(test_mac_pairwise_key_interface_register()); -} - - - - diff --git a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/main.cpp b/test/nanostack/unittest/6lp_mac/mac_pairwise_key/main.cpp deleted file mode 100644 index ca73cc67d166..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_pairwise_key); - diff --git a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/test_mac_pairwise_key.c b/test/nanostack/unittest/6lp_mac/mac_pairwise_key/test_mac_pairwise_key.c deleted file mode 100644 index 2137a90d09c0..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/test_mac_pairwise_key.c +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "mac_api.h" -#include "test_mac_pairwise_key.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "MLE/mle.h" -#include "6LoWPAN/MAC/mac_pairwise_key.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "MAC/rf_driver_storage.h" - -#include - -#include "nsdynmemLIB_stub.h" -#include "protocol_core_stub.h" -#include "mac_helper_stub.h" -#include "mle_stub.h" -#include "mac_common_defines.h" - -bool test_mac_pairwise_key_add() -{ - protocol_interface_info_entry_t info_entry; - mle_neigh_table_entry_t mle_neigh_table_entry; - arm_15_4_mac_parameters_t mac_parameters; - uint8_t eui64[8]; - uint8_t key[16]; - - memset(&info_entry, 0, sizeof(protocol_interface_info_entry_t)); - memset(&mac_parameters, 0, sizeof(arm_15_4_mac_parameters_t)); - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - memset(eui64, 0, 8); - mac_api_t api; - memset(&api, 0, sizeof(mac_api_t)); - info_entry.mac_api = &api; - info_entry.mac_parameters = &mac_parameters; - - protocol_core_stub.entry_ptr = NULL; - mle_stub.mle_neigh_table_entry_ptr = NULL; - - //Register first interface!!! - int ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != -1 ){ - return false; - } - - - protocol_core_stub.entry_ptr = &info_entry; - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != -1 ){ - return false; - } - nsdynmemlib_stub.returnCounter = 2; - mac_pairwise_key_interface_register(0, 6, 3); - protocol_core_stub.entry_ptr = NULL; - - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != -1 ){ - return false; - } - protocol_core_stub.entry_ptr = &info_entry; - nsdynmemlib_stub.returnCounter = 0; - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != -1 ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != -1 ){ - return false; - } - - //Delete - mac_pairwise_key_del(0, eui64); - - //mac_pairwise_key_flush_list(0); - - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - nsdynmemlib_stub.returnCounter = 1; - mac_helper_stub.int8_value = -1; - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != -1 ){ - return false; - } - mac_helper_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != 0 ){ - return false; - } - - eui64[0] = 1; - mle_neigh_table_entry.attribute_index = 1; - nsdynmemlib_stub.returnCounter = 1; - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != 0 ){ - return false; - } - - eui64[0] = 2; - mle_neigh_table_entry.attribute_index = 2; - nsdynmemlib_stub.returnCounter = 1; - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != 0 ){ - return false; - } - - //Test write same key - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != 0 ){ - return false; - } - - //This Should Fail - eui64[0] = 3; - nsdynmemlib_stub.returnCounter = 1; - mle_neigh_table_entry.attribute_index = 3; - ret = mac_pairwise_key_add(0, 0, eui64, key); - if( ret != -1 ){ - return false; - } - - eui64[0] = 0; - mle_neigh_table_entry.attribute_index = 0; - mac_pairwise_key_del(0, eui64); - eui64[0] = 1; - mle_neigh_table_entry.attribute_index = 1; - mac_pairwise_key_del(0, eui64); - eui64[0] = 2; - mle_neigh_table_entry.attribute_index = 2; - mac_pairwise_key_del(0, eui64); - - - mac_pairwise_key_interface_unregister(0); - return true; -} - -bool test_mac_pairwise_key_del() -{ - protocol_interface_info_entry_t info_entry; - mle_neigh_table_entry_t mle_neigh_table_entry; - arm_15_4_mac_parameters_t mac_parameters; - uint8_t eui64[8]; - uint8_t key[16]; - - memset(&info_entry, 0, sizeof(protocol_interface_info_entry_t)); - memset(&mac_parameters, 0, sizeof(arm_15_4_mac_parameters_t)); - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - memset(eui64, 0, 8); - mac_api_t api; - memset(&api, 0, sizeof(mac_api_t)); - info_entry.mac_api = &api; - info_entry.mac_parameters = &mac_parameters; - - - protocol_core_stub.entry_ptr = &info_entry; - if( -1 != mac_pairwise_key_del(0, eui64) ){ - return false; - } - - - //Register first interface!!! - nsdynmemlib_stub.returnCounter = 2; - mac_pairwise_key_interface_register(0, 6, 3); - protocol_core_stub.entry_ptr = NULL; - mle_stub.mle_neigh_table_entry_ptr = NULL; - - if( -1 != mac_pairwise_key_del(0, eui64) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - mac_helper_stub.int8_value = 0; - - protocol_core_stub.entry_ptr = &info_entry; - - if( -1 != mac_pairwise_key_del(0, eui64) ){ - return false; - } - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - mac_pairwise_key_add(0, 0, eui64, key); - - // - mle_stub.mle_neigh_table_entry_ptr = NULL; - - - if( -1 != mac_pairwise_key_del(0, eui64) ){ - return false; - } - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - - mle_neigh_table_entry.attribute_index = 1; - if( -1 != mac_pairwise_key_del(0, eui64) ){ - return false; - } - mle_neigh_table_entry.attribute_index = 0; - - if( 0 != mac_pairwise_key_del(0, eui64) ){ - return false; - } - - - nsdynmemlib_stub.returnCounter = 2; - mac_pairwise_key_interface_register(1, 6, 3); - nsdynmemlib_stub.returnCounter = 2; - mac_pairwise_key_add(1, 0, eui64, key); - if( 0 != mac_pairwise_key_del(1, eui64) ){ - return false; - } - mac_pairwise_key_interface_unregister(0); - mac_pairwise_key_interface_unregister(1); - return true; -} - -bool test_mac_pairwise_key_flush_list() -{ - - protocol_core_stub.entry_ptr = NULL; - if( -1 != mac_pairwise_key_flush_list(0) ){ - return false; - } - - protocol_interface_info_entry_t info_entry; - mle_neigh_table_entry_t mle_neigh_table_entry; - arm_15_4_mac_parameters_t mac_parameters; - uint8_t eui64[8]; - uint8_t key[16]; - - memset(&info_entry, 0, sizeof(protocol_interface_info_entry_t)); - memset(&mac_parameters, 0, sizeof(arm_15_4_mac_parameters_t)); - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - memset(eui64, 0, 8); - info_entry.mac_parameters = &mac_parameters; - info_entry.id = 1; - nsdynmemlib_stub.returnCounter = 2; - mac_helper_stub.int8_value = 0; - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - protocol_core_stub.entry_ptr = &info_entry; - - //Register interface here - nsdynmemlib_stub.returnCounter = 2; - mac_pairwise_key_interface_register(0, 6, 3); - - if( 0 != mac_pairwise_key_flush_list(0) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - mac_pairwise_key_add(0, 0, eui64, key); - if( 0 != mac_pairwise_key_flush_list(0) ){ - return false; - } - - - if( -1 != mac_pairwise_key_flush_list(1) ){ - return false; - } - - mac_pairwise_key_interface_unregister(0); - return true; -} - -bool test_mac_pairwise_key_interface_register() { - - protocol_interface_info_entry_t info_entry; - mle_neigh_table_entry_t mle_neigh_table_entry; - arm_15_4_mac_parameters_t mac_parameters; - uint8_t eui64[8]; - uint8_t key[16]; - - memset(&info_entry, 0, sizeof(protocol_interface_info_entry_t)); - memset(&mac_parameters, 0, sizeof(arm_15_4_mac_parameters_t)); - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - memset(eui64, 0, 8); - info_entry.mac_parameters = &mac_parameters; - info_entry.id = 1; - nsdynmemlib_stub.returnCounter = 2; - mac_helper_stub.int8_value = 0; - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - protocol_core_stub.entry_ptr = NULL; - - - - if (mac_pairwise_key_interface_register(0, 0, 3) == 0) { - return false; - } - - if (mac_pairwise_key_interface_register(0, 3, 0) == 0) { - return false; - } - - if (mac_pairwise_key_interface_register(0, 1, 3) == 0) { - return false; - } - - if (mac_pairwise_key_interface_register(0, 3, 3) == 0) { - return false; - } - protocol_core_stub.entry_ptr = &info_entry; - nsdynmemlib_stub.returnCounter = 0; - if (mac_pairwise_key_interface_register(0, 3, 3) == 0) { - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if (mac_pairwise_key_interface_register(0, 6, 3) == 0) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - if (mac_pairwise_key_interface_register(0, 6, 3) != 0) { - return false; - } - - if (mac_pairwise_key_interface_register(0, 3, 3) == 0) { - return false; - } - - mac_pairwise_key_interface_unregister(0); - - - return true; -} - -bool test_mac_pairwise_key_interface_unregister() { - - protocol_interface_info_entry_t info_entry; - mle_neigh_table_entry_t mle_neigh_table_entry; - arm_15_4_mac_parameters_t mac_parameters; - uint8_t eui64[8]; - uint8_t key[16]; - - memset(&info_entry, 0, sizeof(protocol_interface_info_entry_t)); - memset(&mac_parameters, 0, sizeof(arm_15_4_mac_parameters_t)); - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - memset(eui64, 0, 8); - info_entry.mac_parameters = &mac_parameters; - info_entry.id = 1; - nsdynmemlib_stub.returnCounter = 2; - mac_helper_stub.int8_value = 0; - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - protocol_core_stub.entry_ptr = NULL; - - - if (mac_pairwise_key_interface_unregister(0) != -1) { - return false; - } - protocol_core_stub.entry_ptr = &info_entry; - if (mac_pairwise_key_interface_unregister(0) != -1) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - mac_pairwise_key_interface_register(0, 6, 3); - if (mac_pairwise_key_interface_unregister(0) != 0) { - return false; - } - - return true; -} - diff --git a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/test_mac_pairwise_key.h b/test/nanostack/unittest/6lp_mac/mac_pairwise_key/test_mac_pairwise_key.h deleted file mode 100644 index c8c64555fbae..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_pairwise_key/test_mac_pairwise_key.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_PAIRWISE_KEY_H -#define TEST_MAC_PAIRWISE_KEY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_pairwise_key_add(); - -bool test_mac_pairwise_key_del(); - -bool test_mac_pairwise_key_flush_list(); - -bool test_mac_pairwise_key_interface_register(); - -bool test_mac_pairwise_key_interface_unregister(); - - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_PAIRWISE_KEY_H - diff --git a/test/nanostack/unittest/6lp_mac/mac_response_handler/Makefile b/test/nanostack/unittest/6lp_mac/mac_response_handler/Makefile deleted file mode 100644 index d7135585ccc7..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_response_handler/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_response_handler_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/MAC/mac_response_handler.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_response_handlertest.cpp \ - test_mac_response_handler.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_timer_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/thread_management_if_stub.c \ - ../../stub/adaptation_interface_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD - diff --git a/test/nanostack/unittest/6lp_mac/mac_response_handler/mac_response_handlertest.cpp b/test/nanostack/unittest/6lp_mac/mac_response_handler/mac_response_handlertest.cpp deleted file mode 100644 index 9ace466c4408..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_response_handler/mac_response_handlertest.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_response_handler.h" - -TEST_GROUP(mac_response_handler) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_response_handler, test_mcps_data_confirm_handler) -{ - CHECK(test_mcps_data_confirm_handler()); -} - -TEST(mac_response_handler, test_mcps_data_indication_handler) -{ - CHECK(test_mcps_data_indication_handler()); -} - -TEST(mac_response_handler, test_mlme_confirm_handler) -{ - CHECK(test_mlme_confirm_handler()); -} - -TEST(mac_response_handler, test_mlme_indication_handler) -{ - CHECK(test_mlme_indication_handler()); -} diff --git a/test/nanostack/unittest/6lp_mac/mac_response_handler/main.cpp b/test/nanostack/unittest/6lp_mac/mac_response_handler/main.cpp deleted file mode 100644 index 41438ca96431..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_response_handler/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_response_handler); - diff --git a/test/nanostack/unittest/6lp_mac/mac_response_handler/test_mac_response_handler.c b/test/nanostack/unittest/6lp_mac/mac_response_handler/test_mac_response_handler.c deleted file mode 100644 index 6561a6dba036..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_response_handler/test_mac_response_handler.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_mac_response_handler.h" -#include "mac_api.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" -#include "Core/include/ns_buffer.h" - -#include "mle.h" -#include "mle_stub.h" -#include "mac_helper_stub.h" -#include "buffer_dyn_stub.h" -#include "common_functions_stub.h" -#include "protocol_core_stub.h" -#include "thread_common_stub.h" - -bool visited = false; - -bool test_mcps_data_confirm_handler() -{ - mac_api_t api; - - mcps_data_confirm_handler(&api, NULL); - - return true; -} - -static void mac_security_key_update_cb(protocol_interface_info_entry_t *cur, const mlme_security_t *security_params) -{ - (void) cur; - (void) security_params; -} - -bool test_mcps_data_indication_handler() -{ - mac_api_t api; - protocol_interface_info_entry_t entry; - arm_15_4_mac_parameters_t params; - params.mac_next_key_index = 1; - entry.mac_parameters = ¶ms; - entry.mac_security_key_usage_update_cb = mac_security_key_update_cb; - mcps_data_ind_t data_ind; - buffer_dyn_stub.buffer_ptr = NULL; - mcps_data_indication_handler( &api, &data_ind ); - - buffer_t buf; - buffer_dyn_stub.buffer_ptr = &buf; - uint8_t ubuf[8]; - common_functions_stub.uint8_ptr = &ubuf; - protocol_core_stub.entry_ptr = &entry; - data_ind.DstAddrMode = ADDR_802_15_4_SHORT; - buf.dst_sa.address[2] = 0xff; - buf.dst_sa.address[3] = 0xff; - - data_ind.Key.SecurityLevel = 1; - data_ind.Key.KeyIndex = 1; - thread_info_t info; - thread_stub.info_ptr = &info; - - mcps_data_indication_handler( &api, &data_ind ); - - data_ind.DstAddrMode = ADDR_802_15_4_LONG; - buf.dst_sa.address[0] = 0xff; - buf.dst_sa.address[1] = 0xff; - mcps_data_indication_handler( &api, &data_ind ); - - data_ind.Key.SecurityLevel = 0; - mac_helper_stub.uint8_value = 1; - mle_neigh_table_entry_t tent; - mle_stub.mle_neigh_table_entry_ptr = &tent; - tent.handshakeReady = 1; - mcps_data_indication_handler( &api, &data_ind ); - if (!buf.options.ll_security_bypass_rx ) { - return false; - } - - mac_helper_stub.uint8_value = 0; - mle_stub.mle_neigh_table_entry_ptr = NULL; - mcps_data_indication_handler( &api, &data_ind ); - if (!buf.options.ll_security_bypass_rx ) { - return false; - } - buf.options.ll_security_bypass_rx = false; - mle_stub.mle_neigh_table_entry_ptr = &tent; - mcps_data_indication_handler( &api, &data_ind ); - if (buf.options.ll_security_bypass_rx ) { - return false; - } - return true; -} - -void scan_callback(int8_t if_id, const mlme_scan_conf_t* conf) -{ - visited = true; -} - -void mlme_test_req(const mac_api_t* api, mlme_primitive id, const void *data) -{ - visited = true; -} - -bool test_mlme_confirm_handler() -{ - mac_api_t api; - api.mlme_req = mlme_test_req; - protocol_core_stub.entry_ptr = NULL; - mlme_confirm_handler(&api, 0, NULL); - protocol_interface_info_entry_t entry; - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - entry.mac_api = &api; - protocol_core_stub.entry_ptr = &entry; - mlme_confirm_handler(&api, MLME_ASSOCIATE, NULL); - mlme_confirm_handler(&api, MLME_DISASSOCIATE, NULL); - - mlme_get_conf_t dat; - dat.attr = 254; - mlme_confirm_handler(&api, MLME_GET, NULL); - - mlme_confirm_handler(&api, MLME_GET, &dat); - - dat.attr = macDeviceTable; - dat.value_size = sizeof(mlme_device_descriptor_t) - 4; - mlme_confirm_handler(&api, MLME_GET, &dat); - - mlme_device_descriptor_t desc; - dat.value_pointer = &desc; - dat.value_size = sizeof(mlme_device_descriptor_t); - dat.status = MLME_SUCCESS; - mle_stub.mle_neigh_table_entry_ptr = NULL; - mlme_confirm_handler(&api, MLME_GET, &dat); - - mle_neigh_table_entry_t tent; - mle_stub.mle_neigh_table_entry_ptr = &tent; - desc.ShortAddress = 14; - tent.short_adr = 15; - visited = false; - mlme_confirm_handler(&api, MLME_GET, &dat); - if( !visited ){ - return false; - } - - dat.attr = macFrameCounter; - dat.value_size = 3; - mlme_confirm_handler(&api, MLME_GET, &dat); - - dat.value_size = 4; - mlme_confirm_handler(&api, MLME_GET, &dat); - - mlme_confirm_handler(&api, MLME_GTS, NULL); - mlme_confirm_handler(&api, MLME_RESET, NULL); - mlme_confirm_handler(&api, MLME_RX_ENABLE, NULL); - - visited = false; - entry.scan_cb = &scan_callback; - mlme_confirm_handler(&api, MLME_SCAN, NULL); - if( !visited ){ - return false; - } - - mlme_confirm_handler(&api, MLME_SET, NULL); - mlme_confirm_handler(&api, MLME_START, NULL); - - mlme_confirm_handler(&api, MLME_POLL, NULL); - - mlme_confirm_handler(&api, MLME_BEACON_NOTIFY, NULL); - mlme_confirm_handler(&api, MLME_ORPHAN, NULL); - mlme_confirm_handler(&api, MLME_COMM_STATUS, NULL); - mlme_confirm_handler(&api, MLME_SYNC, NULL); - mlme_confirm_handler(&api, MLME_SYNC_LOSS, NULL); - mlme_confirm_handler(&api, 254, NULL); - return true; -} - -void beacon_ind_cb(int8_t if_id, const mlme_beacon_ind_t* conf) -{ - visited = true; -} - -void comm_status_cb(int8_t if_id, const mlme_comm_status_t* status) -{ - visited = true; -} - -bool test_mlme_indication_handler() -{ - mlme_indication_handler(NULL, MLME_ASSOCIATE, NULL); - mlme_indication_handler(NULL, MLME_DISASSOCIATE, NULL); - - mac_api_t api; - visited = false; - protocol_interface_info_entry_t entry; - entry.beacon_cb = beacon_ind_cb; - protocol_core_stub.entry_ptr = &entry; - mlme_indication_handler(&api, MLME_BEACON_NOTIFY, NULL); - if( !visited ){ - return false; - } - - mlme_indication_handler(NULL, MLME_GTS, NULL); - mlme_indication_handler(NULL, MLME_ORPHAN, NULL); - - mlme_comm_status_t data; - visited = false; - entry.comm_status_ind_cb = &comm_status_cb; - mlme_indication_handler(&api, MLME_COMM_STATUS, &data); - if( !visited ){ - return false; - } - - const mlme_sync_loss_t sync_loss = { - .LossReason = BEACON_LOST - }; - mlme_indication_handler(&api, MLME_SYNC_LOSS, &sync_loss); - mlme_indication_handler(NULL, MLME_GET, NULL); - mlme_indication_handler(NULL, MLME_RESET, NULL); - mlme_indication_handler(NULL, MLME_RX_ENABLE, NULL); - mlme_indication_handler(NULL, MLME_SCAN, NULL); - mlme_indication_handler(NULL, MLME_SET, NULL); - mlme_indication_handler(NULL, MLME_START, NULL); - mlme_indication_handler(NULL, MLME_SYNC, NULL); - mlme_indication_handler(NULL, MLME_POLL, NULL); - mlme_indication_handler(NULL, 254, NULL); - return true; -} diff --git a/test/nanostack/unittest/6lp_mac/mac_response_handler/test_mac_response_handler.h b/test/nanostack/unittest/6lp_mac/mac_response_handler/test_mac_response_handler.h deleted file mode 100644 index a922482e2b6b..000000000000 --- a/test/nanostack/unittest/6lp_mac/mac_response_handler/test_mac_response_handler.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_RESPONSE_HANDLER_H -#define TEST_MAC_RESPONSE_HANDLER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mcps_data_confirm_handler(); - -bool test_mcps_data_indication_handler(); - -bool test_mlme_confirm_handler(); - -bool test_mlme_indication_handler(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_RESPONSE_HANDLER_H - diff --git a/test/nanostack/unittest/Bootstraps/network_lib/Makefile b/test/nanostack/unittest/Bootstraps/network_lib/Makefile deleted file mode 100644 index 39b18f686f9b..000000000000 --- a/test/nanostack/unittest/Bootstraps/network_lib/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = network_lib_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Bootstraps/Generic/network_lib.c - -TEST_SRC_FILES = \ - main.cpp \ - network_libtest.cpp \ - test_network_lib.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/thread_bootstrap_stub.c \ - ../../stub/address_stub.c \ - ../../stub/rpl_data_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Bootstraps/network_lib/main.cpp b/test/nanostack/unittest/Bootstraps/network_lib/main.cpp deleted file mode 100644 index 8e0d3b88b394..000000000000 --- a/test/nanostack/unittest/Bootstraps/network_lib/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(network_lib); - diff --git a/test/nanostack/unittest/Bootstraps/network_lib/network_libtest.cpp b/test/nanostack/unittest/Bootstraps/network_lib/network_libtest.cpp deleted file mode 100644 index 2ba544b68805..000000000000 --- a/test/nanostack/unittest/Bootstraps/network_lib/network_libtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_network_lib.h" - -TEST_GROUP(network_lib) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(network_lib, test_nwk_ready) -{ - CHECK(test_nwk_ready()); -} - diff --git a/test/nanostack/unittest/Bootstraps/network_lib/test_network_lib.c b/test/nanostack/unittest/Bootstraps/network_lib/test_network_lib.c deleted file mode 100644 index b4f3998015dc..000000000000 --- a/test/nanostack/unittest/Bootstraps/network_lib/test_network_lib.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_network_lib.h" -#include - - -bool test_nwk_ready() -{ - nwk_ready(0); - return true; -} - diff --git a/test/nanostack/unittest/Bootstraps/network_lib/test_network_lib.h b/test/nanostack/unittest/Bootstraps/network_lib/test_network_lib.h deleted file mode 100644 index 4bd99f0cfb04..000000000000 --- a/test/nanostack/unittest/Bootstraps/network_lib/test_network_lib.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_NETWORK_LIB_H -#define TEST_NETWORK_LIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_nwk_ready(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_NETWORK_LIB_H - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/Makefile b/test/nanostack/unittest/Bootstraps/protocol_6lowpan/Makefile deleted file mode 100644 index 7ec6fc293fdf..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = protocol_6lowpan_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c - -TEST_SRC_FILES = \ - main.cpp \ - protocol_6lowpantest.cpp \ - test_protocol_6lowpan.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/address_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/net_rpl_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/thread_nd_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/border_router_stub.c \ - ../../stub/cipv6_fragmenter_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/tcp_stub.c \ - ../../stub/udp_stub.c \ - ../../stub/mesh_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/6lowpan_iphc_stub.c \ - ../../stub/adaptation_interface_stub.c \ - ../../stub/security_lib_stub.c \ - ../../stub/net_load_balance_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/main.cpp b/test/nanostack/unittest/Bootstraps/protocol_6lowpan/main.cpp deleted file mode 100644 index 07684fe03503..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(protocol_6lowpan); - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/protocol_6lowpantest.cpp b/test/nanostack/unittest/Bootstraps/protocol_6lowpan/protocol_6lowpantest.cpp deleted file mode 100644 index 1e59557c9911..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/protocol_6lowpantest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_protocol_6lowpan.h" - -TEST_GROUP(protocol_6lowpan) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(protocol_6lowpan, test_protocol_init) -{ - CHECK(test_protocol_init()); -} - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/test_protocol_6lowpan.c b/test/nanostack/unittest/Bootstraps/protocol_6lowpan/test_protocol_6lowpan.c deleted file mode 100644 index ce236df27a60..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/test_protocol_6lowpan.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_protocol_6lowpan.h" -#include - - -bool test_protocol_init() -{ - protocol_init(); - return true; -} - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/test_protocol_6lowpan.h b/test/nanostack/unittest/Bootstraps/protocol_6lowpan/test_protocol_6lowpan.h deleted file mode 100644 index 62bce0c5227b..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan/test_protocol_6lowpan.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PROTOCOL_6LOWPAN_H -#define TEST_PROTOCOL_6LOWPAN_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_protocol_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PROTOCOL_6LOWPAN_H - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/Makefile b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/Makefile deleted file mode 100644 index ca9952e9abf1..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = protocol_6lowpan_bootstrap_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c - -TEST_SRC_FILES = \ - main.cpp \ - protocol_6lowpan_bootstraptest.cpp \ - test_protocol_6lowpan_bootstrap.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/address_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/mle_tlv_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/mle_service_buffer_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_6lowpan_interface_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/beacon_handler_stub.c \ - ../../stub/border_router_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/net_stub.c \ - ../../stub/net_mle_stub.c \ - ../../stub/blacklist_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/icmpv6_radv_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/event_stub.c \ - ../../stub/pana_stub.c \ - ../../stub/pana_client_stub.c \ - ../../stub/net_load_balance_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_6LOWPAN_ND - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/main.cpp b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/main.cpp deleted file mode 100644 index 733fa364067b..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(protocol_6lowpan_bootstrap); - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/protocol_6lowpan_bootstraptest.cpp b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/protocol_6lowpan_bootstraptest.cpp deleted file mode 100644 index e44d6e85e5f0..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/protocol_6lowpan_bootstraptest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_protocol_6lowpan_bootstrap.h" - -TEST_GROUP(protocol_6lowpan_bootstrap) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(protocol_6lowpan_bootstrap, test_protocol_6lowpan_mle_blacklist_clear) -{ - CHECK(test_protocol_6lowpan_mle_blacklist_clear()); -} - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/test_protocol_6lowpan_bootstrap.c b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/test_protocol_6lowpan_bootstrap.c deleted file mode 100644 index 94ba5ed424e3..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/test_protocol_6lowpan_bootstrap.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "test_protocol_6lowpan_bootstrap.h" -#include - - -bool test_protocol_6lowpan_mle_blacklist_clear() -{ - blacklist_clear(); - return true; -} - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/test_protocol_6lowpan_bootstrap.h b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/test_protocol_6lowpan_bootstrap.h deleted file mode 100644 index c54dea243a58..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_bootstrap/test_protocol_6lowpan_bootstrap.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PROTOCOL_6LOWPAN_BOOTSTRAP_H -#define TEST_PROTOCOL_6LOWPAN_BOOTSTRAP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_protocol_6lowpan_mle_blacklist_clear(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PROTOCOL_6LOWPAN_BOOTSTRAP_H - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/Makefile b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/Makefile deleted file mode 100644 index bc55e8dc314c..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = protocol_6lowpan_interface_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c - -TEST_SRC_FILES = \ - main.cpp \ - protocol_6lowpan_interfacetest.cpp \ - test_protocol_6lowpan_interface.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/event_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/blacklist_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/neighbor_cache_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/adaptation_interface_stub.c \ - ../../stub/cipv6_fragmenter_stub.c \ - ../../stub/pana_stub.c \ - ../../stub/net_load_balance_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/main.cpp b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/main.cpp deleted file mode 100644 index b5cd09f48b31..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(protocol_6lowpan_interface); - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/protocol_6lowpan_interfacetest.cpp b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/protocol_6lowpan_interfacetest.cpp deleted file mode 100644 index ca8e588f7bd8..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/protocol_6lowpan_interfacetest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_protocol_6lowpan_interface.h" - -TEST_GROUP(protocol_6lowpan_interface) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(protocol_6lowpan_interface, test_nwk_6lowpan_up) -{ - CHECK(test_nwk_6lowpan_up()); -} - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/test_protocol_6lowpan_interface.c b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/test_protocol_6lowpan_interface.c deleted file mode 100644 index 52379a8d3f9a..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/test_protocol_6lowpan_interface.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_protocol_6lowpan_interface.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" - - -bool test_nwk_6lowpan_up() -{ - protocol_interface_info_entry_t info; - arm_15_4_mac_parameters_t mac_params; - memset(&info, 0, sizeof(protocol_interface_info_entry_t)); - memset(&mac_params, 0, sizeof(arm_15_4_mac_parameters_t)); - info.mac_parameters = &mac_params; - nwk_6lowpan_up(&info); - return true; -} - diff --git a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/test_protocol_6lowpan_interface.h b/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/test_protocol_6lowpan_interface.h deleted file mode 100644 index 205b39202af9..000000000000 --- a/test/nanostack/unittest/Bootstraps/protocol_6lowpan_interface/test_protocol_6lowpan_interface.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PROTOCOL_6LOWPAN_INTERFACE_H -#define TEST_PROTOCOL_6LOWPAN_INTERFACE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_nwk_6lowpan_up(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PROTOCOL_6LOWPAN_INTERFACE_H - diff --git a/test/nanostack/unittest/BorderRouter/border_router/Makefile b/test/nanostack/unittest/BorderRouter/border_router/Makefile deleted file mode 100644 index c06bb2078e81..000000000000 --- a/test/nanostack/unittest/BorderRouter/border_router/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = border_router_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/BorderRouter/border_router.c - -TEST_SRC_FILES = \ - main.cpp \ - border_routertest.cpp \ - test_border_router.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/whiteboard_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/icmpv6_radv_stub.c \ - ../../stub/icmpv6_prefix_stub.c \ - ../../stub/neighbor_cache_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/blacklist_stub.c \ - ../../stub/thread_bootstrap_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/adaptation_interface_stub.c \ - ../../stub/cipv6_fragmenter_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_timer_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/address_stub.c \ - ../../stub/lowpan_context_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/nd_proxy_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/beacon_handler_stub.c \ - ../../stub/pana_stub.c \ - ../../stub/pana_server_stub.c \ - ../../stub/net_load_balance_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/BorderRouter/border_router/border_routertest.cpp b/test/nanostack/unittest/BorderRouter/border_router/border_routertest.cpp deleted file mode 100644 index ed737ebc57bb..000000000000 --- a/test/nanostack/unittest/BorderRouter/border_router/border_routertest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_border_router.h" - -TEST_GROUP(border_router) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(border_router, test_arm_nwk_6lowpan_borderrouter_data_free) -{ - CHECK(test_arm_nwk_6lowpan_borderrouter_data_free()); -} - diff --git a/test/nanostack/unittest/BorderRouter/border_router/main.cpp b/test/nanostack/unittest/BorderRouter/border_router/main.cpp deleted file mode 100644 index 1961b6b25685..000000000000 --- a/test/nanostack/unittest/BorderRouter/border_router/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(border_router); - diff --git a/test/nanostack/unittest/BorderRouter/border_router/test_border_router.c b/test/nanostack/unittest/BorderRouter/border_router/test_border_router.c deleted file mode 100644 index 31cc96ebd441..000000000000 --- a/test/nanostack/unittest/BorderRouter/border_router/test_border_router.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_border_router.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" - -bool test_arm_nwk_6lowpan_borderrouter_data_free() -{ - protocol_interface_info_entry_t info; - info.border_router_setup = NULL; - arm_nwk_6lowpan_borderrouter_data_free(&info); - return true; -} - diff --git a/test/nanostack/unittest/BorderRouter/border_router/test_border_router.h b/test/nanostack/unittest/BorderRouter/border_router/test_border_router.h deleted file mode 100644 index 402e71f27977..000000000000 --- a/test/nanostack/unittest/BorderRouter/border_router/test_border_router.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_BORDER_ROUTER_H -#define TEST_BORDER_ROUTER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_arm_nwk_6lowpan_borderrouter_data_free(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_BORDER_ROUTER_H - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6/Makefile b/test/nanostack/unittest/Common_Protocols/icmpv6/Makefile deleted file mode 100644 index f9f90533f7db..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = icmpv6_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Common_Protocols/icmpv6.c - -TEST_SRC_FILES = \ - main.cpp \ - icmpv6test.cpp \ - test_icmpv6.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/address_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/mpl_stub.c \ - ../../stub/mld_stub.c \ - ../../stub/nd_proxy_stub.c \ - ../../stub/rpl_data_stub.c \ - ../../stub/icmpv6_radv_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6/icmpv6test.cpp b/test/nanostack/unittest/Common_Protocols/icmpv6/icmpv6test.cpp deleted file mode 100644 index e17ef61c337e..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6/icmpv6test.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_icmpv6.h" - -TEST_GROUP(icmpv6) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(icmpv6, test_icmpv6_something) -{ - CHECK(test_icmpv6_something()); -} - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6/main.cpp b/test/nanostack/unittest/Common_Protocols/icmpv6/main.cpp deleted file mode 100644 index a080fec5c7b3..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(icmpv6); - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6/test_icmpv6.c b/test/nanostack/unittest/Common_Protocols/icmpv6/test_icmpv6.c deleted file mode 100644 index 7930929327c3..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6/test_icmpv6.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_icmpv6.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" - -bool test_icmpv6_something() -{ - protocol_interface_info_entry_t info; - info.recv_ra_routes = false; - icmpv6_recv_ra_routes(&info, false); - return true; -} - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6/test_icmpv6.h b/test/nanostack/unittest/Common_Protocols/icmpv6/test_icmpv6.h deleted file mode 100644 index 56cb8455394e..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6/test_icmpv6.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_ICMPV6_H -#define TEST_ICMPV6_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_icmpv6_something(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_ICMPV6_H - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/Makefile b/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/Makefile deleted file mode 100644 index 90e5bd0a6400..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = icmpv6_prefix_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Common_Protocols/icmpv6_prefix.c - -TEST_SRC_FILES = \ - main.cpp \ - icmpv6_prefixtest.cpp \ - test_icmpv6_prefix.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/icmpv6_prefixtest.cpp b/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/icmpv6_prefixtest.cpp deleted file mode 100644 index 02247c7ae4f5..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/icmpv6_prefixtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_icmpv6_prefix.h" - -TEST_GROUP(icmpv6_prefix) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(icmpv6_prefix, test_icmpv6_prefix_list_free) -{ - CHECK(test_icmpv6_prefix_list_free()); -} - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/main.cpp b/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/main.cpp deleted file mode 100644 index ddbbf3dbc787..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(icmpv6_prefix); - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/test_icmpv6_prefix.c b/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/test_icmpv6_prefix.c deleted file mode 100644 index 90b7e2509dd3..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/test_icmpv6_prefix.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_icmpv6_prefix.h" -#include -#include "icmpv6_prefix.h" - -bool test_icmpv6_prefix_list_free() -{ - prefix_list_t list; - ns_list_init(&list); - icmpv6_prefix_list_free(&list); - return true; -} - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/test_icmpv6_prefix.h b/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/test_icmpv6_prefix.h deleted file mode 100644 index a40004d3f3db..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_prefix/test_icmpv6_prefix.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_ICMPV6_PREFIX_H -#define TEST_ICMPV6_PREFIX_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_icmpv6_prefix_list_free(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_ICMPV6_PREFIX_H - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/Makefile b/test/nanostack/unittest/Common_Protocols/icmpv6_radv/Makefile deleted file mode 100644 index 2a11201468d6..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = icmpv6_radv_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Common_Protocols/icmpv6_radv.c - -TEST_SRC_FILES = \ - main.cpp \ - icmpv6_radvtest.cpp \ - test_icmpv6_radv.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/address_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/icmpv6_radvtest.cpp b/test/nanostack/unittest/Common_Protocols/icmpv6_radv/icmpv6_radvtest.cpp deleted file mode 100644 index 1db44fa7d461..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/icmpv6_radvtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_icmpv6_radv.h" - -TEST_GROUP(icmpv6_radv) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(icmpv6_radv, test_icmpv6_radv_init) -{ - CHECK(test_icmpv6_radv_init()); -} - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/main.cpp b/test/nanostack/unittest/Common_Protocols/icmpv6_radv/main.cpp deleted file mode 100644 index 7ee83360dcf6..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(icmpv6_radv); - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/test_icmpv6_radv.c b/test/nanostack/unittest/Common_Protocols/icmpv6_radv/test_icmpv6_radv.c deleted file mode 100644 index b8d0d738553f..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/test_icmpv6_radv.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_icmpv6_radv.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" - - -bool test_icmpv6_radv_init() -{ - protocol_interface_info_entry_t info; - icmpv6_radv_init(&info); - return true; -} - diff --git a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/test_icmpv6_radv.h b/test/nanostack/unittest/Common_Protocols/icmpv6_radv/test_icmpv6_radv.h deleted file mode 100644 index 0393ad5efb95..000000000000 --- a/test/nanostack/unittest/Common_Protocols/icmpv6_radv/test_icmpv6_radv.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_ICMPV6_RADV_H -#define TEST_ICMPV6_RADV_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_icmpv6_radv_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_ICMPV6_RADV_H - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6/Makefile b/test/nanostack/unittest/Common_Protocols/ipv6/Makefile deleted file mode 100644 index 2e585dbc32b1..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = ipv6_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Common_Protocols/ipv6.c - -TEST_SRC_FILES = \ - main.cpp \ - ipv6test.cpp \ - test_ipv6.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/address_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/ipv6_resolution_stub.c \ - ../../stub/ipv6_fragmentation_stub.c \ - ../../stub/ipv6_flow_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/nd_proxy_stub.c \ - ../../stub/rpl_data_stub.c \ - ../../stub/icmpv6_radv_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/rpl_data_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6/ipv6test.cpp b/test/nanostack/unittest/Common_Protocols/ipv6/ipv6test.cpp deleted file mode 100644 index fd4241aa2b12..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6/ipv6test.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_ipv6.h" - -TEST_GROUP(ipv6) -{ - void setup() - { - } - - void teardown() - { - } -}; diff --git a/test/nanostack/unittest/Common_Protocols/ipv6/main.cpp b/test/nanostack/unittest/Common_Protocols/ipv6/main.cpp deleted file mode 100644 index e9d95b0da21d..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(ipv6); - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6/test_ipv6.c b/test/nanostack/unittest/Common_Protocols/ipv6/test_ipv6.c deleted file mode 100644 index 023523087e92..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6/test_ipv6.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "test_ipv6.h" -#include - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6/test_ipv6.h b/test/nanostack/unittest/Common_Protocols/ipv6/test_ipv6.h deleted file mode 100644 index 7c636cb4c55b..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6/test_ipv6.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_IPV6_H -#define TEST_IPV6_H - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef __cplusplus -} -#endif - -#endif // TEST_IPV6_H - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_flow/Makefile b/test/nanostack/unittest/Common_Protocols/ipv6_flow/Makefile deleted file mode 100644 index 038ba99261cd..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_flow/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = ipv6_flow_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Common_Protocols/ipv6_flow.c - -TEST_SRC_FILES = \ - main.cpp \ - ipv6_flowtest.cpp \ - test_ipv6_flow.c \ - ../../stub/randLIB_stub.c \ - ../../stub/fnv_hash_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_flow/ipv6_flowtest.cpp b/test/nanostack/unittest/Common_Protocols/ipv6_flow/ipv6_flowtest.cpp deleted file mode 100644 index a41a794433b0..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_flow/ipv6_flowtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_ipv6_flow.h" - -TEST_GROUP(ipv6_flow) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(ipv6_flow, test_ipv6_flow_random) -{ - CHECK(test_ipv6_flow_random()); -} - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_flow/main.cpp b/test/nanostack/unittest/Common_Protocols/ipv6_flow/main.cpp deleted file mode 100644 index 1bf746c45c23..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_flow/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(ipv6_flow); - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_flow/test_ipv6_flow.c b/test/nanostack/unittest/Common_Protocols/ipv6_flow/test_ipv6_flow.c deleted file mode 100644 index 2532bba3a542..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_flow/test_ipv6_flow.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_ipv6_flow.h" -#include - - -bool test_ipv6_flow_random() -{ - ipv6_flow_random(); - return true; -} - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_flow/test_ipv6_flow.h b/test/nanostack/unittest/Common_Protocols/ipv6_flow/test_ipv6_flow.h deleted file mode 100644 index f82eae3fe0c3..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_flow/test_ipv6_flow.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_IPV6_FLOW_H -#define TEST_IPV6_FLOW_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_ipv6_flow_random(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_IPV6_FLOW_H - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/Makefile b/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/Makefile deleted file mode 100644 index 7140ab56e39d..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = ipv6_fragmentation_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Common_Protocols/ipv6_fragmentation.c - -TEST_SRC_FILES = \ - main.cpp \ - ipv6_fragmentationtest.cpp \ - test_ipv6_fragmentation.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/address_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/socket_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/ipv6_fragmentationtest.cpp b/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/ipv6_fragmentationtest.cpp deleted file mode 100644 index 8c543f0898f2..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/ipv6_fragmentationtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_ipv6_fragmentation.h" - -TEST_GROUP(ipv6_fragmentation) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(ipv6_fragmentation, test_ipv6_frag_set_mru) -{ - CHECK(test_ipv6_frag_set_mru()); -} - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/main.cpp b/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/main.cpp deleted file mode 100644 index 285b4d301e63..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(ipv6_fragmentation); - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/test_ipv6_fragmentation.c b/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/test_ipv6_fragmentation.c deleted file mode 100644 index 501eb4376861..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/test_ipv6_fragmentation.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_ipv6_fragmentation.h" -#include - - -bool test_ipv6_frag_set_mru() -{ - ipv6_frag_set_mru(0); - return true; -} - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/test_ipv6_fragmentation.h b/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/test_ipv6_fragmentation.h deleted file mode 100644 index f3577f2c9a79..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_fragmentation/test_ipv6_fragmentation.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_IPV6_FRAGMENTATION_H -#define TEST_IPV6_FRAGMENTATION_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_ipv6_frag_set_mru(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_IPV6_FRAGMENTATION_H - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/Makefile b/test/nanostack/unittest/Common_Protocols/ipv6_resolution/Makefile deleted file mode 100644 index a613b13f65e3..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = ipv6_resolution_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Common_Protocols/ipv6_resolution.c - -TEST_SRC_FILES = \ - main.cpp \ - ipv6_resolutiontest.cpp \ - test_ipv6_resolution.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/address_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/socket_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/ipv6_resolutiontest.cpp b/test/nanostack/unittest/Common_Protocols/ipv6_resolution/ipv6_resolutiontest.cpp deleted file mode 100644 index 12d7364edd33..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/ipv6_resolutiontest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_ipv6_resolution.h" - -TEST_GROUP(ipv6_resolution) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(ipv6_resolution, test_ipv6_map_ip_to_ll_and_call_ll_addr_handler) -{ - CHECK(test_ipv6_map_ip_to_ll_and_call_ll_addr_handler()); -} - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/main.cpp b/test/nanostack/unittest/Common_Protocols/ipv6_resolution/main.cpp deleted file mode 100644 index 1683dc2e45c3..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(ipv6_resolution); - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/test_ipv6_resolution.c b/test/nanostack/unittest/Common_Protocols/ipv6_resolution/test_ipv6_resolution.c deleted file mode 100644 index 882e41d8944e..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/test_ipv6_resolution.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_ipv6_resolution.h" -#include -#include - -bool test_ipv6_map_ip_to_ll_and_call_ll_addr_handler() -{ - const uint8_t addr[16]; - ipv6_map_ip_to_ll_and_call_ll_addr_handler(NULL, 0, NULL, addr, NULL); - return true; -} - diff --git a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/test_ipv6_resolution.h b/test/nanostack/unittest/Common_Protocols/ipv6_resolution/test_ipv6_resolution.h deleted file mode 100644 index 224b7bc5b764..000000000000 --- a/test/nanostack/unittest/Common_Protocols/ipv6_resolution/test_ipv6_resolution.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_IPV6_RESOLUTION_H -#define TEST_IPV6_RESOLUTION_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_ipv6_map_ip_to_ll_and_call_ll_addr_handler(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_IPV6_RESOLUTION_H - diff --git a/test/nanostack/unittest/Common_Protocols/tcp/Makefile b/test/nanostack/unittest/Common_Protocols/tcp/Makefile deleted file mode 100644 index 704d5eabe37e..000000000000 --- a/test/nanostack/unittest/Common_Protocols/tcp/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = tcp_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Common_Protocols/tcp.c - -TEST_SRC_FILES = \ - main.cpp \ - tcptest.cpp \ - test_tcp.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_timer_stub.c \ - ../../stub/event_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/address_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/ns_sha256_stub.c\ - ../../stub/ipv6_flow_stub.c\ - ../../stub/sockbuf_stub.c\ - ../../stub/ipv6_routing_table_stub.c\ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Common_Protocols/tcp/main.cpp b/test/nanostack/unittest/Common_Protocols/tcp/main.cpp deleted file mode 100644 index 1d8244efd2dd..000000000000 --- a/test/nanostack/unittest/Common_Protocols/tcp/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(tcp); - diff --git a/test/nanostack/unittest/Common_Protocols/tcp/tcptest.cpp b/test/nanostack/unittest/Common_Protocols/tcp/tcptest.cpp deleted file mode 100644 index 6cc90e32e368..000000000000 --- a/test/nanostack/unittest/Common_Protocols/tcp/tcptest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_tcp.h" - -TEST_GROUP(tcp) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(tcp, test_tcp_session_close) -{ - CHECK(test_tcp_session_close()); -} - diff --git a/test/nanostack/unittest/Common_Protocols/tcp/test_tcp.c b/test/nanostack/unittest/Common_Protocols/tcp/test_tcp.c deleted file mode 100644 index 86a596a67476..000000000000 --- a/test/nanostack/unittest/Common_Protocols/tcp/test_tcp.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_tcp.h" -#include -#include "nsconfig.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/tcp.h" - -static tcp_session_t tcp_session; - -bool test_tcp_session_close() -{ - tcp_session.state = TCP_STATE_CLOSED; - tcp_session_close(&tcp_session); - return true; -} - diff --git a/test/nanostack/unittest/Common_Protocols/tcp/test_tcp.h b/test/nanostack/unittest/Common_Protocols/tcp/test_tcp.h deleted file mode 100644 index d275ea70dc99..000000000000 --- a/test/nanostack/unittest/Common_Protocols/tcp/test_tcp.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_TCP_H -#define TEST_TCP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_tcp_session_close(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_TCP_H - diff --git a/test/nanostack/unittest/Common_Protocols/udp/Makefile b/test/nanostack/unittest/Common_Protocols/udp/Makefile deleted file mode 100644 index c2a981047c48..000000000000 --- a/test/nanostack/unittest/Common_Protocols/udp/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = udp_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Common_Protocols/udp.c - -TEST_SRC_FILES = \ - main.cpp \ - udptest.cpp \ - test_udp.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_timer_stub.c \ - ../../stub/event_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/address_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/network_lib_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Common_Protocols/udp/main.cpp b/test/nanostack/unittest/Common_Protocols/udp/main.cpp deleted file mode 100644 index 9bf9d5f2b782..000000000000 --- a/test/nanostack/unittest/Common_Protocols/udp/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(udp); - diff --git a/test/nanostack/unittest/Common_Protocols/udp/test_udp.c b/test/nanostack/unittest/Common_Protocols/udp/test_udp.c deleted file mode 100644 index 7624422090ea..000000000000 --- a/test/nanostack/unittest/Common_Protocols/udp/test_udp.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_udp.h" -#include -#include "nsdynmemLIB.h" -#include "Core/include/address.h" -#include "Core/include/ns_buffer.h" - -bool test_udp_down() -{ - buffer_t *buf = ns_dyn_mem_alloc(sizeof(buffer_t) + 100); - buf->src_sa.addr_type = ADDR_NONE; - udp_down(buf); - return true; -} - diff --git a/test/nanostack/unittest/Common_Protocols/udp/test_udp.h b/test/nanostack/unittest/Common_Protocols/udp/test_udp.h deleted file mode 100644 index 8d9500effd9c..000000000000 --- a/test/nanostack/unittest/Common_Protocols/udp/test_udp.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_UDP_H -#define TEST_UDP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_udp_down(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_UDP_H - diff --git a/test/nanostack/unittest/Common_Protocols/udp/udptest.cpp b/test/nanostack/unittest/Common_Protocols/udp/udptest.cpp deleted file mode 100644 index d64300df0426..000000000000 --- a/test/nanostack/unittest/Common_Protocols/udp/udptest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_udp.h" - -TEST_GROUP(udp) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(udp, test_udp_down) -{ - CHECK(test_udp_down); -} - diff --git a/test/nanostack/unittest/Core/address/Makefile b/test/nanostack/unittest/Core/address/Makefile deleted file mode 100644 index 7fdff5f1528f..000000000000 --- a/test/nanostack/unittest/Core/address/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = address_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Core/address.c - -TEST_SRC_FILES = \ - main.cpp \ - addresstest.cpp \ - test_address.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/multicast_api_stub.c \ - ../../stub/ns_sha256_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/mld_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/ip6tos_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Core/address/addresstest.cpp b/test/nanostack/unittest/Core/address/addresstest.cpp deleted file mode 100644 index 92dabff3a5b6..000000000000 --- a/test/nanostack/unittest/Core/address/addresstest.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_address.h" - -TEST_GROUP(address) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(address, test_addr_len_from_type) -{ - CHECK(test_addr_len_from_type()); -} - -TEST(address, test_addr_max_slaac_entries_set) -{ - CHECK(test_addr_max_slaac_entries_set()); -} diff --git a/test/nanostack/unittest/Core/address/main.cpp b/test/nanostack/unittest/Core/address/main.cpp deleted file mode 100644 index 3b865c069448..000000000000 --- a/test/nanostack/unittest/Core/address/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(address); - diff --git a/test/nanostack/unittest/Core/address/test_address.c b/test/nanostack/unittest/Core/address/test_address.c deleted file mode 100644 index eb44ecee6959..000000000000 --- a/test/nanostack/unittest/Core/address/test_address.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_address.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" - - -bool test_addr_len_from_type() -{ - addr_len_from_type(0); - return true; -} - -bool test_addr_max_slaac_entries_set() -{ - protocol_interface_info_entry_t cur; - addr_max_slaac_entries_set(&cur, 5); - - if (cur.ip_addresses_max_slaac_entries == 5) { - return true; - } else { - return false; - } -} diff --git a/test/nanostack/unittest/Core/address/test_address.h b/test/nanostack/unittest/Core/address/test_address.h deleted file mode 100644 index 342d99c98553..000000000000 --- a/test/nanostack/unittest/Core/address/test_address.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_ADDRESS_H -#define TEST_ADDRESS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_addr_len_from_type(); -bool test_addr_max_slaac_entries_set(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_ADDRESS_H - diff --git a/test/nanostack/unittest/Core/buffer_dyn/Makefile b/test/nanostack/unittest/Core/buffer_dyn/Makefile deleted file mode 100644 index 54be2cf4dc88..000000000000 --- a/test/nanostack/unittest/Core/buffer_dyn/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = buffer_dyn_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Core/buffer_dyn.c - -TEST_SRC_FILES = \ - main.cpp \ - buffer_dyntest.cpp \ - test_buffer_dyn.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/ip_fsc_stub.c \ - ../../stub/ns_list_stub.c\ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Core/buffer_dyn/buffer_dyntest.cpp b/test/nanostack/unittest/Core/buffer_dyn/buffer_dyntest.cpp deleted file mode 100644 index f628d7d85c83..000000000000 --- a/test/nanostack/unittest/Core/buffer_dyn/buffer_dyntest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_buffer_dyn.h" - -TEST_GROUP(buffer_dyn) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(buffer_dyn, test_buffer_get) -{ - CHECK(test_buffer_get()); -} - diff --git a/test/nanostack/unittest/Core/buffer_dyn/main.cpp b/test/nanostack/unittest/Core/buffer_dyn/main.cpp deleted file mode 100644 index 64ab6c32a3ee..000000000000 --- a/test/nanostack/unittest/Core/buffer_dyn/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(buffer_dyn); - diff --git a/test/nanostack/unittest/Core/buffer_dyn/test_buffer_dyn.c b/test/nanostack/unittest/Core/buffer_dyn/test_buffer_dyn.c deleted file mode 100644 index 00412ee04841..000000000000 --- a/test/nanostack/unittest/Core/buffer_dyn/test_buffer_dyn.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_buffer_dyn.h" -#include - - -bool test_buffer_get() -{ - if (buffer_get(1)) { - return false; - } - return true; -} - diff --git a/test/nanostack/unittest/Core/buffer_dyn/test_buffer_dyn.h b/test/nanostack/unittest/Core/buffer_dyn/test_buffer_dyn.h deleted file mode 100644 index 0a890560dc57..000000000000 --- a/test/nanostack/unittest/Core/buffer_dyn/test_buffer_dyn.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_BUFFER_DYN_H -#define TEST_BUFFER_DYN_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_buffer_get(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_BUFFER_DYN_H - diff --git a/test/nanostack/unittest/Core/socket/Makefile b/test/nanostack/unittest/Core/socket/Makefile deleted file mode 100644 index 25587cd545ba..000000000000 --- a/test/nanostack/unittest/Core/socket/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = socket_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Core/ns_socket.c - -TEST_SRC_FILES = \ - main.cpp \ - sockettest.cpp \ - test_socket.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/event_stub.c \ - ../../stub/address_stub.c \ - ../../stub/tcp_stub.c \ - ../../stub/socket_api_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/security_lib_stub.c \ - ../../stub/ip6tos_stub.c \ - ../../stub/sockbuf_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/Core/socket/main.cpp b/test/nanostack/unittest/Core/socket/main.cpp deleted file mode 100644 index 91e728d9a4e3..000000000000 --- a/test/nanostack/unittest/Core/socket/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(socket); - diff --git a/test/nanostack/unittest/Core/socket/sockettest.cpp b/test/nanostack/unittest/Core/socket/sockettest.cpp deleted file mode 100644 index b1b3394f9770..000000000000 --- a/test/nanostack/unittest/Core/socket/sockettest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_socket.h" - -TEST_GROUP(socket) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(socket, test_socket_tasklet_event_handler) -{ - CHECK(test_socket_tasklet_event_handler()); -} - diff --git a/test/nanostack/unittest/Core/socket/test_socket.c b/test/nanostack/unittest/Core/socket/test_socket.c deleted file mode 100644 index 895762e01a83..000000000000 --- a/test/nanostack/unittest/Core/socket/test_socket.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_socket.h" -#include -#include "eventOS_event.h" - - -bool test_socket_tasklet_event_handler() -{ - arm_event_s event; - event.event_type = 999; - socket_tasklet_event_handler(&event); - return true; -} - diff --git a/test/nanostack/unittest/Core/socket/test_socket.h b/test/nanostack/unittest/Core/socket/test_socket.h deleted file mode 100644 index 5623ffd519a3..000000000000 --- a/test/nanostack/unittest/Core/socket/test_socket.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_SOCKET_H -#define TEST_SOCKET_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_socket_tasklet_event_handler(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_SOCKET_H - diff --git a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/Makefile b/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/Makefile deleted file mode 100644 index 1bfdf90db6be..000000000000 --- a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = DHCPv6_Server_service_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/DHCPv6_Server/DHCPv6_Server_service.c - -TEST_SRC_FILES = \ - main.cpp \ - dhcpv6_server_servicetest.cpp \ - test_dhcpv6_server_service.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/tcp_stub.c \ - ../../stub/udp_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/address_stub.c \ - ../../stub/cudp_stub.c \ - ../../stub/event_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/libDHCPv6_server_stub.c \ - ../../stub/libDHCPv6_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/system_timer_stub.c \ - ../../stub/dhcp_service_api_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_DHCPV6_SERVER - diff --git a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/dhcpv6_server_servicetest.cpp b/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/dhcpv6_server_servicetest.cpp deleted file mode 100644 index 933b59b9bff5..000000000000 --- a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/dhcpv6_server_servicetest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_dhcpv6_server_service.h" - -TEST_GROUP(DHCPv6_Server_service) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(DHCPv6_Server_service, test_DHCPv6_server_service_tasklet) -{ - CHECK(test_DHCPv6_server_service_tasklet()); -} - diff --git a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/main.cpp b/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/main.cpp deleted file mode 100644 index f4261103ce1f..000000000000 --- a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(DHCPv6_Server_service); - diff --git a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/test_dhcpv6_server_service.c b/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/test_dhcpv6_server_service.c deleted file mode 100644 index cc5ece264753..000000000000 --- a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/test_dhcpv6_server_service.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_dhcpv6_server_service.h" -#include -#include "eventOS_event.h" - - -bool test_DHCPv6_server_service_tasklet() -{ - arm_event_s ev; - ev.event_type = 999; - DHCPv6_server_service_tasklet(&ev); - return true; -} - diff --git a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/test_dhcpv6_server_service.h b/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/test_dhcpv6_server_service.h deleted file mode 100644 index b709dfafe962..000000000000 --- a/test/nanostack/unittest/DHCPv6_Server/dhcpv6_server_service/test_dhcpv6_server_service.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_DHCPV6_SERVER_SERVICE_H -#define TEST_DHCPV6_SERVER_SERVICE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_DHCPv6_server_service_tasklet(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_DHCPV6_SERVER_SERVICE_H - diff --git a/test/nanostack/unittest/IPHC/6lowpan_iphc/6lowpan_iphctest.cpp b/test/nanostack/unittest/IPHC/6lowpan_iphc/6lowpan_iphctest.cpp deleted file mode 100644 index 1dccf298af33..000000000000 --- a/test/nanostack/unittest/IPHC/6lowpan_iphc/6lowpan_iphctest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_6lowpan_iphc.h" - -TEST_GROUP(6lowpan_iphc) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(6lowpan_iphc, test_lowpan_down) -{ - CHECK(test_lowpan_down()); -} - diff --git a/test/nanostack/unittest/IPHC/6lowpan_iphc/Makefile b/test/nanostack/unittest/IPHC/6lowpan_iphc/Makefile deleted file mode 100644 index 04874a55552a..000000000000 --- a/test/nanostack/unittest/IPHC/6lowpan_iphc/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = 6lowpan_iphc_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c - -TEST_SRC_FILES = \ - main.cpp \ - 6lowpan_iphctest.cpp \ - test_6lowpan_iphc.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/address_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_resolution_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - ../../stub/cudp_stub.c \ - ../../stub/iphc_compress_stub.c \ - ../../stub/iphc_decompress_stub.c \ - ../../stub/mesh_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/thread_routing_stub.c \ - ../../stub/lowpan_context_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/IPHC/6lowpan_iphc/main.cpp b/test/nanostack/unittest/IPHC/6lowpan_iphc/main.cpp deleted file mode 100644 index 9151fb4681f6..000000000000 --- a/test/nanostack/unittest/IPHC/6lowpan_iphc/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(6lowpan_iphc); - diff --git a/test/nanostack/unittest/IPHC/6lowpan_iphc/test_6lowpan_iphc.c b/test/nanostack/unittest/IPHC/6lowpan_iphc/test_6lowpan_iphc.c deleted file mode 100644 index 459351effe66..000000000000 --- a/test/nanostack/unittest/IPHC/6lowpan_iphc/test_6lowpan_iphc.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_6lowpan_iphc.h" -#include -#include "Core/include/ns_buffer.h" -#include "protocol_core_stub.h" - -bool test_lowpan_down() -{ - buffer_t buf; - memset(&buf, 0, sizeof(buffer_t)); - protocol_core_stub.entry_ptr = NULL; - lowpan_down(&buf); - return true; -} - diff --git a/test/nanostack/unittest/IPHC/6lowpan_iphc/test_6lowpan_iphc.h b/test/nanostack/unittest/IPHC/6lowpan_iphc/test_6lowpan_iphc.h deleted file mode 100644 index f4bf15cd9ac2..000000000000 --- a/test/nanostack/unittest/IPHC/6lowpan_iphc/test_6lowpan_iphc.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_6LOWPAN_IPHC_H -#define TEST_6LOWPAN_IPHC_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_lowpan_down(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_6LOWPAN_IPHC_H - diff --git a/test/nanostack/unittest/IPHC/iphc_compress/Makefile b/test/nanostack/unittest/IPHC/iphc_compress/Makefile deleted file mode 100644 index 11690183385c..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_compress/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = iphc_compress_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/IPHC_Decode/iphc_compress.c - -TEST_SRC_FILES = \ - main.cpp \ - iphc_compresstest.cpp \ - test_iphc_compress.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/address_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/IPHC/iphc_compress/iphc_compresstest.cpp b/test/nanostack/unittest/IPHC/iphc_compress/iphc_compresstest.cpp deleted file mode 100644 index 9d1a257b7dba..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_compress/iphc_compresstest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_iphc_compress.h" - -TEST_GROUP(iphc_compress) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(iphc_compress, test_iphc_compress) -{ - CHECK(test_iphc_compress()); -} - diff --git a/test/nanostack/unittest/IPHC/iphc_compress/main.cpp b/test/nanostack/unittest/IPHC/iphc_compress/main.cpp deleted file mode 100644 index 28d0e107c1c0..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_compress/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(iphc_compress); - diff --git a/test/nanostack/unittest/IPHC/iphc_compress/test_iphc_compress.c b/test/nanostack/unittest/IPHC/iphc_compress/test_iphc_compress.c deleted file mode 100644 index 0ac66dc13461..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_compress/test_iphc_compress.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_iphc_compress.h" -#include -#include "Core/include/ns_buffer.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "nsdynmemLIB_stub.h" - -bool test_iphc_compress() -{ - protocol_interface_info_entry_t info; - nsdynmemlib_stub.returnCounter = 1; - buffer_t buf; - memset(&buf, 0, sizeof(buffer_t)); - iphc_compress(&info, &buf, 0); - return true; -} - diff --git a/test/nanostack/unittest/IPHC/iphc_compress/test_iphc_compress.h b/test/nanostack/unittest/IPHC/iphc_compress/test_iphc_compress.h deleted file mode 100644 index e33ada5ba5eb..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_compress/test_iphc_compress.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_IPHC_COMPRESS_H -#define TEST_IPHC_COMPRESS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_iphc_compress(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_IPHC_COMPRESS_H - diff --git a/test/nanostack/unittest/IPHC/iphc_decompress/Makefile b/test/nanostack/unittest/IPHC/iphc_decompress/Makefile deleted file mode 100644 index 46bb73347126..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_decompress/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = iphc_decompress_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/IPHC_Decode/iphc_decompress.c - -TEST_SRC_FILES = \ - main.cpp \ - iphc_decompresstest.cpp \ - test_iphc_decompress.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/address_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/lowpan_context_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/IPHC/iphc_decompress/iphc_decompresstest.cpp b/test/nanostack/unittest/IPHC/iphc_decompress/iphc_decompresstest.cpp deleted file mode 100644 index 658669541c9e..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_decompress/iphc_decompresstest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_iphc_decompress.h" - -TEST_GROUP(iphc_decompress) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(iphc_decompress, test_iphc_decompress) -{ - CHECK(test_iphc_decompress()); -} - diff --git a/test/nanostack/unittest/IPHC/iphc_decompress/main.cpp b/test/nanostack/unittest/IPHC/iphc_decompress/main.cpp deleted file mode 100644 index 8b4cd9b7556c..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_decompress/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(iphc_decompress); - diff --git a/test/nanostack/unittest/IPHC/iphc_decompress/test_iphc_decompress.c b/test/nanostack/unittest/IPHC/iphc_decompress/test_iphc_decompress.c deleted file mode 100644 index 9b857711db87..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_decompress/test_iphc_decompress.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_iphc_decompress.h" -#include -#include "Core/include/ns_buffer.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "nsdynmemLIB_stub.h" - -bool test_iphc_decompress() -{ - protocol_interface_info_entry_t info; - buffer_t buf; - memset(&buf, 0, sizeof(buffer_t)); - iphc_decompress(&info, &buf); - return true; -} - diff --git a/test/nanostack/unittest/IPHC/iphc_decompress/test_iphc_decompress.h b/test/nanostack/unittest/IPHC/iphc_decompress/test_iphc_decompress.h deleted file mode 100644 index d95fca5652be..000000000000 --- a/test/nanostack/unittest/IPHC/iphc_decompress/test_iphc_decompress.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_IPHC_DECOMPRESS_H -#define TEST_IPHC_DECOMPRESS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_iphc_decompress(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_IPHC_DECOMPRESS_H - diff --git a/test/nanostack/unittest/IPHC/lowpan_context/Makefile b/test/nanostack/unittest/IPHC/lowpan_context/Makefile deleted file mode 100644 index dd5ee9466f6c..000000000000 --- a/test/nanostack/unittest/IPHC/lowpan_context/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = lowpan_context_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/IPHC_Decode/lowpan_context.c - -TEST_SRC_FILES = \ - main.cpp \ - lowpan_contexttest.cpp \ - test_lowpan_context.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/IPHC/lowpan_context/lowpan_contexttest.cpp b/test/nanostack/unittest/IPHC/lowpan_context/lowpan_contexttest.cpp deleted file mode 100644 index 9d5b937312c0..000000000000 --- a/test/nanostack/unittest/IPHC/lowpan_context/lowpan_contexttest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_lowpan_context.h" - -TEST_GROUP(lowpan_context) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(lowpan_context, test_lowpan_context_list_free) -{ - CHECK(test_lowpan_context_list_free()); -} - diff --git a/test/nanostack/unittest/IPHC/lowpan_context/main.cpp b/test/nanostack/unittest/IPHC/lowpan_context/main.cpp deleted file mode 100644 index fed195ea99df..000000000000 --- a/test/nanostack/unittest/IPHC/lowpan_context/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(lowpan_context); - diff --git a/test/nanostack/unittest/IPHC/lowpan_context/test_lowpan_context.c b/test/nanostack/unittest/IPHC/lowpan_context/test_lowpan_context.c deleted file mode 100644 index 1208fe74671a..000000000000 --- a/test/nanostack/unittest/IPHC/lowpan_context/test_lowpan_context.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_lowpan_context.h" -#include -#include "6LoWPAN/IPHC_Decode/lowpan_context.h" - -bool test_lowpan_context_list_free() -{ - lowpan_context_list_t list; - ns_list_init(&list); - lowpan_context_list_free(&list); - return true; -} - diff --git a/test/nanostack/unittest/IPHC/lowpan_context/test_lowpan_context.h b/test/nanostack/unittest/IPHC/lowpan_context/test_lowpan_context.h deleted file mode 100644 index 5cbd464f5b45..000000000000 --- a/test/nanostack/unittest/IPHC/lowpan_context/test_lowpan_context.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_LOWPAN_CONTEXT_H -#define TEST_LOWPAN_CONTEXT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_lowpan_context_list_free(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_6LOWPAN_CONTEXT_H - diff --git a/test/nanostack/unittest/Makefile b/test/nanostack/unittest/Makefile deleted file mode 100755 index e904a92443ce..000000000000 --- a/test/nanostack/unittest/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -#scan for folders having "Makefile" in them and remove 'this' to prevent loop -ifeq ($(OS),Windows_NT) -all: -clean: -else -DIRS := $(filter-out ./, $(sort $(dir $(shell find . -name 'Makefile')))) - -all: $(DIRS) - -.PHONY: $(DIRS) -$(DIRS): - make -C $@ vtest - -CLEAN-DIRS := $(foreach dir,$(DIRS),clean-$(dir)) -clean: $(CLEAN-DIRS) - rm -rf stub/*gcov stub/*gcda stubs/*o - rm -rf results/* - rm -rf coverages/* - rm -rf results - rm -rf coverages - -.PHONY: $(CLEAN-DIRS) -$(CLEAN-DIRS): - make -C $(subst clean-,,$@) clean - -endif - diff --git a/test/nanostack/unittest/MakefileWorker.mk b/test/nanostack/unittest/MakefileWorker.mk deleted file mode 100755 index 2096ced03670..000000000000 --- a/test/nanostack/unittest/MakefileWorker.mk +++ /dev/null @@ -1,562 +0,0 @@ -#--------- -# -# MakefileWorker.mk -# -# Include this helper file in your makefile -# It makes -# A static library -# A test executable -# -# See this example for parameter settings -# examples/Makefile -# -#---------- -# Inputs - these variables describe what to build -# -# INCLUDE_DIRS - Directories used to search for include files. -# This generates a -I for each directory -# SRC_DIRS - Directories containing source file to built into the library -# SRC_FILES - Specific source files to build into library. Helpful when not all code -# in a directory can be built for test (hopefully a temporary situation) -# TEST_SRC_DIRS - Directories containing unit test code build into the unit test runner -# These do not go in a library. They are explicitly included in the test runner -# TEST_SRC_FILES - Specific source files to build into the unit test runner -# These do not go in a library. They are explicitly included in the test runner -# MOCKS_SRC_DIRS - Directories containing mock source files to build into the test runner -# These do not go in a library. They are explicitly included in the test runner -#---------- -# You can adjust these variables to influence how to build the test target -# and where to put and name outputs -# See below to determine defaults -# COMPONENT_NAME - the name of the thing being built -# TEST_TARGET - name the test executable. By default it is -# $(COMPONENT_NAME)_tests -# Helpful if you want 1 > make files in the same directory with different -# executables as output. -# CPPUTEST_HOME - where CppUTest home dir found -# TARGET_PLATFORM - Influences how the outputs are generated by modifying the -# CPPUTEST_OBJS_DIR and CPPUTEST_LIB_DIR to use a sub-directory under the -# normal objs and lib directories. Also modifies where to search for the -# CPPUTEST_LIB to link against. -# CPPUTEST_OBJS_DIR - a directory where o and d files go -# CPPUTEST_LIB_DIR - a directory where libs go -# CPPUTEST_ENABLE_DEBUG - build for debug -# CPPUTEST_USE_MEM_LEAK_DETECTION - Links with overridden new and delete -# CPPUTEST_USE_STD_CPP_LIB - Set to N to keep the standard C++ library out -# of the test harness -# CPPUTEST_USE_GCOV - Turn on coverage analysis -# Clean then build with this flag set to Y, then 'make gcov' -# CPPUTEST_MAPFILE - generate a map file -# CPPUTEST_WARNINGFLAGS - overly picky by default -# OTHER_MAKEFILE_TO_INCLUDE - a hook to use this makefile to make -# other targets. Like CSlim, which is part of fitnesse -# CPPUTEST_USE_VPATH - Use Make's VPATH functionality to support user -# specification of source files and directories that aren't below -# the user's Makefile in the directory tree, like: -# SRC_DIRS += ../../lib/foo -# It defaults to N, and shouldn't be necessary except in the above case. -#---------- -# -# Other flags users can initialize to sneak in their settings -# CPPUTEST_CXXFLAGS - flags for the C++ compiler -# CPPUTEST_CPPFLAGS - flags for the C++ AND C preprocessor -# CPPUTEST_CFLAGS - flags for the C complier -# CPPUTEST_LDFLAGS - Linker flags -#---------- - -# Some behavior is weird on some platforms. Need to discover the platform. - -# Platforms -UNAME_OUTPUT = "$(shell uname -a)" -MACOSX_STR = Darwin -MINGW_STR = MINGW -CYGWIN_STR = CYGWIN -LINUX_STR = Linux -SUNOS_STR = SunOS -UNKNWOWN_OS_STR = Unknown - -# Compilers -CC_VERSION_OUTPUT ="$(shell $(CXX) -v 2>&1)" -CLANG_STR = clang -SUNSTUDIO_CXX_STR = SunStudio - -UNAME_OS = $(UNKNWOWN_OS_STR) - -ifeq ($(findstring $(MINGW_STR),$(UNAME_OUTPUT)),$(MINGW_STR)) - UNAME_OS = $(MINGW_STR) -endif - -ifeq ($(findstring $(CYGWIN_STR),$(UNAME_OUTPUT)),$(CYGWIN_STR)) - UNAME_OS = $(CYGWIN_STR) -endif - -ifeq ($(findstring $(LINUX_STR),$(UNAME_OUTPUT)),$(LINUX_STR)) - UNAME_OS = $(LINUX_STR) -endif - -ifeq ($(findstring $(MACOSX_STR),$(UNAME_OUTPUT)),$(MACOSX_STR)) - UNAME_OS = $(MACOSX_STR) -#lion has a problem with the 'v' part of -a - UNAME_OUTPUT = "$(shell uname -pmnrs)" -endif - -ifeq ($(findstring $(SUNOS_STR),$(UNAME_OUTPUT)),$(SUNOS_STR)) - UNAME_OS = $(SUNOS_STR) - - SUNSTUDIO_CXX_ERR_STR = CC -flags -ifeq ($(findstring $(SUNSTUDIO_CXX_ERR_STR),$(CC_VERSION_OUTPUT)),$(SUNSTUDIO_CXX_ERR_STR)) - CC_VERSION_OUTPUT ="$(shell $(CXX) -V 2>&1)" - COMPILER_NAME = $(SUNSTUDIO_CXX_STR) -endif -endif - -ifeq ($(findstring $(CLANG_STR),$(CC_VERSION_OUTPUT)),$(CLANG_STR)) - COMPILER_NAME = $(CLANG_STR) -endif - -#Kludge for mingw, it does not have cc.exe, but gcc.exe will do -ifeq ($(UNAME_OS),$(MINGW_STR)) - CC := gcc -endif - -#And another kludge. Exception handling in gcc 4.6.2 is broken when linking the -# Standard C++ library as a shared library. Unbelievable. -ifeq ($(UNAME_OS),$(MINGW_STR)) - CPPUTEST_LDFLAGS += -static -endif -ifeq ($(UNAME_OS),$(CYGWIN_STR)) - CPPUTEST_LDFLAGS += -static -endif - - -#Kludge for MacOsX gcc compiler on Darwin9 who can't handle pendantic -ifeq ($(UNAME_OS),$(MACOSX_STR)) -ifeq ($(findstring Version 9,$(UNAME_OUTPUT)),Version 9) - CPPUTEST_PEDANTIC_ERRORS = N -endif -endif - -ifndef COMPONENT_NAME - COMPONENT_NAME = name_this_in_the_makefile -endif - -# Debug on by default -ifndef CPPUTEST_ENABLE_DEBUG - CPPUTEST_ENABLE_DEBUG = Y -endif - -# new and delete for memory leak detection on by default -ifndef CPPUTEST_USE_MEM_LEAK_DETECTION - CPPUTEST_USE_MEM_LEAK_DETECTION = Y -endif - -# Use the standard C library -ifndef CPPUTEST_USE_STD_C_LIB - CPPUTEST_USE_STD_C_LIB = Y -endif - -# Use the standard C++ library -ifndef CPPUTEST_USE_STD_CPP_LIB - CPPUTEST_USE_STD_CPP_LIB = Y -endif - -# Use gcov, off by default -ifndef CPPUTEST_USE_GCOV - CPPUTEST_USE_GCOV = N -endif - -ifndef CPPUTEST_PEDANTIC_ERRORS - CPPUTEST_PEDANTIC_ERRORS = Y -endif - -# Default warnings -ifndef CPPUTEST_WARNINGFLAGS - CPPUTEST_WARNINGFLAGS = -Wall -Wextra -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -ifeq ($(CPPUTEST_PEDANTIC_ERRORS), Y) -# CPPUTEST_WARNINGFLAGS += -pedantic-errors - CPPUTEST_WARNINGFLAGS += -pedantic -endif -ifeq ($(UNAME_OS),$(LINUX_STR)) - CPPUTEST_WARNINGFLAGS += -Wsign-conversion -endif - CPPUTEST_CXX_WARNINGFLAGS = -Woverloaded-virtual - CPPUTEST_C_WARNINGFLAGS = -Wstrict-prototypes -endif - -#Wonderful extra compiler warnings with clang -ifeq ($(COMPILER_NAME),$(CLANG_STR)) -# -Wno-disabled-macro-expansion -> Have to disable the macro expansion warning as the operator new overload warns on that. -# -Wno-padded -> I sort-of like this warning but if there is a bool at the end of the class, it seems impossible to remove it! (except by making padding explicit) -# -Wno-global-constructors Wno-exit-time-destructors -> Great warnings, but in CppUTest it is impossible to avoid as the automatic test registration depends on the global ctor and dtor -# -Wno-weak-vtables -> The TEST_GROUP macro declares a class and will automatically inline its methods. Thats ok as they are only in one translation unit. Unfortunately, the warning can't detect that, so it must be disabled. - CPPUTEST_CXX_WARNINGFLAGS += -Weverything -Wno-disabled-macro-expansion -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables - CPPUTEST_C_WARNINGFLAGS += -Weverything -Wno-padded -endif - -# Uhm. Maybe put some warning flags for SunStudio here? -ifeq ($(COMPILER_NAME),$(SUNSTUDIO_CXX_STR)) - CPPUTEST_CXX_WARNINGFLAGS = - CPPUTEST_C_WARNINGFLAGS = -endif - -# Default dir for temporary files (d, o) -ifndef CPPUTEST_OBJS_DIR -ifndef TARGET_PLATFORM - CPPUTEST_OBJS_DIR = objs -else - CPPUTEST_OBJS_DIR = objs/$(TARGET_PLATFORM) -endif -endif - -# Default dir for the outout library -ifndef CPPUTEST_LIB_DIR -ifndef TARGET_PLATFORM - CPPUTEST_LIB_DIR = lib -else - CPPUTEST_LIB_DIR = lib/$(TARGET_PLATFORM) -endif -endif - -# No map by default -ifndef CPPUTEST_MAP_FILE - CPPUTEST_MAP_FILE = N -endif - -# No extentions is default -ifndef CPPUTEST_USE_EXTENSIONS - CPPUTEST_USE_EXTENSIONS = N -endif - -# No VPATH is default -ifndef CPPUTEST_USE_VPATH - CPPUTEST_USE_VPATH := N -endif -# Make empty, instead of 'N', for usage in $(if ) conditionals -ifneq ($(CPPUTEST_USE_VPATH), Y) - CPPUTEST_USE_VPATH := -endif - -ifndef TARGET_PLATFORM -#CPPUTEST_LIB_LINK_DIR = $(CPPUTEST_HOME)/lib -CPPUTEST_LIB_LINK_DIR = /usr/lib/x86_64-linux-gnu -else -CPPUTEST_LIB_LINK_DIR = $(CPPUTEST_HOME)/lib/$(TARGET_PLATFORM) -endif - -# -------------------------------------- -# derived flags in the following area -# -------------------------------------- - -# Without the C library, we'll need to disable the C++ library and ... -ifeq ($(CPPUTEST_USE_STD_C_LIB), N) - CPPUTEST_USE_STD_CPP_LIB = N - CPPUTEST_USE_MEM_LEAK_DETECTION = N - CPPUTEST_CPPFLAGS += -DCPPUTEST_STD_C_LIB_DISABLED - CPPUTEST_CPPFLAGS += -nostdinc -endif - -CPPUTEST_CPPFLAGS += -DCPPUTEST_COMPILATION - -ifeq ($(CPPUTEST_USE_MEM_LEAK_DETECTION), N) - CPPUTEST_CPPFLAGS += -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED -else - ifndef CPPUTEST_MEMLEAK_DETECTOR_NEW_MACRO_FILE - CPPUTEST_MEMLEAK_DETECTOR_NEW_MACRO_FILE = -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorNewMacros.h - endif - ifndef CPPUTEST_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE - CPPUTEST_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE = -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorMallocMacros.h - endif -endif - -ifeq ($(CPPUTEST_ENABLE_DEBUG), Y) - CPPUTEST_CXXFLAGS += -g - CPPUTEST_CFLAGS += -g - CPPUTEST_LDFLAGS += -g -endif - -ifeq ($(CPPUTEST_USE_STD_CPP_LIB), N) - CPPUTEST_CPPFLAGS += -DCPPUTEST_STD_CPP_LIB_DISABLED -ifeq ($(CPPUTEST_USE_STD_C_LIB), Y) - CPPUTEST_CXXFLAGS += -nostdinc++ -endif -endif - -ifdef $(GMOCK_HOME) - GTEST_HOME = $(GMOCK_HOME)/gtest - CPPUTEST_CPPFLAGS += -I$(GMOCK_HOME)/include - GMOCK_LIBRARY = $(GMOCK_HOME)/lib/.libs/libgmock.a - LD_LIBRARIES += $(GMOCK_LIBRARY) - CPPUTEST_CPPFLAGS += -DINCLUDE_GTEST_TESTS - CPPUTEST_WARNINGFLAGS = - CPPUTEST_CPPFLAGS += -I$(GTEST_HOME)/include -I$(GTEST_HOME) - GTEST_LIBRARY = $(GTEST_HOME)/lib/.libs/libgtest.a - LD_LIBRARIES += $(GTEST_LIBRARY) -endif - - -ifeq ($(CPPUTEST_USE_GCOV), Y) - CPPUTEST_CXXFLAGS += -fprofile-arcs -ftest-coverage - CPPUTEST_CFLAGS += -fprofile-arcs -ftest-coverage -endif - -CPPUTEST_CXXFLAGS += $(CPPUTEST_WARNINGFLAGS) $(CPPUTEST_CXX_WARNINGFLAGS) -CPPUTEST_CPPFLAGS += $(CPPUTEST_WARNINGFLAGS) -CPPUTEST_CXXFLAGS += $(CPPUTEST_MEMLEAK_DETECTOR_NEW_MACRO_FILE) -CPPUTEST_CPPFLAGS += $(CPPUTEST_MEMLEAK_DETECTOR_MALLOC_MACRO_FILE) -CPPUTEST_CFLAGS += $(CPPUTEST_C_WARNINGFLAGS) - -TARGET_MAP = $(COMPONENT_NAME).map.txt -ifeq ($(CPPUTEST_MAP_FILE), Y) - CPPUTEST_LDFLAGS += -Wl,-map,$(TARGET_MAP) -endif - -# Link with CppUTest lib -CPPUTEST_LIB = $(CPPUTEST_LIB_LINK_DIR)/libCppUTest.a - -ifeq ($(CPPUTEST_USE_EXTENSIONS), Y) -CPPUTEST_LIB += $(CPPUTEST_LIB_LINK_DIR)/libCppUTestExt.a -endif - -ifdef CPPUTEST_STATIC_REALTIME - LD_LIBRARIES += -lrt -endif - -TARGET_LIB = \ - $(CPPUTEST_LIB_DIR)/lib$(COMPONENT_NAME).a - -ifndef TEST_TARGET - ifndef TARGET_PLATFORM - TEST_TARGET = $(COMPONENT_NAME)_tests - else - TEST_TARGET = $(COMPONENT_NAME)_$(TARGET_PLATFORM)_tests - endif -endif - -#Helper Functions -get_src_from_dir = $(wildcard $1/*.cpp) $(wildcard $1/*.cc) $(wildcard $1/*.c) -get_dirs_from_dirspec = $(wildcard $1) -get_src_from_dir_list = $(foreach dir, $1, $(call get_src_from_dir,$(dir))) -__src_to = $(subst .c,$1, $(subst .cc,$1, $(subst .cpp,$1,$(if $(CPPUTEST_USE_VPATH),$(notdir $2),$2)))) -src_to = $(addprefix $(CPPUTEST_OBJS_DIR)/,$(call __src_to,$1,$2)) -src_to_o = $(call src_to,.o,$1) -src_to_d = $(call src_to,.d,$1) -src_to_gcda = $(call src_to,.gcda,$1) -src_to_gcno = $(call src_to,.gcno,$1) -time = $(shell date +%s) -delta_t = $(eval minus, $1, $2) -debug_print_list = $(foreach word,$1,echo " $(word)";) echo; - -#Derived -STUFF_TO_CLEAN += $(TEST_TARGET) $(TEST_TARGET).exe $(TARGET_LIB) $(TARGET_MAP) - -SRC += $(call get_src_from_dir_list, $(SRC_DIRS)) $(SRC_FILES) -OBJ = $(call src_to_o,$(SRC)) - -STUFF_TO_CLEAN += $(OBJ) - -TEST_SRC += $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) $(TEST_SRC_FILES) -TEST_OBJS = $(call src_to_o,$(TEST_SRC)) -STUFF_TO_CLEAN += $(TEST_OBJS) - - -MOCKS_SRC += $(call get_src_from_dir_list, $(MOCKS_SRC_DIRS)) -MOCKS_OBJS = $(call src_to_o,$(MOCKS_SRC)) -STUFF_TO_CLEAN += $(MOCKS_OBJS) - -ALL_SRC = $(SRC) $(TEST_SRC) $(MOCKS_SRC) - -# If we're using VPATH -ifeq ($(CPPUTEST_USE_VPATH), Y) -# gather all the source directories and add them - VPATH += $(sort $(dir $(ALL_SRC))) -# Add the component name to the objs dir path, to differentiate between same-name objects - CPPUTEST_OBJS_DIR := $(addsuffix /$(COMPONENT_NAME),$(CPPUTEST_OBJS_DIR)) -endif - -#Test coverage with gcov -GCOV_OUTPUT = gcov_output.txt -GCOV_REPORT = gcov_report.txt -GCOV_ERROR = gcov_error.txt -GCOV_GCDA_FILES = $(call src_to_gcda, $(ALL_SRC)) -GCOV_GCNO_FILES = $(call src_to_gcno, $(ALL_SRC)) -TEST_OUTPUT = $(TEST_TARGET).txt -STUFF_TO_CLEAN += \ - $(GCOV_OUTPUT)\ - $(GCOV_REPORT)\ - $(GCOV_REPORT).html\ - $(GCOV_ERROR)\ - $(GCOV_GCDA_FILES)\ - $(GCOV_GCNO_FILES)\ - $(TEST_OUTPUT) - -#The gcda files for gcov need to be deleted before each run -#To avoid annoying messages. -GCOV_CLEAN = $(SILENCE)rm -f $(GCOV_GCDA_FILES) $(GCOV_OUTPUT) $(GCOV_REPORT) $(GCOV_ERROR) -RUN_TEST_TARGET = $(SILENCE) $(GCOV_CLEAN) ; echo "Running $(TEST_TARGET)"; ./$(TEST_TARGET) $(CPPUTEST_EXE_FLAGS) -ojunit - -ifeq ($(CPPUTEST_USE_GCOV), Y) - - ifeq ($(COMPILER_NAME),$(CLANG_STR)) - LD_LIBRARIES += --coverage - else - LD_LIBRARIES += -lgcov - endif -endif - - -INCLUDES_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(INCLUDE_DIRS)) -INCLUDES += $(foreach dir, $(INCLUDES_DIRS_EXPANDED), -I$(dir)) -MOCK_DIRS_EXPANDED = $(call get_dirs_from_dirspec, $(MOCKS_SRC_DIRS)) -INCLUDES += $(foreach dir, $(MOCK_DIRS_EXPANDED), -I$(dir)) - -CPPUTEST_CPPFLAGS += $(INCLUDES) $(CPPUTESTFLAGS) - -DEP_FILES = $(call src_to_d, $(ALL_SRC)) -STUFF_TO_CLEAN += $(DEP_FILES) $(PRODUCTION_CODE_START) $(PRODUCTION_CODE_END) -STUFF_TO_CLEAN += $(STDLIB_CODE_START) $(MAP_FILE) cpputest_*.xml junit_run_output - -# We'll use the CPPUTEST_CFLAGS etc so that you can override AND add to the CppUTest flags -CFLAGS = $(CPPUTEST_CFLAGS) $(CPPUTEST_ADDITIONAL_CFLAGS) -CPPFLAGS = $(CPPUTEST_CPPFLAGS) $(CPPUTEST_ADDITIONAL_CPPFLAGS) -CXXFLAGS = $(CPPUTEST_CXXFLAGS) $(CPPUTEST_ADDITIONAL_CXXFLAGS) -LDFLAGS = $(CPPUTEST_LDFLAGS) $(CPPUTEST_ADDITIONAL_LDFLAGS) - -# Don't consider creating the archive a warning condition that does STDERR output -ARFLAGS := $(ARFLAGS)c - -DEP_FLAGS=-MMD -MP - -# Some macros for programs to be overridden. For some reason, these are not in Make defaults -RANLIB = ranlib - -# Targets - -.PHONY: all -all: start $(TEST_TARGET) - $(RUN_TEST_TARGET) - -.PHONY: start -start: $(TEST_TARGET) - $(SILENCE)START_TIME=$(call time) - -.PHONY: all_no_tests -all_no_tests: $(TEST_TARGET) - -.PHONY: flags -flags: - @echo - @echo "OS ${UNAME_OS}" - @echo "Compile C and C++ source with CPPFLAGS:" - @$(call debug_print_list,$(CPPFLAGS)) - @echo "Compile C++ source with CXXFLAGS:" - @$(call debug_print_list,$(CXXFLAGS)) - @echo "Compile C source with CFLAGS:" - @$(call debug_print_list,$(CFLAGS)) - @echo "Link with LDFLAGS:" - @$(call debug_print_list,$(LDFLAGS)) - @echo "Link with LD_LIBRARIES:" - @$(call debug_print_list,$(LD_LIBRARIES)) - @echo "Create libraries with ARFLAGS:" - @$(call debug_print_list,$(ARFLAGS)) - -TEST_DEPS = $(TEST_OBJS) $(MOCKS_OBJS) $(PRODUCTION_CODE_START) $(TARGET_LIB) $(USER_LIBS) $(PRODUCTION_CODE_END) $(CPPUTEST_LIB) $(STDLIB_CODE_START) -test-deps: $(TEST_DEPS) - -$(TEST_TARGET): $(TEST_DEPS) - @echo Linking $@ - $(SILENCE)$(CXX) -o $@ $^ $(LD_LIBRARIES) $(LDFLAGS) - -$(TARGET_LIB): $(OBJ) - @echo Building archive $@ - $(SILENCE)mkdir -p $(dir $@) - $(SILENCE)$(AR) $(ARFLAGS) $@ $^ - $(SILENCE)$(RANLIB) $@ - -test: $(TEST_TARGET) - $(RUN_TEST_TARGET) | tee $(TEST_OUTPUT) - -vtest: $(TEST_TARGET) - $(RUN_TEST_TARGET) -v | tee $(TEST_OUTPUT) - -$(CPPUTEST_OBJS_DIR)/%.o: %.cc - @echo compiling $(notdir $<) - $(SILENCE)mkdir -p $(dir $@) - $(SILENCE)$(COMPILE.cpp) $(DEP_FLAGS) $(OUTPUT_OPTION) $< - -$(CPPUTEST_OBJS_DIR)/%.o: %.cpp - @echo compiling $(notdir $<) - $(SILENCE)mkdir -p $(dir $@) - $(SILENCE)$(COMPILE.cpp) $(DEP_FLAGS) $(OUTPUT_OPTION) $< - -$(CPPUTEST_OBJS_DIR)/%.o: %.c - @echo compiling $(notdir $<) - $(SILENCE)mkdir -p $(dir $@) - $(SILENCE)$(COMPILE.c) $(DEP_FLAGS) $(OUTPUT_OPTION) $< - -ifneq "$(MAKECMDGOALS)" "clean" --include $(DEP_FILES) -endif - -.PHONY: clean -clean: - @echo Making clean - $(SILENCE)$(RM) $(STUFF_TO_CLEAN) - $(SILENCE)rm -rf gcov objs #$(CPPUTEST_OBJS_DIR) - $(SILENCE)rm -rf $(CPPUTEST_LIB_DIR) - $(SILENCE)find . -name "*.gcno" | xargs rm -f - $(SILENCE)find . -name "*.gcda" | xargs rm -f - -#realclean gets rid of all gcov, o and d files in the directory tree -#not just the ones made by this makefile -.PHONY: realclean -realclean: clean - $(SILENCE)rm -rf gcov - $(SILENCE)find . -name "*.gdcno" | xargs rm -f - $(SILENCE)find . -name "*.[do]" | xargs rm -f - -gcov: test -ifeq ($(CPPUTEST_USE_VPATH), Y) - $(SILENCE)gcov --object-directory $(CPPUTEST_OBJS_DIR) $(SRC) >> $(GCOV_OUTPUT) 2>> $(GCOV_ERROR) -else - $(SILENCE)for d in $(SRC_DIRS) ; do \ - gcov --object-directory $(CPPUTEST_OBJS_DIR)/$$d $$d/*.c $$d/*.cpp >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ - done - $(SILENCE)for f in $(SRC_FILES) ; do \ - gcov --object-directory $(CPPUTEST_OBJS_DIR)/$$f $$f >> $(GCOV_OUTPUT) 2>>$(GCOV_ERROR) ; \ - done -endif -# $(CPPUTEST_HOME)/scripts/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) - /usr/share/cpputest/scripts/filterGcov.sh $(GCOV_OUTPUT) $(GCOV_ERROR) $(GCOV_REPORT) $(TEST_OUTPUT) - $(SILENCE)cat $(GCOV_REPORT) - $(SILENCE)mkdir -p gcov - $(SILENCE)mv *.gcov gcov - $(SILENCE)mv gcov_* gcov - @echo "See gcov directory for details" - -.PHONEY: format -format: - $(CPPUTEST_HOME)/scripts/reformat.sh $(PROJECT_HOME_DIR) - -.PHONEY: debug -debug: - @echo - @echo "Target Source files:" - @$(call debug_print_list,$(SRC)) - @echo "Target Object files:" - @$(call debug_print_list,$(OBJ)) - @echo "Test Source files:" - @$(call debug_print_list,$(TEST_SRC)) - @echo "Test Object files:" - @$(call debug_print_list,$(TEST_OBJS)) - @echo "Mock Source files:" - @$(call debug_print_list,$(MOCKS_SRC)) - @echo "Mock Object files:" - @$(call debug_print_list,$(MOCKS_OBJS)) - @echo "All Input Dependency files:" - @$(call debug_print_list,$(DEP_FILES)) - @echo Stuff to clean: - @$(call debug_print_list,$(STUFF_TO_CLEAN)) - @echo Includes: - @$(call debug_print_list,$(INCLUDES)) - --include $(OTHER_MAKEFILE_TO_INCLUDE) diff --git a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/Makefile b/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/Makefile deleted file mode 100644 index 325a0538a61b..000000000000 --- a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = ipv6_routing_table_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/ipv6_stack/ipv6_routing_table.c - -TEST_SRC_FILES = \ - main.cpp \ - ipv6_routing_tabletest.cpp \ - test_ipv6_routing_table.c \ - ../../stub/ns_list_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ipv6_resolution_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/address_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/ip6tos_stub.c \ - ../../stub/protocol_core_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/ipv6_routing_tabletest.cpp b/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/ipv6_routing_tabletest.cpp deleted file mode 100644 index c29aa87d34b2..000000000000 --- a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/ipv6_routing_tabletest.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_ipv6_routing_table.h" - -TEST_GROUP(ipv6_routing_table) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(ipv6_routing_table, test_ipv6_neighbour_cache_init) -{ - CHECK(test_ipv6_neighbour_cache_init()); -} - -TEST(ipv6_routing_table, test_ipv6_route_table_set_max_entries) -{ - CHECK(test_ipv6_route_table_set_max_entries()); -} diff --git a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/main.cpp b/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/main.cpp deleted file mode 100644 index d295578ae767..000000000000 --- a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(ipv6_routing_table); - diff --git a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/test_ipv6_routing_table.c b/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/test_ipv6_routing_table.c deleted file mode 100644 index 1598778f2e3b..000000000000 --- a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/test_ipv6_routing_table.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "test_ipv6_routing_table.h" -#include -#include "ipv6_stack/ipv6_routing_table.h" -#include "ipv6_resolution_stub.h" - - -bool test_ipv6_neighbour_cache_init() -{ - ipv6_neighbour_cache_t entry; - ns_list_init(&entry.list); - ipv6_neighbour_cache_init(&entry, 0); - return true; -} - - -bool test_ipv6_route_table_set_max_entries() -{ - bool ret_val; - - ipv6_neighbour_cache_t ipv6_neighbour_cache; - memset(&ipv6_neighbour_cache, 0, sizeof(ipv6_neighbour_cache_t)); - - ipv6_resolution_stub.ipv6_neighbour_cache = &ipv6_neighbour_cache; - - // 1st interface - ipv6_route_table_set_max_entries(1, ROUTE_RADV, 5); - - if (ipv6_neighbour_cache.route_if_info.sources[ROUTE_RADV] != 5 || - ipv6_resolution_stub.uint8_input_value != 1) { - return false; - } - memset(&ipv6_neighbour_cache, 0, sizeof(ipv6_neighbour_cache_t)); - - // 2nd interface - ipv6_route_table_set_max_entries(2, ROUTE_REDIRECT, 255); - if (ipv6_neighbour_cache.route_if_info.sources[ROUTE_REDIRECT] != 255 || - ipv6_resolution_stub.uint8_input_value != 2) { - return false; - } - memset(&ipv6_neighbour_cache, 0, sizeof(ipv6_neighbour_cache_t)); - - ipv6_resolution_stub.ipv6_neighbour_cache = NULL; - // No interface - ipv6_route_table_set_max_entries(3, ROUTE_RADV, 7); - - // 3nd interface - ipv6_resolution_stub.ipv6_neighbour_cache = &ipv6_neighbour_cache; - ipv6_route_table_set_max_entries(3, ROUTE_USER, 75); - if (ipv6_neighbour_cache.route_if_info.sources[ROUTE_USER] != 75 || - ipv6_resolution_stub.uint8_input_value != 3) { - return false; - } - memset(&ipv6_neighbour_cache, 0, sizeof(ipv6_neighbour_cache_t)); - - return true; -} diff --git a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/test_ipv6_routing_table.h b/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/test_ipv6_routing_table.h deleted file mode 100644 index cbffaf328044..000000000000 --- a/test/nanostack/unittest/ipv6_stack/ipv6_routing_table/test_ipv6_routing_table.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_IPV6_ROUTING_TABLE_H -#define TEST_IPV6_ROUTING_TABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_ipv6_neighbour_cache_init(); -bool test_ipv6_route_table_set_max_entries(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_IPV6_ROUTING_TABLE_H - diff --git a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/Makefile b/test/nanostack/unittest/ipv6_stack/protocol_ipv6/Makefile deleted file mode 100644 index eef49b1c2689..000000000000 --- a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = protocol_ipv6_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/ipv6_stack/protocol_ipv6.c - -TEST_SRC_FILES = \ - main.cpp \ - protocol_ipv6test.cpp \ - test_protocol_ipv6.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/tcp_stub.c \ - ../../stub/udp_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/address_stub.c \ - ../../stub/cudp_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/icmpv6_radv_stub.c \ - ../../stub/icmpv6_prefix_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/whiteboard_stub.c \ - ../../stub/nd_proxy_stub.c \ - ../../stub/ipv6_resolution_stub.c \ - ../../stub/neighbor_cache_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_ETHERNET - diff --git a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/main.cpp b/test/nanostack/unittest/ipv6_stack/protocol_ipv6/main.cpp deleted file mode 100644 index f79382b48998..000000000000 --- a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(protocol_ipv6); - diff --git a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/protocol_ipv6test.cpp b/test/nanostack/unittest/ipv6_stack/protocol_ipv6/protocol_ipv6test.cpp deleted file mode 100644 index fa7b147afe95..000000000000 --- a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/protocol_ipv6test.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_protocol_ipv6.h" - -TEST_GROUP(protocol_ipv6) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(protocol_ipv6, test_ipv6_interface_phy_sap_register) -{ - CHECK(test_ipv6_interface_phy_sap_register()); -} - diff --git a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/test_protocol_ipv6.c b/test/nanostack/unittest/ipv6_stack/protocol_ipv6/test_protocol_ipv6.c deleted file mode 100644 index 805673d30fa9..000000000000 --- a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/test_protocol_ipv6.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_protocol_ipv6.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" - -bool test_ipv6_interface_phy_sap_register() -{ - protocol_interface_info_entry_t info; - info.eth_mac_api = NULL; - ipv6_interface_phy_sap_register(&info); - return true; -} - diff --git a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/test_protocol_ipv6.h b/test/nanostack/unittest/ipv6_stack/protocol_ipv6/test_protocol_ipv6.h deleted file mode 100644 index 37a12f44edac..000000000000 --- a/test/nanostack/unittest/ipv6_stack/protocol_ipv6/test_protocol_ipv6.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PROTOCOL_IPV6_H -#define TEST_PROTOCOL_IPV6_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_ipv6_interface_phy_sap_register(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PROTOCOL_IPV6_H - diff --git a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/Makefile b/test/nanostack/unittest/libDHCPv6/dhcp_service_api/Makefile deleted file mode 100644 index cbfda90bd716..000000000000 --- a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = dhcp_service_api_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/libDHCPv6/dhcp_service_api.c - -TEST_SRC_FILES = \ - main.cpp \ - dhcp_service_apitest.cpp \ - test_dhcp_service_api.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/socket_api_stub.c \ - ../../stub/event_stub.c \ - ../../stub/system_timer_stub.c \ - ../../stub/libDHCPv6_stub.c \ - ../../stub/protocol_core_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_DHCPV6 - diff --git a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/dhcp_service_apitest.cpp b/test/nanostack/unittest/libDHCPv6/dhcp_service_api/dhcp_service_apitest.cpp deleted file mode 100644 index cfe4f1d29ef1..000000000000 --- a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/dhcp_service_apitest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_dhcp_service_api.h" - -TEST_GROUP(dhcp_service_api) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(dhcp_service_api, test_dhcp_service_allocate) -{ - CHECK(test_dhcp_service_allocate()); -} - diff --git a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/main.cpp b/test/nanostack/unittest/libDHCPv6/dhcp_service_api/main.cpp deleted file mode 100644 index d7da425eca7a..000000000000 --- a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(dhcp_service_api); - diff --git a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/test_dhcp_service_api.c b/test/nanostack/unittest/libDHCPv6/dhcp_service_api/test_dhcp_service_api.c deleted file mode 100644 index 9eaa8e3882ba..000000000000 --- a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/test_dhcp_service_api.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_dhcp_service_api.h" -#include - - -bool test_dhcp_service_allocate() -{ - if( dhcp_service_allocate() ) { - return false; - } - - return true; -} - diff --git a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/test_dhcp_service_api.h b/test/nanostack/unittest/libDHCPv6/dhcp_service_api/test_dhcp_service_api.h deleted file mode 100644 index a737da933194..000000000000 --- a/test/nanostack/unittest/libDHCPv6/dhcp_service_api/test_dhcp_service_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_DHCP_SERVICE_API_H -#define TEST_DHCP_SERVICE_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_dhcp_service_allocate(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_DHCP_SERVICE_API_H - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6/Makefile b/test/nanostack/unittest/libDHCPv6/libdhcpv6/Makefile deleted file mode 100644 index 9ff7603a9fd7..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = libDHCPv6_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/libDHCPv6/libDHCPv6.c - -TEST_SRC_FILES = \ - main.cpp \ - libdhcpv6test.cpp \ - test_libdhcpv6.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_DHCPV6 - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6/libdhcpv6test.cpp b/test/nanostack/unittest/libDHCPv6/libdhcpv6/libdhcpv6test.cpp deleted file mode 100644 index 06c8f1a091dd..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6/libdhcpv6test.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_libdhcpv6.h" - -TEST_GROUP(libDHCPv6) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(libDHCPv6, test_libdhcpv6_txid_get) -{ - CHECK(test_libdhcpv6_txid_get()); -} - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6/main.cpp b/test/nanostack/unittest/libDHCPv6/libdhcpv6/main.cpp deleted file mode 100644 index 6297facb6b9a..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(libDHCPv6); - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6/test_libdhcpv6.c b/test/nanostack/unittest/libDHCPv6/libdhcpv6/test_libdhcpv6.c deleted file mode 100644 index 80a9cefd8210..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6/test_libdhcpv6.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_libdhcpv6.h" -#include - - -bool test_libdhcpv6_txid_get() -{ - libdhcpv6_txid_get(); - return true; -} - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6/test_libdhcpv6.h b/test/nanostack/unittest/libDHCPv6/libdhcpv6/test_libdhcpv6.h deleted file mode 100644 index 6f231a8bf82f..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6/test_libdhcpv6.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_LIBDHCPV6_H -#define TEST_LIBDHCPV6_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_libdhcpv6_txid_get(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_LIBDHCPV6_H - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/Makefile b/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/Makefile deleted file mode 100644 index ba2dadd862ae..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = libDHCPv6_server_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/libDHCPv6/libDHCPv6_server.c - -TEST_SRC_FILES = \ - main.cpp \ - libdhcpv6_servertest.cpp \ - test_libdhcpv6_server.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_DHCPV6 - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/libdhcpv6_servertest.cpp b/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/libdhcpv6_servertest.cpp deleted file mode 100644 index d7bcc4121a96..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/libdhcpv6_servertest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_libdhcpv6_server.h" - -TEST_GROUP(libDHCPv6_server) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(libDHCPv6_server, test_libdhcpv6_gua_servers_time_update) -{ - CHECK(test_libdhcpv6_gua_servers_time_update()); -} - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/main.cpp b/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/main.cpp deleted file mode 100644 index 425c14af34b7..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(libDHCPv6_server); - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/test_libdhcpv6_server.c b/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/test_libdhcpv6_server.c deleted file mode 100644 index 0c1b6e19e7f8..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/test_libdhcpv6_server.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_libdhcpv6_server.h" -#include - - -bool test_libdhcpv6_gua_servers_time_update() -{ - libdhcpv6_gua_servers_time_update(0); - return true; -} - diff --git a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/test_libdhcpv6_server.h b/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/test_libdhcpv6_server.h deleted file mode 100644 index 930aa30c1ac1..000000000000 --- a/test/nanostack/unittest/libDHCPv6/libdhcpv6_server/test_libdhcpv6_server.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_LIBDHCPV6_SERVER_H -#define TEST_LIBDHCPV6_SERVER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_libdhcpv6_gua_servers_time_update(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_LIBDHCPV6_SERVER_H - diff --git a/test/nanostack/unittest/libNET/net/Makefile b/test/nanostack/unittest/libNET/net/Makefile deleted file mode 100644 index 57e22f4173c0..000000000000 --- a/test/nanostack/unittest/libNET/net/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = net_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/libNET/src/ns_net.c - -TEST_SRC_FILES = \ - main.cpp \ - nettest.cpp \ - test_net.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/address_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/rpl_data_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/beacon_handler_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/event_stub.c \ - ../../stub/thread_management_if_stub.c \ - ../../stub/thread_bootstrap_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - ../../stub/rpl_mrhof_stub.c \ - ../../stub/rpl_of0_stub.c \ - ../../stub/network_lib_stub.c \ - ../../stub/pana_stub.c \ - ../../stub/pana_server_stub.c \ - ../../stub/pana_client_stub.c \ - ../../stub/socket_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/libNET/net/main.cpp b/test/nanostack/unittest/libNET/net/main.cpp deleted file mode 100644 index 41908314a30d..000000000000 --- a/test/nanostack/unittest/libNET/net/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(net); - diff --git a/test/nanostack/unittest/libNET/net/nettest.cpp b/test/nanostack/unittest/libNET/net/nettest.cpp deleted file mode 100644 index 7049b52182ba..000000000000 --- a/test/nanostack/unittest/libNET/net/nettest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_net.h" - -TEST_GROUP(net) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(net, test_arm_net_energy_scan) -{ - CHECK(test_arm_net_energy_scan()); -} - diff --git a/test/nanostack/unittest/libNET/net/test_net.c b/test/nanostack/unittest/libNET/net/test_net.c deleted file mode 100644 index 2639bfe12c2f..000000000000 --- a/test/nanostack/unittest/libNET/net/test_net.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_net.h" -#include - - -bool test_arm_net_energy_scan() -{ - arm_net_energy_scan(0); - return true; -} - diff --git a/test/nanostack/unittest/libNET/net/test_net.h b/test/nanostack/unittest/libNET/net/test_net.h deleted file mode 100644 index 4ba29c267637..000000000000 --- a/test/nanostack/unittest/libNET/net/test_net.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_NET_H -#define TEST_NET_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_arm_net_energy_scan(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_NET_H - diff --git a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/Makefile b/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/Makefile deleted file mode 100644 index e422ca245f98..000000000000 --- a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = net_6lowpan_parameter_api_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/libNET/src/net_6lowpan_parameter_api.c - -TEST_SRC_FILES = \ - main.cpp \ - net_6lowpan_parameter_apitest.cpp \ - test_net_6lowpan_parameter_api.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/nd_router_object_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_6LOWPAN_ND - diff --git a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/main.cpp b/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/main.cpp deleted file mode 100644 index e5d25fc64612..000000000000 --- a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(net_6lowpan_parameter_api); - diff --git a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/net_6lowpan_parameter_apitest.cpp b/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/net_6lowpan_parameter_apitest.cpp deleted file mode 100644 index eee1e78fe4bd..000000000000 --- a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/net_6lowpan_parameter_apitest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_net_6lowpan_parameter_api.h" - -TEST_GROUP(net_6lowpan_parameter_api) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(net_6lowpan_parameter_api, test_net_6lowpan_nd_timer_base_tick_set) -{ - CHECK(test_net_6lowpan_nd_timer_base_tick_set()); -} - diff --git a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/test_net_6lowpan_parameter_api.c b/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/test_net_6lowpan_parameter_api.c deleted file mode 100644 index d0296e5a1266..000000000000 --- a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/test_net_6lowpan_parameter_api.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_net_6lowpan_parameter_api.h" -#include - - -bool test_net_6lowpan_nd_timer_base_tick_set() -{ - if( -1 != net_6lowpan_nd_timer_base_tick_set(0) ) { - return false; - } - return true; -} - diff --git a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/test_net_6lowpan_parameter_api.h b/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/test_net_6lowpan_parameter_api.h deleted file mode 100644 index 759993e88188..000000000000 --- a/test/nanostack/unittest/libNET/net_6lowpan_parameter_api/test_net_6lowpan_parameter_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_NET_6LOWPAN_PARAMETER_API_H -#define TEST_NET_6LOWPAN_PARAMETER_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_net_6lowpan_nd_timer_base_tick_set(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_NET_6LOWPAN_PARAMETER_API_H - diff --git a/test/nanostack/unittest/libNET/net_ipv6/Makefile b/test/nanostack/unittest/libNET/net_ipv6/Makefile deleted file mode 100644 index 3d37a5410bd2..000000000000 --- a/test/nanostack/unittest/libNET/net_ipv6/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = net_ipv6_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/libNET/src/net_ipv6.c - -TEST_SRC_FILES = \ - main.cpp \ - net_ipv6test.cpp \ - test_net_ipv6.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/ipv6_fragmentation_stub.c \ - ../../stub/ipv6_flow_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/address_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/libNET/net_ipv6/main.cpp b/test/nanostack/unittest/libNET/net_ipv6/main.cpp deleted file mode 100644 index 83d2a7ab79a1..000000000000 --- a/test/nanostack/unittest/libNET/net_ipv6/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(net_ipv6); - diff --git a/test/nanostack/unittest/libNET/net_ipv6/net_ipv6test.cpp b/test/nanostack/unittest/libNET/net_ipv6/net_ipv6test.cpp deleted file mode 100644 index 69981e19c0fc..000000000000 --- a/test/nanostack/unittest/libNET/net_ipv6/net_ipv6test.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_net_ipv6.h" - -TEST_GROUP(net_ipv6) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(net_ipv6, test_arm_nwk_ipv6_frag_mru) -{ - CHECK(test_arm_nwk_ipv6_frag_mru()); -} - diff --git a/test/nanostack/unittest/libNET/net_ipv6/test_net_ipv6.c b/test/nanostack/unittest/libNET/net_ipv6/test_net_ipv6.c deleted file mode 100644 index 54247cf9549d..000000000000 --- a/test/nanostack/unittest/libNET/net_ipv6/test_net_ipv6.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_net_ipv6.h" -#include - - -bool test_arm_nwk_ipv6_frag_mru() -{ - arm_nwk_ipv6_frag_mru(0); - return true; -} - diff --git a/test/nanostack/unittest/libNET/net_ipv6/test_net_ipv6.h b/test/nanostack/unittest/libNET/net_ipv6/test_net_ipv6.h deleted file mode 100644 index 4c49c7bec879..000000000000 --- a/test/nanostack/unittest/libNET/net_ipv6/test_net_ipv6.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_NET_IPV6_H -#define TEST_NET_IPV6_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_arm_nwk_ipv6_frag_mru(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_NET_IPV6_H - diff --git a/test/nanostack/unittest/libNET/net_mle/Makefile b/test/nanostack/unittest/libNET/net_mle/Makefile deleted file mode 100644 index 8153f25de6f7..000000000000 --- a/test/nanostack/unittest/libNET/net_mle/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = net_mle_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/libNET/src/net_mle.c - -TEST_SRC_FILES = \ - main.cpp \ - net_mletest.cpp \ - test_net_mle.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/mle_service_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/libNET/net_mle/main.cpp b/test/nanostack/unittest/libNET/net_mle/main.cpp deleted file mode 100644 index d2d41710d15e..000000000000 --- a/test/nanostack/unittest/libNET/net_mle/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(net_mle); - diff --git a/test/nanostack/unittest/libNET/net_mle/net_mletest.cpp b/test/nanostack/unittest/libNET/net_mle/net_mletest.cpp deleted file mode 100644 index 42ba62857dad..000000000000 --- a/test/nanostack/unittest/libNET/net_mle/net_mletest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_net_mle.h" - -TEST_GROUP(net_mle) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(net_mle, test_arm_nwk_6lowpan_mle_router_lifetime_set) -{ - CHECK(test_arm_nwk_6lowpan_mle_router_lifetime_set()); -} - diff --git a/test/nanostack/unittest/libNET/net_mle/test_net_mle.c b/test/nanostack/unittest/libNET/net_mle/test_net_mle.c deleted file mode 100644 index 9b687b402ad8..000000000000 --- a/test/nanostack/unittest/libNET/net_mle/test_net_mle.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_net_mle.h" -#include - - -bool test_arm_nwk_6lowpan_mle_router_lifetime_set() -{ - if( -1 != arm_nwk_6lowpan_mle_router_lifetime_set(0, 0) ) { - return false; - } - - return true; -} - diff --git a/test/nanostack/unittest/libNET/net_mle/test_net_mle.h b/test/nanostack/unittest/libNET/net_mle/test_net_mle.h deleted file mode 100644 index 05c4dcf530ef..000000000000 --- a/test/nanostack/unittest/libNET/net_mle/test_net_mle.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_NET_MLE_H -#define TEST_NET_MLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_arm_nwk_6lowpan_mle_router_lifetime_set(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_NET_MLE_H - diff --git a/test/nanostack/unittest/libNET/net_rpl/Makefile b/test/nanostack/unittest/libNET/net_rpl/Makefile deleted file mode 100644 index bf93a458bef1..000000000000 --- a/test/nanostack/unittest/libNET/net_rpl/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = net_rpl_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/libNET/src/net_rpl.c - -TEST_SRC_FILES = \ - main.cpp \ - net_rpltest.cpp \ - test_net_rpl.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/rpl_data_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_RPL - diff --git a/test/nanostack/unittest/libNET/net_rpl/main.cpp b/test/nanostack/unittest/libNET/net_rpl/main.cpp deleted file mode 100644 index a843864e31d8..000000000000 --- a/test/nanostack/unittest/libNET/net_rpl/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(net_rpl); - diff --git a/test/nanostack/unittest/libNET/net_rpl/net_rpltest.cpp b/test/nanostack/unittest/libNET/net_rpl/net_rpltest.cpp deleted file mode 100644 index 5ac8df3c179b..000000000000 --- a/test/nanostack/unittest/libNET/net_rpl/net_rpltest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_net_rpl.h" - -TEST_GROUP(net_rpl) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(net_rpl, test_arm_nwk_6lowpan_rpl_dodag_remove) -{ - CHECK(test_arm_nwk_6lowpan_rpl_dodag_remove()); -} - diff --git a/test/nanostack/unittest/libNET/net_rpl/test_net_rpl.c b/test/nanostack/unittest/libNET/net_rpl/test_net_rpl.c deleted file mode 100644 index ef2f41a954e1..000000000000 --- a/test/nanostack/unittest/libNET/net_rpl/test_net_rpl.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_net_rpl.h" -#include - - -bool test_arm_nwk_6lowpan_rpl_dodag_remove() -{ - if( -1 != arm_nwk_6lowpan_rpl_dodag_remove(0) ) { - return false; - } - return true; -} - diff --git a/test/nanostack/unittest/libNET/net_rpl/test_net_rpl.h b/test/nanostack/unittest/libNET/net_rpl/test_net_rpl.h deleted file mode 100644 index e94a427e6ea7..000000000000 --- a/test/nanostack/unittest/libNET/net_rpl/test_net_rpl.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_NET_RPL_H -#define TEST_NET_RPL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_arm_nwk_6lowpan_rpl_dodag_remove(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_NET_RPL_H - diff --git a/test/nanostack/unittest/libNET/net_short_address_extension/Makefile b/test/nanostack/unittest/libNET/net_short_address_extension/Makefile deleted file mode 100644 index 329cecc50fc2..000000000000 --- a/test/nanostack/unittest/libNET/net_short_address_extension/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = net_short_address_extension_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/libNET/src/net_short_address_extension.c - -TEST_SRC_FILES = \ - main.cpp \ - net_short_address_extensiontest.cpp \ - test_net_short_address_extension.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/libNET/net_short_address_extension/main.cpp b/test/nanostack/unittest/libNET/net_short_address_extension/main.cpp deleted file mode 100644 index 9af08137344a..000000000000 --- a/test/nanostack/unittest/libNET/net_short_address_extension/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(net_short_address_extension); - diff --git a/test/nanostack/unittest/libNET/net_short_address_extension/net_short_address_extensiontest.cpp b/test/nanostack/unittest/libNET/net_short_address_extension/net_short_address_extensiontest.cpp deleted file mode 100644 index 359dd366e5b3..000000000000 --- a/test/nanostack/unittest/libNET/net_short_address_extension/net_short_address_extensiontest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_net_short_address_extension.h" - -TEST_GROUP(net_short_address_extension) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(net_short_address_extension, test_net_ext_set_short_address_from_app) -{ - CHECK(test_net_ext_set_short_address_from_app()); -} - diff --git a/test/nanostack/unittest/libNET/net_short_address_extension/test_net_short_address_extension.c b/test/nanostack/unittest/libNET/net_short_address_extension/test_net_short_address_extension.c deleted file mode 100644 index fd2fbe8ed9d4..000000000000 --- a/test/nanostack/unittest/libNET/net_short_address_extension/test_net_short_address_extension.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_net_short_address_extension.h" -#include - - -bool test_net_ext_set_short_address_from_app() -{ - net_ext_set_short_address_from_app(0, 0); - return true; -} - diff --git a/test/nanostack/unittest/libNET/net_short_address_extension/test_net_short_address_extension.h b/test/nanostack/unittest/libNET/net_short_address_extension/test_net_short_address_extension.h deleted file mode 100644 index cfd2b5e18683..000000000000 --- a/test/nanostack/unittest/libNET/net_short_address_extension/test_net_short_address_extension.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_NET_SHORT_ADDRESS_EXTENSION_H -#define TEST_NET_SHORT_ADDRESS_EXTENSION_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_net_ext_set_short_address_from_app(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_NET_SHORT_ADDRESS_EXTENSION_H - diff --git a/test/nanostack/unittest/libNET/socket_api/Makefile b/test/nanostack/unittest/libNET/socket_api/Makefile deleted file mode 100644 index 828246e568af..000000000000 --- a/test/nanostack/unittest/libNET/socket_api/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = socket_api_unit -SRC_FILES = \ - ../../../../../source/libNET/src/socket_api.c - -TEST_SRC_FILES = \ - main.cpp \ - socket_api_test.cpp \ - ../../stub/socket_stub.c \ - ../../stub/tcp_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/security_lib_stub.c \ - ../../stub/address_stub.c \ - ../../stub/ipv6_flow_stub.c \ - ../../stub/sockbuf_stub.c \ - ../../stub/ns_list_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/libNET/socket_api/main.cpp b/test/nanostack/unittest/libNET/socket_api/main.cpp deleted file mode 100644 index 5e0c10f0c604..000000000000 --- a/test/nanostack/unittest/libNET/socket_api/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(SocketAPI); diff --git a/test/nanostack/unittest/libNET/socket_api/socket_api_test.cpp b/test/nanostack/unittest/libNET/socket_api/socket_api_test.cpp deleted file mode 100644 index 5e450482b892..000000000000 --- a/test/nanostack/unittest/libNET/socket_api/socket_api_test.cpp +++ /dev/null @@ -1,1218 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include -#include -#include -#include "CppUTest/TestHarness.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "../../../../../nanostack/socket_api.h" -#include "ns_error_types.h" - -#include "../../stub/socket_stub.h" -#include "../../stub/address_stub.h" -#include "../../stub/buffer_dyn_stub.h" -#include "../../stub/protocol_core_stub.h" -#include "../../stub/tcp_stub.h" -#include "Common_Protocols/tcp.h" -#include "common_functions.h" - -ns_address_t address = {ADDRESS_IPV6, {0}, 8080}; - -ns_address_t dst_address = {ADDRESS_IPV6, {0x20,0x01, 0x0d,0xb8}, 8080}; - -protocol_interface_info_entry_t interface; - -void socket_callback(void *cb) -{ - //socket_callback_t *sock_cb = (socket_callback_t *) cb; -} - -TEST_GROUP(SocketAPI) -{ - void setup() { - socket_stub_setup(); - } - - void teardown() { - socket_stub_teardown(); - } -}; - -TEST(SocketAPI, Create) -{ - -} - -#if 1 -TEST(SocketAPI, test_socketAPI_open) -{ - int8_t socket = -1; - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - - // socket open OK - test_data->err = eOK; - test_data->socket_id = 0; - socket = socket_open(SOCKET_UDP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, socket); - - // socket open OK (RAW socket) - test_data->socket_id = 1; - socket = socket_open(SOCKET_RAW, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, socket); - - socket = socket_open(SOCKET_RAW, 0x100, socket_callback); - BYTES_EQUAL(-1, socket); - - // Socket open fail, no function callback set - test_data->err = eFALSE; - test_data->socket_id = -1; - socket = socket_open(SOCKET_TCP, 0, NULL); - BYTES_EQUAL(test_data->socket_id, socket); - - // Socket open fail, busy - test_data->err = eBUSY; - test_data->socket_id = -2; - socket = socket_open(SOCKET_TCP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, socket); - - // Socket open failure, test default branch - test_data->err = eSYSTEM; - test_data->socket_id = -1; - socket = socket_open(SOCKET_TCP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, socket); - - // Socket type mismatch - test_data->socket_id = -1; - socket = socket_open(0, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, socket); -} - -TEST(SocketAPI, test_socketAPI_close) -{ - int8_t err; - int8_t socket; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eFALSE; - err = socket_close(-1); - BYTES_EQUAL(-1, err); - - socket_stub_clear_sockets(); - - // OK case - test_data->err = eOK; - socket_stub.socket_structure = test_data->socket_ptr; - socket = socket_open(SOCKET_UDP, 0, socket_callback); - err = socket_close(socket); - BYTES_EQUAL(0, err); - - // fail case - socket_stub.socket_structure = NULL; - test_data->err = eFALSE; - err = socket_close(0); - BYTES_EQUAL(-1, err); -} - -TEST(SocketAPI, test_socketAPI_connect) -{ - int8_t err; - int8_t socket; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - // trying to connect UDP socket - test_data->err = eOK; - test_data->socket_id = 0; - - err = socket_connect(-1, &address, 0); - BYTES_EQUAL(-1, err); - - err = socket_connect(2, &address, 0); - BYTES_EQUAL(-1, err); - - socket_stub.socket_structure = test_data->socket_ptr; - - socket = socket_open(SOCKET_RAW, 0, socket_callback); - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-5, err); - - socket_stub_clear_sockets(); - - socket = socket_open(SOCKET_UDP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, socket); - buffer_t buffer_ptr; - buffer_dyn_stub.buffer_ptr = &buffer_ptr; - protocol_interface_info_entry_t entry; - socket_stub.entry_ptr = &entry; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(0, err); - - // TCP socket - test_data->err = eOK; - test_data->socket_id = 0; - socket = socket_open(SOCKET_TCP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, socket); - - // socket is not valid - socket_stub.socket_structure = NULL; - test_data->err = eOK; - err = socket_connect(-1, &address, 0); - BYTES_EQUAL(-1, err); - - // address is NULL - socket_stub.socket_structure = test_data->socket_ptr; - test_data->err = eOK; - err = socket_connect(socket, NULL, 0); - BYTES_EQUAL(-1, err); - - test_data->err = eOK; - test_data->socket_id = 0; - buffer_dyn_stub.buffer_ptr = NULL; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-2, err); - socket_listen(socket, 5); - buffer_dyn_stub.buffer_ptr = &buffer_ptr; - test_data->socket_ptr->flags = SOCKET_LISTEN_STATE; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-3, err); - - socket_stub_clear_sockets(); - test_data = socket_stub_get_test_data(); - - // trying to connect TCP socket - test_data->err = eOK; - test_data->socket_id = 0; - test_data->socket_ptr->flags = 0; - socket = socket_open(SOCKET_TCP, 0, socket_callback); - tcp_session_t tcp_session; - test_data->socket_ptr->inet_pcb->session = &tcp_session; - tcp_stub.tcp_error_value = TCP_ERROR_WRONG_STATE; - test_data->socket_ptr->inet_pcb->flow_label == /*IPV6_FLOW_AUTOGENERATE*/ -2; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-4, err); - test_data->socket_ptr->inet_pcb->session = NULL; - tcp_stub.tcp_error_value = TCP_ERROR_BUFFER_ALLOCATION_ERROR; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-2, err); - tcp_stub.tcp_session_ptr = &tcp_session; - - tcp_stub.tcp_error_value = TCP_ERROR_BUFFER_ALLOCATION_ERROR; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-2, err); - - tcp_stub.tcp_error_value = TCP_ERROR_NO_ERROR; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(0, err); - socket = socket_open(SOCKET_UDP, 0, socket_callback); - buffer_dyn_stub.buffer_ptr = NULL; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-4, err); - buffer_dyn_stub.buffer_ptr = &buffer_ptr; - socket_stub.entry_ptr = NULL; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-4, err); - socket_stub.entry_ptr = &entry; - address_stub.int8_value = -1; - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-4, err); - address_stub.int8_value = 0; - address.identifier = 128; - test_data->socket_ptr->inet_pcb->flow_label = (-2); - err = socket_connect(socket, &address, 0); - BYTES_EQUAL(-4, err); -} - -TEST(SocketAPI, test_socketAPI_shutdown) -{ - int8_t status; - int8_t sock_id; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 0; - sock_id = socket_open(SOCKET_TCP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - socket_stub.socket_structure = test_data->socket_ptr; - // test: If no active TCP session - status = socket_shutdown(sock_id, SOCKET_SHUT_RDWR); - BYTES_EQUAL(-2, status); - socket_stub.socket_structure = NULL; - status = socket_shutdown(2, SOCKET_SHUT_RDWR); - // test: If no such socket ID is found - BYTES_EQUAL(-1, status); - - tcp_stub.tcp_error_value = TCP_ERROR_BUFFER_ALLOCATION_ERROR; - socket_stub.socket_structure = test_data->socket_ptr; - test_data->socket_ptr->inet_pcb->local_port = 10; - status = socket_shutdown(sock_id, SOCKET_SHUT_RDWR); - BYTES_EQUAL(-2, status); - - status = socket_shutdown(sock_id, NULL); - BYTES_EQUAL(-2, status); - - tcp_session_t tcp_session; - tcp_stub.tcp_error_value = TCP_ERROR_NO_ERROR; - test_data->socket_ptr->inet_pcb->session = &tcp_session; - status = socket_shutdown(sock_id, SOCKET_SHUT_RDWR); - BYTES_EQUAL(-2, status); - - // test: close bad socket ID - socket_stub.socket_structure = NULL; - status = socket_shutdown(-1, SOCKET_SHUT_RDWR); - BYTES_EQUAL(-1, status); - - //Test UDP close - sock_id = socket_open(SOCKET_UDP, 0, socket_callback); - test_data->socket_ptr->inet_pcb->local_port = 10; - socket_stub.socket_structure = test_data->socket_ptr; - status = socket_shutdown(sock_id, SOCKET_SHUT_RDWR); - // Currently Socket_shutdown is not supporting UDP - BYTES_EQUAL(-1, status); - - sock_id = socket_open(SOCKET_RAW, 0, socket_callback); - socket_stub.socket_structure = test_data->socket_ptr; - status = socket_shutdown(sock_id, SOCKET_SHUT_RDWR); - BYTES_EQUAL(-1, status); - -} - -TEST(SocketAPI, test_socketAPI_send) -{ - int8_t status; - int8_t sock_id; - uint8_t buf[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 1; - sock_id = socket_open(SOCKET_TCP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - - // connect socket to address - test_data->err = eOK; - socket_stub.socket_structure = test_data->socket_ptr; - buffer_dyn_stub.buffer_ptr = NULL; - tcp_stub.tcp_error_value = TCP_ERROR_BUFFER_ALLOCATION_ERROR; - status = socket_connect(sock_id, &address, 0); - BYTES_EQUAL(-2, status); - - // test length zero - buffer_t buffer_ptr; - buffer_dyn_stub.buffer_ptr = &buffer_ptr; - status = socket_send(sock_id, (uint8_t *)&buf, 0); - BYTES_EQUAL(0, status); - - // test with valid params, - status = socket_send(sock_id, (uint8_t *)&buf, sizeof(buf)); - BYTES_EQUAL(0, status); - - tcp_session_t tcp_session; - test_data->socket_ptr->inet_pcb->session = &tcp_session; - //status = socket_send(sock_id, (uint8_t *)&buf, sizeof(buf)); - //BYTES_EQUAL(-3, status); - protocol_interface_info_entry_t entry; - protocol_core_stub.entry_ptr = &entry; - address_stub.uint8_ptr = NULL; - //status = socket_send(sock_id, (uint8_t *)&buf, sizeof(buf)); - //BYTES_EQUAL(-3, status); - uint8_t temp_address[16]; - address_stub.uint8_ptr = temp_address; - buffer_dyn_stub.buffer_ptr = NULL; - //status = socket_send(sock_id, (uint8_t *)&buf, sizeof(buf)); - //BYTES_EQUAL(-2, status); - buffer_dyn_stub.buffer_ptr = &buffer_ptr; - //status = socket_send(sock_id, (uint8_t *)&buf, sizeof(buf)); - //BYTES_EQUAL(0, status); - - // test sending data to UDP socket - uint8_t sock_udp_id = socket_open(SOCKET_UDP, 0, socket_callback); -// status = socket_send(sock_udp_id, (uint8_t *)&buf, sizeof(buf)); -// BYTES_EQUAL(-5, status); -// test_data->socket_ptr->inet_pcb->remote_port = 10; - //Buffer get fail - buffer_dyn_stub.buffer_ptr = &buffer_ptr; - status = socket_send(sock_udp_id, (uint8_t *)&buf, sizeof(buf)); - BYTES_EQUAL(0, status); - -} - -TEST(SocketAPI, test_socketAPI_read) -{ - int8_t status; - int8_t sock_id; - uint8_t buf[10]; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 1; - sock_id = socket_open(SOCKET_TCP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - - // test reading from unknow socket - socket_stub.socket_structure = NULL; - status = socket_read(sock_id, &address, (uint8_t *)&buf, 10); - BYTES_EQUAL(-1, status); - - socket_stub.socket_structure = test_data->socket_ptr; - - // test NULL address - status = socket_read(sock_id, NULL, (uint8_t *)&buf, 10); - BYTES_EQUAL(0, status); - - // test NULL buffer - socket_stub.socket_read_cnt = 0; - status = socket_read(sock_id, &address, NULL, 10); - BYTES_EQUAL(0, status); - - socket_stub.socket_read_cnt = 2; - status = socket_read(sock_id, &address, NULL, 10); - BYTES_EQUAL(0, status); - - status = socket_read(sock_id, &address, NULL, 10); - BYTES_EQUAL(0, status); - socket_stub.socket_structure = NULL; -} - -TEST(SocketAPI, test_socketAPI_bind2addrsel) -{ - int8_t status; - int8_t sock_id; - uint8_t buf[10]; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 0; - - status = socket_bind2addrsel(-1,NULL); - BYTES_EQUAL(-1, status); - - status = socket_bind2addrsel(100,NULL); - BYTES_EQUAL(-1, status); - - status = socket_bind2addrsel(2,NULL); - BYTES_EQUAL(-1, status); - - socket_stub_clear_sockets(); - socket_stub.socket_structure = test_data->socket_ptr; - test_data->err = eOK; - sock_id = socket_open(SOCKET_RAW, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - status = socket_bind2addrsel(sock_id,NULL); - BYTES_EQUAL(-1, status); - status = socket_bind2addrsel(sock_id,&dst_address); - BYTES_EQUAL(-6, status); - sock_id = socket_open(SOCKET_UDP, 0, socket_callback); - // Fails due to buffer_get failing - status = socket_bind2addrsel(sock_id,&address); - BYTES_EQUAL(-2, status); - - buffer_t buffer_ptr; - buffer_dyn_stub.buffer_ptr = NULL; - status = socket_bind2addrsel(sock_id,&address); - BYTES_EQUAL(-2, status); - buffer_dyn_stub.buffer_ptr = &buffer_ptr; - socket_stub.entry_ptr = NULL; - status = socket_bind2addrsel(sock_id,&address); - BYTES_EQUAL(-4, status); - protocol_interface_info_entry_t entry; - socket_stub.entry_ptr = &entry; - address_stub.int8_value = -1; - status = socket_bind2addrsel(sock_id,&address); - BYTES_EQUAL(-5, status); - address_stub.int8_value = 0; - status = socket_bind2addrsel(sock_id,&address); - BYTES_EQUAL(0, status); - -} - -#endif - -TEST(SocketAPI, socket_getpeername) -{ - ns_address_t addr; - int8_t socket = -1; - int8_t err; - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - - // socket open OK - test_data->err = eOK; - test_data->socket_id = 0; - socket = socket_open(SOCKET_UDP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, socket); - - socket_stub.socket_structure = test_data->socket_ptr; - err = socket_getpeername(test_data->socket_id, &addr); - BYTES_EQUAL(-2, err); - - err = socket_getpeername(test_data->socket_id, &addr); - BYTES_EQUAL(-2, err); - // fail, bad socket - socket_stub.socket_structure = NULL; - err = socket_getpeername(-1, &addr); - BYTES_EQUAL(-1, err); - - // fail, bad socket in socket range - err = socket_getpeername(2, &addr); - BYTES_EQUAL(-1, err); -} - -TEST(SocketAPI, socket_sendto) -{ - int8_t status; - int8_t sock_id; - uint8_t buf[] = "abcd"; - ns_address_t addr; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 1; - sock_id = socket_open(SOCKET_UDP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - socket_stub.socket_structure = test_data->socket_ptr; - - // Tx with length 0 - status = socket_sendto(sock_id, &address, (uint8_t *)&buf, sizeof(buf)); - BYTES_EQUAL(0, status); - // Tx with length 0 - status = socket_sendto(sock_id, &address, (uint8_t *)&buf, 0); - BYTES_EQUAL(0, status); - - status = socket_sendmsg(sock_id, NULL, 0); - BYTES_EQUAL(-1, status); - - buffer_dyn_stub.buffer_ptr = NULL; - -} - -TEST(SocketAPI, socket_bind) -{ - int8_t status; - int8_t sock_id; - ns_address_t addr = {ADDRESS_IPV6, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, 0}; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 1; - - sock_id = socket_open(SOCKET_RAW, 0, socket_callback); - - socket_stub.socket_structure = test_data->socket_ptr; - status = socket_bind(sock_id, &addr); - BYTES_EQUAL(-5, status); - - sock_id = socket_open(SOCKET_UDP, 8080, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - - // fail, bad socket - socket_stub.socket_structure = NULL; - status = socket_bind(-1, &addr); - BYTES_EQUAL(-1, status); - - // fail, bad socket - status = socket_bind(2, &addr); - BYTES_EQUAL(-1, status); - - // fail, NULL address - socket_stub.socket_structure = test_data->socket_ptr; - status = socket_bind(sock_id, NULL); - BYTES_EQUAL(-1, status); - - // OK - addr.identifier = 8080; - status = socket_bind(sock_id, &addr); - BYTES_EQUAL(0, status); - - // fail, port already chosen - addr.identifier = 8081; - status = socket_bind(sock_id, &addr); - BYTES_EQUAL(-4, status); - - // create new socket - test_data->err = eOK; - test_data->socket_id = 2; - sock_id = socket_open(SOCKET_UDP, 0, socket_callback); - socket_stub.socket_structure = test_data->socket_ptr; - BYTES_EQUAL(test_data->socket_id, sock_id); - - // fail, port validation fails - addr.identifier = 8081; - test_data->socket_ptr->inet_pcb->local_port = 0; - test_data->err = eFALSE; - status = socket_bind(sock_id, &addr); - BYTES_EQUAL(-2, status); - - test_data->err = eOK; - status = socket_bind(sock_id, &addr); - BYTES_EQUAL(0, status); -} - -TEST(SocketAPI, socket_listen) -{ - int8_t status; - int8_t sock_id; - ns_address_t addr = {ADDRESS_IPV6, {0}, 8080}; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 1; - sock_id = socket_open(SOCKET_UDP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - - // fail, bad socket id - status = socket_listen(-1, 5); - BYTES_EQUAL(-1, status); - - // fail, bad socket id but in socket range - status = socket_listen(2, 5); - BYTES_EQUAL(-1, status); - - // fail, listening UDP socket - socket_stub.socket_structure = test_data->socket_ptr; - status = socket_listen(sock_id, 5); - BYTES_EQUAL(-1, status); - - socket_stub_clear_sockets(); - - // create TCP socket - test_data = socket_stub_get_test_data(); - test_data->err = eOK; - test_data->socket_id = 2; - sock_id = socket_open(SOCKET_TCP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - socket_stub.socket_structure = test_data->socket_ptr; - - // fail, not bound to a port - status = socket_listen(sock_id, 5); - BYTES_EQUAL(-1, status); - - // bind the socket to a port - status = socket_bind(sock_id, &addr); - BYTES_EQUAL(0, status) - - // OK - test_data->socket_ptr->u.live.fptr = socket_callback; - test_data->socket_ptr->type = SOCKET_TYPE_STREAM; - status = socket_listen(sock_id, 5); - BYTES_EQUAL(0, status); -} - -TEST(SocketAPI, socket_setsockopt) -{ - int8_t status; - int8_t sock_id; - int8_t sock_id_tcp; - socket_t *sock_tcp; - socket_t *sock_udp; - int8_t opt_int8 = 0; - int16_t opt_int16 = 0; - int32_t opt_int32 = 0; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 1; - sock_id = socket_open(SOCKET_UDP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - - // fail, bad socket id - status = socket_setsockopt(-1, SOCKET_IPPROTO_IPV6, SOCKET_LINK_LAYER_SECURITY, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(-1, status); - - // fail, bad protocol level - sock_udp = test_data->socket_ptr; - socket_stub.socket_structure = test_data->socket_ptr; - status = socket_setsockopt(sock_id, 0, SOCKET_LINK_LAYER_SECURITY, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(-2, status); - - // fail, bad option name - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, 0, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(-2, status); - - // fail, NULL option - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_LINK_LAYER_SECURITY, NULL, sizeof(int8_t)); - BYTES_EQUAL(-1, status); - - // OK - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_INTERFACE_SELECT, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(0, status); - - // fail, bad size - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_INTERFACE_SELECT, &opt_int8, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - // OK, SOCKET_LINK_LAYER_SECURITY - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_LINK_LAYER_SECURITY, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(0, status); - - // fail, bad size SOCKET_LINK_LAYER_SECURITY - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_LINK_LAYER_SECURITY, &opt_int8, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - // OK, SOCKET_IPV6_USE_MIN_MTU - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_USE_MIN_MTU, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(0, status); - - // fail, bad size SOCKET_IPV6_USE_MIN_MTU - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_USE_MIN_MTU, &opt_int8, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - // fail, bad value SOCKET_IPV6_USE_MIN_MTU - opt_int8 = 2; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_USE_MIN_MTU, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(-3, status); - opt_int8 = 0; - - // OK, SOCKET_IPV6_DONTFRAG - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_DONTFRAG, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(0, status); - - // fail, bad size SOCKET_IPV6_DONTFRAG - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_DONTFRAG, &opt_int8, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - // fail, bad value SOCKET_IPV6_DONTFRAG - opt_int8 = 2; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_DONTFRAG, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(-3, status); - - // INT16 - test_data->err = eOK; - test_data->socket_id = 2; - sock_id_tcp = socket_open(SOCKET_TCP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id_tcp); - sock_tcp = test_data->socket_ptr; - socket_stub.socket_structure = sock_udp; - // OK, SOCKET_IPV6_TCLASS - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(0, status); - - // fail, bad size SOCKET_IPV6_DONTFRAG - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &opt_int16, sizeof(int8_t)); - BYTES_EQUAL(-3, status); - - socket_stub.socket_structure = sock_tcp; - // fail, bad socket type SOCKET_IPV6_DONTFRAG - status = socket_setsockopt(sock_id_tcp, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(-2, status); - - // OK, special value -1 - socket_stub.socket_structure = sock_udp; - opt_int16 = -1; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(0, status); - - // fail, invalid value -2 - opt_int16 = -2; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - opt_int16 = 0; - - // OK, SOCKET_IPV6_UNICAST_HOPS - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_UNICAST_HOPS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(0, status); - - // fail, bad size SOCKET_IPV6_UNICAST_HOPS - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_UNICAST_HOPS, &opt_int16, sizeof(int8_t)); - BYTES_EQUAL(-3, status); - - // OK, special value -2 - opt_int16 = -2; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_UNICAST_HOPS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - // OK, SOCKET_IPV6_MULTICAST_HOPS - opt_int16 = 0; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_MULTICAST_HOPS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(0, status); - - // fail, bad size SOCKET_IPV6_MULTICAST_HOPS - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_MULTICAST_HOPS, &opt_int16, sizeof(int8_t)); - BYTES_EQUAL(-3, status); - - // OK, special value -1 - opt_int16 = -1; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_MULTICAST_HOPS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(0, status); - - // fail, special value -2 - opt_int16 = -2; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_MULTICAST_HOPS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - // OK, SOCKET_IPV6_ADDRESS_SELECT - opt_int16 = SOCKET_SRC_ADDRESS_MODE_PRIMARY; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_ADDRESS_SELECT, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(0, status); - - // OK, SOCKET_IPV6_ADDRESS_SELECT - opt_int16 = SOCKET_SRC_ADDRESS_MODE_SECONDARY; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_ADDRESS_SELECT, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(0, status); - - // Fail, bad value in options - opt_int16 = -2; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_ADDRESS_SELECT, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - // fail, bad size SOCKET_IPV6_ADDRESS_SELECT - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_ADDRESS_SELECT, &opt_int16, sizeof(int8_t)); - BYTES_EQUAL(-3, status); - - // INT32 options - - // OK, SOCKET_IPV6_ADDR_PREFERENCES - opt_int32 = SOCKET_IPV6_PREFER_SRC_PUBLIC; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_ADDR_PREFERENCES, &opt_int32, sizeof(int32_t)); - BYTES_EQUAL(0, status); - - // fail, bad option SOCKET_IPV6_ADDR_PREFERENCES - opt_int32 = 0xffffffff; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_ADDR_PREFERENCES, &opt_int32, sizeof(int32_t)); - BYTES_EQUAL(-3, status); - - // fail, bad len SOCKET_IPV6_ADDR_PREFERENCES - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_ADDR_PREFERENCES, &opt_int32, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - //fail by length - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_BROADCAST_PAN, &opt_int8, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_BROADCAST_PAN, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(0, status); - - //fail by length - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_FLOW_LABEL, &opt_int32, sizeof(int16_t)); - BYTES_EQUAL(-3, status); - - opt_int32 = 0x100000; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_FLOW_LABEL, &opt_int32, sizeof(int32_t)); - BYTES_EQUAL(-3, status); - - opt_int32 = 1; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_FLOW_LABEL, &opt_int32, sizeof(int32_t)); - BYTES_EQUAL(0, status); - - - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVPKTINFO, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(0, status); - - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVHOPLIMIT, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(0, status); - - - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVTCLASS, &opt_int8, sizeof(int8_t)); - BYTES_EQUAL(0, status); - -} - -TEST(SocketAPI, socket_getsockopt) -{ - int8_t status; - int8_t sock_id; - void *option; - uint16_t option_len = 4; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 1; - sock_id = socket_open(SOCKET_TCP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - socket_stub.socket_structure = NULL; - // fail, bad socket id - status = socket_getsockopt(-1, SOCKET_IPPROTO_IPV6, SOCKET_LINK_LAYER_SECURITY, &option, &option_len); - BYTES_EQUAL(-1, status); - socket_stub.socket_structure = test_data->socket_ptr; - // fail, bad protocol level - status = socket_getsockopt(sock_id, 0, SOCKET_LINK_LAYER_SECURITY, &option, &option_len); - BYTES_EQUAL(-2, status); - - // fail, bad option name - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, 0, &option, &option_len); - BYTES_EQUAL(-2, status); - - // fail, NULL option - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_LINK_LAYER_SECURITY, NULL, &option_len); - BYTES_EQUAL(-1, status); - - //OK cases - socket_stub.socket_structure = test_data->socket_ptr; - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_INTERFACE_SELECT, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(1, option_len); - option_len = 4; - - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_LINK_LAYER_SECURITY, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(1, option_len); - option_len = 4; - - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(2, option_len); - option_len = 4; - - // OK, set SOCKET_IPV6_UNICAST_HOPS first - int16_t opt_int16 = 64; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_UNICAST_HOPS, &opt_int16, sizeof(int16_t)); - BYTES_EQUAL(0, status); - - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_UNICAST_HOPS, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(64, option); - BYTES_EQUAL(2, option_len); - option_len = 4; - - tcp_session_t tcp_session; - protocol_interface_info_entry_t entry; - tcp_session.interface = &entry; - entry.cur_hop_limit = 64; - test_data->socket_ptr->inet_pcb->session = &tcp_session; - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_UNICAST_HOPS, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(entry.cur_hop_limit, option); - BYTES_EQUAL(2, option_len); - option_len = 4; - - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_MULTICAST_HOPS, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(2, option_len); - option_len = 4; - - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_ADDR_PREFERENCES, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(4, option_len); - option_len = 4; - - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_USE_MIN_MTU, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(1, option_len); - option_len = 4; - - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_DONTFRAG, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(1, option_len); - - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_BROADCAST_PAN, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(1, option_len); - - option_len = 8; - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_FLOW_LABEL, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(4, option_len); - option_len = 8; - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVPKTINFO, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(1, option_len); - option_len = 8; - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVHOPLIMIT, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(1, option_len); - option_len = 8; - status = socket_getsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVTCLASS, &option, &option_len); - BYTES_EQUAL(0, status); - BYTES_EQUAL(1, option_len); - -} - -//Test properly socket_readmsg() - -TEST(SocketAPI, socket_recvmsg) -{ - int8_t status; - int8_t sock_id; - uint8_t buf[10]; - - ns_iovec_t msg_iov; - ns_msghdr_t msghdr; - - //Init message payload vector - msg_iov.iov_base = buf; - msg_iov.iov_len = sizeof(buf); - - //Set messages name buffer - msghdr.msg_name = &address; - msghdr.msg_namelen = sizeof(ns_address_t); - msghdr.msg_control = NULL; - msghdr.msg_controllen = 0; - msghdr.msg_flags = 0; - msghdr.msg_iov = &msg_iov; - msghdr.msg_iovlen = 1; - - socket_stub_data_t *test_data = socket_stub_get_test_data(); - socket_stub.socket_structure = NULL; - test_data->err = eOK; - test_data->socket_id = 1; - sock_id = socket_open(SOCKET_UDP, 0, socket_callback); - BYTES_EQUAL(test_data->socket_id, sock_id); - - // test reading from unknow socket - socket_stub.socket_structure = NULL; - status = socket_recvmsg(sock_id, NULL, 0); - BYTES_EQUAL(-1, status); - - socket_stub.socket_read_cnt = 0; - - status = socket_recvmsg(sock_id, &msghdr, 0); - BYTES_EQUAL(-1, status); - - socket_stub.socket_structure = test_data->socket_ptr; - status = socket_recvmsg(sock_id, &msghdr, 0); - /*Would block*/ - BYTES_EQUAL(-100, status); - - socket_stub.socket_read_cnt = 10; - msg_iov.iov_base = buf; - buffer_t *read_buffer = test_data->socket_read_buffer; - uint8_t *ptr; - ptr = buffer_data_pointer(read_buffer); - ptr = common_write_16_bit(1000, ptr); - read_buffer->buf_end = ptr - read_buffer->buf; - - read_buffer->interface = &interface; - read_buffer->interface->id = 2; - read_buffer->size = 4; - - memset(read_buffer->dst_sa.address, 4, 16); - read_buffer->options.hop_limit = 32; - read_buffer->options.traffic_class = 14; - - //sockbuf_init(&test_data->socket_ptr->rcvq); - //sockbuf_append(&test_data->socket_ptr->rcvq, read_buffer); - ns_list_init(&test_data->socket_ptr->rcvq.bufs); - ns_list_add_to_end(&test_data->socket_ptr->rcvq.bufs, read_buffer); - - status = socket_recvmsg(sock_id, &msghdr, NS_MSG_PEEK); - BYTES_EQUAL(2, status); - msghdr.msg_namelen = 2; - status = socket_recvmsg(sock_id, &msghdr, NS_MSG_PEEK); - BYTES_EQUAL(-1, status); - //Set back to real address - msghdr.msg_namelen = sizeof(ns_address_t); - - //Test receive ancillary data - uint8_t ancillary_databuffer[NS_CMSG_SPACE(sizeof(ns_in6_pktinfo_t)) + NS_CMSG_SPACE(sizeof(int16_t)) + NS_CMSG_SPACE(sizeof(int16_t))]; - msghdr.msg_control = ancillary_databuffer; - msghdr.msg_controllen = sizeof(ancillary_databuffer); - //Test to give buffer without order data - status = socket_recvmsg(sock_id, &msghdr, NS_MSG_PEEK); - BYTES_EQUAL(2, status); - BYTES_EQUAL(0, msghdr.msg_controllen); - // Now set the ancillary data size - msghdr.msg_controllen = sizeof(ancillary_databuffer); - - //Request PKtInfo - int8_t recvr_enable = true; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVPKTINFO, &recvr_enable, sizeof(int8_t)); - BYTES_EQUAL(0, status); - - status = socket_recvmsg(sock_id, &msghdr, NS_MSG_PEEK); - BYTES_EQUAL(2, status); - BYTES_EQUAL(NS_CMSG_SPACE(sizeof(ns_in6_pktinfo_t)), msghdr.msg_controllen); - - ns_cmsghdr_t *cmsg = NS_CMSG_FIRSTHDR(&msghdr); - uint8_t *temp_ptr; - ns_in6_pktinfo_t *packetinfo; - int status_compare; - int16_t data_int16; - uint8_t data_u8; - //Stay at while when full ancillary data is analyzed - while (cmsg ) { - BYTES_EQUAL(SOCKET_IPPROTO_IPV6, cmsg->cmsg_level); - - temp_ptr = NS_CMSG_DATA(cmsg); - switch (cmsg->cmsg_type) { - case SOCKET_IPV6_PKTINFO: - BYTES_EQUAL(NS_CMSG_LEN(sizeof(ns_in6_pktinfo_t)), cmsg->cmsg_len); - packetinfo = (ns_in6_pktinfo_t*)temp_ptr; - - status_compare = memcmp(packetinfo->ipi6_addr, read_buffer->dst_sa.address, 16); - - BYTES_EQUAL(0, status_compare); - BYTES_EQUAL(read_buffer->interface->id, packetinfo->ipi6_ifindex); - break; - - default: - break; - } - - cmsg = NS_CMSG_NXTHDR(&msghdr, cmsg); - } - msghdr.msg_controllen = sizeof(ancillary_databuffer); - recvr_enable = false; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVPKTINFO, &recvr_enable, sizeof(int8_t)); - recvr_enable = true; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVTCLASS, &recvr_enable, sizeof(int8_t)); - status = socket_recvmsg(sock_id, &msghdr, NS_MSG_PEEK); - BYTES_EQUAL(2, status); - BYTES_EQUAL(NS_CMSG_SPACE(sizeof(int16_t)), msghdr.msg_controllen); - - cmsg = NS_CMSG_FIRSTHDR(&msghdr); - //Stay at while when full ancillary data is analyzed - while (cmsg ) { - BYTES_EQUAL(SOCKET_IPPROTO_IPV6, cmsg->cmsg_level); - - temp_ptr = NS_CMSG_DATA(cmsg); - switch (cmsg->cmsg_type) { - case SOCKET_IPV6_TCLASS: { - BYTES_EQUAL(NS_CMSG_LEN(sizeof(int16_t)), cmsg->cmsg_len); - data_int16 = *(int16_t*)temp_ptr; - data_u8 = (uint8_t)data_int16; - BYTES_EQUAL(read_buffer->options.traffic_class, data_u8); - break; - } - - default: - break; - } - - cmsg = NS_CMSG_NXTHDR(&msghdr, cmsg); - } - - recvr_enable = false; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVTCLASS, &recvr_enable, sizeof(int8_t)); - recvr_enable = true; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVHOPLIMIT, &recvr_enable, sizeof(int8_t)); - - status = socket_recvmsg(sock_id, &msghdr, NS_MSG_PEEK); - BYTES_EQUAL(2, status); - BYTES_EQUAL(NS_CMSG_SPACE(sizeof(int16_t)), msghdr.msg_controllen); - - cmsg = NS_CMSG_FIRSTHDR(&msghdr); - //Stay at while when full ancillary data is analyzed - while (cmsg ) { - BYTES_EQUAL(SOCKET_IPPROTO_IPV6, cmsg->cmsg_level); - - temp_ptr = NS_CMSG_DATA(cmsg); - switch (cmsg->cmsg_type) { - case SOCKET_IPV6_RECVHOPLIMIT: - BYTES_EQUAL(NS_CMSG_LEN(sizeof(int16_t)), cmsg->cmsg_len); - data_int16 = common_read_16_bit(temp_ptr); - data_u8 = data_int16; - BYTES_EQUAL(read_buffer->options.hop_limit, data_u8); - break; - - default: - break; - } - - cmsg = NS_CMSG_NXTHDR(&msghdr, cmsg); - } - - recvr_enable = true; - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVTCLASS, &recvr_enable, sizeof(int8_t)); - status = socket_setsockopt(sock_id, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_RECVPKTINFO, &recvr_enable, sizeof(int8_t)); - msghdr.msg_controllen = sizeof(ancillary_databuffer); - status = socket_recvmsg(sock_id, &msghdr, NS_MSG_PEEK); - BYTES_EQUAL(2, status); - BYTES_EQUAL(sizeof(ancillary_databuffer), msghdr.msg_controllen); - - cmsg = NS_CMSG_FIRSTHDR(&msghdr); - //Stay at while when full ancillary data is analyzed - while (cmsg ) { - BYTES_EQUAL(SOCKET_IPPROTO_IPV6, cmsg->cmsg_level); - - temp_ptr = NS_CMSG_DATA(cmsg); - switch (cmsg->cmsg_type) { - case SOCKET_IPV6_RECVHOPLIMIT: - BYTES_EQUAL(NS_CMSG_LEN(sizeof(int16_t)), cmsg->cmsg_len); - data_int16 = *(int16_t*)temp_ptr; - data_u8 = data_int16; - BYTES_EQUAL(read_buffer->options.hop_limit, data_u8); - break; - case SOCKET_IPV6_TCLASS: - BYTES_EQUAL(NS_CMSG_LEN(sizeof(int16_t)), cmsg->cmsg_len); - data_int16 = *(int16_t*)temp_ptr; - data_u8 = data_int16; - BYTES_EQUAL(read_buffer->options.traffic_class, data_u8); - break; - case SOCKET_IPV6_PKTINFO: - BYTES_EQUAL(NS_CMSG_LEN(sizeof(ns_in6_pktinfo_t)), cmsg->cmsg_len); - packetinfo = (ns_in6_pktinfo_t*)temp_ptr; - - status_compare = memcmp(packetinfo->ipi6_addr, read_buffer->dst_sa.address, 16); - - BYTES_EQUAL(0, status_compare); - BYTES_EQUAL(read_buffer->interface->id, packetinfo->ipi6_ifindex); - break; - - default: - break; - } - - cmsg = NS_CMSG_NXTHDR(&msghdr, cmsg); - } - - msghdr.msg_controllen = sizeof(ancillary_databuffer) - 1; - status = socket_recvmsg(sock_id, &msghdr, NS_MSG_PEEK); - - BYTES_EQUAL(NS_MSG_CTRUNC, msghdr.msg_flags); - BYTES_EQUAL(2, status); - BYTES_EQUAL(NS_CMSG_SPACE(sizeof(ns_in6_pktinfo_t)) + NS_CMSG_SPACE(sizeof(int16_t)), msghdr.msg_controllen); - - cmsg = NS_CMSG_FIRSTHDR(&msghdr); - //Stay at while when full ancillary data is analyzed - while (cmsg ) { - BYTES_EQUAL(SOCKET_IPPROTO_IPV6, cmsg->cmsg_level); - - temp_ptr = NS_CMSG_DATA(cmsg); - switch (cmsg->cmsg_type) { - case SOCKET_IPV6_RECVHOPLIMIT: - BYTES_EQUAL(NS_CMSG_LEN(sizeof(int16_t)), cmsg->cmsg_len); - data_int16 = *(int16_t*)temp_ptr; - data_u8 = data_int16; - BYTES_EQUAL(read_buffer->options.hop_limit, data_u8); - break; - case SOCKET_IPV6_TCLASS: - BYTES_EQUAL(NS_CMSG_LEN(sizeof(int16_t)), cmsg->cmsg_len); - data_int16 = *(int16_t*)temp_ptr; - data_u8 = data_int16; - BYTES_EQUAL(read_buffer->options.traffic_class, data_u8); - break; - case SOCKET_IPV6_PKTINFO: - BYTES_EQUAL(NS_CMSG_LEN(sizeof(ns_in6_pktinfo_t)), cmsg->cmsg_len); - packetinfo = (ns_in6_pktinfo_t*)temp_ptr; - - status_compare = memcmp(packetinfo->ipi6_addr, read_buffer->dst_sa.address, 16); - - BYTES_EQUAL(0, status_compare); - BYTES_EQUAL(read_buffer->interface->id, packetinfo->ipi6_ifindex); - break; - - default: - break; - } - - cmsg = NS_CMSG_NXTHDR(&msghdr, cmsg); - } - -} - - diff --git a/test/nanostack/unittest/mac/ethernet_mac_api/Makefile b/test/nanostack/unittest/mac/ethernet_mac_api/Makefile deleted file mode 100644 index 11be5a26ca67..000000000000 --- a/test/nanostack/unittest/mac/ethernet_mac_api/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = ethernet_mac_api_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/ethernet/ethernet_mac_api.c - -TEST_SRC_FILES = \ - main.cpp \ - ethernet_mac_apitest.cpp \ - test_ethernet_mac_api.c \ - ../../stub/common_functions_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/event_stub.c \ - ../../stub/rf_driver_storage_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/ethernet_mac_api/ethernet_mac_apitest.cpp b/test/nanostack/unittest/mac/ethernet_mac_api/ethernet_mac_apitest.cpp deleted file mode 100644 index 1c91d3c25310..000000000000 --- a/test/nanostack/unittest/mac/ethernet_mac_api/ethernet_mac_apitest.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_ethernet_mac_api.h" - -TEST_GROUP(ethernet_mac_api) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(ethernet_mac_api, test_ethernet_mac_create) -{ - CHECK(test_ethernet_mac_create()); -} - -TEST(ethernet_mac_api, test_ethernet_mac_destroy) -{ - CHECK(test_ethernet_mac_destroy()); -} - -TEST(ethernet_mac_api, test_data_request) -{ - CHECK(test_data_request()); -} - -TEST(ethernet_mac_api, test_data_confirm) -{ - CHECK(test_data_confirm()); -} - -TEST(ethernet_mac_api, test_data_indication) -{ - CHECK(test_data_indication()); -} - -TEST(ethernet_mac_api, test_eth_mac_mac48_address_set) -{ - CHECK(test_eth_mac_mac48_address_set()); -} - -TEST(ethernet_mac_api, test_eth_mac_mac48_address_get) -{ - CHECK(test_eth_mac_mac48_address_get()); -} - -TEST(ethernet_mac_api, test_eth_mac_api_initialize) -{ - CHECK(test_eth_mac_api_initialize()); -} - -TEST(ethernet_mac_api, test_rx_cb) -{ - CHECK(test_rx_cb()); -} - -TEST(ethernet_mac_api, test_tx_done_cb) -{ - CHECK(test_tx_done_cb()); -} diff --git a/test/nanostack/unittest/mac/ethernet_mac_api/main.cpp b/test/nanostack/unittest/mac/ethernet_mac_api/main.cpp deleted file mode 100644 index f5ea8192edb9..000000000000 --- a/test/nanostack/unittest/mac/ethernet_mac_api/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(ethernet_mac_api); - diff --git a/test/nanostack/unittest/mac/ethernet_mac_api/test_ethernet_mac_api.c b/test/nanostack/unittest/mac/ethernet_mac_api/test_ethernet_mac_api.c deleted file mode 100644 index 4ee5cb14e0a8..000000000000 --- a/test/nanostack/unittest/mac/ethernet_mac_api/test_ethernet_mac_api.c +++ /dev/null @@ -1,538 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_ethernet_mac_api.h" -#include "ethernet_mac_api.h" -#include -#include "rf_driver_storage_stub.h" -#include "nsdynmemLIB_stub.h" -#include "platform/arm_hal_phy.h" -#include "eventOS_event.h" -#include "event_stub.h" -#include "common_functions_stub.h" - -bool cb_visited = false; - -static void confirm_test_cb( const eth_mac_api_t* api, const eth_data_conf_t *data ) -{ - cb_visited = true; -} - -void indication_test_cb( const eth_mac_api_t* api, const eth_data_ind_t *data ) -{ - cb_visited = true; -} - -static int8_t mac_state_control(phy_interface_state_e a, uint8_t b) -{ - -} - -static int8_t mac_tx(uint8_t *a, uint16_t b, uint8_t c) -{ - -} - -static int8_t mac_address_write(phy_address_type_e a,uint8_t *b) -{ - -} - -static int8_t mac_extension(phy_extension_type_e a,uint8_t *b) -{ - -} - -static int8_t addr_write_cb(phy_address_type_e a, uint8_t *b) -{ - -} - -static uint8_t mymac[8]; - -static phy_device_driver_s device_driver = { -.PHY_MAC = mymac, -.link_type = PHY_LINK_ETHERNET_TYPE, -.driver_description = "eth_test_iface", -.phy_MTU = 1280, -.phy_tail_length = 0, -.phy_header_length = 0, -.state_control = mac_state_control, -.tx = mac_tx, -.address_write = mac_address_write, -.extension = mac_extension, -}; - -bool test_ethernet_mac_create() -{ - rf_driver_storage_stub.list_value = NULL; - eth_mac_api_t *api = ethernet_mac_create(0); - if( api ){ - return NULL; - } - - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - driver->phy_driver = &phy_driver; - rf_driver_storage_stub.list_value = driver; - - nsdynmemlib_stub.returnCounter = 0; - nsdynmemlib_stub.expectedPointer = NULL; - - api = ethernet_mac_create(0); - if( api ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 0; - uint8_t mac64[8]; - memset(mac64, 0, 8); - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - phy_driver.link_type = PHY_LINK_SLIP; - api = ethernet_mac_create(0); - if( api ){ - return false; - } - - phy_driver.link_type = PHY_LINK_TUN; - nsdynmemlib_stub.returnCounter = 0; - api = ethernet_mac_create(0); - if( api ){ - return false; - } - - phy_driver.link_type = PHY_LINK_15_4_SUBGHZ_TYPE; - nsdynmemlib_stub.returnCounter = 0; - api = ethernet_mac_create(0); - if( api ){ - return false; - } - - phy_driver.link_type = PHY_LINK_ETHERNET_TYPE; - nsdynmemlib_stub.returnCounter = 1; - api = ethernet_mac_create(0); - if( api ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - api = ethernet_mac_create(0); - if( !api ){ - return false; - } - - ethernet_mac_destroy(api); - free(driver); - - return true; -} - -bool test_ethernet_mac_destroy() -{ - if( -1 != ethernet_mac_destroy(NULL)) { - return false; - } - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - rf_driver_storage_stub.list_value = driver; - nsdynmemlib_stub.returnCounter = 2; - eth_mac_api_t *api = ethernet_mac_create(0); - - if( 0!= ethernet_mac_destroy(api) ){ - return false; - } - free(driver); - return true; -} - -bool test_data_request() -{ - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - rf_driver_storage_stub.list_value = driver; - nsdynmemlib_stub.returnCounter = 2; - eth_mac_api_t *api = ethernet_mac_create(0); - - api->data_req(NULL, NULL); - - api->data_req(api, NULL); - - driver->phy_driver = &device_driver; - rf_driver_storage_stub.list_value = driver; - - api->data_req(api, NULL); - - driver->phy_driver = &device_driver; - rf_driver_storage_stub.list_value = driver; - - uint8_t databuf[100]; - eth_data_req_t data; - memset(&data, 0, sizeof(eth_data_req_t)); - data.dstAddress = databuf; - data.srcAddress = databuf; - data.msdu = data.dstAddress = databuf; - - device_driver.link_type = PHY_LINK_ETHERNET_TYPE; - data.msduLength = 1600; - api->data_req(api, &data); - - data.msduLength = 100; - api->data_req(api, &data); - - device_driver.link_type = PHY_LINK_TUN; - data.msduLength = 1600; - api->data_req(api, &data); - - data.msduLength = 100; - api->data_req(api, &data); - - device_driver.link_type = PHY_LINK_SLIP; - data.msduLength = 100; - api->data_req(api, &data); - - device_driver.link_type = PHY_LINK_ETHERNET_TYPE; - - ethernet_mac_destroy(api); - free(driver); - return true; -} - -#define ETH_INIT_EVENT 0 -#define ETH_DATA_IND_EVENT 1 -#define ETH_DATA_CNF_EVENT 2 - -bool test_data_confirm() -{ - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - nsdynmemlib_stub.returnCounter = 2; - rf_driver_storage_stub.list_value = driver; - eth_mac_api_t *api = ethernet_mac_create(0); - api->mac_initialize(api, confirm_test_cb, NULL , 0); - cb_visited = false; - - arm_event_s event; - //NOTE: Specially test init here (does nothing) - event.event_type = ETH_INIT_EVENT; - event_stub.func_ptr(&event); - - event.event_type = ETH_DATA_CNF_EVENT; - nsdynmemlib_stub.returnCounter = 1; - eth_data_conf_t *data = ns_dyn_mem_temporary_alloc(sizeof(eth_data_conf_t)); - event.data_ptr = data; - event_stub.func_ptr(&event); - - if( !cb_visited ){ - return false; - } - - ethernet_mac_destroy(api); - free(driver); - return true; -} - -bool test_data_indication() -{ - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - nsdynmemlib_stub.returnCounter = 2; - rf_driver_storage_stub.list_value = driver; - eth_mac_api_t *api = ethernet_mac_create(0); - api->mac_initialize(api, NULL, indication_test_cb, 0); - cb_visited = false; - - arm_event_s event; - event.event_type = ETH_DATA_IND_EVENT; - nsdynmemlib_stub.returnCounter = 1; - eth_data_ind_t *data = ns_dyn_mem_temporary_alloc(sizeof(eth_data_ind_t)); - data->msdu = NULL; - event.data_ptr = data; - event_stub.func_ptr(&event); - - if( !cb_visited ){ - return false; - } - - ethernet_mac_destroy(api); - free(driver); - return true; -} - -bool test_eth_mac_mac48_address_set() -{ - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - rf_driver_storage_stub.list_value = driver; - phy_driver.address_write = &addr_write_cb; - nsdynmemlib_stub.returnCounter = 2; - eth_mac_api_t *api = ethernet_mac_create(0); - - uint8_t buf[8]; - int8_t ret = api->mac48_set(NULL, &buf); - if( -1 != ret ){ - return false; - } - - ret = api->mac48_set(api, &buf); - if( 0 != ret ){ - return false; - } - - ethernet_mac_destroy(api); - free(driver); - return true; -} - -bool test_eth_mac_mac48_address_get() -{ - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - rf_driver_storage_stub.list_value = driver; - nsdynmemlib_stub.returnCounter = 2; - eth_mac_api_t *api = ethernet_mac_create(0); - - uint8_t buf[8]; - int8_t ret = api->mac48_get(NULL, &buf); - if( -1 != ret ){ - return false; - } - - ret = api->mac48_get(api, &buf); - if( 0 != ret ){ - return false; - } - - ethernet_mac_destroy(api); - free(driver); - return true; -} - -bool test_eth_mac_api_initialize() -{ - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - rf_driver_storage_stub.list_value = driver; - nsdynmemlib_stub.returnCounter = 2; - eth_mac_api_t *api = ethernet_mac_create(0); - - int8_t ret = api->mac_initialize(NULL, NULL, NULL, 0); - if( -1 != ret ){ - return false; - } - - ret = api->mac_initialize(api, NULL, NULL, 0); - if( 0 != ret ){ - return false; - } - - ethernet_mac_destroy(api); - free(driver); - return true; -} - -bool test_rx_cb() -{ - event_stub.int8_value = 0; - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - nsdynmemlib_stub.returnCounter = 2; - rf_driver_storage_stub.list_value = driver; - eth_mac_api_t *api = ethernet_mac_create(0); - api->mac_initialize(api, confirm_test_cb, indication_test_cb, 0); - rf_driver_storage_stub.list_value = NULL; - - uint8_t data[20]; - int8_t ret = rf_driver_storage_stub.rx_cb(&data, 10, 0, 0, 0); - if( -1 != ret ){ - return false; - } - - rf_driver_storage_stub.list_value = driver; - nsdynmemlib_stub.returnCounter = 0; - ret = rf_driver_storage_stub.rx_cb(&data, 0, 0, 0, 0); - if( -1 != ret ){ - return false; - } - - ret = rf_driver_storage_stub.rx_cb(&data, 10, 0, 0, 0); - if( -1 != ret ){ - return false; - } - - phy_driver.link_type = PHY_LINK_ETHERNET_TYPE; - nsdynmemlib_stub.returnCounter = 1; - ret = rf_driver_storage_stub.rx_cb(&data, 10, 0, 0, 0); - if( -1 != ret ){ - return false; - } - - phy_driver.link_type = PHY_LINK_ETHERNET_TYPE; - nsdynmemlib_stub.returnCounter = 2; - ret = rf_driver_storage_stub.rx_cb(&data, 20, 0, 0, 0); - if( 0 != ret ){ - return false; - } - - phy_driver.link_type = PHY_LINK_TUN; - event_stub.int8_value = -1; - event_stub.ignore_callback = true; - nsdynmemlib_stub.returnCounter = 2; - ret = rf_driver_storage_stub.rx_cb(&data, 3, 0, 0, 0); - if( -1 != ret ){ - event_stub.ignore_callback = false; - return false; - } - - common_functions_stub.uint16_value = 3; - phy_driver.tunnel_type = 7; - phy_driver.link_type = PHY_LINK_TUN; - nsdynmemlib_stub.returnCounter = 1; - ret = rf_driver_storage_stub.rx_cb(&data, 10, 0, 0, 0); - if( -1 != ret ){ - event_stub.ignore_callback = false; - return false; - } - - common_functions_stub.uint16_value = 7; - phy_driver.link_type = PHY_LINK_SLIP; - nsdynmemlib_stub.returnCounter = 1; - ret = rf_driver_storage_stub.rx_cb(&data, 10, 0, 0, 0); - if( -1 != ret ){ - event_stub.ignore_callback = false; - return false; - } - - phy_driver.link_type = PHY_LINK_TUN; - nsdynmemlib_stub.returnCounter = 2; - ret = rf_driver_storage_stub.rx_cb(&data, 10, 0, 0, 0); - if( -1 != ret ){ - event_stub.ignore_callback = false; - return false; - } - event_stub.ignore_callback = false; - ethernet_mac_destroy(api); - free(driver); - return true; -} - -bool test_tx_done_cb() -{ - event_stub.int8_value = 0; - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - memset(driver, 0, sizeof(arm_device_driver_list_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.PHY_MAC = &mac64; - driver->phy_driver = &phy_driver; - nsdynmemlib_stub.returnCounter = 2; - rf_driver_storage_stub.list_value = driver; - eth_mac_api_t *api = ethernet_mac_create(0); - api->mac_initialize(api, confirm_test_cb, indication_test_cb, 0); - rf_driver_storage_stub.list_value = NULL; - - int8_t ret = rf_driver_storage_stub.done_cb(0, 0, PHY_LINK_TX_DONE, 0, 0); - if( -1 != ret ){ - return false; - } - - driver->phy_driver = &device_driver; - rf_driver_storage_stub.list_value = driver; - ret = rf_driver_storage_stub.done_cb(0, 0, PHY_LINK_TX_DONE, 0, 0); - if( 0 != ret ){ - return false; - } - uint8_t databuf[100]; - eth_data_req_t data; - memset(&data, 0, sizeof(eth_data_req_t)); - data.dstAddress = databuf; - data.srcAddress = databuf; - data.msdu = data.dstAddress = databuf; - - data.msduLength = 100; - - api->data_req(api, &data); - event_stub.int8_value = 12; - ret = rf_driver_storage_stub.done_cb(0, 0, PHY_LINK_TX_DONE, 0, 0); - if( -1 != ret ){ - return false; - } - - api->data_req(api, &data); - nsdynmemlib_stub.returnCounter = 1; - ret = rf_driver_storage_stub.done_cb(0, 0, PHY_LINK_TX_DONE, 0, 0); - if( 12 != ret ){ - return false; - } - - ethernet_mac_destroy(api); - free(driver); - return true; -} diff --git a/test/nanostack/unittest/mac/ethernet_mac_api/test_ethernet_mac_api.h b/test/nanostack/unittest/mac/ethernet_mac_api/test_ethernet_mac_api.h deleted file mode 100644 index ffc518129036..000000000000 --- a/test/nanostack/unittest/mac/ethernet_mac_api/test_ethernet_mac_api.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_ETHERNET_MAC_API_H -#define TEST_ETHERNET_MAC_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_ethernet_mac_create(); - -bool test_ethernet_mac_destroy(); - -bool test_data_request(); - -bool test_data_confirm(); - -bool test_data_indication(); - -bool test_eth_mac_mac48_address_set(); - -bool test_eth_mac_mac48_address_get(); - -bool test_eth_mac_api_initialize(); - -bool test_rx_cb(); - -bool test_tx_done_cb(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_ETHERNET_MAC_API_H - diff --git a/test/nanostack/unittest/mac/fhss_callbacks/Makefile b/test/nanostack/unittest/mac/fhss_callbacks/Makefile deleted file mode 100644 index 9d3ea8bcffdb..000000000000 --- a/test/nanostack/unittest/mac/fhss_callbacks/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = fhss_callbacks_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/mac_fhss_callbacks.c - -TEST_SRC_FILES = \ - main.cpp \ - fhss_callbackstest.cpp \ - test_fhss_callbacks.c \ - ../../stub/sw_mac_stub.c \ - ../../stub/rf_driver_storage_stub.c \ - ../../stub/mac_mlme_stub.c \ - ../../stub/mac_mcps_sap_stub.c \ - ../../stub/common_functions_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/fhss_callbacks/fhss_callbackstest.cpp b/test/nanostack/unittest/mac/fhss_callbacks/fhss_callbackstest.cpp deleted file mode 100644 index 2a8a0c98d3f9..000000000000 --- a/test/nanostack/unittest/mac/fhss_callbacks/fhss_callbackstest.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_fhss_callbacks.h" - -TEST_GROUP(fhss_callbacks) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(fhss_callbacks, test_mac_read_tx_queue_sizes) -{ - CHECK(test_mac_read_tx_queue_sizes()); -} - -TEST(fhss_callbacks, test_mac_read_64bit_mac_address) -{ - CHECK(test_mac_read_64bit_mac_address()); -} - -TEST(fhss_callbacks, test_mac_read_phy_datarate) -{ - CHECK(test_mac_read_phy_datarate()); -} - -TEST(fhss_callbacks, test_mac_set_channel) -{ - CHECK(test_mac_set_channel()); -} - -TEST(fhss_callbacks, test_mac_fhss_frame_tx) -{ - CHECK(test_mac_fhss_frame_tx()); -} - -TEST(fhss_callbacks, test_mac_synch_lost) -{ - CHECK(test_mac_synch_lost()); -} - -TEST(fhss_callbacks, test_mac_poll_tx_queue) -{ - CHECK(test_mac_poll_tx_queue()); -} - -TEST(fhss_callbacks, test_mac_broadcast_notification) -{ - CHECK(test_mac_broadcast_notification()); -} - -TEST(fhss_callbacks, test_mac_get_coordinator_mac_address) -{ - CHECK(test_mac_get_coordinator_mac_address()); -} diff --git a/test/nanostack/unittest/mac/fhss_callbacks/main.cpp b/test/nanostack/unittest/mac/fhss_callbacks/main.cpp deleted file mode 100644 index 28fa4a865555..000000000000 --- a/test/nanostack/unittest/mac/fhss_callbacks/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(fhss_callbacks); - diff --git a/test/nanostack/unittest/mac/fhss_callbacks/test_fhss_callbacks.c b/test/nanostack/unittest/mac/fhss_callbacks/test_fhss_callbacks.c deleted file mode 100644 index 2f5f8f803229..000000000000 --- a/test/nanostack/unittest/mac/fhss_callbacks/test_fhss_callbacks.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_fhss_callbacks.h" -#include "fhss_api.h" -#include -#include -#include "sw_mac_stub.h" -#include "rf_driver_storage_stub.h" -#include "mac_mlme_stub.h" - -static int8_t tx_done(int8_t driver_id, uint8_t tx_handle, phy_link_tx_status_e status, uint8_t cca_retry, uint8_t tx_retry) -{ - return 0; -} - -int8_t virt_cfg(int8_t driver_id, const uint8_t *data, uint16_t length) -{ - (void)driver_id; - (void)data; - (void)length; - return 0; -} - -void mlme_ind(const mac_api_t* api, mlme_primitive id, const void *data) -{ - -} - -bool test_mac_read_tx_queue_sizes() -{ - fhss_api_t fhss_api; - protocol_interface_rf_mac_setup_s setup; - setup.fhss_api = &fhss_api; - setup.unicast_queue_size = 5; - setup.broadcast_queue_size = 3; - // Test when MAC cannot be found - sw_mac_stub.rf_mac_ptr = NULL; - if (mac_read_tx_queue_sizes(&fhss_api, false)) { - return false; - } - sw_mac_stub.rf_mac_ptr = &setup; - // Test when unicast TX queue size is set to 5 - if (mac_read_tx_queue_sizes(&fhss_api, false) != 5) { - return false; - } - // Test when broadcast TX queue size is set to 3 - if (mac_read_tx_queue_sizes(&fhss_api, true) != 3) { - return false; - } - return true; -} - -bool test_mac_read_64bit_mac_address() -{ - fhss_api_t fhss_api; - protocol_interface_rf_mac_setup_s setup; - setup.fhss_api = &fhss_api; - uint8_t mac_array[8]; - memset(mac_array, 0, 8); - memset(setup.mac64, 1, 8); - // Test when MAC cannot be found - sw_mac_stub.rf_mac_ptr = NULL; - if (mac_read_64bit_mac_address(&fhss_api, &mac_array) == 0) { - return false; - } - // MAC assigned - sw_mac_stub.rf_mac_ptr = &setup; - if (mac_read_64bit_mac_address(&fhss_api, &mac_array) != 0) { - return false; - } - // Test that mac64 is copied to mac_array - if (memcmp(mac_array, setup.mac64, 8)) { - return false; - } - return true; -} - -bool test_mac_read_phy_datarate() -{ - fhss_api_t fhss_api; - protocol_interface_rf_mac_setup_s setup; - arm_device_driver_list_s driver; - phy_device_driver_s dev_driver; - setup.fhss_api = &fhss_api; - driver.phy_driver = &dev_driver; - setup.dev_driver = &driver; - rf_driver_storage_stub.uint32_value = 250000; - - // Test when MAC cannot be found - sw_mac_stub.rf_mac_ptr = NULL; - if (mac_read_phy_datarate(&fhss_api) != 0) { - return false; - } - // MAC assigned - sw_mac_stub.rf_mac_ptr = &setup; - // Test that function returns correct datarate - if (mac_read_phy_datarate(&fhss_api) != 250000) { - return false; - } - return true; -} - -bool test_mac_set_channel() -{ - fhss_api_t fhss_api; - protocol_interface_rf_mac_setup_s setup; - phy_device_driver_s phy_driver; - arm_device_driver_list_s dev_driver; - phy_driver.phy_tx_done_cb = tx_done; - dev_driver.phy_driver = &phy_driver; - setup.fhss_api = &fhss_api; - setup.dev_driver = &dev_driver; - mac_mlme_stub.int8_value = 0; - // Test when MAC cannot be found - sw_mac_stub.rf_mac_ptr = NULL; - if (mac_set_channel(&fhss_api, 0) == 0) { - return false; - } - // MAC assigned - sw_mac_stub.rf_mac_ptr = &setup; - setup.macRfRadioTxActive = true; - if (mac_set_channel(&fhss_api, 0) != 0) { - return false; - } - return true; -} - -bool test_mac_fhss_frame_tx() -{ - fhss_api_t fhss_api; - protocol_interface_rf_mac_setup_s setup; - setup.fhss_api = &fhss_api; - mac_mlme_stub.uint8_value = 0; - // Test when MAC cannot be found - sw_mac_stub.rf_mac_ptr = NULL; - if (mac_fhss_frame_tx(&fhss_api, FHSS_SYNCH_FRAME) == 0) { - return false; - } - // MAC assigned - sw_mac_stub.rf_mac_ptr = &setup; - // Should fail because mac_mlme_beacon_req_tx returns 0 - if (mac_fhss_frame_tx(&fhss_api, FHSS_SYNCH_REQUEST_FRAME) == 0) { - return false; - } - // Send synch frame - if (mac_fhss_frame_tx(&fhss_api, FHSS_SYNCH_FRAME) != 0) { - return false; - } - // Send synch frame when MAC fails to start transmission - mac_mlme_stub.int8_value = -1; - if (mac_fhss_frame_tx(&fhss_api, FHSS_SYNCH_FRAME) == 0) { - return false; - } - // Send non supported frame - if (mac_fhss_frame_tx(&fhss_api, FHSS_DATA_FRAME) == 0) { - return false; - } - return true; -} - -bool test_mac_synch_lost() -{ - fhss_api_t fhss_api; - protocol_interface_rf_mac_setup_s setup; - setup.fhss_api = &fhss_api; - mac_mlme_stub.uint8_value = 0; - sw_mac_stub.rf_mac_ptr = NULL; - - if (-1 != mac_synch_lost(&fhss_api)) { - return false; - } - sw_mac_stub.rf_mac_ptr = &setup; - - sw_mac_stub.mac_api_ptr = NULL; - if (-1 != mac_synch_lost(&fhss_api)) { - return false; - } - - mac_api_t api; - api.mlme_ind_cb = &mlme_ind; - sw_mac_stub.mac_api_ptr = &api; - - if (0 != mac_synch_lost(&fhss_api)) { - return false; - } - - return true; -} - -bool test_mac_poll_tx_queue() -{ - fhss_api_t fhss_api; - protocol_interface_rf_mac_setup_s setup; - setup.fhss_api = &fhss_api; - // Test when MAC cannot be found - sw_mac_stub.rf_mac_ptr = NULL; - if (mac_poll_tx_queue(&fhss_api) == 0) { - return false; - } - // MAC assigned - sw_mac_stub.rf_mac_ptr = &setup; - if (mac_poll_tx_queue(&fhss_api) != 0) { - return false; - } - return true; -} - -bool test_mac_broadcast_notification() -{ - fhss_api_t fhss_api; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - setup.fhss_api = &fhss_api; - mac_mlme_stub.uint8_value = 0; - // Test when MAC cannot be found - sw_mac_stub.rf_mac_ptr = NULL; - if (mac_broadcast_notification(&fhss_api, 2) != -1) { - return false; - } - - sw_mac_stub.rf_mac_ptr = &setup; - struct arm_device_driver_list driv; - setup.tun_extension_rf_driver = &driv; - phy_device_driver_s dev_driver; - driv.phy_driver = &dev_driver; - dev_driver.virtual_config_tx_cb = &virt_cfg; - if (mac_broadcast_notification(&fhss_api, 2) != 0) { - return false; - } - - return true; -} - -bool test_mac_get_coordinator_mac_address() -{ - fhss_api_t fhss_api; - protocol_interface_rf_mac_setup_s setup; - setup.fhss_api = &fhss_api; - mac_mlme_stub.uint8_value = 0; - // Test when MAC cannot be found - sw_mac_stub.rf_mac_ptr = NULL; - uint8_t address[8]; - if (mac_get_coordinator_mac_address(&fhss_api, address) != -1) { - return false; - } - - sw_mac_stub.rf_mac_ptr = &setup; - - if (mac_get_coordinator_mac_address(&fhss_api, address) != 0) { - return false; - } - return true; -} diff --git a/test/nanostack/unittest/mac/fhss_callbacks/test_fhss_callbacks.h b/test/nanostack/unittest/mac/fhss_callbacks/test_fhss_callbacks.h deleted file mode 100644 index bf4732aba90d..000000000000 --- a/test/nanostack/unittest/mac/fhss_callbacks/test_fhss_callbacks.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_MAC_FILTER_H -#define TEST_MAC_FILTER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// Test reading queue sizes callback -bool test_mac_read_tx_queue_sizes(); -// Test reading MAC address callback -bool test_mac_read_64bit_mac_address(); -// Test reading datarate callback -bool test_mac_read_phy_datarate(); -// Test channel setting callback -bool test_mac_set_channel(); -// Test sending FHSS frame callback -bool test_mac_fhss_frame_tx(); -bool test_mac_synch_lost(); -// Test polling TX queue callback -bool test_mac_poll_tx_queue(); - -bool test_mac_broadcast_notification(); -bool test_mac_get_coordinator_mac_address(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_FILTER_H - diff --git a/test/nanostack/unittest/mac/mac_filter/Makefile b/test/nanostack/unittest/mac/mac_filter/Makefile deleted file mode 100644 index 15cd5e3bea87..000000000000 --- a/test/nanostack/unittest/mac/mac_filter/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_filter_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/mac_filter.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_filtertest.cpp \ - test_mac_filter.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mac_header_helper_functions_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/mac_filter/mac_filtertest.cpp b/test/nanostack/unittest/mac/mac_filter/mac_filtertest.cpp deleted file mode 100644 index 44c3da21e31d..000000000000 --- a/test/nanostack/unittest/mac/mac_filter/mac_filtertest.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_filter.h" - -TEST_GROUP(mac_filter) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_filter, test_mac_filter_modify_link_quality) -{ - CHECK(test_mac_filter_modify_link_quality()); -} - -TEST(mac_filter, test_mac_filter_start) -{ - CHECK(test_mac_filter_start()); -} - -TEST(mac_filter, test_mac_filter_stop) -{ - CHECK(test_mac_filter_stop()); -} - -TEST(mac_filter, test_mac_filter_clear) -{ - CHECK(test_mac_filter_clear()); -} - -TEST(mac_filter, test_mac_filter_set_address_mapping) -{ - CHECK(test_mac_filter_set_address_mapping()); -} - -TEST(mac_filter, test_mac_filter_delete_short) -{ - CHECK(test_mac_filter_delete_short()); -} - -TEST(mac_filter, test_mac_filter_delete_long) -{ - CHECK(test_mac_filter_delete_long()); -} - -TEST(mac_filter, test_mac_filter_add_short) -{ - CHECK(test_mac_filter_add_short()); -} - -TEST(mac_filter, test_mac_filter_add_long) -{ - CHECK(test_mac_filter_add_long()); -} - diff --git a/test/nanostack/unittest/mac/mac_filter/main.cpp b/test/nanostack/unittest/mac/mac_filter/main.cpp deleted file mode 100644 index 988c7d91ae04..000000000000 --- a/test/nanostack/unittest/mac/mac_filter/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_filter); - diff --git a/test/nanostack/unittest/mac/mac_filter/test_mac_filter.c b/test/nanostack/unittest/mac/mac_filter/test_mac_filter.c deleted file mode 100644 index 65209a4a6027..000000000000 --- a/test/nanostack/unittest/mac/mac_filter/test_mac_filter.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_mac_filter.h" -#include -#include -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "MAC/rf_driver_storage.h" - -#include "nsdynmemLIB_stub.h" -#include "common_functions_stub.h" - -int_fast8_t long_value = -1; -int_fast8_t short_value = -1; - -int_fast8_t long_cb(int8_t interface_id, uint8_t mac64[8], uint16_t mac16) -{ - memset(&mac64, 0, 8); - return long_value; -} - -int_fast8_t short_cb(int8_t interface_id, uint8_t mac64[8], uint16_t *mac16) -{ - memset(&mac64, 0, 8); - *mac16 = 0; - return short_value; -} - - -bool test_mac_filter_modify_link_quality() -{ - int ret = mac_filter_modify_link_quality(0, NULL); - if( 0 != ret ){ - return false; - } - nsdynmemlib_stub.returnCounter = 1; - mac_filter_start(0, 2, -12, 3, -12); - - //Stop is tested last to keep filter enabled during the test - - mac_pre_parsed_frame_t frame; - frame.fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_NONE; - ret = mac_filter_modify_link_quality(0, &frame); - if( 0 != ret ){ - return false; - } - - frame.fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - common_functions_stub.uint16_value = 1; - mac_filter_set_address_mapping(0, &long_cb, &short_cb); - long_value = 0; - ret = mac_filter_modify_link_quality(0, &frame); - if( 1 != ret ){ - return false; - } - long_value = -1; - - short_value = 0; - frame.LQI = 2; - frame.dbm = 33; - frame.fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_64_BIT; - - nsdynmemlib_stub.returnCounter = 1; - mac_filter_add_short(0, 0, 30000, 256, 256, 600); - ret = mac_filter_modify_link_quality(0, &frame); - if( 0 != ret ){ - return false; - } - - mac_filter_clear(0); - nsdynmemlib_stub.returnCounter = 1; - mac_filter_add_short(0, 0, 0, 2, 256, -66); - frame.LQI = 254; - frame.dbm = -94; //== MAC_FILTER_SIGNAL_FLOOR - ret = mac_filter_modify_link_quality(0, &frame); - if( 1 != ret ){ - return false; - } - - //Test enabled == false - mac_filter_stop(0); - ret = mac_filter_modify_link_quality(0, &frame); - if( 0 != ret ){ - return false; - } - - mac_filter_clear(0); - mac_filter_set_address_mapping(0, NULL, NULL); - - return true; -} - -bool test_mac_filter_start() -{ - int8_t ret = mac_filter_start(0, 2, -12, 3, -12); - if( -1 != ret ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - ret = mac_filter_start(0, 2, -12, 3, -12); - if( 0 != ret ){ - return false; - } - - mac_filter_stop(0); - - return true; -} - -bool test_mac_filter_stop() -{ - mac_filter_stop(0); - - nsdynmemlib_stub.returnCounter = 1; - mac_filter_start(0, 2, -12, 3, -12); - - mac_filter_stop(0); //fails if memory leak(s) found - return true; -} - -bool test_mac_filter_clear() -{ - int ret = mac_filter_clear(0); - if( -1 != ret ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - mac_filter_start(0, 2, -12, 3, -12); - - uint8_t mac[8]; - memset(&mac, 0, 8); - nsdynmemlib_stub.returnCounter = 1; - mac_filter_add_long(0, mac, 30000, 256, 256, 600); - - nsdynmemlib_stub.returnCounter = 1; - mac_filter_add_short(0, mac, 30000, 256, 256, 600); - - ret = mac_filter_clear(0); - if( 0 != ret ){ - return false; - } - mac_filter_stop(0); - - return true; -} - -bool test_mac_filter_set_address_mapping() -{ - int ret = mac_filter_set_address_mapping(0, &long_cb, &short_cb); - if( -1 != ret ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - ret = mac_filter_set_address_mapping(0, &long_cb, &short_cb); - if( 0 != ret ){ - return false; - } - - mac_filter_stop(0); - ret = mac_filter_set_address_mapping(0, NULL, NULL); - if( 0 != ret ){ - return false; - } - - return true; -} - -bool test_mac_filter_delete_short() -{ - int ret = mac_filter_delete_short(0, 0); - if( -1 != ret ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - mac_filter_start(0, 2, -12, 3, -12); - - nsdynmemlib_stub.returnCounter = 1; - mac_filter_add_short(0, 0, 30000, 256, 256, 600); - ret = mac_filter_delete_short(0, 0); - if( 0 != ret ){ - return false; - } - mac_filter_stop(0); - - return true; -} - -bool test_mac_filter_delete_long() -{ - uint8_t mac[8]; - memset(&mac, 0, 8); - int ret = mac_filter_delete_long(0, &mac); - if( -1 != ret ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - mac_filter_start(0, 2, -12, 3, -12); - - nsdynmemlib_stub.returnCounter = 1; - mac_filter_add_long(0, mac, 30000, 256, 256, 600); - ret = mac_filter_delete_long(0, &mac); - if( 0 != ret ){ - return false; - } - mac_filter_stop(0); - return true; -} - -bool test_mac_filter_add_short() -{ - int ret = mac_filter_add_short(0, 0, 30000, 256, 256, 600); - if( ret != -1 ){ - return false; - } - nsdynmemlib_stub.returnCounter = 1; - mac_filter_start(0, 2, -12, 3, -12); - ret = mac_filter_add_short(0, 0, 30000, 256, 256, 600); - if( ret != -2 ){ - return false; - } - nsdynmemlib_stub.returnCounter = 1; - ret = mac_filter_add_short(0, 0, 30000, 256, 256, 600); - if( ret != 0 ){ - return false; - } - - mac_filter_delete_short(0, 0); - mac_filter_stop(0); - return true; -} - -bool test_mac_filter_add_long() -{ - uint8_t mac[8]; - int8_t ret = mac_filter_add_long(0, mac, 0,0,0,0); - if( ret != -1 ){ - return false; - } - nsdynmemlib_stub.returnCounter = 1; - mac_filter_start(0, 2, -12, 3, -12); - ret = mac_filter_add_long(0, 0, 30000, 256, 256, 600); - if( ret != -1 ){ - return false; - } - ret = mac_filter_add_long(0, mac, 30000, 256, 256, 600); - if( ret != -2 ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - ret = mac_filter_add_long(0, mac, 30000, 256, 256, 600); - if( ret != 0 ){ - return false; - } - - mac_filter_delete_short(0, 0); - mac_filter_stop(0); - return true; -} diff --git a/test/nanostack/unittest/mac/mac_filter/test_mac_filter.h b/test/nanostack/unittest/mac/mac_filter/test_mac_filter.h deleted file mode 100644 index 43b4c6baf5ba..000000000000 --- a/test/nanostack/unittest/mac/mac_filter/test_mac_filter.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_FILTER_H -#define TEST_MAC_FILTER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_filter_modify_link_quality(); - -bool test_mac_filter_start(); - -bool test_mac_filter_stop(); - -bool test_mac_filter_clear(); - -bool test_mac_filter_set_address_mapping(); - -bool test_mac_filter_delete_short(); - -bool test_mac_filter_delete_long(); - -bool test_mac_filter_add_short(); - -bool test_mac_filter_add_long(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_FILTER_H - diff --git a/test/nanostack/unittest/mac/mac_header_helper_functions/Makefile b/test/nanostack/unittest/mac/mac_header_helper_functions/Makefile deleted file mode 100644 index cffd31db2481..000000000000 --- a/test/nanostack/unittest/mac/mac_header_helper_functions/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_header_helper_functions_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/mac_header_helper_functions.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_header_helper_functionstest.cpp \ - test_mac_header_helper_functions.c \ - ../../stub/common_functions_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/mac_header_helper_functions/mac_header_helper_functionstest.cpp b/test/nanostack/unittest/mac/mac_header_helper_functions/mac_header_helper_functionstest.cpp deleted file mode 100644 index 4fd9be018b85..000000000000 --- a/test/nanostack/unittest/mac/mac_header_helper_functions/mac_header_helper_functionstest.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_header_helper_functions.h" - -TEST_GROUP(mac_header_helper_functions) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_header_helper_functions, test_mac_security_mic_length_get) -{ - CHECK(test_mac_security_mic_length_get()); -} - -TEST(mac_header_helper_functions, test_mac_header_security_aux_header_length) -{ - CHECK(test_mac_header_security_aux_header_length()); -} - -TEST(mac_header_helper_functions, test_mac_header_address_length) -{ - CHECK(test_mac_header_address_length()); -} - -TEST(mac_header_helper_functions, test_mac_header_security_parameter_set) -{ - CHECK(test_mac_header_security_parameter_set()); -} - -TEST(mac_header_helper_functions, test_mac_header_parse_fcf_dsn) -{ - CHECK(test_mac_header_parse_fcf_dsn()); -} - -TEST(mac_header_helper_functions, test_mac_header_security_components_read) -{ - CHECK(test_mac_header_security_components_read()); -} - -TEST(mac_header_helper_functions, test_mac_header_get_src_panid) -{ - CHECK(test_mac_header_get_src_panid()); -} - -TEST(mac_header_helper_functions, test_mac_header_get_dst_panid) -{ - CHECK(test_mac_header_get_dst_panid()); -} - -TEST(mac_header_helper_functions, test_mac_header_get_src_address) -{ - CHECK(test_mac_header_get_src_address()); -} - -TEST(mac_header_helper_functions, test_mac_header_get_dst_address) -{ - CHECK(test_mac_header_get_dst_address()); -} - -TEST(mac_header_helper_functions, test_mcps_payload_length_from_received_frame) -{ - CHECK(test_mcps_payload_length_from_received_frame()); -} - -TEST(mac_header_helper_functions, test_mcps_mac_header_length_from_received_frame) -{ - CHECK(test_mcps_mac_header_length_from_received_frame()); -} - -TEST(mac_header_helper_functions, test_mcps_mac_security_frame_counter_read) -{ - CHECK(test_mcps_mac_security_frame_counter_read()); -} - -TEST(mac_header_helper_functions, test_mcps_mac_command_frame_id_get) -{ - CHECK(test_mcps_mac_command_frame_id_get()); -} - -TEST(mac_header_helper_functions, test_mcps_mac_payload_pointer_get) -{ - CHECK(test_mcps_mac_payload_pointer_get()); -} - -TEST(mac_header_helper_functions, test_mcps_security_mic_pointer_get) -{ - CHECK(test_mcps_security_mic_pointer_get()); -} - -TEST(mac_header_helper_functions, test_mcps_mac_security_aux_header_start_pointer_get) -{ - CHECK(test_mcps_mac_security_aux_header_start_pointer_get()); -} - -TEST(mac_header_helper_functions, test_mcps_generic_header_write) -{ - CHECK(test_mcps_generic_header_write()); -} diff --git a/test/nanostack/unittest/mac/mac_header_helper_functions/main.cpp b/test/nanostack/unittest/mac/mac_header_helper_functions/main.cpp deleted file mode 100644 index b38913175fb1..000000000000 --- a/test/nanostack/unittest/mac/mac_header_helper_functions/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_header_helper_functions); - diff --git a/test/nanostack/unittest/mac/mac_header_helper_functions/test_mac_header_helper_functions.c b/test/nanostack/unittest/mac/mac_header_helper_functions/test_mac_header_helper_functions.c deleted file mode 100644 index 69f4b49a4f63..000000000000 --- a/test/nanostack/unittest/mac/mac_header_helper_functions/test_mac_header_helper_functions.c +++ /dev/null @@ -1,547 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_mac_header_helper_functions.h" -#include -#include "inttypes.h" -#include "mac_common_defines.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "MAC/IEEE802_15_4/mac_header_helper_functions.h" -#include "MAC/rf_driver_storage.h" -#include "nsdynmemLIB.h" -#include "nsdynmemLIB_stub.h" - -#include "common_functions_stub.h" - -bool test_mac_security_mic_length_get() -{ - if( 0 != mac_security_mic_length_get(0)){ - return false; - } - if( 4 != mac_security_mic_length_get(1)){ - return false; - } - if( 8 != mac_security_mic_length_get(2)){ - return false; - } - if( 16 != mac_security_mic_length_get(3)){ - return false; - } - if( 0 != mac_security_mic_length_get(4)){ - return false; - } - if( 4 != mac_security_mic_length_get(5)){ - return false; - } - if( 8 != mac_security_mic_length_get(6)){ - return false; - } - if( 16 != mac_security_mic_length_get(7)){ - return false; - } - return true; -} - -bool test_mac_header_security_aux_header_length() -{ - if( 0 != mac_header_security_aux_header_length(0, 0)){ - return false; - } - if( 14 != mac_header_security_aux_header_length(1, MAC_KEY_ID_MODE_SRC8_IDX)){ - return false; - } - if( 10 != mac_header_security_aux_header_length(1, MAC_KEY_ID_MODE_SRC4_IDX)){ - return false; - } - if( 6 != mac_header_security_aux_header_length(1, MAC_KEY_ID_MODE_IDX)){ - return false; - } - if( 5 != mac_header_security_aux_header_length(1, MAC_KEY_ID_MODE_IMPLICIT)){ - return false; - } - - return true; -} - -bool test_mac_header_address_length() -{ - mac_fcf_sequence_t seq; - if( 0 != mac_header_address_length(NULL)){ - return false; - } - seq.DstAddrMode = MAC_ADDR_MODE_16_BIT; - seq.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - seq.intraPan = 0; - if( 8 != mac_header_address_length(&seq)){ - return false; - } - - seq.DstAddrMode = MAC_ADDR_MODE_64_BIT; - seq.SrcAddrMode = MAC_ADDR_MODE_64_BIT; - if( 20 != mac_header_address_length(&seq)){ - return false; - } - - seq.DstAddrMode = MAC_ADDR_MODE_16_BIT; - seq.SrcAddrMode = MAC_ADDR_MODE_NONE; - if( 4 != mac_header_address_length(&seq)){ - return false; - } - - seq.DstAddrMode = MAC_ADDR_MODE_64_BIT; - seq.SrcAddrMode = MAC_ADDR_MODE_NONE; - if( 10 != mac_header_address_length(&seq)){ - return false; - } - - seq.DstAddrMode = MAC_ADDR_MODE_NONE; - seq.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - if( 4 != mac_header_address_length(&seq)){ - return false; - } - - seq.DstAddrMode = MAC_ADDR_MODE_NONE; - seq.SrcAddrMode = MAC_ADDR_MODE_64_BIT; - if( 10 != mac_header_address_length(&seq)){ - return false; - } - - return true; -} - -bool test_mac_header_security_parameter_set() -{ - mac_header_security_parameter_set(NULL, NULL); - mac_aux_security_header_t header; - memset(&header, 0, sizeof(mac_aux_security_header_t)); - mlme_security_t sec; - sec.SecurityLevel = 1; - sec.KeyIdMode = MAC_KEY_ID_MODE_IMPLICIT; - mac_header_security_parameter_set(&header, &sec); - if( header.securityLevel != 1 ){ - return false; - } - - memset(&sec.Keysource, 5, 8); - sec.KeyIdMode = MAC_KEY_ID_MODE_IDX; - mac_header_security_parameter_set(&header, &sec); - if( header.Keysource[0] != 0 ){ - return false; - } - - memset(&sec.Keysource, 6, 8); - sec.KeyIdMode = MAC_KEY_ID_MODE_SRC4_IDX; - mac_header_security_parameter_set(&header, &sec); - if( header.Keysource[0] != 6 || header.Keysource[6] != 0){ - return false; - } - - memset(&sec.Keysource, 7, 8); - sec.KeyIdMode = MAC_KEY_ID_MODE_SRC8_IDX; - mac_header_security_parameter_set(&header, &sec); - if( header.Keysource[7] != 7 ){ - return false; - } - - return true; -} - -bool test_mac_header_parse_fcf_dsn() -{ - mac_header_parse_fcf_dsn(NULL, NULL); - - mac_fcf_sequence_t header; - uint8_t ptr[3]; - ptr[2] = 7; - common_functions_stub.uint16_value = 0x987F; - mac_header_parse_fcf_dsn(&header, &ptr); - - if( header.DSN != 7 ){ - return false; - } - if( header.frametype != 7 ){ - return false; - } - if( !header.securityEnabled ){ - return false; - } - if( !header.framePending ){ - return false; - } - if( !header.ackRequested ){ - return false; - } - if( !header.intraPan ){ - return false; - } - if( header.DstAddrMode != 2 ){ - return false; - } - if( header.frameVersion != 1 ){ - return false; - } - if( header.SrcAddrMode != 2 ){ - return false; - } - return true; -} - -bool test_mac_header_security_components_read() -{ - mac_header_security_components_read(NULL, NULL); - mac_pre_parsed_frame_t frame; - memset(&frame, 0, sizeof(mac_pre_parsed_frame_t)); - mlme_security_t sec; - mac_header_security_components_read(&frame, &sec); - - frame.fcf_dsn.securityEnabled = true; - mac_header_security_components_read(&frame, &sec); - - nsdynmemlib_stub.returnCounter = 1; - mac_pre_parsed_frame_t *frame2 = ns_dyn_mem_alloc(sizeof(mac_pre_parsed_frame_t)+13); - memset(frame2, 0, sizeof(mac_pre_parsed_frame_t)+13); - frame2->buf[0] = MAC_KEY_ID_MODE_IMPLICIT << 3 + 1; - frame2->fcf_dsn.securityEnabled = true; - mac_header_security_components_read(frame2, &sec); - if( sec.KeyIdMode != MAC_KEY_ID_MODE_IMPLICIT ) { - return false; - } - - frame2->buf[0] = (MAC_KEY_ID_MODE_IDX << 3) + 1; - frame2->buf[5] = 5; - mac_header_security_components_read(frame2, &sec); - if( sec.KeyIndex != 5 ) { - return false; - } - - frame2->buf[0] = (MAC_KEY_ID_MODE_SRC4_IDX << 3) + 1; - frame2->buf[5] = 6; - mac_header_security_components_read(frame2, &sec); - if( sec.Keysource[0] != 6 ) { - return false; - } - - frame2->buf[5] = 7; - frame2->buf[9] = 9; - frame2->buf[0] = (MAC_KEY_ID_MODE_SRC8_IDX << 3) + 1; - mac_header_security_components_read(frame2, &sec); - if( sec.Keysource[0] != 7 || sec.Keysource[4] != 9 ) { - return false; - } - - ns_dyn_mem_free(frame2); - return true; -} - -bool test_mac_header_get_src_panid() -{ - if( 0 != mac_header_get_src_panid(NULL, NULL) ){ - return false; - } - mac_fcf_sequence_t seq; - uint8_t ptr[15]; - memset(&ptr, 0, 15); - ptr[3] = 3; - ptr[4] = 0; - seq.intraPan = false; - seq.DstAddrMode = MAC_ADDR_MODE_NONE; - if( 3 != mac_header_get_src_panid(&seq, &ptr) ){ - return false; - } - - ptr[7] = 4; - ptr[8] = 0; - seq.DstAddrMode = MAC_ADDR_MODE_16_BIT; - if( 4 != mac_header_get_src_panid(&seq, &ptr) ){ - return false; - } - - ptr[13] = 5; - ptr[14] = 0; - seq.DstAddrMode = MAC_ADDR_MODE_64_BIT; - if( 5 != mac_header_get_src_panid(&seq, &ptr) ){ - return false; - } - - return true; -} - -bool test_mac_header_get_dst_panid() -{ - if( 0 != mac_header_get_dst_panid(NULL, NULL) ){ - return false; - } - mac_fcf_sequence_t seq; - uint8_t ptr[5]; - memset(&ptr, 0, 5); - ptr[3] = 3; - ptr[4] = 0; - seq.DstAddrMode = MAC_ADDR_MODE_NONE; - uint16_t ret = mac_header_get_dst_panid(&seq, &ptr); - if( 65535 != ret ){ - return false; - } - - seq.DstAddrMode = MAC_ADDR_MODE_16_BIT; - if( 3 != mac_header_get_dst_panid(&seq, &ptr) ){ - return false; - } - - return true; -} - -bool test_mac_header_get_src_address() -{ - mac_header_get_src_address(NULL, NULL, NULL); - - mac_fcf_sequence_t seq; - uint8_t ptr[25]; - memset(&ptr, 0, 25); - uint8_t addr[15]; - memset(&addr, 0, 15); - seq.intraPan = false; - seq.DstAddrMode = MAC_ADDR_MODE_NONE; - seq.SrcAddrMode = MAC_ADDR_MODE_NONE; - mac_header_get_src_address(&seq, &ptr, &addr); - - seq.DstAddrMode = MAC_ADDR_MODE_16_BIT; - seq.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - ptr[9] = 5; - mac_header_get_src_address(&seq, &ptr, &addr); - if( 5 != addr[1] ){ - return false; - } - - ptr[15] = 15; - seq.DstAddrMode = MAC_ADDR_MODE_64_BIT; - seq.SrcAddrMode = MAC_ADDR_MODE_64_BIT; - mac_header_get_src_address(&seq, &ptr, &addr); - if( 15 != addr[7] ){ - return false; - } - - return true; -} - -bool test_mac_header_get_dst_address() -{ - mac_header_get_dst_address(NULL, NULL, NULL); - mac_fcf_sequence_t seq; - uint8_t ptr[25]; - memset(&ptr, 0, 25); - uint8_t addr[15]; - memset(&addr, 0, 15); - seq.DstAddrMode = MAC_ADDR_MODE_NONE; - mac_header_get_dst_address(&seq, &ptr, &addr); - - ptr[5] = 5; - seq.DstAddrMode = MAC_ADDR_MODE_16_BIT; - mac_header_get_dst_address(&seq, &ptr, &addr); - if( 5 != addr[1] ){ - return false; - } - - ptr[5] = 15; - seq.DstAddrMode = MAC_ADDR_MODE_64_BIT; - mac_header_get_dst_address(&seq, &ptr, &addr); - if( 15 != addr[7] ){ - return false; - } - - return true; -} - -bool test_mcps_payload_length_from_received_frame() -{ - if( 0 != mcps_payload_length_from_received_frame(NULL) ){ - return false; - } - mac_pre_parsed_frame_t frame; - frame.mac_payload_length = 2; - if( 2 != mcps_payload_length_from_received_frame(&frame) ){ - return false; - } - - return true; -} - -bool test_mcps_mac_header_length_from_received_frame() -{ - if( 0 != mcps_mac_header_length_from_received_frame(NULL) ){ - return false; - } - mac_pre_parsed_frame_t frame; - frame.mac_header_length = 1; - frame.security_aux_header_length = 1; - if( 2 != mcps_mac_header_length_from_received_frame(&frame) ){ - return false; - } - return true; -} - -bool test_mcps_mac_security_frame_counter_read() -{ - uint32_t ret = mcps_mac_security_frame_counter_read(NULL); - if( 0xffffffff != ret ){ - return false; - } - mac_pre_parsed_frame_t frame; - frame.mac_header_length = 0; - frame.fcf_dsn.securityEnabled = true; - common_functions_stub.uint32_value = 0x5454; - ret = mcps_mac_security_frame_counter_read(&frame); - if( 0x5454 != ret ){ - return false; - } - - return true; -} - -bool test_mcps_mac_command_frame_id_get() -{ - if( NULL != mcps_mac_command_frame_id_get(NULL) ){ - return false; - } - nsdynmemlib_stub.returnCounter = 1; - mac_pre_parsed_frame_t *frame2 = ns_dyn_mem_alloc(sizeof(mac_pre_parsed_frame_t)+13); - memset(frame2, 0, sizeof(mac_pre_parsed_frame_t)+13); - frame2->mac_header_length = 0; - frame2->security_aux_header_length = 0; - frame2->buf[0] = 2; - if( NULL == mcps_mac_command_frame_id_get(frame2) ){ - return false; - } - ns_dyn_mem_free(frame2); - return true; -} - -bool test_mcps_mac_payload_pointer_get() -{ - if( NULL != mcps_mac_payload_pointer_get(NULL) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - mac_pre_parsed_frame_t *frame2 = ns_dyn_mem_alloc(sizeof(mac_pre_parsed_frame_t)+13); - memset(frame2, 0, sizeof(mac_pre_parsed_frame_t)+13); - frame2->mac_header_length = 0; - frame2->security_aux_header_length = 0; - frame2->buf[0] = 2; - if( NULL == mcps_mac_payload_pointer_get(frame2) ){ - return false; - } - ns_dyn_mem_free(frame2); - - return true; -} - -bool test_mcps_security_mic_pointer_get() -{ - if( NULL != mcps_security_mic_pointer_get(NULL) ){ - return false; - } - nsdynmemlib_stub.returnCounter = 1; - mac_pre_parsed_frame_t *frame2 = ns_dyn_mem_alloc(sizeof(mac_pre_parsed_frame_t)+13); - memset(frame2, 0, sizeof(mac_pre_parsed_frame_t)+13); - frame2->mac_payload_length = 0; - frame2->buf[0] = 2; - if( NULL == mcps_security_mic_pointer_get(frame2) ){ - return false; - } - ns_dyn_mem_free(frame2); - return true; -} - -bool test_mcps_mac_security_aux_header_start_pointer_get() -{ - if( NULL != mcps_mac_security_aux_header_start_pointer_get(NULL) ){ - return false; - } - nsdynmemlib_stub.returnCounter = 1; - mac_pre_parsed_frame_t *frame2 = ns_dyn_mem_alloc(sizeof(mac_pre_parsed_frame_t)+13); - memset(frame2, 0, sizeof(mac_pre_parsed_frame_t)+13); - frame2->mac_header_length = 0; - frame2->fcf_dsn.securityEnabled = true; - frame2->buf[0] = 2; - if( NULL == mcps_mac_security_aux_header_start_pointer_get(frame2) ){ - return false; - } - - ns_dyn_mem_free(frame2); - return true; -} - -static int test_pointer_move_length(uint8_t *new, uint8_t *old) -{ - return (int)(new - old); -} - -bool test_mcps_generic_header_write() -{ - uint8_t buffer_ptr[30]; - uint8_t *ptr; - nsdynmemlib_stub.returnCounter = 1; - mac_pre_build_frame_t *frame2 = ns_dyn_mem_alloc(sizeof(mac_pre_build_frame_t)); - memset(frame2, 0, sizeof(mac_pre_build_frame_t)); - - frame2->fcf_dsn.DSN = 1; - frame2->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - frame2->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - frame2->fcf_dsn.intraPan = true; - ptr = mcps_generic_header_write(buffer_ptr, frame2); - //3+4+2 - if (test_pointer_move_length(ptr, buffer_ptr) != 9) { - return false; - } - - frame2->fcf_dsn.intraPan = false; - ptr = mcps_generic_header_write(buffer_ptr, frame2); - //3+4+4 - if (test_pointer_move_length(ptr, buffer_ptr) != 11) { - return false; - } - frame2->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_64_BIT; - ptr = mcps_generic_header_write(buffer_ptr, frame2); - //3+10+4 - if (test_pointer_move_length(ptr, buffer_ptr) != 17) { - return false; - } - - frame2->fcf_dsn.intraPan = true; - ptr = mcps_generic_header_write(buffer_ptr, frame2); - //3+10+2 - if (test_pointer_move_length(ptr, buffer_ptr) != 15) { - return false; - } - frame2->fcf_dsn.intraPan = false; - frame2->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - ptr = mcps_generic_header_write(buffer_ptr, frame2); - //3+4 - if (test_pointer_move_length(ptr, buffer_ptr) != 7) { - return false; - } - frame2->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_64_BIT; - ptr = mcps_generic_header_write(buffer_ptr, frame2); - //3+10 - if (test_pointer_move_length(ptr, buffer_ptr) != 13) { - return false; - } - - ns_dyn_mem_free(frame2); - return true; - -} diff --git a/test/nanostack/unittest/mac/mac_header_helper_functions/test_mac_header_helper_functions.h b/test/nanostack/unittest/mac/mac_header_helper_functions/test_mac_header_helper_functions.h deleted file mode 100644 index a3403e777f22..000000000000 --- a/test/nanostack/unittest/mac/mac_header_helper_functions/test_mac_header_helper_functions.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_HEADER_HELPER_FUNCTIONS_H -#define TEST_MAC_HEADER_HELPER_FUNCTIONS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_security_mic_length_get(); - -bool test_mac_header_security_aux_header_length(); - -bool test_mac_header_address_length(); - -bool test_mac_header_security_parameter_set(); - -bool test_mac_header_parse_fcf_dsn(); - -bool test_mac_header_security_components_read(); - -bool test_mac_header_get_src_panid(); - -bool test_mac_header_get_dst_panid(); - -bool test_mac_header_get_src_address(); - -bool test_mac_header_get_dst_address(); - -bool test_mcps_payload_length_from_received_frame(); - -bool test_mcps_mac_header_length_from_received_frame(); - -bool test_mcps_mac_security_frame_counter_read(); - -bool test_mcps_mac_command_frame_id_get(); - -bool test_mcps_mac_payload_pointer_get(); - -bool test_mcps_security_mic_pointer_get(); - -bool test_mcps_mac_security_aux_header_start_pointer_get(); - -bool test_mcps_generic_header_write(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_HEADER_HELPER_FUNCTIONS_H - diff --git a/test/nanostack/unittest/mac/mac_indirect_data/Makefile b/test/nanostack/unittest/mac/mac_indirect_data/Makefile deleted file mode 100644 index b5424ca31455..000000000000 --- a/test/nanostack/unittest/mac/mac_indirect_data/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_indirect_data_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/mac_indirect_data.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_indirect_datatest.cpp \ - test_mac_indirect_data.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mac_header_helper_functions_stub.c \ - ../../stub/sw_mac_stub.c \ - ../../stub/mac_mcps_sap_stub.c \ - ../../stub/ns_timer_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/mac_indirect_data/mac_indirect_datatest.cpp b/test/nanostack/unittest/mac/mac_indirect_data/mac_indirect_datatest.cpp deleted file mode 100644 index ed6c2e05ad7e..000000000000 --- a/test/nanostack/unittest/mac/mac_indirect_data/mac_indirect_datatest.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_indirect_data.h" - -TEST_GROUP(mac_indirect_data) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_indirect_data, test_mac_indirect_data_ttl_handle) -{ - CHECK(test_mac_indirect_data_ttl_handle()); -} - -TEST(mac_indirect_data, test_mac_indirect_data_req_handle) -{ - CHECK(test_mac_indirect_data_req_handle()); -} - -TEST(mac_indirect_data, test_mac_indirect_queue_write) -{ - CHECK(test_mac_indirect_queue_write()); -} - diff --git a/test/nanostack/unittest/mac/mac_indirect_data/main.cpp b/test/nanostack/unittest/mac/mac_indirect_data/main.cpp deleted file mode 100644 index 7130bfcfc3ed..000000000000 --- a/test/nanostack/unittest/mac/mac_indirect_data/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_indirect_data); - diff --git a/test/nanostack/unittest/mac/mac_indirect_data/test_mac_indirect_data.c b/test/nanostack/unittest/mac/mac_indirect_data/test_mac_indirect_data.c deleted file mode 100644 index f86602a75665..000000000000 --- a/test/nanostack/unittest/mac/mac_indirect_data/test_mac_indirect_data.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_mac_indirect_data.h" -#include -#include "inttypes.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "MAC/rf_driver_storage.h" - -#include "sw_mac_stub.h" -#include "common_functions_stub.h" -#include "mac_header_helper_functions_stub.h" - -bool visited = false; - -static int8_t mac_state_control(phy_interface_state_e a, uint8_t b) -{ - visited = true; -} - -static int8_t mac_tx(uint8_t *a, uint16_t b, uint8_t c) -{ - visited = true; -} - -static int8_t mac_address_write(phy_address_type_e a,uint8_t *b) -{ - visited = true; -} - -static int8_t mac_extension(phy_extension_type_e a,uint8_t *b) -{ - visited = true; -} - -static uint8_t mymac[8]; - -static phy_device_driver_s device_driver = { -.PHY_MAC = mymac, -.link_type = PHY_LINK_ETHERNET_TYPE, -.driver_description = "indirect_test_iface", -.phy_MTU = 1280, -.phy_tail_length = 0, -.phy_header_length = 0, -.state_control = mac_state_control, -.tx = mac_tx, -.address_write = mac_address_write, -.extension = mac_extension, -}; - -static void test_data_confirm_cb( const mac_api_t* api, const mcps_data_conf_t *data ) -{ - -} - -void test_mlme_request(const mac_api_t* api, mlme_primitive id, const void *data) -{ - -} - -bool test_mac_indirect_data_ttl_handle() -{ - mac_indirect_data_ttl_handle(NULL, 0); //Crashes if NULL not handled - - arm_device_driver_list_s list; - protocol_interface_rf_mac_setup_s cur; - cur.dev_driver = &list; - cur.dev_driver->phy_driver = &device_driver; - cur.indirect_pd_data_request_queue = NULL; - visited = false; - mac_indirect_data_ttl_handle(&cur, 0); - if( !visited ){ - return false; - } - - mac_pre_build_frame_t frame; - mac_pre_build_frame_t frame2; - mac_pre_build_frame_t frame3; - frame.next = &frame2; - frame2.next = &frame3; - frame3.next = NULL; - sw_mac_stub.mac_api_ptr = NULL; - cur.indirect_pd_data_request_queue = &frame; - mac_indirect_data_ttl_handle(&cur, 0); - - mac_api_t api; - sw_mac_stub.mac_api_ptr = &api; - frame.buffer_ttl = 2; - api.data_conf_cb = &test_data_confirm_cb; - cur.indirect_pd_data_request_queue = &frame; - mac_indirect_data_ttl_handle(&cur, 0); - - frame.buffer_ttl = 1; - frame2.buffer_ttl = 80; - frame3.buffer_ttl = 2; - cur.indirect_pd_data_request_queue = &frame; - mac_indirect_data_ttl_handle(&cur, 80); - - return true; -} - -bool test_mac_indirect_data_req_handle() -{ - uint8_t ret = mac_indirect_data_req_handle( NULL, NULL ); - if( 1 != ret ){ - return false; - } - - mac_pre_parsed_frame_t frame; - memset(&frame, 0, sizeof(mac_pre_parsed_frame_t)); - protocol_interface_rf_mac_setup_s mac; - frame.fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - frame.fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_NONE; - ret = mac_indirect_data_req_handle( &frame, &mac ); - if( 1 != ret ){ - return false; - } - - mac_api_t api; - sw_mac_stub.mac_api_ptr = &api; - api.mlme_ind_cb = &test_mlme_request; - frame.fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - frame.ack_pendinfg_status = false; - mac_pre_build_frame_t pre_frame; - memset(&pre_frame, 0, sizeof(mac_pre_build_frame_t)); - - mac.indirect_pd_data_request_queue = &pre_frame; - ret = mac_indirect_data_req_handle( &frame, &mac ); - if( 1 != ret ){ - return false; - } - frame.ack_pendinfg_status = true; - ret = mac_indirect_data_req_handle( &frame, &mac ); - if( 0 != ret ){ - return false; - } - - mac_pre_build_frame_t pre_frame2; - memset(&pre_frame2, 0, sizeof(mac_pre_build_frame_t)); - pre_frame.next = &pre_frame2; - pre_frame2.fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - frame.ack_pendinfg_status = true; - ret = mac_indirect_data_req_handle( &frame, &mac ); - if( 1 != ret ){ - return false; - } - - mlme_device_descriptor_t desc; - frame.neigh_info = &desc; - - desc.ShortAddress = 8; - common_functions_stub.uint16_value = 8; - pre_frame.fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - ret = mac_indirect_data_req_handle( &frame, &mac ); - if( 1 != ret ){ - return false; - } - - memset(&desc.ExtAddress, 4, 8); - memset(&pre_frame.DstAddr, 4, 8); - pre_frame.fcf_dsn.DstAddrMode = MAC_ADDR_MODE_64_BIT; - mac.indirect_pd_data_request_queue = &pre_frame; - frame.fcf_dsn.DstAddrMode = MAC_ADDR_MODE_64_BIT; - frame.fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_64_BIT; - ret = mac_indirect_data_req_handle( &frame, &mac ); - if( 1 != ret ){ - return false; - } - - return true; -} - -bool test_mac_indirect_queue_write() -{ - mac_indirect_queue_write(NULL, NULL); - - mac_pre_build_frame_t pre_frame; - memset(&pre_frame, 0, sizeof(mac_pre_build_frame_t)); - protocol_interface_rf_mac_setup_s cur; - memset(&cur, 0, sizeof(protocol_interface_rf_mac_setup_s)); - arm_device_driver_list_s list; - cur.dev_driver = &list; - cur.dev_driver->phy_driver = &device_driver; - - visited = false; - mac_indirect_queue_write(&cur, &pre_frame); - if( !visited ){ - return false; - } - - mac_pre_build_frame_t pre_frame2; - memset(&pre_frame2, 0, sizeof(mac_pre_build_frame_t)); - mac_indirect_queue_write(&cur, &pre_frame2); - - mac_pre_build_frame_t pre_frame3; - memset(&pre_frame3, 0, sizeof(mac_pre_build_frame_t)); - mac_indirect_queue_write(&cur, &pre_frame3); - - return true; -} diff --git a/test/nanostack/unittest/mac/mac_indirect_data/test_mac_indirect_data.h b/test/nanostack/unittest/mac/mac_indirect_data/test_mac_indirect_data.h deleted file mode 100644 index 0b6c3e61d938..000000000000 --- a/test/nanostack/unittest/mac/mac_indirect_data/test_mac_indirect_data.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_INDIRECT_DATA_H -#define TEST_MAC_INDIRECT_DATA_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_indirect_data_ttl_handle(); - -bool test_mac_indirect_data_req_handle(); - -bool test_mac_indirect_queue_write(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_INDIRECT_DATA_H - diff --git a/test/nanostack/unittest/mac/mac_mcps_sap/Makefile b/test/nanostack/unittest/mac/mac_mcps_sap/Makefile deleted file mode 100644 index 529dd2b4e1cd..000000000000 --- a/test/nanostack/unittest/mac/mac_mcps_sap/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_mcps_sap_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/mac_mcps_sap.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_mcps_saptest.cpp \ - test_mac_mcps_sap.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mac_header_helper_functions_stub.c \ - ../../stub/event_stub.c \ - ../../stub/ns_timer_stub.c \ - ../../stub/sw_mac_stub.c \ - ../../stub/mac_mlme_stub.c \ - ../../stub/mac_timer_stub.c \ - ../../stub/mac_filter_stub.c \ - ../../stub/mac_indirect_data_stub.c \ - ../../stub/mac_security_mib_stub.c \ - ../../stub/mac_pd_sap_stub.c \ - ../../stub/mac_pairwise_key_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/ccm_security_stub.c \ - ../../stub/fhss_config_stub.c \ - ../../stub/fhss_mac_interface_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/mac_mcps_sap/mac_mcps_saptest.cpp b/test/nanostack/unittest/mac/mac_mcps_sap/mac_mcps_saptest.cpp deleted file mode 100644 index ce9a55cc2365..000000000000 --- a/test/nanostack/unittest/mac/mac_mcps_sap/mac_mcps_saptest.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_mcps_sap.h" - -TEST_GROUP(mac_mcps_sap) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_mcps_sap, test_mac_generic_event_trig) -{ - CHECK(test_mac_generic_event_trig()); -} - -TEST(mac_mcps_sap, test_mcps_sap_trig_tx) -{ - CHECK(test_mcps_sap_trig_tx()); -} - -TEST(mac_mcps_sap, test_mac_virtual_sap_data_cb) -{ - CHECK(test_mac_virtual_sap_data_cb()); -} - -TEST(mac_mcps_sap, test_mac_mcps_data_confirmation) -{ - CHECK(test_mac_mcps_data_confirmation()); -} - - -TEST(mac_mcps_sap, test_mac_mcps_data_indication) -{ - CHECK(test_mac_mcps_data_indication()); -} - -TEST(mac_mcps_sap, test_mac_mcps_sap_tasklet_init) -{ - CHECK(test_mac_mcps_sap_tasklet_init()); -} - -TEST(mac_mcps_sap, test_mcps_sap_pre_parsed_frame_buffer_free) -{ - CHECK(test_mcps_sap_pre_parsed_frame_buffer_free()); -} - -TEST(mac_mcps_sap, test_mcps_sap_prebuild_frame_buffer_get) -{ - CHECK(test_mcps_sap_prebuild_frame_buffer_get()); -} - -TEST(mac_mcps_sap, test_mcps_sap_prebuild_frame_buffer_free) -{ - CHECK(test_mcps_sap_prebuild_frame_buffer_free()); -} - -TEST(mac_mcps_sap, test_mcps_sap_pd_req_queue_write) -{ - CHECK(test_mcps_sap_pd_req_queue_write()); -} - -//TEST(mac_mcps_sap, test_mcps_data_confirm_handle) -//{ -// CHECK(test_mcps_data_confirm_handle()); -//} - -TEST(mac_mcps_sap, test_mcps_sap_pre_parsed_frame_buffer_get) -{ - CHECK(test_mcps_sap_pre_parsed_frame_buffer_get()); -} - -TEST(mac_mcps_sap, test_mcps_sap_pd_ind) -{ - CHECK(test_mcps_sap_pd_ind()); -} - -TEST(mac_mcps_sap, test_mcps_sap_pd_confirm) -{ - CHECK(test_mcps_sap_pd_confirm()); -} - -TEST(mac_mcps_sap, test_mcps_sap_data_req_handler) -{ - CHECK(test_mcps_sap_data_req_handler()); -} - -TEST(mac_mcps_sap, test_mac_mcps_trig_buffer_from_queue) -{ - CHECK(test_mac_mcps_trig_buffer_from_queue()); -} - -TEST(mac_mcps_sap, test_mac_mcps_buffer_queue_free) -{ - CHECK(test_mac_mcps_buffer_queue_free()); -} diff --git a/test/nanostack/unittest/mac/mac_mcps_sap/main.cpp b/test/nanostack/unittest/mac/mac_mcps_sap/main.cpp deleted file mode 100644 index dc575d7899f9..000000000000 --- a/test/nanostack/unittest/mac/mac_mcps_sap/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_mcps_sap); - diff --git a/test/nanostack/unittest/mac/mac_mcps_sap/test_mac_mcps_sap.c b/test/nanostack/unittest/mac/mac_mcps_sap/test_mac_mcps_sap.c deleted file mode 100644 index 55e656572d86..000000000000 --- a/test/nanostack/unittest/mac/mac_mcps_sap/test_mac_mcps_sap.c +++ /dev/null @@ -1,2741 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" - -#include "nsconfig.h" -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_callback_timer.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "randLIB.h" -#include "ccmLIB.h" -#include "mlme.h" -#include "mac_api.h" -#include "fhss_api.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/IEEE802_15_4/mac_header_helper_functions.h" -#include "MAC/IEEE802_15_4/mac_timer.h" -#include "MAC/IEEE802_15_4/mac_security_mib.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "MAC/IEEE802_15_4/mac_filter.h" -#include "MAC/IEEE802_15_4/mac_pd_sap.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "MAC/IEEE802_15_4/mac_indirect_data.h" -#include "MAC/rf_driver_storage.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "platform/arm_hal_interrupt.h" -#include "common_functions.h" -#include "mac_api.h" -#include "sw_mac.h" - -#include "test_mac_mcps_sap.h" -#include "sw_mac_stub.h" -#include "ccm_security_stub.h" -#include "mac_security_mib_stub.h" -#include "mac_header_helper_functions_stub.h" -#include "nsdynmemLIB_stub.h" -#include "mac_indirect_data_stub.h" -#include "event_stub.h" -#include "mac_filter_stub.h" -#include "mac_mlme_stub.h" -#include "fhss_config_stub.h" -#include "fhss_mac_interface_stub.h" -#include - -static uint8_t tes_mac_mcps_mac64[8]; - - -static mac_pre_build_frame_t * tes_mac_mcps_temporary_buffer_get(uint16_t length) { - mac_pre_build_frame_t *buf = malloc(sizeof(mac_pre_build_frame_t)); - - memset(buf,0, sizeof(mac_pre_build_frame_t)); - - if (length) { - buf->mac_payload = malloc(length); - buf->mac_allocated_payload_ptr = true; - buf->mac_payload_length = length; - } - - return buf; -} - -static void test_mac_buffer_settings(mac_pre_build_frame_t *buf, mac_frame_e frame_type, uint8_t srcType, uint8_t dstType,bool ack_request, bool intra, bool security, mac_aux_security_header_t *security_params) -{ - buf->fcf_dsn.frametype = frame_type; - buf->fcf_dsn.SrcAddrMode = srcType; - buf->fcf_dsn.DstAddrMode = dstType; - buf->fcf_dsn.intraPan = intra; - buf->fcf_dsn.securityEnabled = security; - buf->fcf_dsn.ackRequested = ack_request; - buf->mac_header_length_with_security = 3; - switch (buf->fcf_dsn.DstAddrMode) { - case MAC_ADDR_MODE_64_BIT: - buf->mac_header_length_with_security += 10; - break; - case MAC_ADDR_MODE_16_BIT: - buf->mac_header_length_with_security += 4; - break; - } - - switch (buf->fcf_dsn.SrcAddrMode) { - case MAC_ADDR_MODE_64_BIT: - buf->mac_header_length_with_security += 8; - break; - case MAC_ADDR_MODE_16_BIT: - buf->mac_header_length_with_security += 2; - break; - } - - if (!intra) { - buf->mac_header_length_with_security += 2; - } - - - if (security) { - buf->aux_header = *security_params; - if (buf->aux_header.securityLevel) { - - - - - switch (buf->aux_header.KeyIdMode) { - case 1: - case 5: - buf->security_mic_len = 4; - break; - - case 2: - case 6: - buf->security_mic_len = 8; - break; - case 3: - case 7: - buf->security_mic_len = 16; - break; - default: - - buf->security_mic_len = 0; - break; - } - buf->mac_header_length_with_security += 5; //Level and frame counter - - switch (buf->aux_header.securityLevel) { - case MAC_KEY_ID_MODE_IMPLICIT: - break; - case MAC_KEY_ID_MODE_IDX: - buf->mac_header_length_with_security += 1; - break; - - case MAC_KEY_ID_MODE_SRC4_IDX: - buf->mac_header_length_with_security += 5; - break; - case MAC_KEY_ID_MODE_SRC8_IDX: - buf->mac_header_length_with_security += 9; - break; - } - - - } else { - buf->aux_header.KeyIdMode = 0; - } - } -} - -static void test_set_security_params(mac_aux_security_header_t *params, uint8_t security_level, uint8_t key_id_mode, uint8_t key_index) -{ - params->KeyIdMode = key_id_mode; - params->KeyIndex = 1; - params->frameCounter = 0; - params->securityLevel = security_level; -} - -static int8_t test_phy_rf_virtual_rx(const uint8_t *data_ptr, uint16_t data_len,int8_t driver_id) -{ - -} - -static phy_link_tx_status_e virtual_tx_done_status; -static bool virtual_cb_ok = false; - -static int8_t test_phy_rf_tx_done(int8_t driver_id, uint8_t tx_handle, phy_link_tx_status_e status, uint8_t cca_retry, uint8_t tx_retry) -{ - if (status == virtual_tx_done_status) { - virtual_cb_ok = true; - } else { - virtual_cb_ok = false; - } - -} - -static uint16_t expected_virtual_rx_data_length = 0; -static bool virtual_rx_data_length_ok = false; - -static int8_t test_phy_rf_rx(const uint8_t *data_ptr, uint16_t data_len, uint8_t link_quality, int8_t dbm, int8_t driver_id) -{ - //Validate proper data length here - if (expected_virtual_rx_data_length == data_len) { - virtual_rx_data_length_ok = true; - } else { - virtual_rx_data_length_ok = false; - } -} - - -static arm_device_driver_list_s * rf_client_driver_allocate() -{ - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - phy_device_driver_s *dev_driver = malloc(sizeof(phy_device_driver_s)); - - - memset(driver, 0, sizeof(arm_device_driver_list_s)); - memset(dev_driver, 0, sizeof(phy_device_driver_s)); - - driver->phy_driver = dev_driver; - - - dev_driver->arm_net_virtual_rx_cb = &test_phy_rf_virtual_rx; - dev_driver->phy_rx_cb = &test_phy_rf_rx; - dev_driver->phy_tx_done_cb = &test_phy_rf_tx_done; - - - return driver; -} - - -static protocol_interface_rf_mac_setup_s * test_mac_rf_mac_class_allocate(void) { - protocol_interface_rf_mac_setup_s *rf_mac_setup = malloc(sizeof(protocol_interface_rf_mac_setup_s)); - - memset(rf_mac_setup,0, sizeof(protocol_interface_rf_mac_setup_s)); - rf_mac_setup->dev_driver_tx_buffer.buf = malloc(128); - rf_mac_setup->dev_driver_tx_buffer.len = 127; - - - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - phy_device_driver_s *dev_driver = malloc(sizeof(phy_device_driver_s)); - - - memset(driver, 0, sizeof(arm_device_driver_list_s)); - memset(dev_driver, 0, sizeof(phy_device_driver_s)); - - dev_driver->PHY_MAC = tes_mac_mcps_mac64; - dev_driver->phy_MTU = 127; - dev_driver->phy_header_length = 0; - driver->phy_driver = dev_driver; - rf_mac_setup->dev_driver = driver; - - return rf_mac_setup; -} - -static uint8_t expect_data_confirmation_status = 0; -static bool data_confirm_valid = false; - -void test_mcps_data_confirm( const mac_api_t* api, const mcps_data_conf_t *data ) -{ - if (data->status == expect_data_confirmation_status) { - data_confirm_valid = true; - } else { - data_confirm_valid = false; - } -} -static uint16_t expected_data_length = 0; -static bool data_ind_valid = false; - -static void test_mcps_data_indication( const mac_api_t* api, const mcps_data_ind_t *data ) -{ - if (data->msduLength == expected_data_length) { - data_ind_valid = true; - } else { - data_ind_valid = false; - } -} - -static mlme_primitive expected_mlme_id_cnf = 0; -static bool mlme_confirm_valid = false; - -void test_mlme_confirm( const mac_api_t* api, mlme_primitive id, const void *data ) -{ - if (id == expected_mlme_id_cnf) { - mlme_confirm_valid = true; - } else { - mlme_confirm_valid = false; - } -} - -static uint8_t expected_purge_status = 0; -static uint8_t expected_purge_handle = 0; -static uint8_t expected_purge_result = false; - -void test_purge_confirm( const mac_api_t* api, const mcps_purge_conf_t *data ) -{ - if (expected_purge_handle != data->msduHandle) { - expected_purge_result = false; - } else if (expected_purge_status != data->status){ - expected_purge_result = false; - } else { - expected_purge_result= true; - } -} - -static mlme_primitive expected_mlme_ind_id_cnf = 0; -static uint8_t mlme_ind_status; -static bool mlme_ind_valid = false; - - -void test_mlme_indication( const mac_api_t* api, mlme_primitive id, const void *data ) -{ - mlme_ind_valid = false; - if (id == expected_mlme_ind_id_cnf) { - - if (id == MLME_COMM_STATUS) { - mlme_comm_status_t *comm_status = (mlme_comm_status_t*) data; - if (comm_status->status == mlme_ind_status) { - mlme_ind_valid = true; - } - } else { - mlme_ind_valid = true; - } - } - -} - -static uint8_t expected_event_type = 0; -static bool valid_pd_sap_confirm_forward = false; - -static void handler_func_ptr(arm_event_s *event) -{ - if (event->event_type == expected_event_type) { - valid_pd_sap_confirm_forward = true; - } else { - valid_pd_sap_confirm_forward = false; - } -} - - -void test_mac_rf_mac_class_free(protocol_interface_rf_mac_setup_s *rf_ptr) { - - free(rf_ptr->dev_driver_tx_buffer.buf); - free(rf_ptr->dev_driver->phy_driver); - free(rf_ptr->dev_driver); - if (rf_ptr->tun_extension_rf_driver) { - free(rf_ptr->tun_extension_rf_driver->phy_driver); - free(rf_ptr->tun_extension_rf_driver); - } - free(rf_ptr); -} - - -bool test_mac_generic_event_trig() -{ - //Init event handler - event_stub.int8_value = 0; - int8_t mac_tasklet_id = mac_mcps_sap_tasklet_init(); - mcps_data_req_t data_req; - - ccm_globals_t ccm_ptr; - mac_api_t mac_api; - mlme_key_descriptor_t key_description; - mlme_device_descriptor_t device_description; - mac_aux_security_header_t secuirity_params; - mlme_key_device_descriptor_t key_device_description; - memset(&data_req, 0, sizeof(mcps_data_req_t)); - - uint8_t tx_buf[127]; - uint8_t tx_temp[200]; - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - memset(tx_buf, 1, 127); - - memset(&key_description, 0, sizeof(mlme_key_descriptor_t)); - memset(&device_description, 0, sizeof(mlme_device_descriptor_t)); - - mac_api.data_conf_cb = &test_mcps_data_confirm; - mac_api.mlme_conf_cb = &test_mlme_confirm; - mac_api.data_ind_cb = &test_mcps_data_indication; - mac_api.mlme_ind_cb = &test_mlme_indication; - - rf_mac_setup->macUpState = true; - sw_mac_stub.mac_api_ptr = &mac_api; - - mac_generic_event_trig(MAC_MLME_EVENT_HANDLER,rf_mac_setup,false); - - mac_generic_event_trig(MAC_MLME_SCAN_CONFIRM_HANDLER,rf_mac_setup,true); - - test_mac_rf_mac_class_free(rf_mac_setup); - return true; - -} - -bool test_mcps_sap_trig_tx() -{ - //Init event handler - event_stub.int8_value = 0; - int8_t mac_tasklet_id = mac_mcps_sap_tasklet_init(); - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - - rf_mac_setup->fhss_api = ns_fhss_create(0, 0); - mac_pre_build_frame_t *buf = tes_mac_mcps_temporary_buffer_get(0); - rf_mac_setup->pd_data_request_bc_queue_to_go = buf; - - // Test without MAC setup - mcps_sap_trig_tx(NULL); - if (rf_mac_setup->active_pd_data_request == buf) { - return false; - } - - // Test when TX trig active - rf_mac_setup->active_mac_events |= (1 << MAC_SAP_TRIG_TX); - mcps_sap_trig_tx(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request == buf) { - return false; - } - rf_mac_setup->active_mac_events &= ~(1 << MAC_SAP_TRIG_TX); - - // FHSS is on broadcast channel and tx conditions are fine - fhss_mac_interface_stub.channel_bool_value = true; - fhss_mac_interface_stub.cond_bool_value = true; - - mcps_sap_trig_tx(rf_mac_setup); - // Active data request should be buf - if (rf_mac_setup->active_pd_data_request != buf) { - return false; - } - mac_mcps_buffer_queue_free(rf_mac_setup); - test_mac_rf_mac_class_free(rf_mac_setup); - - return true; -} - -bool test_mac_virtual_sap_data_cb() { - //Init event handler - event_stub.int8_value = 0; - int8_t mac_tasklet_id = mac_mcps_sap_tasklet_init(); - mcps_data_req_t data_req; - - ccm_globals_t ccm_ptr; - mac_api_t mac_api; - mlme_key_descriptor_t key_description; - mlme_device_descriptor_t device_description; - mac_aux_security_header_t secuirity_params; - mlme_key_device_descriptor_t key_device_description; - memset(&data_req, 0, sizeof(mcps_data_req_t)); - - uint8_t tx_buf[127]; - uint8_t tx_temp[200]; - uint8_t virtual_tx_temp[200]; - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - memset(tx_buf, 1, 127); - - memset(&key_description, 0, sizeof(mlme_key_descriptor_t)); - memset(&device_description, 0, sizeof(mlme_device_descriptor_t)); - - mac_api.data_conf_cb = &test_mcps_data_confirm; - mac_api.mlme_conf_cb = &test_mlme_confirm; - mac_api.data_ind_cb = &test_mcps_data_indication; - mac_api.mlme_ind_cb = &test_mlme_indication; - - rf_mac_setup->macUpState = true; - sw_mac_stub.mac_api_ptr = &mac_api; - - rf_mac_setup->tun_extension_rf_driver = rf_client_driver_allocate(); - - arm_phy_sap_msg_t phy_message; - - memset(&phy_message, 0 , sizeof(arm_phy_sap_msg_t)); - - mac_virtual_sap_data_cb(NULL, NULL); - - phy_message.id = MAC802_PD_SAP_DATA_TX_CONFIRM; - if (-1 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - rf_mac_setup->macUpState = false; - - //TEST MLME Extension - - phy_message.id = MACTUN_MLME_NAP_EXTENSION; - uint8_t beacon_payload[18]; - beacon_payload[0] = macBeaconPayload; - beacon_payload[1] = 0; - phy_message.message.mlme_request.mlme_ptr = beacon_payload; - phy_message.message.mlme_request.primitive = MLME_SET; - phy_message.message.mlme_request.ptr_length = 18; - - mac_mlme_stub.int8_value = -1; - if (-1 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - - mac_mlme_stub.int8_value = 0; - if (0 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - - phy_message.message.mlme_request.primitive = MLME_SCAN; - phy_message.message.mlme_request.ptr_length = 40; - if (-1 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - phy_message.message.mlme_request.ptr_length = 47; - if (0 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - - phy_message.message.mlme_request.primitive = MLME_START; - phy_message.message.mlme_request.ptr_length = 30; - if (-1 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - phy_message.message.mlme_request.ptr_length = 34; - if (0 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - - // Test unsupported primitive - phy_message.message.mlme_request.primitive = 65535; - if (-1 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - - //Test Mac down state - phy_message.id = MACTUN_PD_SAP_NAP_IND; - if (-1 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - - //Test too long - rf_mac_setup->macUpState = true; - phy_message.message.generic_data_ind.data_ptr = virtual_tx_temp; - phy_message.message.generic_data_ind.data_len = 128; - if (mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) == 0) { - return false; - } - - //Test Buffer fail allocation - nsdynmemlib_stub.returnCounter = 0; - - phy_message.message.generic_data_ind.data_len = 40; - if (-1 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - - //Test no ack request - nsdynmemlib_stub.returnCounter = 3; - mac_header_helper_functions_stub.fcf.ackRequested = false; - - - virtual_tx_done_status = PHY_LINK_TX_SUCCESS; - virtual_cb_ok = false; - - //Waiting tx success from callback - if (0 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - - if (!rf_mac_setup->active_pd_data_request || !virtual_cb_ok) { - return false; - } - - //Free current buffer - mac_mcps_buffer_queue_free(rf_mac_setup); - //Test with ack - nsdynmemlib_stub.returnCounter = 3; - mac_header_helper_functions_stub.fcf.ackRequested = true; - if (0 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - - if (!rf_mac_setup->active_pd_data_request) { - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - //Test copying MAC address from payload - uint8_t test_tx_buffer[21] = {0x61, 0xcc, 0x8, 0x55, 0x12, 0x3, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x2, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2}; - uint8_t test_dst_addr_buffer[8] = {0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x3}; - phy_message.message.generic_data_ind.data_ptr = test_tx_buffer; - phy_message.message.generic_data_ind.data_len = sizeof(test_tx_buffer); - nsdynmemlib_stub.returnCounter = 3; - mac_header_helper_functions_stub.fcf.ackRequested = true; - mac_header_helper_functions_stub.fcf.DstAddrMode = MAC_ADDR_MODE_64_BIT; - memcpy(mac_header_helper_functions_stub.dst_address, test_dst_addr_buffer, 8); - if (0 != mac_virtual_sap_data_cb(rf_mac_setup, &phy_message) ) { - return false; - } - if (!rf_mac_setup->active_pd_data_request) { - return false; - } - // Destination address check - if (memcmp(rf_mac_setup->active_pd_data_request->DstAddr, test_dst_addr_buffer, 8)) { - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - test_mac_rf_mac_class_free(rf_mac_setup); - return true; -} - -bool test_mac_mcps_data_confirmation() -{ - //Init event handler - event_stub.int8_value = 0; - int8_t mac_tasklet_id = mac_mcps_sap_tasklet_init(); - mcps_data_req_t data_req; - - ccm_globals_t ccm_ptr; - mac_api_t mac_api; - mlme_key_descriptor_t key_description; - mlme_device_descriptor_t device_description; - mac_aux_security_header_t secuirity_params; - mlme_key_device_descriptor_t key_device_description; - memset(&data_req, 0, sizeof(mcps_data_req_t)); - - uint8_t tx_buf[127]; - uint8_t tx_temp[200]; - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - memset(tx_buf, 1, 127); - - memset(&key_description, 0, sizeof(mlme_key_descriptor_t)); - memset(&device_description, 0, sizeof(mlme_device_descriptor_t)); - - mac_api.data_conf_cb = &test_mcps_data_confirm; - mac_api.mlme_conf_cb = &test_mlme_confirm; - mac_api.data_ind_cb = &test_mcps_data_indication; - mac_api.mlme_ind_cb = &test_mlme_indication; - - rf_mac_setup->macUpState = true; - sw_mac_stub.mac_api_ptr = &mac_api; - - data_req.msdu = tx_buf; - data_req.msduLength = 10; - - rf_mac_setup->macUpState = true; - - //Empty call - mcps_sap_pd_confirm(rf_mac_setup); - //TODO add better validation at callbacks - //CCA Fail - rf_mac_setup->mac_tx_result = MAC_CCA_FAIL; - nsdynmemlib_stub.returnCounter = 3; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - mcps_sap_pd_confirm(rf_mac_setup); - - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - - nsdynmemlib_stub.returnCounter = 3; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - rf_mac_setup->mac_tx_result = MAC_TX_FAIL; - mcps_sap_pd_confirm(rf_mac_setup); - - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - nsdynmemlib_stub.returnCounter = 3; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - rf_mac_setup->mac_tx_result = MAC_TX_DONE; - mcps_sap_pd_confirm(rf_mac_setup); - - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - nsdynmemlib_stub.returnCounter = 3; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - rf_mac_setup->mac_tx_result = MAC_TX_DONE_PENDING; - mcps_sap_pd_confirm(rf_mac_setup); - - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - nsdynmemlib_stub.returnCounter = 3; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - rf_mac_setup->mac_tx_result = MAC_TX_TIMEOUT; - mcps_sap_pd_confirm(rf_mac_setup); - - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - //Change data packet to MAC command: DATA_REQ and test all CONFIRM events - - nsdynmemlib_stub.returnCounter = 3; - data_req.DstAddrMode = MAC_ADDR_MODE_64_BIT; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - rf_mac_setup->mac_tx_result = MAC_TX_DONE; - //rf_mac_setup->active_pd_data_request->status = MLME_SUCCESS; - rf_mac_setup->active_pd_data_request->fcf_dsn.frametype = FC_CMD_FRAME; - rf_mac_setup->active_pd_data_request->mac_command_id = MAC_DATA_REQ; - rf_mac_setup->active_pd_data_request->upper_layer_request = false; - mcps_sap_pd_confirm(rf_mac_setup); - - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - //Test data wait state + driver request - nsdynmemlib_stub.returnCounter = 3; - rf_mac_setup->dev_driver->phy_driver->phy_header_length = 1; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - rf_mac_setup->mac_tx_result = MAC_TX_DONE_PENDING; - //rf_mac_setup->active_pd_data_request->status = MLME_SUCCESS; - rf_mac_setup->active_pd_data_request->fcf_dsn.frametype = FC_CMD_FRAME; - rf_mac_setup->active_pd_data_request->mac_command_id = MAC_DATA_REQ; - rf_mac_setup->active_pd_data_request->upper_layer_request = false; - - mcps_sap_pd_confirm(rf_mac_setup); - - if (!rf_mac_setup->active_pd_data_request || rf_mac_setup->mac_mlme_event != ARM_NWK_MAC_MLME_INDIRECT_DATA_POLL) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - //Test Virtual mac extension confirmation + driver request - - rf_mac_setup->tun_extension_rf_driver = rf_client_driver_allocate(); - - rf_mac_setup->active_pd_data_request->mac_command_id = 0xff; - rf_mac_setup->active_pd_data_request->fcf_dsn.frametype = FC_DATA_FRAME; - rf_mac_setup->active_pd_data_request->fcf_dsn.ackRequested = true; - rf_mac_setup->mac_tx_result = MAC_TX_FAIL; - mcps_sap_pd_confirm(rf_mac_setup); - - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - // Test FHSS channel retry - rf_mac_setup->fhss_api = ns_fhss_create(0, 0); - nsdynmemlib_stub.returnCounter = 3; - data_req.TxAckReq = true; - fhss_mac_interface_stub.cond_bool_value = true; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - rf_mac_setup->mac_tx_result = MAC_TX_FAIL; - mcps_sap_pd_confirm(rf_mac_setup); - if (!rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - rf_mac_setup->mac_tx_result = MAC_TX_DONE; - mcps_sap_pd_confirm(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - - - - test_mac_rf_mac_class_free(rf_mac_setup); - return true; - -} - -bool test_mac_mcps_data_indication() -{ - //Init event handler - event_stub.int8_value = 0; - int8_t mac_tasklet_id = mac_mcps_sap_tasklet_init(); - - - ccm_globals_t ccm_ptr; - mac_api_t mac_api; - mlme_key_descriptor_t key_description; - mlme_device_descriptor_t device_description; - mac_aux_security_header_t secuirity_params; - mlme_key_device_descriptor_t key_device_description; - mcps_data_req_t data_req; - memset(&data_req, 0, sizeof(mcps_data_req_t)); - - uint8_t tx_buf[127]; - uint8_t tx_temp[200]; - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - memset(tx_buf, 1, 127); - - memset(&key_description, 0, sizeof(mlme_key_descriptor_t)); - memset(&device_description, 0, sizeof(mlme_device_descriptor_t)); - - mac_api.data_conf_cb = &test_mcps_data_confirm; - mac_api.mlme_conf_cb = &test_mlme_confirm; - mac_api.data_ind_cb = &test_mcps_data_indication; - mac_api.mlme_ind_cb = &test_mlme_indication; - - rf_mac_setup->macUpState = true; - rf_mac_setup->pan_id = 0x0101; - mac_header_helper_functions_stub.pan_src = 0x0101; - sw_mac_stub.mac_api_ptr = &mac_api; - - nsdynmemlib_stub.returnCounter = 1; - mac_pre_parsed_frame_t *buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 100); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.securityEnabled = false; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 100-9; - buffer->security_aux_header_length = 0; - buffer->mac_class_ptr = NULL; - //First Buffer push - mcps_sap_pd_ind(buffer); - - //Drop by mac filter - nsdynmemlib_stub.returnCounter = 1; - mac_filter_stub_def.value_int8 = 1; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 100); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.securityEnabled = false; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 100-9; - buffer->security_aux_header_length = 0; - buffer->mac_class_ptr = rf_mac_setup; - mcps_sap_pd_ind(buffer); - - //Drop by unknow SW MAC class - mac_filter_stub_def.value_int8 = 0; - sw_mac_stub.mac_api_ptr = NULL; - - nsdynmemlib_stub.returnCounter = 1; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 100); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.securityEnabled = false; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 100-9; - buffer->security_aux_header_length = 0; - buffer->mac_class_ptr = rf_mac_setup; - mcps_sap_pd_ind(buffer); - - nsdynmemlib_stub.returnCounter = 1; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 100); - buffer->fcf_dsn.frametype = FC_CMD_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.securityEnabled = false; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 100-9; - buffer->security_aux_header_length = 0; - buffer->mac_class_ptr = rf_mac_setup; - mcps_sap_pd_ind(buffer); -// - //Drop by data confirm ind allocate fail - sw_mac_stub.mac_api_ptr = &mac_api; - nsdynmemlib_stub.returnCounter = 1; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 100); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.securityEnabled = false; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 100-9; - buffer->security_aux_header_length = 0; - buffer->mac_class_ptr = rf_mac_setup; - mcps_sap_pd_ind(buffer); - - //Drp by rx on idle - //Drop when not waiting data - nsdynmemlib_stub.returnCounter = 2; - rf_mac_setup->macWaitingData = false; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 100); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.securityEnabled = false; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 100-9; - buffer->security_aux_header_length = 0; - buffer->mac_class_ptr = rf_mac_setup; - mcps_sap_pd_ind(buffer); - - //Drop by brodacst destination - nsdynmemlib_stub.returnCounter = 2; - rf_mac_setup->macWaitingData = true; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 100); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = false; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 100-9; - buffer->security_aux_header_length = 0; - buffer->mac_class_ptr = rf_mac_setup; - //Set Bradcast address - mac_header_helper_functions_stub.dst_address[0] = 0xff; - mac_header_helper_functions_stub.dst_address[1] = 0xff; - mcps_sap_pd_ind(buffer); - - //Drop Empty data packet - mac_mlme_stub.pollConfirm = 0xfc; - nsdynmemlib_stub.returnCounter = 2; - rf_mac_setup->macWaitingData = true; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 9); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = false; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 0; - buffer->security_aux_header_length = 0; - buffer->mac_class_ptr = rf_mac_setup; - //Set Bradcast address - mac_header_helper_functions_stub.dst_address[0] = 0; - mac_header_helper_functions_stub.dst_address[1] = 0; - mcps_sap_pd_ind(buffer); - - if (mac_mlme_stub.pollConfirm != MLME_NO_DATA) { - return false; - } - - - expected_data_length = 20; - data_ind_valid = false; - - mac_mlme_stub.pollConfirm = 0xfc; - nsdynmemlib_stub.returnCounter = 2; - rf_mac_setup->macWaitingData = true; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 29); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = false; - rf_mac_setup->macDataPollReq = true; - rf_mac_setup->macRxDataAtPoll = false; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - //Set Bradcast address - mac_header_helper_functions_stub.dst_address[0] = 0; - mac_header_helper_functions_stub.dst_address[1] = 0; - mcps_sap_pd_ind(buffer); - - if (rf_mac_setup->mac_mlme_event != ARM_NWK_MAC_MLME_INDIRECT_DATA_POLL_AFTER_DATA || !rf_mac_setup->macRxDataAtPoll) { - return false; - } - - //Test security data packet - - mac_header_helper_functions_stub.security_header.securityLevel = 5; //securityLevel - mac_header_helper_functions_stub.security_header.KeyIdMode = MAC_KEY_ID_MODE_IDX; - mac_header_helper_functions_stub.security_header.KeyIndex = 1; - mac_header_helper_functions_stub.security_header.frameCounter = 0; - mac_header_helper_functions_stub.uint8_ptr = tx_buf + 35; // Set Mic pointer - - rf_mac_setup->macCapRxOnIdle = true; - rf_mac_setup->macWaitingData = false; - - //Unsupported security should call here - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_UNSUPPORTED_SECURITY; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - //Test MLME_UNSUPPORTED_LEGACY - mac_header_helper_functions_stub.security_header.securityLevel = 0; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_UNSUPPORTED_LEGACY; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - //Enable security at MAC - mac_header_helper_functions_stub.security_header.securityLevel = 5; - rf_mac_setup->mac_security_enabled = true; - //Generate MLME_COUNTER_ERROR - mac_header_helper_functions_stub.security_header.frameCounter = 0xffffffff; - - nsdynmemlib_stub.returnCounter = 2; - rf_mac_setup->mac_security_enabled = true; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_COUNTER_ERROR; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - //Generate MLME_UNAVAILABLE_KEY - mac_header_helper_functions_stub.security_header.frameCounter = 0; - mac_security_mib_stub.key_ptr = NULL; - - nsdynmemlib_stub.returnCounter = 2; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_UNAVAILABLE_KEY; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - //MLME_UNSUPPORTED_SECURITY - mac_security_mib_stub.key_ptr = &key_description; - - mac_security_mib_stub.device_ptr = NULL; - - nsdynmemlib_stub.returnCounter = 2; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_UNSUPPORTED_SECURITY; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - //Test drop blacklisted device - //MLME_UNAVAILABLE_KEY - key_device_description.Blacklisted = true; - mac_security_mib_stub.device_ptr = &device_description; - mac_security_mib_stub.key_dev_ptr = &key_device_description; - - nsdynmemlib_stub.returnCounter = 2; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_UNAVAILABLE_KEY; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - //Test drop REPLay attack - //MLME_COUNTER_ERROR - key_device_description.Blacklisted = false; - device_description.FrameCounter = 1; - - nsdynmemlib_stub.returnCounter = 2; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_COUNTER_ERROR; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - //Test ccm busy or init fail - //MLME_UNSUPPORTED_SECURITY - ccm_security_stub_def.ccm_struct_ptr = NULL; - device_description.FrameCounter = 1; - mac_header_helper_functions_stub.security_header.frameCounter = 1; - nsdynmemlib_stub.returnCounter = 2; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_UNSUPPORTED_SECURITY; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - //Generate Enrypt fail - //MLME_SECURITY_FAIL - ccm_security_stub_def.ccm_struct_ptr = &ccm_ptr; - ccm_security_stub_def.value_int8 = -1; - - nsdynmemlib_stub.returnCounter = 2; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_SECURITY_FAIL; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 16); - buffer->fcf_dsn.frametype = FC_CMD_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Shuold generate MLME_UNSUPPORTED_SECURITY COMM Status call back call - expected_mlme_ind_id_cnf = MLME_COMM_STATUS; - mlme_ind_status = MLME_SECURITY_FAIL; - mlme_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!mlme_ind_valid) { - return false; - } - - - - //sucesfully CCM decrypt with key desc - ccm_security_stub_def.value_int8 = 0; - nsdynmemlib_stub.returnCounter = 2; - - ccm_ptr.mic_len = 4; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - expected_data_length = 20; - data_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!data_ind_valid || device_description.FrameCounter != (mac_header_helper_functions_stub.security_header.frameCounter +1)) { - return false; - } - - //sucesfully CCM decrypt with key desc - ccm_security_stub_def.value_int8 = 0; - nsdynmemlib_stub.returnCounter = 2; - device_description.FrameCounter--; - - ccm_ptr.mic_len = 0; - mac_header_helper_functions_stub.security_header.securityLevel = 4; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 35); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - expected_data_length = 20; - data_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!data_ind_valid || device_description.FrameCounter != (mac_header_helper_functions_stub.security_header.frameCounter +1)) { - return false; - } - - //Update key device and key description tables - ccm_ptr.mic_len = 4; - mac_header_helper_functions_stub.security_header.securityLevel = 5; - - key_device_description.Blacklisted = false; - - //SET init values which should not be same after - device_description.FrameCounter = 100; - key_device_description.DeviceDescriptorHandle = 100; - - mac_security_mib_stub.device_ptr = &device_description; - mac_security_mib_stub.key_dev_update_ptr = &key_device_description; //For update new key stub response - mac_security_mib_stub.key_dev_ptr = NULL; //Un used key for this device - - mac_security_mib_stub.uint8_value = 4; - - ccm_security_stub_def.value_int8 = 0; - nsdynmemlib_stub.returnCounter = 2; - - ccm_ptr.mic_len = 4; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - expected_data_length = 20; - data_ind_valid = false; - - mcps_sap_pd_ind(buffer); - - if (!data_ind_valid || key_device_description.DeviceDescriptorHandle != 4 || device_description.FrameCounter != (mac_header_helper_functions_stub.security_header.frameCounter +1)) { - return false; - } - - - - //Test Data Request with security and trig dummy data packet - indirect_data_stub_def.value_uint8 = 0; - ccm_security_stub_def.value_int8 = 0; - nsdynmemlib_stub.returnCounter = 1; - mac_header_helper_functions_stub.uint8_value = MAC_DATA_REQ; - - - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 1; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 20); - buffer->fcf_dsn.frametype = MAC_FRAME_CMD; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Test here first empty data packet allocae fail - mcps_sap_pd_ind(buffer); - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 20); - buffer->fcf_dsn.frametype = MAC_FRAME_CMD; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //Test here that data request is pushed to queue - mcps_sap_pd_ind(buffer); - - if (!rf_mac_setup->active_pd_data_request) { - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - //Test Beacon REQ - //MAC_BEACON_REQ - - mac_header_helper_functions_stub.uint8_value = MAC_BEACON_REQ; - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 18); - buffer->fcf_dsn.frametype = MAC_FRAME_CMD; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - - //Test Firts handle when not cordinator - rf_mac_setup->macCapCordinator = false; - mcps_sap_pd_ind(buffer); - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 18); - buffer->fcf_dsn.frametype = MAC_FRAME_CMD; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - - //Test Now drop by unsupported address - rf_mac_setup->macCapCordinator = true; - mcps_sap_pd_ind(buffer); - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 18); - buffer->fcf_dsn.frametype = MAC_FRAME_CMD; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - - //Test succesfully request - mcps_sap_pd_ind(buffer); - - //test unknow command MAC_COORD_REALIGN - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 18); - buffer->fcf_dsn.frametype = MAC_FRAME_CMD; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - mac_header_helper_functions_stub.uint8_value = MAC_COORD_REALIGN; - - mcps_sap_pd_ind(buffer); - - //Test RX beacon filter for dig´ffrenrent pan: - mac_header_helper_functions_stub.pan_src = 0x2222; - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 21); - buffer->fcf_dsn.frametype = MAC_FRAME_BEACON; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 4; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //NO GTS or Pending - tx_buf[0] = 0xff; - tx_buf[1] = 0xff; - tx_buf[2] = 0; - tx_buf[3] = 0; - mac_header_helper_functions_stub.uint8_ptr = tx_buf; - mac_header_helper_functions_stub.uint16_value = 4; - mcps_sap_pd_ind(buffer); - - if (mac_mlme_stub.beacon_ind.beacon_data_length != 0) { - return false; - } - mac_header_helper_functions_stub.pan_src = 0x0101; - - //RX beacon without payload - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 21); - buffer->fcf_dsn.frametype = MAC_FRAME_BEACON; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 4; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //NO GTS or Pending - tx_buf[0] = 0xff; - tx_buf[1] = 0xff; - tx_buf[2] = 0; - tx_buf[3] = 0; - mac_header_helper_functions_stub.uint8_ptr = tx_buf; - mac_header_helper_functions_stub.uint16_value = 4; - mcps_sap_pd_ind(buffer); - - if (mac_mlme_stub.beacon_ind.beacon_data_length != 0) { - return false; - } - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 25); - buffer->fcf_dsn.frametype = MAC_FRAME_BEACON; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 8; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //NO GTS or Pending - tx_buf[0] = 0xff; - tx_buf[1] = 0xff; - tx_buf[2] = 0; - tx_buf[3] = 0; - mac_header_helper_functions_stub.uint8_ptr = tx_buf; - mac_header_helper_functions_stub.uint16_value = 8; - mcps_sap_pd_ind(buffer); - - if (mac_mlme_stub.beacon_ind.beacon_data_length != 4) { - return false; - } - - mac_mlme_stub.beacon_ind.beacon_data_length = 0; - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 25); - buffer->fcf_dsn.frametype = MAC_FRAME_BEACON; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 8; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //NO GTS or Pending - tx_buf[0] = 0xff; - tx_buf[1] = 0xff; - tx_buf[2] = 2;//GTS length should be 3 - tx_buf[3] = 0; - mac_header_helper_functions_stub.uint8_ptr = tx_buf; - mac_header_helper_functions_stub.uint16_value = 8; - mcps_sap_pd_ind(buffer); - - if (mac_mlme_stub.beacon_ind.beacon_data_length != 0) { - return false; - } - - mac_mlme_stub.beacon_ind.beacon_data_length = 0; - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 28); - buffer->fcf_dsn.frametype = MAC_FRAME_BEACON; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 11; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //NO GTS or Pending - tx_buf[0] = 0xff; - tx_buf[1] = 0xff; - tx_buf[2] = 2;//GTS length should be 3 - tx_buf[3] = 0; - tx_buf[4] = 0; - tx_buf[5] = 0; - tx_buf[6] = 0; - tx_buf[7] = 0; - tx_buf[8] = 0; - tx_buf[9] = 0; - mac_header_helper_functions_stub.uint8_ptr = tx_buf; - mac_header_helper_functions_stub.uint16_value = 11; - mcps_sap_pd_ind(buffer); - - if (mac_mlme_stub.beacon_ind.beacon_data_length != 1) { - return false; - } - - mac_mlme_stub.beacon_ind.beacon_data_length = 0; - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 30); - buffer->fcf_dsn.frametype = MAC_FRAME_BEACON; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 13; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //NO GTS or Pending - tx_buf[0] = 0xff; - tx_buf[1] = 0xff; - tx_buf[2] = 2;//GTS length should be 3 - tx_buf[3] = 0; - tx_buf[4] = 0; - tx_buf[5] = 0; - tx_buf[6] = 0; - tx_buf[7] = 0; - tx_buf[8] = 0; - tx_buf[9] = 1; - mac_header_helper_functions_stub.uint8_ptr = tx_buf; - mac_header_helper_functions_stub.uint16_value = 13; - mcps_sap_pd_ind(buffer); - - if (mac_mlme_stub.beacon_ind.beacon_data_length != 1) { - return false; - } - - mac_mlme_stub.beacon_ind.beacon_data_length = 0; - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 30); - buffer->fcf_dsn.frametype = MAC_FRAME_BEACON; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 13; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //NO GTS or Pending - tx_buf[0] = 0xff; - tx_buf[1] = 0xff; - tx_buf[2] = 2;//GTS length should be 3 - tx_buf[3] = 0; - tx_buf[4] = 0; - tx_buf[5] = 0; - tx_buf[6] = 0; - tx_buf[7] = 0; - tx_buf[8] = 0; - tx_buf[9] = 2; - mac_header_helper_functions_stub.uint8_ptr = tx_buf; - mac_header_helper_functions_stub.uint16_value = 13; - mcps_sap_pd_ind(buffer); - - if (mac_mlme_stub.beacon_ind.beacon_data_length != 0) { - return false; - } - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 30); - buffer->fcf_dsn.frametype = MAC_FRAME_BEACON; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 13; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - //NO GTS or Pending - tx_buf[0] = 0xff; - tx_buf[1] = 0xff; - tx_buf[2] = 2;//GTS length should be 3 - tx_buf[3] = 0; - tx_buf[4] = 0; - tx_buf[5] = 0; - tx_buf[6] = 0; - tx_buf[7] = 0; - tx_buf[8] = 0; - tx_buf[9] = 0x35; - mac_header_helper_functions_stub.uint8_ptr = tx_buf; - mac_header_helper_functions_stub.uint16_value = 13; - mcps_sap_pd_ind(buffer); - - if (mac_mlme_stub.beacon_ind.beacon_data_length != 0) { - return false; - } - - //Test Unknow frame - - device_description.FrameCounter--; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 30); - buffer->fcf_dsn.frametype = MAC_ILLEGAL_LEGACY; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = false; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 13; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - mcps_sap_pd_ind(buffer); - - //Test virtual MAC data forward - //Allocate driver - rf_mac_setup->tun_extension_rf_driver = rf_client_driver_allocate(); - - ccm_security_stub_def.value_int8 = 0; - nsdynmemlib_stub.returnCounter = 2; - - ccm_ptr.mic_len = 4; - - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 39); - buffer->fcf_dsn.frametype = FC_DATA_FRAME; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.intraPan = true; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 9; - buffer->mac_payload_length = 20; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - expected_virtual_rx_data_length = 39; - virtual_rx_data_length_ok = false; - - mcps_sap_pd_ind(buffer); - if (!virtual_rx_data_length_ok) { - return false; - } - - //Validate that length is 39 - - //Test Beacon request - mac_header_helper_functions_stub.uint8_value = MAC_BEACON_REQ; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 18); - buffer->fcf_dsn.frametype = MAC_FRAME_CMD; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - mcps_sap_pd_ind(buffer); - - - //Test Data request - mac_header_helper_functions_stub.uint8_value = MAC_DATA_REQ; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 18); - buffer->fcf_dsn.frametype = MAC_FRAME_CMD; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - - expected_virtual_rx_data_length = 18; - virtual_rx_data_length_ok = false; - - mcps_sap_pd_ind(buffer); - if (!virtual_rx_data_length_ok) { - return false; - } - - // Test calling FHSS receive synch request - rf_mac_setup->fhss_api = ns_fhss_create(0, 0); - int start_value = fhss_mac_interface_stub.int8_value; - mac_header_helper_functions_stub.uint8_value = MAC_BEACON_REQ; - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_pre_parsed_frame_buffer_get(tx_buf, 18); - buffer->fcf_dsn.frametype = MAC_FRAME_CMD; - buffer->fcf_dsn.DstAddrMode = MAC_ADDR_MODE_16_BIT; - buffer->fcf_dsn.SrcAddrMode = MAC_ADDR_MODE_NONE; - buffer->fcf_dsn.intraPan = false; - buffer->fcf_dsn.ackRequested = true; - buffer->fcf_dsn.securityEnabled = true; - buffer->mac_header_length = 7; - buffer->mac_payload_length = 1; - buffer->security_aux_header_length = 6; - buffer->mac_class_ptr = rf_mac_setup; - mcps_sap_pd_ind(buffer); - if (start_value != (fhss_mac_interface_stub.int8_value - 1)) { - return false; - } - - test_mac_rf_mac_class_free(rf_mac_setup); - return true; -} - - -bool test_mac_mcps_sap_tasklet_init() -{ - return true; -} - -bool test_mcps_sap_pre_parsed_frame_buffer_free() -{ - mcps_sap_pre_parsed_frame_buffer_free(NULL); - mac_pre_parsed_frame_t *buf = malloc(sizeof(mac_pre_parsed_frame_t) + 100); - mcps_sap_pre_parsed_frame_buffer_free(buf); - return true; -} - -bool test_mcps_sap_prebuild_frame_buffer_get() -{ - mac_pre_build_frame_t * buffer; - nsdynmemlib_stub.returnCounter = 0; - buffer = mcps_sap_prebuild_frame_buffer_get(0); - if (buffer) { - return false; - } - nsdynmemlib_stub.returnCounter = 1; - buffer = mcps_sap_prebuild_frame_buffer_get(0); - if (!buffer || buffer->mac_allocated_payload_ptr) { - return false; - } - mcps_sap_prebuild_frame_buffer_free(buffer); - nsdynmemlib_stub.returnCounter = 1; - buffer = mcps_sap_prebuild_frame_buffer_get(100); - if (buffer) { - return false; - } - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(100); - if (!buffer || !buffer->mac_allocated_payload_ptr || buffer->mac_payload_length != 100) { - return false; - } - mcps_sap_prebuild_frame_buffer_free(buffer); - return true; -} - -bool test_mcps_sap_prebuild_frame_buffer_free() -{ - mcps_sap_prebuild_frame_buffer_free(NULL); - - mac_pre_build_frame_t *buf_1 = tes_mac_mcps_temporary_buffer_get(10); - mac_pre_build_frame_t *buf_2 = tes_mac_mcps_temporary_buffer_get(0); - - mcps_sap_prebuild_frame_buffer_free(buf_1); - mcps_sap_prebuild_frame_buffer_free(buf_2); - - return true; -} - -bool test_mcps_sap_pd_req_queue_write() -{ - ccm_globals_t ccm_ptr; - mac_api_t mac_api; - mlme_key_descriptor_t key_description; - mac_aux_security_header_t secuirity_params; - mcps_data_req_t data_req; - memset(&data_req, 0, sizeof(mcps_data_req_t)); - - uint8_t tx_buf[127]; - - uint8_t tx_temp[200]; - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - memset(tx_buf, 1, 127); - - memset(&key_description, 0, sizeof(mlme_key_descriptor_t)); - - mac_api.data_conf_cb = &test_mcps_data_confirm; - mac_api.mlme_conf_cb = &test_mlme_confirm; - mac_api.data_ind_cb = &test_mcps_data_indication; - - rf_mac_setup->macUpState = true; - sw_mac_stub.mac_api_ptr = &mac_api; - mac_header_helper_functions_stub.uint8_ptr = tx_temp; - - mcps_sap_pd_req_queue_write(NULL, NULL); - nsdynmemlib_stub.returnCounter = 2; - mac_pre_build_frame_t *buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - - if (!rf_mac_setup->active_pd_data_request || rf_mac_setup->active_pd_data_request != buffer) { - return false; - } - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - - if (rf_mac_setup->pd_data_request_queue_to_go != buffer) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - - if (rf_mac_setup->pd_data_request_queue_to_go->next != buffer) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - buffer->priority = 2; - - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - if (rf_mac_setup->pd_data_request_queue_to_go != buffer) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - buffer->priority = 1; - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - - if (rf_mac_setup->pd_data_request_queue_to_go->next != buffer) { - return false; - } - mac_mcps_buffer_queue_free(rf_mac_setup); - - // FHSS TESTS START - rf_mac_setup->fhss_api = ns_fhss_create(0, 0); - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - - // Buffer has broadcast destination and TX conditions are fine - buffer->fcf_dsn.ackRequested = false; - fhss_mac_interface_stub.cond_bool_value = true; - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - // Should be sent immediately - if (rf_mac_setup->active_pd_data_request != buffer) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - - // Buffer has broadcast destination and TX conditions are bad - buffer->fcf_dsn.ackRequested = false; - fhss_mac_interface_stub.cond_bool_value = false; - fhss_mac_interface_stub.queue_bool_value = true; - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - // Should be first in BC queue, one buffer in a bc queue - if ((rf_mac_setup->pd_data_request_bc_queue_to_go != buffer) || (rf_mac_setup->broadcast_queue_size != 1)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - - // Buffer has broadcast destination and TX conditions are bad - buffer->fcf_dsn.ackRequested = false; - fhss_mac_interface_stub.cond_bool_value = false; - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - // Should be second in BC queue, two buffers in a bc queue - if ((rf_mac_setup->pd_data_request_bc_queue_to_go->next != buffer) || (rf_mac_setup->broadcast_queue_size != 2)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - - // Buffer has broadcast destination and TX conditions are bad - buffer->fcf_dsn.ackRequested = false; - fhss_mac_interface_stub.cond_bool_value = false; - // Higher priority for this buffer - buffer->priority = 2; - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - // Should be first in a BC queue since priority is highest, three buffers in a bc queue - if ((rf_mac_setup->pd_data_request_bc_queue_to_go != buffer) || (rf_mac_setup->broadcast_queue_size != 3)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - - // Buffer has unicast destination and TX conditions are bad - buffer->fcf_dsn.ackRequested = true; - fhss_mac_interface_stub.cond_bool_value = false; - fhss_mac_interface_stub.queue_bool_value = false; - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - // Should be first in a UC queue, 1 buffer in a uc queue - if ((rf_mac_setup->pd_data_request_queue_to_go != buffer) || (rf_mac_setup->unicast_queue_size != 1)) { - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - - // Buffer has broadcast destination and TX conditions are bad - buffer->fcf_dsn.ackRequested = false; - fhss_mac_interface_stub.cond_bool_value = false; - // Beacon request should go to unicast queue - buffer->fcf_dsn.frametype = FC_CMD_FRAME; - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - // Goes to first in a BC queue using push_to_queue label - if (rf_mac_setup->pd_data_request_queue_to_go != buffer) { - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - nsdynmemlib_stub.returnCounter = 2; - buffer = mcps_sap_prebuild_frame_buffer_get(80); - test_mac_buffer_settings(buffer, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - - // Test queueing when broadcast disable - buffer->fcf_dsn.ackRequested = false; - rf_mac_setup->macBroadcastDisabled = true; - fhss_mac_interface_stub.queue_bool_value = true; - mcps_sap_pd_req_queue_write(rf_mac_setup, buffer); - // Should be first in a BC queue, 1 buffer in a BC queue - if ((rf_mac_setup->pd_data_request_bc_queue_to_go != buffer) || (rf_mac_setup->broadcast_queue_size != 1)) { - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - test_mac_rf_mac_class_free(rf_mac_setup); - return true; -} - -bool test_mcps_sap_pre_parsed_frame_buffer_get() -{ - uint8_t buffer[8]; - for (int i= 0; i< 8; i++) { - buffer[i] = i; - } - nsdynmemlib_stub.returnCounter = 0; - mac_pre_parsed_frame_t *buf = mcps_sap_pre_parsed_frame_buffer_get(buffer, 8); - if (buf) { - return false; - } - nsdynmemlib_stub.returnCounter = 1; - buf = mcps_sap_pre_parsed_frame_buffer_get(buffer, 8); - if (!buf || buf->frameLength != 8 ) { - return false; - } - - if (memcmp(mac_header_message_start_pointer(buf),buffer , 8) != 0) { - return false; - } - - ns_dyn_mem_free(buf); - return true; -} - -bool test_mcps_sap_pd_ind() -{ - mac_pre_parsed_frame_t buffer; - //Firts test without init - mcps_sap_pd_ind(NULL); - mcps_sap_pd_ind(&buffer); - - return true; -} - - - -bool test_mcps_sap_pd_confirm() -{ - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - //Firts test without init - mcps_sap_pd_confirm(NULL); - mcps_sap_pd_confirm(rf_mac_setup); - test_mac_rf_mac_class_free(rf_mac_setup); - return true; -} - -bool test_mcps_sap_data_req_handler() -{ - ccm_globals_t ccm_ptr; - mac_api_t mac_api; - mlme_key_descriptor_t key_description; - mlme_device_descriptor_t device_description; - mac_aux_security_header_t secuirity_params; - mcps_data_req_t data_req; - memset(&data_req, 0, sizeof(mcps_data_req_t)); - - uint8_t tx_buf[127]; - uint8_t msdu_handle = 0; - - uint8_t tx_temp[200]; - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - memset(tx_buf, 1, 127); - - memset(&key_description, 0, sizeof(mlme_key_descriptor_t)); - memset(&device_description, 0, sizeof(mlme_device_descriptor_t)); - - mac_api.data_conf_cb = &test_mcps_data_confirm; - mac_api.mlme_conf_cb = &test_mlme_confirm; - mac_api.data_ind_cb = &test_mcps_data_indication; - mac_api.purge_conf_cb = &test_purge_confirm; - - - sw_mac_stub.mac_api_ptr = &mac_api; - - data_req.msdu = tx_buf; - - //Test unsupported security case with security enabled request - //Wait MLME_UNSUPPORTED_SECURITY confirmation status - - rf_mac_setup->mac_security_enabled = false; - - data_req.Key.SecurityLevel = 5; - data_req.Key.KeyIndex = 1; - data_req.Key.KeyIdMode = MAC_KEY_ID_MODE_IDX; - data_req.msduHandle = msdu_handle++; - expect_data_confirmation_status = MLME_UNSUPPORTED_SECURITY; - data_confirm_valid = false; - - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - return false; - } - - - //Test Packet Too long case - //wait MLME_FRAME_TOO_LONG confirmation status - data_req.Key.SecurityLevel = 0; - data_req.msduLength = 117; - expect_data_confirmation_status = MLME_FRAME_TOO_LONG; - data_confirm_valid = false; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - return false; - } - - //Test Buffer allocate fail - // Wait MLME_TRANSACTION_OVERFLOW confirmation status - data_req.msduLength = 116; - data_req.DstAddrMode = MAC_ADDR_MODE_16_BIT; - data_req.DstPANId = 1; - data_req.InDirectTx = false; - data_req.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - expect_data_confirmation_status = MLME_TRANSACTION_OVERFLOW; - data_confirm_valid = false; - nsdynmemlib_stub.returnCounter = 0; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - return false; - } - - //Test Radio shutdown case - //wait MLME_TRX_OFF confirmation status - expect_data_confirmation_status = MLME_TRX_OFF; - data_confirm_valid = false; - nsdynmemlib_stub.returnCounter = 1; - rf_mac_setup->macUpState = false; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - return false; - } - - - // Test Direct data push fail by security fail - // Wait MLME_SECURITY_FAIL - data_req.Key.SecurityLevel = 5; - data_req.msduLength = 85; - rf_mac_setup->macUpState = true; - rf_mac_setup->mac_security_enabled = true; - mac_security_mib_stub.key_ptr = NULL; - mac_security_mib_stub.device_ptr = NULL; - mac_header_helper_functions_stub.security_header.securityLevel = 5; //securityLevel - mac_header_helper_functions_stub.security_header.KeyIdMode = MAC_KEY_ID_MODE_IDX; - mac_header_helper_functions_stub.security_header.KeyIndex = 1; - - - expect_data_confirmation_status = MLME_UNAVAILABLE_KEY; - data_confirm_valid = false; - nsdynmemlib_stub.returnCounter = 1; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - return false; - } - - - //Test with unknow neighbor - mac_security_mib_stub.key_ptr = &key_description; - - expect_data_confirmation_status = MLME_UNAVAILABLE_KEY; - data_confirm_valid = false; - nsdynmemlib_stub.returnCounter = 1; - data_req.TxAckReq = true; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - data_req.msduHandle = msdu_handle++; - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - return false; - } - - //Test Direct TX with succesfully to active push - - mac_security_mib_stub.device_ptr = &device_description; - - ccm_security_stub_def.ccm_struct_ptr = &ccm_ptr; - - mac_header_helper_functions_stub.uint8_ptr = tx_temp; - - nsdynmemlib_stub.returnCounter = 1; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (!rf_mac_setup->active_pd_data_request) { - return false; - } - data_req.msduLength = 75; - mac_header_helper_functions_stub.security_header.securityLevel = 6; //securityLevel - mac_header_helper_functions_stub.security_header.KeyIdMode = MAC_KEY_ID_MODE_SRC4_IDX; - data_req.DstAddrMode = MAC_ADDR_MODE_64_BIT; - data_req.SrcAddrMode = MAC_ADDR_MODE_NONE; - nsdynmemlib_stub.returnCounter = 1; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (!rf_mac_setup->active_pd_data_request || !rf_mac_setup->pd_data_request_queue_to_go) { - return false; - } - - data_req.msduLength = 40; - mac_header_helper_functions_stub.security_header.securityLevel = 7; //securityLevel - mac_header_helper_functions_stub.security_header.KeyIdMode = MAC_KEY_ID_MODE_SRC8_IDX; - data_req.DstAddrMode = MAC_ADDR_MODE_64_BIT; - data_req.SrcAddrMode = MAC_ADDR_MODE_NONE; - rf_mac_setup->shortAdressValid = true; - nsdynmemlib_stub.returnCounter = 1; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (!rf_mac_setup->active_pd_data_request || !rf_mac_setup->pd_data_request_queue_to_go || !rf_mac_setup->pd_data_request_queue_to_go->next) { - return false; - } - - data_req.msduLength = 40; - mac_header_helper_functions_stub.security_header.securityLevel = 4; //securityLevel - mac_header_helper_functions_stub.security_header.KeyIdMode = MAC_KEY_ID_MODE_IMPLICIT; - data_req.DstAddrMode = MAC_ADDR_MODE_16_BIT; - data_req.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - data_req.InDirectTx = true; - data_req.DstPANId = 0; - data_req.TxAckReq = true; - rf_mac_setup->shortAdressValid = true; - indirect_data_stub_def.indirect_buf = NULL; - nsdynmemlib_stub.returnCounter = 1; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (!rf_mac_setup->active_pd_data_request || !rf_mac_setup->pd_data_request_queue_to_go || !rf_mac_setup->pd_data_request_queue_to_go->next || !indirect_data_stub_def.indirect_buf) { - return false; - } - if (!rf_mac_setup->indirect_pd_data_request_queue) { - return false; - } - //Use confirmable for release indirect packet - mcps_purge_t purge; - purge.msduHandle = data_req.msduHandle; - - expected_purge_status = MLME_SUCCESS; - expected_purge_handle = data_req.msduHandle; - expected_purge_result = false; - - mcps_sap_purge_reg_handler(rf_mac_setup, &purge); - if (!expected_purge_result) { - return false; - } - expected_purge_result = false; - expected_purge_status = MLME_INVALID_HANDLE; - mcps_sap_purge_reg_handler(rf_mac_setup, &purge); - if (!expected_purge_result) { - return false; - } - - indirect_data_stub_def.indirect_buf = NULL; - - - mac_mcps_buffer_queue_free(rf_mac_setup); - - data_req.msduLength = 75; - mac_header_helper_functions_stub.security_header.securityLevel = 6; //securityLevel - mac_header_helper_functions_stub.security_header.KeyIdMode = MAC_KEY_ID_MODE_SRC4_IDX; - data_req.DstAddrMode = MAC_ADDR_MODE_16_BIT; - data_req.SrcAddrMode = MAC_ADDR_MODE_NONE; - data_req.TxAckReq = false; - data_req.InDirectTx = false; - data_req.DstAddr[0] = 0xff; - data_req.DstAddr[1] = 0xff; - nsdynmemlib_stub.returnCounter = 1; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (!rf_mac_setup->active_pd_data_request ) { - return false; - } - - - nsdynmemlib_stub.returnCounter = 1; - data_req.msduHandle = msdu_handle++; - mcps_sap_data_req_handler(rf_mac_setup, &data_req); - if (!rf_mac_setup->active_pd_data_request || !rf_mac_setup->pd_data_request_queue_to_go) { - return false; - } - - purge.msduHandle = data_req.msduHandle; - - mcps_sap_purge_reg_handler(rf_mac_setup, &purge); - - mac_mcps_buffer_queue_free(rf_mac_setup); - - - //Test indirect data request with security - //mcps_sap_data_req_handler(); - - //Test indirect data request without security - //mcps_sap_data_req_handler(); - - test_mac_rf_mac_class_free(rf_mac_setup); - return true; -} - -bool test_mac_mcps_trig_buffer_from_queue() -{ - - ccm_globals_t ccm_ptr; - mac_api_t mac_api; - mlme_key_descriptor_t key_description; - mlme_device_descriptor_t device_description; - mac_aux_security_header_t secuirity_params; - uint8_t tx_buf[127]; - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - memset(tx_buf, 1, 127); - - memset(&key_description, 0, sizeof(mlme_key_descriptor_t)); - memset(&device_description, 0, sizeof(mlme_device_descriptor_t)); - - mac_api.data_conf_cb = &test_mcps_data_confirm; - mac_api.mlme_conf_cb = &test_mlme_confirm; - mac_api.data_ind_cb = &test_mcps_data_indication; - - //NULL pointer test - mac_mcps_trig_buffer_from_queue(NULL); - - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - //allocate test buffer - - mac_pre_build_frame_t *buf = tes_mac_mcps_temporary_buffer_get(0); - rf_mac_setup->pd_data_request_queue_to_go = buf; - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - - if (!rf_mac_setup->active_pd_data_request || rf_mac_setup->pd_data_request_queue_to_go) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - rf_mac_setup->dev_driver->phy_driver->phy_header_length = 1; - rf_mac_setup->pd_data_request_queue_to_go = tes_mac_mcps_temporary_buffer_get(0); - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (!rf_mac_setup->active_pd_data_request || rf_mac_setup->pd_data_request_queue_to_go) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - rf_mac_setup->dev_driver->phy_driver->phy_header_length = 0; - //Test Data Frame types - buf = tes_mac_mcps_temporary_buffer_get(20); - rf_mac_setup->pd_data_request_queue_to_go = buf; - // No security and with acks - - //Send Beacon - - test_mac_buffer_settings(buf, MAC_FRAME_BEACON, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (!rf_mac_setup->active_pd_data_request || rf_mac_setup->pd_data_request_queue_to_go) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - mac_mcps_buffer_queue_free(rf_mac_setup); - - buf = tes_mac_mcps_temporary_buffer_get(20); - - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_mac_buffer_settings(buf, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_NONE, false, false, false, &secuirity_params); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (!rf_mac_setup->active_pd_data_request || rf_mac_setup->pd_data_request_queue_to_go) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - mac_mcps_buffer_queue_free(rf_mac_setup); - - //Send too long packet - - //Set SW MAC stub class - - expect_data_confirmation_status = MLME_FRAME_TOO_LONG; - data_confirm_valid = false; - sw_mac_stub.mac_api_ptr = &mac_api; - buf = tes_mac_mcps_temporary_buffer_get(0); - buf->mac_payload = tx_buf; - buf->mac_payload_length = 110; - buf->upper_layer_request = true; - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_mac_buffer_settings(buf, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, false, &secuirity_params); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - //First unknow key - expect_data_confirmation_status = MLME_UNAVAILABLE_KEY; - data_confirm_valid = false; - sw_mac_stub.mac_api_ptr = &mac_api; - mac_security_mib_stub.key_ptr = NULL; - mac_security_mib_stub.device_ptr = NULL; - buf = tes_mac_mcps_temporary_buffer_get(0); - buf->mac_payload = tx_buf; - buf->mac_payload_length = 85; - buf->upper_layer_request = true; - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_set_security_params(&secuirity_params, 4, MAC_KEY_ID_MODE_IDX, 1); - test_mac_buffer_settings(buf, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, true, &secuirity_params); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - //Test security counter overflow - expect_data_confirmation_status = MLME_COUNTER_ERROR; - data_confirm_valid = false; - - mac_security_mib_stub.key_ptr = &key_description; - mac_security_mib_stub.device_ptr = &device_description; - - - - rf_mac_setup->security_frame_counter = 0xffffffff; - buf = tes_mac_mcps_temporary_buffer_get(0); - buf->mac_payload = tx_buf; - buf->mac_payload_length = 85; - buf->upper_layer_request = true; - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_set_security_params(&secuirity_params, 4, MAC_KEY_ID_MODE_IDX, 1); - test_mac_buffer_settings(buf, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, true, &secuirity_params); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - //Test busy CCM process - expect_data_confirmation_status = MLME_SECURITY_FAIL; - data_confirm_valid = false; - ccm_security_stub_def.ccm_struct_ptr = NULL; - rf_mac_setup->security_frame_counter = 0; - buf = tes_mac_mcps_temporary_buffer_get(0); - buf->mac_payload = tx_buf; - buf->mac_payload_length = 85; - buf->upper_layer_request = true; - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_set_security_params(&secuirity_params, 4, MAC_KEY_ID_MODE_IDX, 1); - test_mac_buffer_settings(buf, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, true, &secuirity_params); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request || !data_confirm_valid) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - //First Succesfully builded Data packet with security - ccm_security_stub_def.ccm_struct_ptr = &ccm_ptr; - rf_mac_setup->security_frame_counter = 0; - buf = tes_mac_mcps_temporary_buffer_get(0); - buf->mac_payload = tx_buf; - buf->mac_payload_length = 50; - buf->upper_layer_request = true; - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_set_security_params(&secuirity_params, 5, MAC_KEY_ID_MODE_IDX, 1); - test_mac_buffer_settings(buf, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, true, &secuirity_params); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (!rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - buf = tes_mac_mcps_temporary_buffer_get(0); - buf->mac_payload = tx_buf; - buf->mac_payload_length = 50; - buf->upper_layer_request = true; - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_set_security_params(&secuirity_params, 6, MAC_KEY_ID_MODE_SRC8_IDX, 1); - test_mac_buffer_settings(buf, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, true, &secuirity_params); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (!rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - buf = tes_mac_mcps_temporary_buffer_get(0); - buf->mac_payload = tx_buf; - buf->mac_payload_length = 50; - buf->upper_layer_request = true; - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_set_security_params(&secuirity_params, 7, MAC_KEY_ID_MODE_SRC4_IDX, 1); - test_mac_buffer_settings(buf, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, true, &secuirity_params); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (!rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - mac_mcps_buffer_queue_free(rf_mac_setup); - - - //Test without callback Negative confirmation handle - ccm_security_stub_def.ccm_struct_ptr = NULL; - expected_mlme_id_cnf = MLME_POLL; - buf = tes_mac_mcps_temporary_buffer_get(0); - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_set_security_params(&secuirity_params, 7, MAC_KEY_ID_MODE_SRC4_IDX, 1); - test_mac_buffer_settings(buf, MAC_FRAME_CMD, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, true, &secuirity_params); - buf->mac_command_id = DATA_REQUEST; - - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request || !mlme_confirm_valid) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - - buf = tes_mac_mcps_temporary_buffer_get(0); - rf_mac_setup->pd_data_request_queue_to_go = buf; - test_set_security_params(&secuirity_params, 7, MAC_KEY_ID_MODE_SRC4_IDX, 1); - test_mac_buffer_settings(buf, MAC_FRAME_CMD, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, true, &secuirity_params); - buf->mac_command_id = MAC_BEACON_REQ; - - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - - - - //Test without callback - buf = tes_mac_mcps_temporary_buffer_get(0); - buf->mac_payload = tx_buf; - buf->mac_payload_length = 110; - buf->upper_layer_request = false; - rf_mac_setup->pd_data_request_queue_to_go = buf; - - test_mac_buffer_settings(buf, FC_DATA_FRAME, MAC_ADDR_MODE_64_BIT,MAC_ADDR_MODE_64_BIT, true, true, true, &secuirity_params); - - test_set_security_params(&secuirity_params, 7, MAC_KEY_ID_MODE_IMPLICIT, 1); - mac_header_helper_functions_stub.uint8_ptr = rf_mac_setup->dev_driver_tx_buffer.buf + buf->mac_header_length_with_security; - - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (rf_mac_setup->active_pd_data_request) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - mac_mcps_buffer_queue_free(rf_mac_setup); - - // FHSS TESTS START - rf_mac_setup->fhss_api = ns_fhss_create(0, 0); - buf = tes_mac_mcps_temporary_buffer_get(0); - rf_mac_setup->pd_data_request_bc_queue_to_go = buf; - rf_mac_setup->broadcast_queue_size = 1; - - // FHSS is not on broadcast channel and tx conditions are fine - fhss_mac_interface_stub.channel_bool_value = false; - fhss_mac_interface_stub.cond_bool_value = true; - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (!rf_mac_setup->pd_data_request_bc_queue_to_go) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - // FHSS is on broadcast channel and tx conditions are bad - fhss_mac_interface_stub.channel_bool_value = true; - fhss_mac_interface_stub.cond_bool_value = false; - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (!rf_mac_setup->pd_data_request_bc_queue_to_go) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - - // FHSS is on broadcast channel and tx conditions are fine - fhss_mac_interface_stub.channel_bool_value = true; - fhss_mac_interface_stub.cond_bool_value = true; - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - if (!rf_mac_setup->active_pd_data_request || rf_mac_setup->pd_data_request_bc_queue_to_go || rf_mac_setup->broadcast_queue_size) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - mac_mcps_buffer_queue_free(rf_mac_setup); - - // Test taking second packet from unicast queue - rf_mac_setup->fhss_api = ns_fhss_create(0, 0); - buf = tes_mac_mcps_temporary_buffer_get(0); - mac_pre_build_frame_t *buf2 = tes_mac_mcps_temporary_buffer_get(0); - // First packet is Beacon request and sending it is currently not allowed - buf->fcf_dsn.frametype = FC_CMD_FRAME; - rf_mac_setup->pd_data_request_queue_to_go = buf; - rf_mac_setup->pd_data_request_queue_to_go->next = buf2; - rf_mac_setup->unicast_queue_size = 2; - fhss_mac_interface_stub.channel_bool_value = false; - fhss_mac_interface_stub.cond_bool_value = true; - // Should trig second packet from queue - mac_mcps_trig_buffer_from_queue(rf_mac_setup); - // First packet should still be the Beacon request - if (rf_mac_setup->pd_data_request_queue_to_go != buf) { - test_mac_rf_mac_class_free(rf_mac_setup); - return false; - } - mac_mcps_buffer_queue_free(rf_mac_setup); - // Free test setup struct - test_mac_rf_mac_class_free(rf_mac_setup); - return true; -} - - - -bool test_mac_mcps_buffer_queue_free() -{ - protocol_interface_rf_mac_setup_s *rf_mac_setup = test_mac_rf_mac_class_allocate(); - - //Allocate 5 buffer - - //Allocate 1 active - rf_mac_setup->active_pd_data_request = tes_mac_mcps_temporary_buffer_get(2); - //allocate 2 pending - rf_mac_setup->pd_data_request_queue_to_go = tes_mac_mcps_temporary_buffer_get(0); - rf_mac_setup->pd_data_request_queue_to_go->next = tes_mac_mcps_temporary_buffer_get(20); - //allocate 2 buffers in broadcast queue - rf_mac_setup->pd_data_request_bc_queue_to_go = tes_mac_mcps_temporary_buffer_get(0); - rf_mac_setup->pd_data_request_bc_queue_to_go->next = tes_mac_mcps_temporary_buffer_get(20); - //allocate 2 indirect pending - rf_mac_setup->indirect_pd_data_request_queue = tes_mac_mcps_temporary_buffer_get(0); - rf_mac_setup->indirect_pd_data_request_queue->next = tes_mac_mcps_temporary_buffer_get(20); - - mac_mcps_buffer_queue_free(rf_mac_setup); - test_mac_rf_mac_class_free(rf_mac_setup); - return true; -} diff --git a/test/nanostack/unittest/mac/mac_mcps_sap/test_mac_mcps_sap.h b/test/nanostack/unittest/mac/mac_mcps_sap/test_mac_mcps_sap.h deleted file mode 100644 index 7c780fcf328d..000000000000 --- a/test/nanostack/unittest/mac/mac_mcps_sap/test_mac_mcps_sap.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_MCPS_SAP_H -#define TEST_MAC_MCPS_SAP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_generic_event_trig(); -// Test sending TX trig event -bool test_mcps_sap_trig_tx(); - -bool test_mac_virtual_sap_data_cb(); - -bool test_mac_mcps_sap_tasklet_init(); - -bool test_mcps_sap_pre_parsed_frame_buffer_free(); - -bool test_mcps_sap_prebuild_frame_buffer_get(); - -bool test_mcps_sap_prebuild_frame_buffer_free(); - -bool test_mcps_sap_pd_req_queue_write(); - -//bool test_mcps_data_confirm_handle(); - -bool test_mcps_sap_pre_parsed_frame_buffer_get(); - -bool test_mcps_sap_pd_ind(); - -bool test_mcps_sap_pd_confirm(); - -bool test_mcps_sap_data_req_handler(); - -bool test_mac_mcps_trig_buffer_from_queue(); - -bool test_mac_mcps_buffer_queue_free(); - -bool test_mac_mcps_data_indication(); - -bool test_mac_mcps_data_confirmation(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_MCPS_SAP_H - diff --git a/test/nanostack/unittest/mac/mac_mlme/Makefile b/test/nanostack/unittest/mac/mac_mlme/Makefile deleted file mode 100644 index 1148d4e320ea..000000000000 --- a/test/nanostack/unittest/mac/mac_mlme/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_mlme_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/mac_mlme.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_mlmetest.cpp \ - test_mac_mlme.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/sw_mac_stub.c \ - ../../stub/mac_header_helper_functions_stub.c \ - ../../stub/mac_timer_stub.c \ - ../../stub/mac_filter_stub.c \ - ../../stub/mac_indirect_data_stub.c \ - ../../stub/mac_security_mib_stub.c \ - ../../stub/mac_pd_sap_stub.c \ - ../../stub/mac_mcps_sap_stub.c \ - ../../stub/event_stub.c \ - ../../stub/ns_timer_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/rf_driver_storage_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/fhss_config_stub.c \ - ../../stub/fhss_mac_interface_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/mac_mlme/mac_mlmetest.cpp b/test/nanostack/unittest/mac/mac_mlme/mac_mlmetest.cpp deleted file mode 100644 index 20e09402e671..000000000000 --- a/test/nanostack/unittest/mac/mac_mlme/mac_mlmetest.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_mac_mlme.h" - -TEST_GROUP(mac_mlme) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_mlme, test_mac_mlme_link_beacon_join_priority_tx_callback_set) -{ - CHECK(test_mac_mlme_link_beacon_join_priority_tx_callback_set()); -} - -TEST(mac_mlme, test_mac_mlme_link_beacon_compare_rx_callback_set) -{ - CHECK(test_mac_mlme_link_beacon_compare_rx_callback_set()); -} - -TEST(mac_mlme, test_mac_mlme_scan_confirmation_handle) -{ - CHECK(test_mac_mlme_scan_confirmation_handle()); -} - -TEST(mac_mlme, test_mac_mlme_scan_request) -{ - CHECK(test_mac_mlme_scan_request()); -} - -TEST(mac_mlme, test_mac_mlme_energy_scan_request) -{ - CHECK(test_mac_mlme_energy_scan_request()); -} - -TEST(mac_mlme, test_mac_mlme_start_req) -{ - CHECK(test_mac_mlme_start_req()); -} - -TEST(mac_mlme, test_mac_mlme_reset) -{ - CHECK(test_mac_mlme_reset()); -} - -TEST(mac_mlme, test_mac_mlme_set_req) -{ - CHECK(test_mac_mlme_set_req()); -} - -TEST(mac_mlme, test_mac_mlme_get_req) -{ - CHECK(test_mac_mlme_get_req()); -} - -TEST(mac_mlme, test_mac_extended_mac_set) -{ - CHECK(test_mac_extended_mac_set()); -} - -TEST(mac_mlme, test_mac_mlme_poll_req) -{ - CHECK(test_mac_mlme_poll_req()); -} - -TEST(mac_mlme, test_mac_mlme_poll_process_confirm) -{ - CHECK(test_mac_mlme_poll_process_confirm()); -} - -TEST(mac_mlme, test_mac_mlme_mac_radio_disabled) -{ - CHECK(test_mac_mlme_mac_radio_disabled()); -} - -TEST(mac_mlme, test_mac_mlme_mac_radio_enable) -{ - CHECK(test_mac_mlme_mac_radio_enable()); -} - -TEST(mac_mlme, test_mac_mlme_rf_channel_change) -{ - CHECK(test_mac_mlme_rf_channel_change()); -} - -TEST(mac_mlme, test_mac_mlme_active_scan_response_timer_start) -{ - CHECK(test_mac_mlme_active_scan_response_timer_start()); -} - -TEST(mac_mlme, test_mac_mlme_beacon_notify) -{ - CHECK(test_mac_mlme_beacon_notify()); -} - -TEST(mac_mlme, test_mac_mlme_event_cb) -{ - CHECK(test_mac_mlme_event_cb()); -} - -TEST(mac_mlme, test_mac_mlme_timer_cb) -{ - CHECK(test_mac_mlme_timer_cb()); -} - -TEST(mac_mlme, test_mac_mlme_set_active_state) -{ - CHECK(test_mac_mlme_set_active_state()); -} - -TEST(mac_mlme, test_mac_mlme_data_base_allocate) -{ - CHECK(test_mac_mlme_data_base_allocate()); -} - -TEST(mac_mlme, test_mac_mlme_data_base_deallocate) -{ - CHECK(test_mac_mlme_data_base_deallocate()); -} - -TEST(mac_mlme, test_mac_mlme_set_new_sqn) -{ - CHECK(test_mac_mlme_set_new_sqn()); -} - -TEST(mac_mlme, test_mac_mlme_set_new_beacon_sqn) -{ - CHECK(test_mac_mlme_set_new_beacon_sqn()); -} - -TEST(mac_mlme, test_mac_mlme_get_panid) -{ - CHECK(test_mac_mlme_get_panid()); -} - -TEST(mac_mlme, test_mac_frame_src_address_set_from_interface) -{ - CHECK(test_mac_frame_src_address_set_from_interface()); -} - -TEST(mac_mlme, test_mac_mlme_beacon_tx) -{ - CHECK(test_mac_mlme_beacon_tx()); -} - -TEST(mac_mlme, test_mac_mlme_beacon_req_tx) -{ - CHECK(test_mac_mlme_beacon_req_tx()); -} - -TEST(mac_mlme, test_mac_mlme_virtual_confirmation_handle) -{ - CHECK(test_mac_mlme_virtual_confirmation_handle()); -} diff --git a/test/nanostack/unittest/mac/mac_mlme/main.cpp b/test/nanostack/unittest/mac/mac_mlme/main.cpp deleted file mode 100644 index 2977bba420ab..000000000000 --- a/test/nanostack/unittest/mac/mac_mlme/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_mlme); - diff --git a/test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.c b/test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.c deleted file mode 100644 index 1fa9b4c1d1a0..000000000000 --- a/test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.c +++ /dev/null @@ -1,1637 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "test_mac_mlme.h" -#include -#include "mac_api.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "MAC/IEEE802_15_4/mac_security_mib.h" -#include "MAC/rf_driver_storage.h" -#include "mlme.h" -#include "nsdynmemLIB.h" -#include "fhss_api.h" - -#include "sw_mac_stub.h" -#include "nsdynmemLIB_stub.h" -#include "mac_mcps_sap_stub.h" -#include "common_functions_stub.h" -#include "mac_security_mib_stub.h" -#include "ns_timer_stub.h" -#include "mac_header_helper_functions_stub.h" -#include "fhss_config_stub.h" -#include "fhss_api.h" - -bool visited = false; - -static int8_t test_arm_net_virtual_tx_fn(const virtual_data_req_t *data_req,int8_t driver_id) -{ - return 0; -} - -static int8_t test_phy_rf_virtual_rx(const uint8_t *data_ptr, uint16_t data_len,int8_t driver_id) -{ - -} - -static phy_link_tx_status_e virtual_tx_done_status; -static bool virtual_cb_ok = false; - -static int8_t test_phy_rf_tx_done(int8_t driver_id, uint8_t tx_handle, phy_link_tx_status_e status, uint8_t cca_retry, uint8_t tx_retry) -{ - if (status == virtual_tx_done_status) { - virtual_cb_ok = true; - } else { - virtual_cb_ok = false; - } - -} - -static uint16_t expected_virtual_rx_data_length = 0; -static bool virtual_rx_data_length_ok = false; - -static int8_t test_phy_rf_rx(const uint8_t *data_ptr, uint16_t data_len, uint8_t link_quality, int8_t dbm, int8_t driver_id) -{ - //Validate proper data length here - if (expected_virtual_rx_data_length == data_len) { - virtual_rx_data_length_ok = true; - } else { - virtual_rx_data_length_ok = false; - } -} - -static int8_t test_phy_rf_virtual_tx(const virtual_data_req_t *data, int8_t driver_id){ - - return 0; -} - -static arm_device_driver_list_s * rf_client_driver_allocate() -{ - arm_device_driver_list_s *driver = malloc(sizeof(arm_device_driver_list_s)); - phy_device_driver_s *dev_driver = malloc(sizeof(phy_device_driver_s)); - - - memset(driver, 0, sizeof(arm_device_driver_list_s)); - memset(dev_driver, 0, sizeof(phy_device_driver_s)); - - driver->phy_driver = dev_driver; - - - dev_driver->arm_net_virtual_rx_cb = &test_phy_rf_virtual_rx; - dev_driver->phy_rx_cb = &test_phy_rf_rx; - dev_driver->phy_tx_done_cb = &test_phy_rf_tx_done; - dev_driver->arm_net_virtual_tx_cb = &test_phy_rf_virtual_tx; - - - return driver; -} - -void test_mac_rf_mac_class_free(protocol_interface_rf_mac_setup_s *rf_ptr) { - if (rf_ptr->tun_extension_rf_driver) { - free(rf_ptr->tun_extension_rf_driver->phy_driver); - free(rf_ptr->tun_extension_rf_driver); - } -} - - -int8_t test_phy_tx_done(int8_t driver_id, uint8_t tx_handle, phy_link_tx_status_e status, uint8_t cca_retry, uint8_t tx_retry) -{ - return 1; -} - -int8_t test_phy_rx(const uint8_t *data_ptr, uint16_t data_len, uint8_t link_quality, int8_t dbm, int8_t driver_id) -{ - return 1; -} - -static void mlme_conf( const mac_api_t* api, mlme_primitive id, const void *data ) -{ - visited = true; -} - -static void mlme_ind_callback( const mac_api_t* api, mlme_primitive id, const void *data ) -{ - -} - -int8_t *test_state_control(phy_interface_state_e a, uint8_t b) -{ - visited = true; - return 0; -} - -int8_t *addr_write(phy_address_type_e a, uint8_t *b) -{ - return 0; -} - -int8_t *ext(phy_extension_type_e a, uint8_t *b) -{ - if( b ){ - *b = 1; - } - return 0; -} - -bool test_mac_mlme_link_beacon_join_priority_tx_callback_set() -{ - //TODO: test when refactor complete - - return true; -} - -bool test_mac_mlme_link_beacon_compare_rx_callback_set() -{ - //TODO: test when refactor complete - return true; -} - -void fhss_sync_state_set(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id) -{ - (void)api; - (void)fhss_state; - (void)pan_id; -} - - -bool test_mac_mlme_scan_confirmation_handle() -{ - mac_mlme_scan_confirmation_handle(NULL); - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - - nsdynmemlib_stub.returnCounter = 1; - mlme_scan_conf_t *conf = ns_dyn_mem_alloc(sizeof(mlme_scan_conf_t)); - memset(conf, 0, sizeof(mlme_scan_conf_t)); - setup.mac_mlme_scan_resp = conf; - conf->ScanType = MAC_ACTIVE_SCAN; - mac_api_t api; - sw_mac_stub.mac_api_ptr = &api; - api.mlme_conf_cb = &mlme_conf; - mac_mlme_scan_confirmation_handle(&setup); - - // Test with TUN extension - nsdynmemlib_stub.returnCounter = 1; - conf = ns_dyn_mem_alloc(sizeof(mlme_scan_conf_t)); - conf->ScanType = MAC_ACTIVE_SCAN; - conf->ED_values = NULL; - conf->ResultListSize = 0; - setup.mac_mlme_scan_resp = conf; - setup.tun_extension_rf_driver = rf_client_driver_allocate(); - mac_mlme_scan_confirmation_handle(&setup); - test_mac_rf_mac_class_free(&setup); - - arm_device_driver_list_s driver; - memset(&driver, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.arm_net_virtual_tx_cb = test_arm_net_virtual_tx_fn; - driver.phy_driver = &phy_driver; - setup.tun_extension_rf_driver = &driver; - - nsdynmemlib_stub.returnCounter = 1; - conf = ns_dyn_mem_alloc(sizeof(mlme_scan_conf_t)); - memset(conf, 0, sizeof(mlme_scan_conf_t)); - nsdynmemlib_stub.returnCounter = 1; - conf->ED_values = ns_dyn_mem_alloc(5); - nsdynmemlib_stub.returnCounter = 1; - conf->PAN_values[0] = ns_dyn_mem_alloc(sizeof(mlme_pan_descriptor_t)); - conf->ResultListSize = 1; - setup.mac_mlme_scan_resp = conf; - conf->ScanType = MAC_ED_SCAN_TYPE; - mac_mlme_scan_confirmation_handle(&setup); - - return true; -} - -bool test_mac_mlme_scan_request() -{ - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - - nsdynmemlib_stub.returnCounter = 1; - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - - nsdynmemlib_stub.returnCounter = 1; - mlme_scan_conf_t *conf = ns_dyn_mem_alloc(sizeof(mlme_scan_conf_t)); - memset(conf, 0, sizeof(mlme_scan_conf_t)); - setup.mac_mlme_scan_resp = conf; - mac_pre_build_frame_t fr; - setup.active_pd_data_request = &fr; - mlme_scan_t scan; - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - setup.dev_driver = &list; - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_2_4GHZ_TYPE; - mac_api_t api; - sw_mac_stub.mac_api_ptr = &api; - api.mlme_conf_cb = &mlme_conf; - scan.ScanChannels.channel_page = 0; - memset(&scan.ScanChannels.channel_mask, 0, 8); - nsdynmemlib_stub.returnCounter = 1; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp->ED_values ); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - conf = NULL; - - scan.ScanChannels.channel_mask[0] = 0x7000000; //0x7fff800 - scan.ScanType = MAC_ED_SCAN_TYPE; - nsdynmemlib_stub.returnCounter = 1; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp->ED_values ); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - scan.ScanChannels.channel_mask[0] = 0x7000000; //0x7fff800 - scan.ScanType = MAC_ED_SCAN_TYPE; - nsdynmemlib_stub.returnCounter = 1; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp->ED_values ); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - setup.dev_driver->phy_driver->link_type = PHY_LINK_ETHERNET_TYPE; - scan.ScanChannels.channel_mask[0] = 0; - nsdynmemlib_stub.returnCounter = 1; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp->ED_values ); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_SUBGHZ_TYPE; - scan.ScanChannels.channel_mask[0] = 0x7000000; - nsdynmemlib_stub.returnCounter = 1; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp->ED_values ); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_SUBGHZ_TYPE; - scan.ScanChannels.channel_mask[0] = 0x0f; - nsdynmemlib_stub.returnCounter = 1; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp->ED_values ); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_SUBGHZ_TYPE; - scan.ScanChannels.channel_mask[0] = 0x0f; - nsdynmemlib_stub.returnCounter = 2; - drv.state_control = NULL; - setup.macRfRadioOn = true; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp->ED_values ); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_SUBGHZ_TYPE; - scan.ScanChannels.channel_mask[0] = 0x0f; - nsdynmemlib_stub.returnCounter = 2; - drv.state_control = &test_state_control; - setup.macRfRadioOn = true; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp->ED_values ); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - scan.ScanType = MAC_ACTIVE_SCAN; - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_SUBGHZ_TYPE; - scan.ScanChannels.channel_mask[0] = 0x0f; - nsdynmemlib_stub.returnCounter = 2; - drv.state_control = &test_state_control; - setup.macRfRadioOn = true; - scan.ScanChannels.channel_page = CHANNEL_PAGE_10; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - scan.ScanType = MAC_ORPHAN_SCAN; - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_SUBGHZ_TYPE; - scan.ScanChannels.channel_mask[0] = 0x0f; - nsdynmemlib_stub.returnCounter = 2; - drv.state_control = &test_state_control; - setup.macRfRadioOn = true; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - scan.ScanType = MAC_ACTIVE_SCAN; - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_2_4GHZ_TYPE; - scan.ScanChannels.channel_mask[0] = 0x7000000; - scan.ScanChannels.channel_page = CHANNEL_PAGE_0; - nsdynmemlib_stub.returnCounter = 2; - drv.state_control = &test_state_control; - setup.macRfRadioOn = true; - mac_mlme_scan_request(&scan, &setup); - ns_dyn_mem_free( setup.mac_mlme_scan_resp->ED_values ); - ns_dyn_mem_free( setup.mac_mlme_scan_resp ); - setup.mac_mlme_scan_resp = NULL; - - return true; -} - -bool test_mac_mlme_energy_scan_request() -{ - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - - nsdynmemlib_stub.returnCounter = 1; - mlme_scan_conf_t *conf = ns_dyn_mem_alloc(sizeof(mlme_scan_conf_t)); - memset(conf, 0, sizeof(mlme_scan_conf_t)); - mac_pre_build_frame_t fr; - setup.active_pd_data_request = &fr; - mlme_scan_t scan; - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - setup.dev_driver = &list; - scan.ScanChannels.channel_page = 0; - memset(&scan.ScanChannels.channel_mask, 0, 8); - nsdynmemlib_stub.returnCounter = 1; - scan.ScanType = MAC_ED_SCAN_TYPE; - drv.state_control = &test_state_control; - setup.macRfRadioOn = true; - mac_api_t api; - sw_mac_stub.mac_api_ptr = &api; - api.mlme_conf_cb = &mlme_conf; - - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_SUBGHZ_TYPE; - - // Page 0, channel 0, 868 Mhz BPSK, 20000 symbol rate - scan.ScanChannels.channel_mask[0] = 0x00000001; - scan.ScanChannels.channel_page = 0; - scan.ScanDuration = 10; - - nsdynmemlib_stub.returnCounter = 2; - mac_mlme_scan_request(&scan, &setup); - - // aBaseSuperframeDuration * (2^10 + 1) / 4,8ms (timer length) - if (setup.mlme_ED_counter != 10250) { - ns_dyn_mem_free( conf ); - return false; - } - - ns_dyn_mem_free(setup.mac_mlme_scan_resp->ED_values); - ns_dyn_mem_free(setup.mac_mlme_scan_resp); - setup.mac_mlme_scan_resp = NULL; - - // Page 0, channel 1, 915 Mhz BPSK, 40000 symbol rate - scan.ScanChannels.channel_mask[0] = 0x00000002; - - nsdynmemlib_stub.returnCounter = 2; - mac_mlme_scan_request(&scan, &setup); - - // aBaseSuperframeDuration * (2^10 + 1) / 4,8ms (timer length) - if (setup.mlme_ED_counter != 5125) { - ns_dyn_mem_free( conf ); - return false; - } - - ns_dyn_mem_free(setup.mac_mlme_scan_resp->ED_values); - ns_dyn_mem_free(setup.mac_mlme_scan_resp); - setup.mac_mlme_scan_resp = NULL; - - setup.dev_driver->phy_driver->link_type = PHY_LINK_15_4_2_4GHZ_TYPE; - - // Page 0, channel 11, 2450 Mhz O-QPSK, 62500 symbol rate - scan.ScanChannels.channel_mask[0] = 0x00000800; - - nsdynmemlib_stub.returnCounter = 2; - mac_mlme_scan_request(&scan, &setup); - - // aBaseSuperframeDuration * (2^10 + 1) / 4,8ms (timer length) - if (setup.mlme_ED_counter != 3280) { - ns_dyn_mem_free( conf ); - return false; - } - - ns_dyn_mem_free(setup.mac_mlme_scan_resp->ED_values); - ns_dyn_mem_free(setup.mac_mlme_scan_resp); - setup.mac_mlme_scan_resp = NULL; - - ns_dyn_mem_free( conf ); - return true; -} - -bool test_mac_mlme_start_req() -{ - if( -1 != mac_mlme_start_req(NULL, NULL) ){ - return false; - } - - - mac_pre_build_frame_t buf; - memset(&buf, 0, sizeof(mac_pre_build_frame_t)); - - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_start_t start; - memset(&start, 0, sizeof(mlme_start_t)); - arm_device_driver_list_s list; - memset(&list, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - list.phy_driver = &drv; - setup.dev_driver = &list; - drv.state_control = &test_state_control; - - start.PANCoordinator = true; - start.BatteryLifeExtension = true; - setup.active_pd_data_request = &buf; - sw_mac_stub.mac_api_ptr = NULL; - if( 0 != mac_mlme_start_req(&start, &setup) ){ - return false; - } - - setup.active_pd_data_request = NULL; - drv.address_write = &addr_write; - start.PANCoordinator = false; - start.BatteryLifeExtension = false; - if( 0 != mac_mlme_start_req(&start, &setup) ){ - return false; - } - - // FHSS TESTS START - setup.fhss_api = ns_fhss_create(0, 0); - if (0 != mac_mlme_start_req(&start, &setup)) { - return false; - } - - return true; -} - -bool test_mac_mlme_reset() -{ - if( -1 != mac_mlme_reset(NULL, NULL) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_reset_t reset; - memset(&reset, 0, sizeof(mlme_reset_t)); - setup.mac_mlme_event = ARM_NWK_MAC_MLME_ED_ANALYZE; - - fhss_api_t api; - setup.fhss_api = &api; - setup.fhss_api->synch_state_set = &fhss_sync_state_set; - - reset.SetDefaultPIB = true; - if (0 != mac_mlme_reset(&setup, &reset)) { - return false; - } - - return true; -} - -bool test_mac_mlme_set_req() -{ - uint8_t beacon_payload[MAC_IEEE_802_15_4_MAX_BEACON_PAYLOAD_LENGTH]; - memset(beacon_payload, 0, MAC_IEEE_802_15_4_MAX_BEACON_PAYLOAD_LENGTH); - uint8_t test_beacon_payload[MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE]; - if( -1 != mac_mlme_set_req(NULL, NULL) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_set_t set; - memset(&set, 0, sizeof(mlme_set_t)); - arm_device_driver_list_s list; - memset(&list, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - list.phy_driver = &drv; - setup.dev_driver = &list; - drv.extension = ext; - setup.mac_beacon_payload = beacon_payload; - setup.max_beacon_payload_length = MAC_IEEE_802_15_4_MAX_BEACON_PAYLOAD_LENGTH; - - set.attr = macBeaconPayload; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.value_pointer = test_beacon_payload; - - set.value_size = 57; - if( 0 == mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.value_size = 1; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.attr = macCoordExtendedAddress; - set.value_size = 8; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - uint8_t val[1]; - set.value_pointer = &val; - - set.attr = 0xfb; - set.value_size = 0; - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.attr = 0xfc; - set.value_size = 13; - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - //Test buffer type values here --> - uint8_t val_buf[8]; - set.value_pointer = &val_buf; - set.value_size = 1; - set.attr = macDeviceTable; - - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - mlme_device_descriptor_t desc; - set.value_pointer = &desc; - set.value_size = sizeof(mlme_device_descriptor_t); - set.attr = macDeviceTable; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.value_pointer = &val_buf; - set.value_size = 1; - set.attr = macKeyTable; - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - mlme_key_descriptor_entry_t entry; - set.value_pointer = &entry; - set.value_size = sizeof(mlme_key_descriptor_entry_t); - set.attr = macKeyTable; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.value_pointer = &val_buf; - set.value_size = 1; - set.attr = macDefaultKeySource; - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.value_pointer = &val_buf; - set.value_size = 8; - set.attr = macDefaultKeySource; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.value_pointer = &val_buf; - set.value_size = 1; - set.attr = macAutoRequestKeySource; - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.value_pointer = &val_buf; - set.value_size = 8; - set.attr = macAutoRequestKeySource; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - // <-- Tested buffer type values here - - //default case: --> - //Test all boolean set (mac_mlme_boolean_set) values here --> - bool bval = true; - set.value_pointer = &bval; - set.value_size = 1; - - set.attr = macSecurityEnabled; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macRxOnWhenIdle; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macPromiscuousMode; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macGTSPermit; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macAssociationPermit; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macAssociatedPANCoord; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macTimestampSupported; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macBattLifeExt; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macAutoRequest; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.attr = macThreadForceLongAddressForBeacon; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - drv.extension = NULL; - set.attr = macLoadBalancingAcceptAnyBeacon; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - drv.extension = ext; - set.attr = macLoadBalancingAcceptAnyBeacon; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - //<-- Tested all boolean set values here (except default case) - //Test all uint8_t* set (mac_mlme_8bit_set) values here --> - set.value_size = 1; - set.value_pointer = &val; - set.attr = phyCurrentChannel; - setup.mac_channel = 2; - val[0] = 2; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - val[0] = 3; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - mac_pre_build_frame_t buf2; - setup.active_pd_data_request = &buf2; - val[0] = 4; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - setup.active_pd_data_request = NULL; - - set.attr = macMaxFrameRetries; - setup.mac_mlme_retry_max = 3; - val[0] = 5; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - if (setup.mac_mlme_retry_max != 5) { - return false; - } - - val[0] = 8; - - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - if (setup.mac_mlme_retry_max != 5) { - return false; - } - - setup.mac_channel = 2; - mac_pre_build_frame_t frame; - setup.active_pd_data_request = &frame; - val[0] = 1; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.attr = macBeaconPayloadLength; - val[0] = 60; - if( 0 == mac_mlme_set_req(&setup, &set) ){ - return false; - } - - val[0] = 1; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macAutoRequestKeyIndex; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macAutoRequestKeyIdMode; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.attr = macAutoRequestSecurityLevel; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - - set.attr = 0xf0; - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - //<-- Tested all uint8_t* set values here (also default) - //Test all uint16_t* set (mac_mlme_16bit_set) values here --> - set.value_size = 2; - uint16_t val16; - set.value_pointer = &val16; - val16 = 0x6712; - set.attr = macCoordShortAddress; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.attr = macPANId; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - - - drv.link_type = PHY_LINK_TUN; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - drv.link_type = 0; - - drv.address_write = &addr_write; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - if (setup.pan_id != val16) { - return false; - } - - set.attr = macShortAddress; - val16 = 0x400; - - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - if (setup.mac_short_address != val16) { - return false; - } - - val16 = 0xffff; - - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - if (setup.mac_short_address != val16) { - return false; - } - - common_functions_stub.uint16_value = 0xffff; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - common_functions_stub.uint16_value = 0; - - set.attr = macSyncSymbolOffset; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.attr = macTransactionPersistenceTime; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - set.attr = 0xfc; - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - // <-- Tested all uint16_t* set (mac_mlme_16bit_set) values here - //Test all uint32_t* set (mac_mlme_32bit_set) values here --> - set.value_size = 4; - uint32_t val32 = 0xac457733; - set.value_pointer = &val32; - set.attr = macFrameCounter; - if( 0 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - if (setup.security_frame_counter != val32) { - return false; - } - - - set.attr = 0xfc; - if( -1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - // <-- Tested all uint32_t* set (mac_mlme_32bit_set) values here - set.attr = 0xfd; - set.value_size = 4; - uint16_t tx_period = 100; - set.value_pointer = &tx_period; - if(-1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - set.value_size = 2; - if(-1 != mac_mlme_set_req(&setup, &set) ){ - return false; - } - - return true; -} - -bool test_mac_mlme_get_req() -{ - if( -1 != mac_mlme_get_req(NULL, NULL) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_get_conf_t get; - memset(&get, 0, sizeof(mlme_get_conf_t)); - get.attr = macDeviceTable; - get.value_pointer = NULL; - mac_security_mib_stub.device_ptr = NULL; - if( 0 != mac_mlme_get_req(&setup, &get) ){ - return false; - } - - mlme_device_descriptor_t desc; - mac_security_mib_stub.device_ptr = &desc; - if( 0 != mac_mlme_get_req(&setup, &get) ){ - return false; - } - mac_security_mib_stub.device_ptr = NULL; - - get.attr = macFrameCounter; - if( 0 != mac_mlme_get_req(&setup, &get) ){ - return false; - } - - get.attr = macDefaultKeySource; - if( 0 != mac_mlme_get_req(&setup, &get) ){ - return false; - } - - setup.mac_mlme_retry_max = 5; - get.attr = macMaxFrameRetries; - if( 0 != mac_mlme_get_req(&setup, &get) ){ - return false; - } - uint8_t *ptr = get.value_pointer; - if (get.value_size != 1 || *ptr != setup.mac_mlme_retry_max) { - return false; - } - - - return true; -} - -bool test_mac_extended_mac_set() -{ - mac_extended_mac_set(NULL, NULL); - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - uint8_t mac[8]; - memset(&mac, 0, 8); - arm_device_driver_list_s list; - memset(&list, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - list.phy_driver = &drv; - setup.dev_driver = &list; - drv.address_write = &addr_write; - mac_extended_mac_set(&setup, &mac); - - return true; -} - -bool test_mac_mlme_poll_req() -{ - mac_mlme_poll_req(NULL, NULL); - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_poll_t poll; - memset(&poll, 0, sizeof(mlme_poll_t)); - setup.macDataPollReq = true; - mac_mlme_poll_req(&setup, &poll); - - mac_mcps_sap_stub.frame_ptr = NULL; - setup.macDataPollReq = false; - mac_mlme_poll_req(&setup, &poll); - - mac_pre_build_frame_t frame; - mac_mcps_sap_stub.frame_ptr = &frame; - mac_header_helper_functions_stub.security_header.securityLevel = 3; //securityLevel - mac_header_helper_functions_stub.security_header.KeyIdMode = 1; - mac_header_helper_functions_stub.security_header.KeyIndex = 1; - setup.mac_short_address = 0xffff; - mac_mlme_poll_req(&setup, &poll); - - setup.macDataPollReq = false; - setup.mac_short_address = 0x0015; - mac_mlme_poll_req(&setup, &poll); - - return true; -} - -bool test_mac_mlme_poll_process_confirm() -{ - mac_mlme_poll_process_confirm(NULL, 0); - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_pre_build_frame_t frame; - memset(&frame, 0, sizeof(mac_pre_build_frame_t)); - setup.active_pd_data_request = &frame; - arm_device_driver_list_s list; - memset(&list, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - list.phy_driver = &drv; - setup.dev_driver = &list; - - sw_mac_stub.mac_api_ptr = NULL; - mac_mlme_poll_process_confirm(&setup, 0); - mac_api_t api; - sw_mac_stub.mac_api_ptr = &api; - api.mlme_conf_cb = &mlme_conf; - - visited = false; - mac_mlme_poll_process_confirm(&setup, 0); - if( !visited ){ - return false; - } - - return true; -} - -bool test_mac_mlme_mac_radio_disabled() -{ - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - arm_device_driver_list_s list; - memset(&list, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - list.phy_driver = &drv; - setup.dev_driver = &list; - mac_mlme_mac_radio_disabled(NULL); - - mac_mlme_mac_radio_disabled(&setup); - - drv.link_type = PHY_LINK_TUN; - mac_mlme_mac_radio_disabled(&setup); - - drv.state_control = &test_state_control; - setup.macRfRadioOn = true; - visited = false; - mac_mlme_mac_radio_disabled(&setup); - if( !visited ){ - return false; - } - - return true; -} - -bool test_mac_mlme_mac_radio_enable() -{ - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - arm_device_driver_list_s list; - memset(&list, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - list.phy_driver = &drv; - setup.dev_driver = &list; - mac_mlme_mac_radio_enable(NULL); - - mac_mlme_mac_radio_enable(&setup); - - drv.link_type = PHY_LINK_TUN; - mac_mlme_mac_radio_enable(&setup); - - drv.state_control = &test_state_control; - setup.macRfRadioOn = true; - - mac_mlme_mac_radio_enable(&setup); - - setup.macRfRadioOn = false; - setup.macProminousMode = true; - visited = false; - mac_mlme_mac_radio_enable(&setup); - if( !visited ){ - return false; - } - - setup.macRfRadioOn = false; - setup.macProminousMode = false; - visited = false; - mac_mlme_mac_radio_enable(&setup); - if( !visited ){ - return false; - } - return true; -} - -bool test_mac_mlme_rf_channel_change() -{ - if( -1 != mac_mlme_rf_channel_change(NULL, 1) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - arm_device_driver_list_s list; - memset(&list, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s drv; - list.phy_driver = &drv; - setup.dev_driver = &list; - drv.link_type = PHY_LINK_15_4_2_4GHZ_TYPE; - drv.extension = NULL; - - if( -1 != mac_mlme_rf_channel_change(&setup, 1) ){ - return false; - } - drv.link_type = PHY_LINK_TUN; - if( 0 != mac_mlme_rf_channel_change(&setup, 1) ){ - return false; - } - - drv.extension = &ext; - setup.mac_channel = 1; - if( 0 != mac_mlme_rf_channel_change(&setup, 1) ){ - return false; - } - - setup.mac_channel = 3; - if( 0 != mac_mlme_rf_channel_change(&setup, 1) ){ - return false; - } - - return true; -} - -bool test_mac_mlme_active_scan_response_timer_start() -{ - mac_mlme_active_scan_response_timer_start(NULL); - - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - setup.mac_mlme_event = ARM_NWK_MAC_MLME_SCAN; - mac_mlme_active_scan_response_timer_start(&setup); - return true; -} - -bool test_mac_mlme_beacon_notify() -{ - if( -1 != mac_mlme_beacon_notify(NULL, NULL)){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - setup.tun_extension_rf_driver = NULL; - mlme_beacon_ind_t data; - mac_api_t api; - api.mlme_ind_cb = &mlme_ind_callback; - sw_mac_stub.mac_api_ptr = &api; - mlme_scan_conf_t conf; - setup.mac_mlme_scan_resp = &conf; - - //Test add_or_update_beacon here completely --> - mlme_pan_descriptor_t desc1; - conf.PAN_values[0] = &desc1; - conf.PAN_values[1] = NULL; - conf.ResultListSize = 2; - desc1.LogicalChannel = 11; - data.PANDescriptor.LogicalChannel = 11; - desc1.CoordPANId = 1; - data.PANDescriptor.CoordPANId = 1; - desc1.LinkQuality = 1; - data.PANDescriptor.LinkQuality = 2; - // Beacon data length doesn't contain FHSS synch info on single channel - data.beacon_data_length = FHSS_SYNCH_INFO_START; - - //for loop covered here - if(0 != mac_mlme_beacon_notify(&setup, &data)){ - return false; - } - - conf.PAN_values[0] = NULL; - if(0 != mac_mlme_beacon_notify(&setup, &data)){ - return false; - } - - conf.ResultListSize = 2; - nsdynmemlib_stub.returnCounter = 1; - if(0 != mac_mlme_beacon_notify(&setup, &data)){ - return false; - } - - // Test FHSS beacon on single channel - data.beacon_data_length = FHSS_SYNCH_INFO_START + FHSS_SYNCH_INFO_LENGTH; - if(0 != mac_mlme_beacon_notify(&setup, &data)){ - return false; - } - - ns_dyn_mem_free(conf.PAN_values[2]); - - // FHSS TESTS START - setup.fhss_api = ns_fhss_create(0, 0); - nsdynmemlib_stub.returnCounter = 1; - data.beacon_data_length = FHSS_SYNCH_INFO_START + FHSS_SYNCH_INFO_LENGTH; - if(0 != mac_mlme_beacon_notify(&setup, &data)){ - return false; - } - // Beacon notify should cut synch info from data length - if (data.beacon_data_length != FHSS_SYNCH_INFO_START) { - return false; - } - - // Test too short FHSS beacon - data.beacon_data_length = FHSS_SYNCH_INFO_START; - if(0 != mac_mlme_beacon_notify(&setup, &data)){ - return false; - } - - ns_dyn_mem_free(conf.PAN_values[2]); - - //<-- Test add_or_update_beacon here completely - - return true; -} - -bool test_mac_mlme_event_cb() -{ - mac_mlme_event_cb(NULL); - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - setup.mac_mlme_event = ARM_NWK_MAC_MLME_IDLE; - mac_mlme_event_cb(&setup); - - arm_device_driver_list_s list; - memset(&list, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s drv; - list.phy_driver = &drv; - setup.dev_driver = &list; - drv.state_control = &test_state_control; - - //Test static mlme_scan_operation here --> - setup.mac_mlme_event = ARM_NWK_MAC_MLME_SCAN; - setup.scan_type = MAC_ED_SCAN_TYPE; - setup.mac_channel_list.channel_page = CHANNEL_PAGE_1; - setup.mac_channel_list.channel_mask[0] = 0x400; - mlme_scan_conf_t conf; - memset(&conf, 0, sizeof(mlme_scan_conf_t)); - uint8_t buf[20]; - memset(&buf, 0, 20); - conf.ED_values = &buf; - setup.mac_mlme_scan_resp = &conf; - setup.mac_mlme_scan_resp->ResultListSize = MLME_MAC_RES_SIZE_MAX-1; - mac_mlme_event_cb(&setup); - - setup.mac_mlme_event = ARM_NWK_MAC_MLME_SCAN; - setup.mac_mlme_scan_resp->ResultListSize = 0; - setup.scan_type = MAC_ACTIVE_SCAN; - mac_mlme_event_cb(&setup); - - //Only way to test mac_mlme_energy_scan_start with radio ON - setup.mac_mlme_event = ARM_NWK_MAC_MLME_SCAN; - setup.scan_type = MAC_ED_SCAN_TYPE; - setup.macRfRadioOn = true; - setup.mac_mlme_scan_resp->ResultListSize = MLME_MAC_RES_SIZE_MAX-2; - setup.mac_channel_list.channel_mask[0] = 0x04; - setup.scan_duration = 1; - mac_mlme_event_cb(&setup); - - //<-- Test static mlme_scan_operation here - - setup.mac_mlme_event = ARM_NWK_MAC_MLME_INDIRECT_DATA_POLL; - //No need to test inner function, handled elsewhere - mac_mlme_event_cb(&setup); - - setup.mac_mlme_event = ARM_NWK_MAC_MLME_INDIRECT_DATA_POLL_AFTER_DATA; - mac_mlme_event_cb(&setup); - - return true; -} - -bool test_mac_mlme_timer_cb() -{ - protocol_interface_rf_mac_setup_s *setup; - uint8_t buf[8]; - memset(&buf, 0, 8); - arm_device_driver_list_s list; - phy_device_driver_s drv; - - phy_device_channel_page_s phy_channel_pages; - phy_rf_channel_configuration_s rf_channel_configuration; - rf_channel_configuration.datarate = 250000; - rf_channel_configuration.number_of_channels = 16; - rf_channel_configuration.modulation = M_OQPSK; - rf_channel_configuration.channel_0_center_frequency = 2405000000; - rf_channel_configuration.channel_spacing = 5000000; - - phy_channel_pages.channel_page = CHANNEL_PAGE_0; - phy_channel_pages.rf_channel_configuration = &rf_channel_configuration; - list.phy_driver = &drv; - drv.extension = &ext; - mac_security_mib_stub.int8_value = 0; - drv.phy_MTU = MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE; - drv.phy_channel_pages = &phy_channel_pages; - mac_mcps_sap_stub.int8_value = 1; - ns_timer_stub.cb_counter = 1; - - ns_timer_stub.int8_value = 1; - nsdynmemlib_stub.returnCounter = 3; - drv.address_write = &addr_write; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - setup = mac_mlme_data_base_allocate(&buf, &list, &storage_sizes); - - if( ns_timer_stub.cb ){ - sw_mac_stub.rf_mac_ptr = NULL; - ns_timer_stub.cb(1, 1); - - sw_mac_stub.rf_mac_ptr = setup; - setup->mlme_tick_count = 0; - setup->mac_mlme_event = ARM_NWK_MAC_MLME_ED_ANALYZE; - setup->mlme_ED_counter = 2; - setup->max_ED = 0; - ns_timer_stub.cb(1, 1); - - setup->mlme_ED_counter = 0; - ns_timer_stub.cb(1, 1); - - setup->mac_mlme_event = ARM_NWK_MAC_MLME_SCAN; - ns_timer_stub.cb(1, 1); - - setup->mlme_tick_count = 1; - ns_timer_stub.cb(1, 1); - } - - mac_mlme_data_base_deallocate(setup); - return true; -} - -bool test_mac_mlme_set_active_state() -{ - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_set_active_state(&setup, true); - return true; -} - -bool test_mac_mlme_data_base_allocate() -{ - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - protocol_interface_rf_mac_setup_s *setup = mac_mlme_data_base_allocate(NULL, NULL, &storage_sizes); - if( setup ){ - return false; - } - uint8_t buf[8]; - memset(buf, 3, 8); - arm_device_driver_list_s list; - list.phy_driver = NULL; - - setup = mac_mlme_data_base_allocate(NULL, &list, &storage_sizes); - if( setup ){ - return false; - } - - setup = mac_mlme_data_base_allocate(&buf, &list, NULL); - if( setup ){ - return false; - } - - - //Allocate Fail - nsdynmemlib_stub.returnCounter = 0; - setup = mac_mlme_data_base_allocate(&buf, &list, &storage_sizes); - if( setup ){ - return false; - } - phy_device_driver_s drv; - phy_device_channel_page_s phy_channel_pages; - phy_rf_channel_configuration_s rf_channel_configuration; - rf_channel_configuration.datarate = 250000; - rf_channel_configuration.number_of_channels = 16; - rf_channel_configuration.modulation = M_OQPSK; - rf_channel_configuration.channel_0_center_frequency = 2405000000; - rf_channel_configuration.channel_spacing = 5000000; - - phy_channel_pages.channel_page = CHANNEL_PAGE_0; - phy_channel_pages.rf_channel_configuration = &rf_channel_configuration; - - list.phy_driver = &drv; - drv.phy_MTU = 0; - drv.phy_channel_pages = &phy_channel_pages; - nsdynmemlib_stub.returnCounter = 0; - mac_security_mib_stub.int8_value = 1; - setup = mac_mlme_data_base_allocate(&buf, &list, &storage_sizes); - if( setup ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - setup = mac_mlme_data_base_allocate(&buf, &list,&storage_sizes); - if( setup ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - mac_security_mib_stub.int8_value = 0; - setup = mac_mlme_data_base_allocate(&buf, &list,&storage_sizes); - if( setup ){ - return false; - } - - drv.phy_MTU = MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE; - mac_security_mib_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - setup = mac_mlme_data_base_allocate(&buf, &list, &storage_sizes); - if( setup ){ - return false; - } - nsdynmemlib_stub.returnCounter = 1; - mac_mcps_sap_stub.int8_value = -1; - setup = mac_mlme_data_base_allocate(&buf, &list, &storage_sizes); - if( setup ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - setup = mac_mlme_data_base_allocate(&buf, &list, &storage_sizes); - if( setup ){ - return false; - } - - - mac_mcps_sap_stub.int8_value = -1; - nsdynmemlib_stub.returnCounter = 3; - setup = mac_mlme_data_base_allocate(&buf, &list, &storage_sizes); - if( setup ){ - return false; - } - - mac_mcps_sap_stub.int8_value = 1; - ns_timer_stub.int8_value = -1; - nsdynmemlib_stub.returnCounter = 3; - setup = mac_mlme_data_base_allocate(&buf, &list, &storage_sizes); - if( setup ){ - return false; - } - - ns_timer_stub.int8_value = 1; - nsdynmemlib_stub.returnCounter = 3; - drv.address_write = &addr_write; - setup = mac_mlme_data_base_allocate(&buf, &list, &storage_sizes); - if( !setup ){ - return false; - } - - mac_mlme_data_base_deallocate(setup); - - return true; -} - -bool test_mac_mlme_data_base_deallocate() -{ - nsdynmemlib_stub.returnCounter = 1; - protocol_interface_rf_mac_setup_s *setup = ns_dyn_mem_alloc(sizeof(protocol_interface_rf_mac_setup_s)); - memset(setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - - nsdynmemlib_stub.returnCounter = 1; - setup->dev_driver_tx_buffer.buf = ns_dyn_mem_alloc(12); - arm_device_driver_list_s list; - setup->dev_driver = &list; - - mac_mlme_data_base_deallocate(setup); - - return true; -} - -bool test_mac_mlme_set_new_sqn() -{ - if( 0 != mac_mlme_set_new_sqn(NULL) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - if( 1 != mac_mlme_set_new_sqn(&setup) ){ - return false; - } - - return true; -} - -bool test_mac_mlme_set_new_beacon_sqn() -{ - if( 0 != mac_mlme_set_new_beacon_sqn(NULL) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - if( 1 != mac_mlme_set_new_beacon_sqn(&setup) ){ - return false; - } - - return true; -} - -bool test_mac_mlme_get_panid() -{ - uint16_t ret = mac_mlme_get_panid(NULL); - if( 0xffff != ret ){ - return false; - } - - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - setup.pan_id = 0x1234; - ret = mac_mlme_get_panid(&setup); - if( 0x1234 != ret ){ - return false; - } - - return true; -} - -bool test_mac_frame_src_address_set_from_interface() -{ - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - uint8_t buf[100]; - memset(&buf, 0, 100); - - mac_frame_src_address_set_from_interface(MAC_ADDR_MODE_16_BIT, NULL, &buf); - - mac_frame_src_address_set_from_interface(MAC_ADDR_MODE_16_BIT, &setup, &buf); - - mac_frame_src_address_set_from_interface(MAC_ADDR_MODE_64_BIT, &setup, &buf); - return true; -} - -bool test_mac_mlme_beacon_tx() -{ - if( -1 != mac_mlme_beacon_tx(NULL) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - //setup.beacon_join_priority_tx_cb_ptr = &beacon_join_pri_tx_cb; - mac_mcps_sap_stub.frame_ptr = NULL; - if( -1 != mac_mlme_beacon_tx(&setup) ){ - return false; - } - setup.macCapCordinator = true; - if( -1 != mac_mlme_beacon_tx(&setup) ){ - return false; - } - - - - - mac_pre_build_frame_t fr; - - setup.active_pd_data_request = &fr; - - fr.next = NULL; - fr.fcf_dsn.frametype = FC_BEACON_FRAME; - if( -2 != mac_mlme_beacon_tx(&setup) ){ - return false; - } - setup.active_pd_data_request = NULL; - setup.pd_data_request_queue_to_go = &fr; - - if( -2 != mac_mlme_beacon_tx(&setup) ){ - return false; - } - fr.fcf_dsn.frametype = FC_DATA_FRAME; - - mac_mcps_sap_stub.frame_ptr = &fr; - setup.beaconSrcAddressModeLong = true; - setup.macCapCordinator = true; - setup.macCapBatteryPowered = true; - setup.macCapAssocationPermit = true; - uint8_t buf[100]; - memset(&buf, 0, 100); - fr.mac_payload = &buf; - common_functions_stub.uint8_ptr = &buf; - setup.mac_beacon_payload_size = 1; - setup.mac_beacon_payload = &buf; - if( 0 != mac_mlme_beacon_tx(&setup) ){ - return false; - } - setup.pd_data_request_queue_to_go = NULL; - setup.active_pd_data_request = NULL; - setup.beaconSrcAddressModeLong = false; - setup.shortAdressValid = true; - if( 0 != mac_mlme_beacon_tx(&setup) ){ - return false; - } - setup.active_pd_data_request = NULL; - setup.shortAdressValid = false; - if( 0 != mac_mlme_beacon_tx(&setup) ){ - return false; - } - - // FHSS TESTS START - setup.fhss_api = ns_fhss_create(0, 0); - setup.active_pd_data_request = NULL; - setup.shortAdressValid = false; - if( 0 != mac_mlme_beacon_tx(&setup) ){ - return false; - } - - return true; -} - -bool test_mac_mlme_beacon_req_tx() -{ - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - - if( 0 != mac_mlme_beacon_req_tx(&setup) ){ - return false; - } - mac_pre_build_frame_t fr; - mac_mcps_sap_stub.frame_ptr = &fr; - - if( 1 != mac_mlme_beacon_req_tx(&setup) ){ - return false; - } - - return true; -} - - -bool test_mac_mlme_virtual_confirmation_handle() -{ - if (-1 != mac_mlme_virtual_confirmation_handle(-1, NULL, 0)) { - return false; - } - protocol_interface_rf_mac_setup_s setup; - sw_mac_stub.rf_mac_ptr = &setup; - - //Stub A driver - arm_device_driver_list_s driver; - memset(&driver, 0, sizeof(arm_device_driver_list_s)); - phy_device_driver_s phy_driver; - memset(&phy_driver, 0, sizeof(phy_device_driver_s)); - phy_driver.arm_net_virtual_tx_cb = test_arm_net_virtual_tx_fn; - driver.phy_driver = &phy_driver; - setup.tun_extension_rf_driver = &driver; - uint8_t test_data[10]; - test_data[0] = MLME_SCAN; - - // Fail memory allocation - nsdynmemlib_stub.returnCounter = 0; - if (-1 != mac_mlme_virtual_confirmation_handle(0, test_data, 0)) { - return false; - } - nsdynmemlib_stub.returnCounter = 1; - if (0 != mac_mlme_virtual_confirmation_handle(0, test_data, 0)) { - return false; - } - - return true; -} diff --git a/test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.h b/test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.h deleted file mode 100644 index 093ec5eea4b9..000000000000 --- a/test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_MAC_MLME_H -#define TEST_MAC_MLME_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_mlme_link_beacon_join_priority_tx_callback_set(); - -bool test_mac_mlme_link_beacon_compare_rx_callback_set(); - -bool test_mac_mlme_scan_confirmation_handle(); - -bool test_mac_mlme_scan_request(); - -bool test_mac_mlme_energy_scan_request(); - -bool test_mac_mlme_start_req(); - -bool test_mac_mlme_reset(); - -bool test_mac_mlme_set_req(); - -bool test_mac_mlme_get_req(); - -bool test_mac_extended_mac_set(); - -bool test_mac_mlme_poll_req(); - -bool test_mac_mlme_poll_process_confirm(); - -bool test_mac_mlme_mac_radio_disabled(); - -bool test_mac_mlme_mac_radio_enable(); - -bool test_mac_mlme_rf_channel_change(); - -bool test_mac_mlme_active_scan_response_timer_start(); - -bool test_mac_mlme_beacon_notify(); - -bool test_mac_mlme_event_cb(); - -bool test_mac_mlme_timer_cb(); - -bool test_mac_mlme_set_active_state(); - -bool test_mac_mlme_data_base_allocate(); - -bool test_mac_mlme_data_base_deallocate(); - -bool test_mac_mlme_set_new_sqn(); - -bool test_mac_mlme_set_new_beacon_sqn(); - -bool test_mac_mlme_get_panid(); - -bool test_mac_frame_src_address_set_from_interface(); - -bool test_mac_mlme_beacon_tx(); - -bool test_mac_mlme_beacon_req_tx(); - -bool test_mac_mlme_virtual_confirmation_handle(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_MLME_H - diff --git a/test/nanostack/unittest/mac/mac_pd_sap/Makefile b/test/nanostack/unittest/mac/mac_pd_sap/Makefile deleted file mode 100644 index 97c609b150ce..000000000000 --- a/test/nanostack/unittest/mac/mac_pd_sap/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_pd_sap_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/mac_pd_sap.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_pd_saptest.cpp \ - test_mac_pd_sap.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/event_stub.c \ - ../../stub/ns_timer_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/mac_mcps_sap_stub.c \ - ../../stub/mac_header_helper_functions_stub.c \ - ../../stub/mac_timer_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/mac_mlme_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/fhss_config_stub.c \ - ../../stub/fhss_mac_interface_stub.c \ - ../../stub/sw_mac_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/mac_pd_sap/mac_pd_saptest.cpp b/test/nanostack/unittest/mac/mac_pd_sap/mac_pd_saptest.cpp deleted file mode 100644 index 2118f9c7a709..000000000000 --- a/test/nanostack/unittest/mac/mac_pd_sap/mac_pd_saptest.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_pd_sap.h" - -TEST_GROUP(mac_pd_sap) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_pd_sap, test_mac_pd_sap_req) -{ - CHECK(test_mac_pd_sap_req()); -} - -TEST(mac_pd_sap, test_mac_pd_sap_rf_low_level_function_set) -{ - CHECK(test_mac_pd_sap_rf_low_level_function_set()); -} - -TEST(mac_pd_sap, test_mac_pd_sap_data_cb) -{ - CHECK(test_mac_pd_sap_data_cb()); -} - -TEST(mac_pd_sap, test_mac_pd_sap_state_machine) -{ - CHECK(test_mac_pd_sap_state_machine()); -} - diff --git a/test/nanostack/unittest/mac/mac_pd_sap/main.cpp b/test/nanostack/unittest/mac/mac_pd_sap/main.cpp deleted file mode 100644 index b3924d1cdddd..000000000000 --- a/test/nanostack/unittest/mac/mac_pd_sap/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_pd_sap); - diff --git a/test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.c b/test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.c deleted file mode 100644 index 81e25212d3fb..000000000000 --- a/test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.c +++ /dev/null @@ -1,679 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "inttypes.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/IEEE802_15_4/mac_pd_sap.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "MAC/IEEE802_15_4/mac_header_helper_functions.h" -#include "MAC/rf_driver_storage.h" - -#include "fhss_api.h" -#include "test_mac_pd_sap.h" -#include "mac_header_helper_functions_stub.h" -#include "mac_mcps_sap_stub.h" -#include "nsdynmemLIB_stub.h" -#include "fhss_mac_interface_stub.h" -#include - -static int8_t tx_return = -1; - -static int8_t test_rf_extension(phy_extension_type_e extension, uint8_t *buf) { - switch (extension) { - case PHY_EXTENSION_READ_LAST_ACK_PENDING_STATUS: - *buf = 1; - break; - default: - break; - } - return 0; -} - -static int8_t test_rf_tx(uint8_t *data, uint16_t length, uint8_t tx_handle, data_protocol_e protocol) { - return tx_return; -} -static int8_t test_rf_virtual_tx(const virtual_data_req_t *data_req,int8_t driver_id) { - return 0; -} - - -bool test_mac_pd_sap_req() -{ - protocol_interface_rf_mac_setup_s rf_ptr; - arm_device_driver_list_s driver; - mac_fcf_sequence_t fcf; - arm_phy_sap_msg_t phy_message; - phy_device_driver_s dev_driver; - mac_pre_build_frame_t temp_buf; - - - uint8_t tx_buffer[127]; - - memset(&rf_ptr, 0, sizeof(protocol_interface_rf_mac_setup_s)); - memset(&driver, 0, sizeof(arm_device_driver_list_s)); - memset(&dev_driver, 0, sizeof(phy_device_driver_s)); - memset(&phy_message, 0, sizeof(arm_phy_sap_msg_t)); - memset(&fcf, 0, sizeof(mac_fcf_sequence_t)); - memset(&temp_buf, 0, sizeof(mac_pre_build_frame_t)); - rf_ptr.active_pd_data_request = &temp_buf; - - rf_ptr.dev_driver_tx_buffer.buf = tx_buffer; - rf_ptr.dev_driver_tx_buffer.len = 100; - dev_driver.extension = &test_rf_extension; - dev_driver.tx = &test_rf_tx; - driver.phy_driver = &dev_driver; - rf_ptr.dev_driver = &driver; - rf_ptr.macUpState = false; - if (-1 != mac_pd_sap_req(&rf_ptr) ) { - return false; - } - rf_ptr.macUpState = true; - temp_buf.fcf_dsn.frametype = MAC_FRAME_BEACON; - if (0 != mac_pd_sap_req(&rf_ptr) ) { - return false; - } - temp_buf.fcf_dsn.frametype = MAC_FRAME_DATA; - if (0 != mac_pd_sap_req(&rf_ptr) ) { - return false; - } - return true; -} - -bool test_mac_pd_sap_rf_low_level_function_set() -{ - protocol_interface_rf_mac_setup_s rf_ptr; - arm_device_driver_list_s driver; - mac_fcf_sequence_t fcf; - arm_phy_sap_msg_t phy_message; - phy_device_driver_s dev_driver; - - uint8_t tx_buffer[127]; - - memset(&rf_ptr, 0, sizeof(protocol_interface_rf_mac_setup_s)); - memset(&driver, 0, sizeof(arm_device_driver_list_s)); - memset(&dev_driver, 0, sizeof(phy_device_driver_s)); - memset(&phy_message, 0, sizeof(arm_phy_sap_msg_t)); - memset(&fcf, 0, sizeof(mac_fcf_sequence_t)); - - - rf_ptr.dev_driver_tx_buffer.buf = tx_buffer; - rf_ptr.dev_driver_tx_buffer.len = 100; - dev_driver.extension = &test_rf_extension; - dev_driver.tx = &test_rf_tx; - driver.phy_driver = &dev_driver; - rf_ptr.dev_driver = &driver; - mac_pd_sap_rf_low_level_function_set(&rf_ptr,&driver); - if (!driver.phy_sap_identifier || !driver.phy_sap_upper_cb) { - return false; - } - return true; -} - - - -bool test_mac_pd_sap_data_cb() -{ - protocol_interface_rf_mac_setup_s rf_ptr; - arm_device_driver_list_s driver; - mac_fcf_sequence_t fcf; - arm_phy_sap_msg_t phy_message; - phy_device_driver_s dev_driver; - - mac_pre_build_frame_t *frame_buf = malloc(sizeof(mac_pre_build_frame_t) + 32); - - - uint8_t buffer[127]; - uint8_t tx_buffer[127]; - - uint8_t *ptr = buffer; - - memset(buffer, 0, 127); - memset(&rf_ptr, 0, sizeof(protocol_interface_rf_mac_setup_s)); - memset(&driver, 0, sizeof(arm_device_driver_list_s)); - memset(&phy_message, 0, sizeof(arm_phy_sap_msg_t)); - memset(&fcf, 0, sizeof(mac_fcf_sequence_t)); - - - rf_ptr.dev_driver_tx_buffer.buf = tx_buffer; - rf_ptr.dev_driver_tx_buffer.len = 100; - dev_driver.extension = &test_rf_extension; - dev_driver.tx = &test_rf_tx; - driver.phy_driver = &dev_driver; - rf_ptr.dev_driver = &driver; - rf_ptr.macMaxCSMABackoffs = 4; - rf_ptr.macMaxBE = 5; - rf_ptr.macMinBE = 3; - - int8_t ret = mac_pd_sap_data_cb(NULL, NULL); - if( ret != -1 ){ - free(frame_buf); - return false; - } - //Test mac dwn state - rf_ptr.macUpState = false; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -2 ){ - free(frame_buf); - return false; - } - //Test unkow message id - - phy_message.id = MACTUN_PD_SAP_NAP_IND; - rf_ptr.macUpState = true; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - free(frame_buf); - return false; - } - //Test length < 3 - phy_message.id = MAC15_4_PD_SAP_DATA_IND; - phy_message.message.generic_data_ind.data_ptr = buffer; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - free(frame_buf); - return false; - } - - //Test buffer allocate fail - mac_mcps_sap_stub.pre_parsed = NULL; - nsdynmemlib_stub.returnCounter = 0; - phy_message.message.generic_data_ind.data_len = 32; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -3 ){ - free(frame_buf); - return false; - } - //Test first prosimus mode - mac_mcps_sap_stub.pre_parsed = frame_buf; - nsdynmemlib_stub.returnCounter = 2; - mac_header_helper_functions_stub.fcf = fcf; - mac_mcps_sap_stub.int8_value = -1; - rf_ptr.macProminousMode = true; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - free(frame_buf); - return false; - } - - mac_mcps_sap_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - //Test dropped data type (ACK) - rf_ptr.macProminousMode = false; - fcf.frametype = FC_ACK_FRAME; - mac_header_helper_functions_stub.fcf = fcf; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - //Test dropped data type (UN SUPPORTED) - rf_ptr.macProminousMode = false; - fcf.frametype = MAC_FCF_FRAME_TYPE_MASK; - mac_header_helper_functions_stub.fcf = fcf; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - //Test malformed message - fcf.frametype = FC_DATA_FRAME; - fcf.DstAddrMode = MAC_ADDR_MODE_16_BIT; - phy_message.message.generic_data_ind.data_len = 3; - mac_header_helper_functions_stub.fcf = fcf; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - phy_message.message.generic_data_ind.data_len = 32; - mac_header_helper_functions_stub.fcf = fcf; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - - //Test malformed security - fcf.DstAddrMode = MAC_ADDR_MODE_64_BIT; - fcf.SrcAddrMode = MAC_ADDR_MODE_64_BIT; - fcf.securityEnabled = true; - fcf.intraPan = true; - - mac_header_helper_functions_stub.fcf = fcf; - ptr += 3 + 10 + 8; - phy_message.message.generic_data_ind.data_len = 22; - *ptr = ((MAC_KEY_ID_MODE_IMPLICIT << 3 ) + 1); - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - phy_message.message.generic_data_ind.data_len = 22; - *ptr = ((MAC_KEY_ID_MODE_IDX << 3) + 2); - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - phy_message.message.generic_data_ind.data_len = 22; - *ptr = ((MAC_KEY_ID_MODE_SRC4_IDX << 3) + 3); - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - phy_message.message.generic_data_ind.data_len = 22; - *ptr = ((MAC_KEY_ID_MODE_SRC8_IDX << 3) + 4); - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - phy_message.message.generic_data_ind.data_len = 22; - *ptr = (0); - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - - fcf.DstAddrMode = MAC_ADDR_MODE_64_BIT; - fcf.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - - ptr += 3 + 10 + 2; - mac_header_helper_functions_stub.fcf = fcf; - - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - - fcf.DstAddrMode = MAC_ADDR_MODE_64_BIT; - fcf.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - fcf.intraPan = false; - ptr += 3 + 10 + 4; - mac_header_helper_functions_stub.fcf = fcf; - - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - - fcf.DstAddrMode = MAC_ADDR_MODE_16_BIT; - fcf.SrcAddrMode = MAC_ADDR_MODE_64_BIT; - ptr += 3 + 10 + 4; - fcf.intraPan = false; - mac_header_helper_functions_stub.fcf = fcf; - *ptr = (4); - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - fcf.DstAddrMode = MAC_ADDR_MODE_NONE; - fcf.SrcAddrMode = MAC_ADDR_MODE_NONE; - fcf.frametype = FC_BEACON_FRAME; - fcf.securityEnabled = false; - mac_header_helper_functions_stub.fcf = fcf; - //Test Beacon frame - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - fcf.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - fcf.frametype = FC_BEACON_FRAME; - fcf.securityEnabled = false; - mac_header_helper_functions_stub.fcf = fcf; - //Test Beacon frame - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - - //Test Command frame - fcf.DstAddrMode = MAC_ADDR_MODE_16_BIT; - fcf.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - fcf.frametype = FC_CMD_FRAME; - fcf.securityEnabled = false; - fcf.intraPan = true; - mac_header_helper_functions_stub.fcf = fcf; - ptr += 3 + 4 + 2; - *ptr = 1; - //Test payload length zero - phy_message.message.generic_data_ind.data_len = 9; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - phy_message.message.generic_data_ind.data_len = 10; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - //Test unsupported frame type - fcf.frametype = MAC_FCF_FRAME_TYPE_MASK; - mac_header_helper_functions_stub.fcf = fcf; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - //Test MAC15_4_PD_SAP_DATA_TX_CONFIRM - phy_message.id = MAC15_4_PD_SAP_DATA_TX_CONFIRM; - rf_ptr.macRfRadioTxActive = false; - phy_message.message.mac15_4_pd_sap_confirm.cca_retry = 1; - phy_message.message.mac15_4_pd_sap_confirm.tx_retry = 1; - phy_message.message.mac15_4_pd_sap_confirm.status = PHY_LINK_TX_SUCCESS; - - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - rf_ptr.macRfRadioTxActive = true; - rf_ptr.macTxProcessActive = true; - rf_ptr.macTxRequestAck = true; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = false; - rf_ptr.macTxRequestAck = false; - - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - rf_ptr.macRfRadioTxActive = true; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - - rf_ptr.macTxProcessActive = true; - phy_message.message.mac15_4_pd_sap_confirm.status = PHY_LINK_CCA_FAIL; - rf_ptr.macRfRadioTxActive = false; - rf_ptr.mac_cca_retry = 0; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != -1 ){ - return false; - } - - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = true; - rf_ptr.mac_cca_retry = 0; - - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - - if (rf_ptr.macRfRadioTxActive || !rf_ptr.macTxProcessActive) { - return false; - } - - rf_ptr.macRfRadioTxActive = true; - rf_ptr.mac_cca_retry = MAC_CCA_MAX; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - //Do 3 retry - - rf_ptr.mac_mlme_retry_max = 3; - rf_ptr.mac_tx_retry = 0; - phy_message.message.mac15_4_pd_sap_confirm.status = PHY_LINK_TX_FAIL; - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = true; - phy_message.message.mac15_4_pd_sap_confirm.tx_retry = 1; - phy_message.message.mac15_4_pd_sap_confirm.cca_retry = 1; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - if (rf_ptr.macRfRadioTxActive || !rf_ptr.macTxProcessActive) { - return false; - } - //Simulate last retry - rf_ptr.macRfRadioTxActive = true; - rf_ptr.macRfRadioTxActive = true; - rf_ptr.mac_tx_retry = 2; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - if (rf_ptr.macRfRadioTxActive || rf_ptr.macTxProcessActive) { - return false; - } - phy_message.message.mac15_4_pd_sap_confirm.status = PHY_LINK_TX_DONE; - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = true; - - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - if (rf_ptr.macRfRadioTxActive || rf_ptr.macTxProcessActive) { - return false; - } - - phy_message.message.mac15_4_pd_sap_confirm.status = PHY_LINK_TX_DONE_PENDING; - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = true; - - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if( ret != 0 ){ - return false; - } - if (rf_ptr.macRfRadioTxActive || rf_ptr.macTxProcessActive) { - return false; - } - - // FHSS TESTS START - mac_pre_build_frame_t temp_buf; - rf_ptr.active_pd_data_request = &temp_buf; - mac_mcps_sap_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - rf_ptr.fhss_api = ns_fhss_create(0, 0); - fcf.DstAddrMode = MAC_ADDR_MODE_NONE; - fcf.SrcAddrMode = MAC_ADDR_MODE_16_BIT; - fcf.frametype = FC_BEACON_FRAME; - fcf.securityEnabled = false; - mac_header_helper_functions_stub.fcf = fcf; - phy_message.id = MAC15_4_PD_SAP_DATA_IND; - phy_message.message.generic_data_ind.data_ptr = buffer; - // Test returning timestamp - fhss_mac_interface_stub.uint32_value = 1234567890; - ret = mac_pd_sap_data_cb(&rf_ptr, &phy_message); - if (ret != 0) { - return false; - } - if (mac_mcps_sap_stub.pre_parsed->timestamp != 1234567890){ - return false; - } - // Test TX confirm - phy_message.id = MAC15_4_PD_SAP_DATA_TX_CONFIRM; - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = true; - if (mac_pd_sap_data_cb(&rf_ptr, &phy_message) != 0) { - return false; - } - - rf_ptr.mac_mlme_retry_max = 3; - rf_ptr.mac_tx_retry = 0; - phy_message.message.mac15_4_pd_sap_confirm.status = PHY_LINK_TX_FAIL; - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = true; - phy_message.message.mac15_4_pd_sap_confirm.tx_retry = 1; - phy_message.message.mac15_4_pd_sap_confirm.cca_retry = 1; - if (mac_pd_sap_data_cb(&rf_ptr, &phy_message) != 0) { - return false; - } - - // Test TX done with FHSS - rf_ptr.fhss_api = ns_fhss_create(0, 0); - phy_message.id = MAC15_4_PD_SAP_DATA_TX_CONFIRM; - phy_message.message.mac15_4_pd_sap_confirm.status = PHY_LINK_TX_DONE; - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = true; - rf_ptr.mac_tx_result = MAC_TX_DONE; - if (mac_pd_sap_data_cb(&rf_ptr, &phy_message) != 0) { - return false; - } - - free(frame_buf); - return true; -} - -bool test_mac_pd_sap_state_machine() -{ - //Testing MAC timer event handler - protocol_interface_rf_mac_setup_s rf_ptr; - arm_device_driver_list_s driver; - mac_fcf_sequence_t fcf; - arm_phy_sap_msg_t phy_message; - phy_device_driver_s dev_driver; - - uint8_t tx_buffer[127]; - - memset(&rf_ptr, 0, sizeof(protocol_interface_rf_mac_setup_s)); - memset(&driver, 0, sizeof(arm_device_driver_list_s)); - memset(&dev_driver, 0, sizeof(phy_device_driver_s)); - memset(&phy_message, 0, sizeof(arm_phy_sap_msg_t)); - memset(&fcf, 0, sizeof(mac_fcf_sequence_t)); - - - rf_ptr.dev_driver_tx_buffer.buf = tx_buffer; - rf_ptr.dev_driver_tx_buffer.len = 100; - dev_driver.extension = &test_rf_extension; - dev_driver.tx = &test_rf_tx; - driver.phy_driver = &dev_driver; - rf_ptr.dev_driver = &driver; - - //Test CCA timer - - rf_ptr.macTxProcessActive = true; - rf_ptr.macUpState = true; - rf_ptr.mac_tx_result = MAC_TIMER_CCA; - - tx_return = -1; - mac_pd_sap_state_machine(&rf_ptr); - if (rf_ptr.macRfRadioTxActive ) { - return false; - } - - - rf_ptr.mac_tx_result = MAC_TIMER_CCA; - tx_return = 0; - mac_pd_sap_state_machine(&rf_ptr); - if (!rf_ptr.macRfRadioTxActive ) { - return false; - } - - //Test Virtual callback usecase - rf_ptr.mac_tx_result = MAC_TIMER_CCA; - rf_ptr.macTxProcessActive = true; - dev_driver.arm_net_virtual_tx_cb = &test_rf_virtual_tx; - tx_return = -1; - rf_ptr.macRfRadioTxActive = false; - mac_pd_sap_state_machine(&rf_ptr); - if (rf_ptr.macRfRadioTxActive && rf_ptr.macTxProcessActive) { - return false; - } - - tx_return = 0; - rf_ptr.mac_tx_result = MAC_TIMER_CCA; - rf_ptr.macTxProcessActive = true; - mac_pd_sap_state_machine(&rf_ptr); - if (!rf_ptr.macRfRadioTxActive || !rf_ptr.macTxProcessActive) { - return false; - } - - dev_driver.arm_net_virtual_tx_cb = NULL; - - //End of CCA timer - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = true; - rf_ptr.macUpState = true; - rf_ptr.mac_tx_result = MAC_TIMER_ACK; - rf_ptr.mac_mlme_retry_max = 3; - rf_ptr.mac_tx_retry = 0; - mac_pd_sap_state_machine(&rf_ptr); - - if (!rf_ptr.macTxProcessActive) { - return false; - } - - rf_ptr.macRfRadioTxActive = true; - rf_ptr.mac_tx_retry = 2; - mac_pd_sap_state_machine(&rf_ptr); - if (!rf_ptr.macTxProcessActive || rf_ptr.mac_tx_retry != 3) { - return false; - } - rf_ptr.macRfRadioTxActive = true; - mac_pd_sap_state_machine(&rf_ptr); - if (rf_ptr.macTxProcessActive ) { - return false; - } - - //Test Timeout - rf_ptr.mac_tx_result = MAC_TX_TIMEOUT; - rf_ptr.macTxProcessActive = true; - rf_ptr.macRfRadioTxActive = true; - rf_ptr.macUpState = true; - mac_pd_sap_state_machine(&rf_ptr); - if (rf_ptr.macTxProcessActive || rf_ptr.macRfRadioTxActive) { - return false; - } - - // FHSS TESTS START - mac_pre_build_frame_t temp_buf; - rf_ptr.fhss_api = ns_fhss_create(0, 0); - rf_ptr.mac_tx_result = MAC_TIMER_CCA; - rf_ptr.macTxProcessActive = true; - rf_ptr.active_pd_data_request = &temp_buf; - mac_pd_sap_state_machine(&rf_ptr); - if (rf_ptr.macRfRadioTxActive == false) { - return false; - } - - // Test TX handle fail - rf_ptr.mac_tx_result = MAC_TIMER_CCA; - fhss_mac_interface_stub.handle_value = -1; - mac_pd_sap_state_machine(&rf_ptr); - if (!rf_ptr.macRfRadioTxActive ) { - return false; - } - // Test synch frame - rf_ptr.mac_tx_result = MAC_TIMER_CCA; - fhss_mac_interface_stub.handle_value = 0; - rf_ptr.active_pd_data_request->fcf_dsn.frametype = FC_BEACON_FRAME; - mac_pd_sap_state_machine(&rf_ptr); - if (!rf_ptr.macRfRadioTxActive ) { - return false; - } - // Test without active request - rf_ptr.mac_tx_result = MAC_TIMER_CCA; - rf_ptr.active_pd_data_request = NULL; - mac_pd_sap_state_machine(&rf_ptr); - - return true; -} diff --git a/test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.h b/test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.h deleted file mode 100644 index 02f96d0ac6a1..000000000000 --- a/test/nanostack/unittest/mac/mac_pd_sap/test_mac_pd_sap.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_PD_SAP_H -#define TEST_MAC_PD_SAP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_pd_sap_req(); - -bool test_mac_pd_sap_rf_low_level_function_set(); - -bool test_mac_pd_sap_data_cb(); - -bool test_mac_pd_sap_state_machine(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_PD_SAP_H - diff --git a/test/nanostack/unittest/mac/mac_security_mib/Makefile b/test/nanostack/unittest/mac/mac_security_mib/Makefile deleted file mode 100644 index 5386bf17abff..000000000000 --- a/test/nanostack/unittest/mac/mac_security_mib/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_security_mib_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/mac_security_mib.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_security_mibtest.cpp \ - test_mac_security_mib.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/mac_security_mib/mac_security_mibtest.cpp b/test/nanostack/unittest/mac/mac_security_mib/mac_security_mibtest.cpp deleted file mode 100644 index 62af5e9f4e75..000000000000 --- a/test/nanostack/unittest/mac/mac_security_mib/mac_security_mibtest.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_security_mib.h" - -TEST_GROUP(mac_security_mib) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_security_mib, test_mac_sec_mib_init) -{ - CHECK(test_mac_sec_mib_init()); -} - -TEST(mac_security_mib, test_mac_sec_mib_deinit) -{ - CHECK(test_mac_sec_mib_deinit()); -} - -TEST(mac_security_mib, test_mac_sec_mib_device_description_set) -{ - CHECK(test_mac_sec_mib_device_description_set()); -} - -TEST(mac_security_mib, test_mac_sec_mib_key_description_set) -{ - CHECK(test_mac_sec_mib_key_description_set()); -} - -TEST(mac_security_mib, test_mac_sec_mib_device_description_get_attribute_index) -{ - CHECK(test_mac_sec_mib_device_description_get_attribute_index()); -} - -TEST(mac_security_mib, test_mac_sec_mib_device_description_get) -{ - CHECK(test_mac_sec_mib_device_description_get()); -} - -TEST(mac_security_mib, test_mac_mib_device_descption_attribute_get_by_descriptor) -{ - CHECK(test_mac_mib_device_descption_attribute_get_by_descriptor()); -} - -TEST(mac_security_mib, test_mac_sec_key_description_get) -{ - CHECK(test_mac_sec_key_description_get()); -} - -TEST(mac_security_mib, test_mac_sec_mib_key_device_description_list_update) -{ - CHECK(test_mac_sec_mib_key_device_description_list_update()); -} - -TEST(mac_security_mib, test_mac_sec_mib_key_device_description_discover_from_list) -{ - CHECK(test_mac_sec_mib_key_device_description_discover_from_list()); -} - -TEST(mac_security_mib, test_mac_sec_mib_device_description_blacklist) -{ - CHECK(test_mac_sec_mib_device_description_blacklist()); -} - diff --git a/test/nanostack/unittest/mac/mac_security_mib/main.cpp b/test/nanostack/unittest/mac/mac_security_mib/main.cpp deleted file mode 100644 index 7af8142d535e..000000000000 --- a/test/nanostack/unittest/mac/mac_security_mib/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_security_mib); - diff --git a/test/nanostack/unittest/mac/mac_security_mib/test_mac_security_mib.c b/test/nanostack/unittest/mac/mac_security_mib/test_mac_security_mib.c deleted file mode 100644 index 6c19785623dd..000000000000 --- a/test/nanostack/unittest/mac/mac_security_mib/test_mac_security_mib.c +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "mac_api.h" -#include "test_mac_security_mib.h" -#include -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/IEEE802_15_4/mac_security_mib.h" -#include "MAC/rf_driver_storage.h" - -#include "nsdynmemLIB_stub.h" -#include "common_functions_stub.h" - -bool test_mac_sec_mib_init() -{ - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - int8_t ret = mac_sec_mib_init(NULL, &storage_sizes); - if( ret != -1 ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - ret = mac_sec_mib_init(NULL, &storage_sizes); - if( ret != -1 ){ - return false; - } - - ret = mac_sec_mib_init(&setup, &storage_sizes); - if( ret != -1 ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - ret = mac_sec_mib_init(&setup, &storage_sizes); - if( ret != -1 ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - ret = mac_sec_mib_init(&setup, &storage_sizes); - if( ret != -1 ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 3; - ret = mac_sec_mib_init(&setup, &storage_sizes); - if( ret != -1 ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 4; - ret = mac_sec_mib_init(&setup, &storage_sizes); - if( ret != -1 ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 5; - ret = mac_sec_mib_init(&setup, &storage_sizes); - if( ret != 0 ){ - return false; - } - - mac_sec_mib_deinit(&setup); - - return true; -} - -bool test_mac_sec_mib_deinit() -{ - mac_sec_mib_deinit(NULL); - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - nsdynmemlib_stub.returnCounter = 5; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - mac_sec_mib_init(&setup, &storage_sizes); - mac_sec_mib_deinit(&setup); - - return true; -} - -bool test_mac_sec_mib_device_description_set() -{ - if( -1 != mac_sec_mib_device_description_set(0, NULL, NULL) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_device_descriptor_t desc; - memset(&desc, 0, sizeof(mlme_device_descriptor_t)); - desc.ExtAddress[0] = 1; - - nsdynmemlib_stub.returnCounter = 5; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - mac_sec_mib_init(&setup, &storage_sizes); - - if( 0 != mac_sec_mib_device_description_set(0, &desc, &setup) ){ - return false; - } - - mlme_device_descriptor_t desc2; - memset(&desc2, 0, sizeof(mlme_device_descriptor_t)); - desc2.ExtAddress[0] = 2; - - if( 0 != mac_sec_mib_device_description_set(1, &desc2, &setup) ){ - return false; - } - - mlme_device_descriptor_t desc3; - memset(&desc3, 0, sizeof(mlme_device_descriptor_t)); - desc3.ExtAddress[0] = 3; - - if( 0 != mac_sec_mib_device_description_set(2, &desc3, &setup) ){ - return false; - } - - mlme_device_descriptor_t desc4; - memset(&desc4, 0, sizeof(mlme_device_descriptor_t)); - desc4.ExtAddress[0] = 4; - - mlme_key_descriptor_t *key_ptr = setup.key_description_table; - key_ptr->KeyDeviceListEntries = 3; - key_ptr->KeyDeviceList[0].DeviceDescriptorHandle = 0; - key_ptr->KeyDeviceList[1].DeviceDescriptorHandle = 1; - key_ptr->KeyDeviceList[2].DeviceDescriptorHandle = 2; - - if( 0 != mac_sec_mib_device_description_set(1, &desc4, &setup) ){ - return false; - } - - mac_sec_mib_deinit(&setup); - - return true; -} - -bool test_mac_sec_mib_key_description_set() -{ - if( -1 != mac_sec_mib_key_description_set(0, NULL, NULL) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_key_descriptor_entry_t kdesc; - memset(&kdesc, 0, sizeof(mlme_key_descriptor_entry_t)); - - nsdynmemlib_stub.returnCounter = 5; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - mac_sec_mib_init(&setup, &storage_sizes); - - kdesc.KeyDeviceList = NULL; - kdesc.KeyDeviceListEntries = 1; - if( -1 != mac_sec_mib_key_description_set(0, &kdesc, &setup) ){ - return false; - } - - kdesc.KeyDeviceListEntries = 0; - kdesc.KeyIdLookupList = NULL; - kdesc.KeyIdLookupListEntries = 1; - if( -1 != mac_sec_mib_key_description_set(0, &kdesc, &setup) ){ - return false; - } - - kdesc.KeyIdLookupListEntries = 0; - kdesc.KeyUsageList = NULL; - kdesc.KeyUsageListEntries = 1; - if( -1 != mac_sec_mib_key_description_set(0, &kdesc, &setup) ){ - return false; - } - kdesc.KeyUsageListEntries = 0; - - mac_sec_mib_deinit(&setup); - nsdynmemlib_stub.returnCounter = 5; - mac_sec_mib_init(&setup, &storage_sizes); - - mlme_key_device_descriptor_t desc; - kdesc.KeyDeviceList = &desc; - kdesc.KeyDeviceListEntries = 1; - - kdesc.KeyIdLookupListEntries = 1; - mlme_key_id_lookup_descriptor_t list; - kdesc.KeyIdLookupList = &list; - - kdesc.KeyUsageListEntries = 1; - mlme_key_usage_descriptor_t usage; - kdesc.KeyUsageList = &usage; - - if( 0 != mac_sec_mib_key_description_set(0, &kdesc, &setup) ){ - return false; - } - - mac_sec_mib_deinit(&setup); - - return true; -} - -bool test_mac_sec_mib_device_description_get_attribute_index() -{ - if( mac_sec_mib_device_description_get_attribute_index(NULL, 0) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - - nsdynmemlib_stub.returnCounter = 5; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - mac_sec_mib_init(&setup, &storage_sizes); - - if( !mac_sec_mib_device_description_get_attribute_index(&setup, 0) ){ - return false; - } - - mac_sec_mib_deinit(&setup); - - return true; -} - -bool test_mac_sec_mib_device_description_get() -{ - if( mac_sec_mib_device_description_get(NULL, NULL, 0) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - - uint8_t mac16[2]; - if( mac_sec_mib_device_description_get(&setup, &mac16, MAC_ADDR_MODE_16_BIT) ){ - return false; - } - - uint8_t mac64[8]; - if( mac_sec_mib_device_description_get(&setup, &mac64, MAC_ADDR_MODE_64_BIT) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 5; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - mac_sec_mib_init(&setup, &storage_sizes); - - mac16[0] = 0; - mac16[1] = 0; - if( mac_sec_mib_device_description_get(&setup, &mac16, MAC_ADDR_MODE_16_BIT) ){ - return false; - } - - if( mac_sec_mib_device_description_get(&setup, &mac64, MAC_ADDR_MODE_64_BIT) ){ - return false; - } - - mlme_device_descriptor_t *device_table = setup.device_description_table; - device_table++; - device_table->ShortAddress = 16; - common_functions_stub.uint16_value = 16; - if( !mac_sec_mib_device_description_get(&setup, &mac16, MAC_ADDR_MODE_16_BIT) ){ - return false; - } - common_functions_stub.uint16_value = 0; - - memset(&device_table->ExtAddress, 1, 8); - memset(&mac64, 1, 8); - if( !mac_sec_mib_device_description_get(&setup, &mac64, MAC_ADDR_MODE_64_BIT) ){ - return false; - } - - mac_sec_mib_deinit(&setup); - - return true; -} - -bool test_mac_mib_device_descption_attribute_get_by_descriptor() -{ - uint8_t ret = mac_mib_device_descption_attribute_get_by_descriptor(NULL, NULL); - if( 0xff != ret ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_device_descriptor_t desc; - - ret = mac_mib_device_descption_attribute_get_by_descriptor(&setup, &desc); - if( 0xff != ret ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 5; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - mac_sec_mib_init(&setup, &storage_sizes); - - mlme_device_descriptor_t *device_table = setup.device_description_table; - device_table->ShortAddress = 13; - device_table++; - - ret = mac_mib_device_descption_attribute_get_by_descriptor(&setup, device_table); - if( 1 != ret ){ - return false; - } - - mac_sec_mib_deinit(&setup); - - return true; -} - -bool test_mac_sec_key_description_get() -{ - uint8_t address[8]; - uint16_t pan_id = 0xface; - memset(address, 0, 8); - if( mac_sec_key_description_get(NULL, NULL, MAC_ADDR_MODE_16_BIT,address, pan_id) ){ - return false; - } - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_security_t sec; - memset(&sec, 0, sizeof(mlme_security_t)); - sec.KeyIdMode = MAC_KEY_ID_MODE_IMPLICIT; - - //64 MAC_ADDR_MODE_64_BIT - if( mac_sec_key_description_get(&setup, &sec, MAC_ADDR_MODE_64_BIT, address, pan_id ) ){ - return false; - } - - //MAC_ADDR_MODE_16_BIT - if( mac_sec_key_description_get(&setup, &sec,MAC_ADDR_MODE_16_BIT,address, pan_id ) ){ - return false; - } - - //MAC_ADDR_MODE_NONE - if( mac_sec_key_description_get(&setup, &sec, MAC_ADDR_MODE_NONE, address, pan_id ) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 5; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 6; - storage_sizes.key_lookup_size = 2; //Test multiple lookup - storage_sizes.key_usage_size = 3; - mac_sec_mib_init(&setup, &storage_sizes); - - sec.KeyIdMode = MAC_KEY_ID_MODE_IDX; - if( mac_sec_key_description_get(&setup, &sec, MAC_ADDR_MODE_16_BIT,address, pan_id) ){ - return false; - } - - mlme_key_descriptor_t *key_description = setup.key_description_table; - key_description->KeyIdLookupListEntries = 2; - - key_description->KeyIdLookupList[0].LookupDataSize = 0; - memset(&key_description->KeyIdLookupList[0].LookupData, 0, 9); - key_description->KeyIdLookupList[0].LookupData[4] = 7; - - key_description->KeyIdLookupList[1].LookupDataSize = 1; - memset(&key_description->KeyIdLookupList[1].LookupData, 0, 9); - key_description->KeyIdLookupList[1].LookupData[8] = 7; - - sec.KeyIndex = 7; - - sec.KeyIdMode = MAC_KEY_ID_MODE_SRC4_IDX; - if( !mac_sec_key_description_get(&setup, &sec, MAC_ADDR_MODE_16_BIT,address, pan_id) ){ - return false; - } - - sec.KeyIndex = 7; - sec.KeyIdMode = MAC_KEY_ID_MODE_SRC8_IDX; - if( !mac_sec_key_description_get(&setup, &sec, MAC_ADDR_MODE_16_BIT,address, pan_id) ){ - return false; - } - - mac_sec_mib_deinit(&setup); - - return true; -} - -bool test_mac_sec_mib_key_device_description_list_update() -{ - if( mac_sec_mib_key_device_description_list_update(NULL) ){ - return false; - } - mlme_key_descriptor_t desc; - mlme_key_device_descriptor_t deviceList[2]; - memset(&desc, 0, sizeof(mlme_key_descriptor_t)); - memset(&deviceList, 0, sizeof(mlme_key_device_descriptor_t) *2); - desc.KeyDeviceList = &deviceList; - desc.KeyDeviceListSize = 2; - if( !mac_sec_mib_key_device_description_list_update(&desc) || - 1 != desc.KeyDeviceListEntries ){ - return false; - } - - if( !mac_sec_mib_key_device_description_list_update(&desc) || - 2 != desc.KeyDeviceListEntries ){ - return false; - } - - - return true; -} - -bool test_mac_sec_mib_key_device_description_discover_from_list() -{ - if( mac_sec_mib_key_device_description_discover_from_list(NULL, 0)){ - return false; - } - mlme_key_descriptor_t desc; - memset(&desc, 0, sizeof(mlme_key_descriptor_t)); - mlme_key_device_descriptor_t keydevicelist[2]; - memset(&keydevicelist, 0, sizeof(mlme_key_device_descriptor_t) *2); - - keydevicelist[0].DeviceDescriptorHandle = 8; - keydevicelist[1].DeviceDescriptorHandle = 34; - desc.KeyDeviceList = &keydevicelist; - desc.KeyDeviceListEntries = 2; - - if( !mac_sec_mib_key_device_description_discover_from_list(&desc, 34)){ - return false; - } - - return true; -} - -bool test_mac_sec_mib_device_description_blacklist() -{ - mac_sec_mib_device_description_blacklist(NULL, 0); - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mlme_key_descriptor_t desc; - memset(&desc, 0, sizeof(mlme_key_descriptor_t)); - mlme_key_device_descriptor_t deviceList[2]; - deviceList[0].DeviceDescriptorHandle = 8; - deviceList[1].DeviceDescriptorHandle = 34; - desc.KeyDeviceList = &deviceList; - desc.KeyDeviceListEntries = 2; - setup.key_description_table = &desc; - setup.key_description_table_size = 2; - - mac_sec_mib_device_description_blacklist(&setup, 34); - if( !deviceList[1].Blacklisted ){ - return false; - } - - return true; -} - diff --git a/test/nanostack/unittest/mac/mac_security_mib/test_mac_security_mib.h b/test/nanostack/unittest/mac/mac_security_mib/test_mac_security_mib.h deleted file mode 100644 index 802e2c8ea7f9..000000000000 --- a/test/nanostack/unittest/mac/mac_security_mib/test_mac_security_mib.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_SECURITY_MIB_H -#define TEST_MAC_SECURITY_MIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mac_sec_mib_init(); - -bool test_mac_sec_mib_deinit(); - -bool test_mac_sec_mib_device_description_set(); - -bool test_mac_sec_mib_key_description_set(); - -bool test_mac_sec_mib_device_description_get_attribute_index(); - -bool test_mac_sec_mib_device_description_get(); - -bool test_mac_mib_device_descption_attribute_get_by_descriptor(); - -bool test_mac_sec_key_description_get(); - -bool test_mac_sec_mib_key_device_description_list_update(); - -bool test_mac_sec_mib_key_device_description_discover_from_list(); - -bool test_mac_sec_mib_device_description_blacklist(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_SECURITY_MIB_H - diff --git a/test/nanostack/unittest/mac/mac_timer/Makefile b/test/nanostack/unittest/mac/mac_timer/Makefile deleted file mode 100644 index 5712fb02efdd..000000000000 --- a/test/nanostack/unittest/mac/mac_timer/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mac_timer_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/mac_timer.c - -TEST_SRC_FILES = \ - main.cpp \ - mac_timertest.cpp \ - test_mac_timer.c \ - ../../stub/event_stub.c \ - ../../stub/ns_timer_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/sw_mac_stub.c \ - ../../stub/mac_pd_sap_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/mac_timer/mac_timertest.cpp b/test/nanostack/unittest/mac/mac_timer/mac_timertest.cpp deleted file mode 100644 index 5166ae78cfe3..000000000000 --- a/test/nanostack/unittest/mac/mac_timer/mac_timertest.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mac_timer.h" - -TEST_GROUP(mac_timer) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mac_timer, test_timer_mac_start) -{ - CHECK(test_timer_mac_start()); -} - -TEST(mac_timer, test_timer_mac_stop) -{ - CHECK(test_timer_mac_stop()); -} - -TEST(mac_timer, test_timer_mac_interrupt) -{ - CHECK(test_timer_mac_interrupt()); -} - diff --git a/test/nanostack/unittest/mac/mac_timer/main.cpp b/test/nanostack/unittest/mac/mac_timer/main.cpp deleted file mode 100644 index 1fc6fca1e817..000000000000 --- a/test/nanostack/unittest/mac/mac_timer/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mac_timer); - diff --git a/test/nanostack/unittest/mac/mac_timer/test_mac_timer.c b/test/nanostack/unittest/mac/mac_timer/test_mac_timer.c deleted file mode 100644 index 6548912f044a..000000000000 --- a/test/nanostack/unittest/mac/mac_timer/test_mac_timer.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_mac_timer.h" -#include -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "sw_mac_stub.h" - -bool test_timer_mac_start() -{ - protocol_interface_rf_mac_setup_s mac; - mac.mac_timer_id = 1; - mac_event_t ev; - timer_mac_start(&mac, ev, 0); - return true; -} - -bool test_timer_mac_stop() -{ - protocol_interface_rf_mac_setup_s mac; - mac.mac_timer_id = 1; - timer_mac_stop(&mac); - return true; -} - -bool test_timer_mac_interrupt() -{ - timer_mac_interrupt(0, 0); - protocol_interface_rf_mac_setup_s rf_mac_setup; - sw_mac_stub.rf_mac_ptr = &rf_mac_setup; - timer_mac_interrupt(0, 0); - - return true; -} diff --git a/test/nanostack/unittest/mac/mac_timer/test_mac_timer.h b/test/nanostack/unittest/mac/mac_timer/test_mac_timer.h deleted file mode 100644 index 8476303b6229..000000000000 --- a/test/nanostack/unittest/mac/mac_timer/test_mac_timer.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MAC_TIMER_H -#define TEST_MAC_TIMER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_timer_mac_start(); - -bool test_timer_mac_stop(); - -bool test_timer_mac_interrupt(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MAC_TIMER_H - diff --git a/test/nanostack/unittest/mac/rf_driver_storage/Makefile b/test/nanostack/unittest/mac/rf_driver_storage/Makefile deleted file mode 100644 index 75beb53d4957..000000000000 --- a/test/nanostack/unittest/mac/rf_driver_storage/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = rf_driver_storage_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/rf_driver_storage.c - -TEST_SRC_FILES = \ - main.cpp \ - rf_driver_storagetest.cpp \ - test_rf_driver_storage.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/protocol_tun_driver_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/randLIB_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_LOCAL_SOCKET - diff --git a/test/nanostack/unittest/mac/rf_driver_storage/main.cpp b/test/nanostack/unittest/mac/rf_driver_storage/main.cpp deleted file mode 100644 index e545d0003074..000000000000 --- a/test/nanostack/unittest/mac/rf_driver_storage/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(rf_driver_storage); - diff --git a/test/nanostack/unittest/mac/rf_driver_storage/rf_driver_storagetest.cpp b/test/nanostack/unittest/mac/rf_driver_storage/rf_driver_storagetest.cpp deleted file mode 100644 index 62154d1ee5e1..000000000000 --- a/test/nanostack/unittest/mac/rf_driver_storage/rf_driver_storagetest.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_rf_driver_storage.h" - -TEST_GROUP(rf_driver_storage) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(rf_driver_storage, test_arm_net_phy_register) -{ - CHECK(test_arm_net_phy_register()); -} - -TEST(rf_driver_storage, test_arm_net_phy_init) -{ - CHECK(test_arm_net_phy_init()); -} - -TEST(rf_driver_storage, test_arm_net_phy_driver_pointer) -{ - CHECK(test_arm_net_phy_driver_pointer()); -} - -//TEST(rf_driver_storage, test_dev_get_phy_datarate) -//{ -// CHECK(test_dev_get_phy_datarate()); -//} - -TEST(rf_driver_storage, test_arm_net_phy_mac64_set) -{ - CHECK(test_arm_net_phy_mac64_set()); -} - -TEST(rf_driver_storage, test_arm_net_phy_mac64_get) -{ - CHECK(test_arm_net_phy_mac64_get()); -} - -TEST(rf_driver_storage, test_arm_net_phy_rf_type) -{ - CHECK(test_arm_net_phy_rf_type()); -} - -TEST(rf_driver_storage, test_arm_net_phy_mtu_size) -{ - CHECK(test_arm_net_phy_mtu_size()); -} - -TEST(rf_driver_storage, test_arm_net_observer_cb_set) -{ - CHECK(test_arm_net_observer_cb_set()); -} - - diff --git a/test/nanostack/unittest/mac/rf_driver_storage/test_rf_driver_storage.c b/test/nanostack/unittest/mac/rf_driver_storage/test_rf_driver_storage.c deleted file mode 100644 index 642c7c712039..000000000000 --- a/test/nanostack/unittest/mac/rf_driver_storage/test_rf_driver_storage.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_rf_driver_storage.h" -#include -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "protocol_tun_driver_stub.h" -#include "nsdynmemLIB_stub.h" - -typedef struct { - phy_device_driver_s *drv; - ns_list_link_t link; -} test_s; - -static NS_LIST_DEFINE(test_list, test_s, link); - -int8_t test_control(phy_interface_state_e a, uint8_t b){ - return 1; -} - -bool test_arm_net_phy_register() -{ - int8_t ret = arm_net_phy_register(NULL); - if( ret != -1 ){ - return false; - } - - phy_device_driver_s driver; - - driver.link_type = PHY_LINK_15_4_2_4GHZ_TYPE; - driver.phy_channel_pages = NULL; - ret = arm_net_phy_register(&driver); - if( ret != -1 ){ - return false; - } - - - phy_device_channel_page_s phy_channel_pages; - phy_rf_channel_configuration_s rf_channel_configuration; - memset(&rf_channel_configuration, 0, sizeof(phy_rf_channel_configuration_s)); - - driver.phy_channel_pages = &phy_channel_pages; - phy_channel_pages.rf_channel_configuration = NULL; - ret = arm_net_phy_register(&driver); - if( ret != -1 ){ - return false; - } - - phy_channel_pages.rf_channel_configuration = &rf_channel_configuration; - - - protocol_tun_driver_stub.int8_value = -1; - ret = arm_net_phy_register(&driver); - if( ret != -2 ){ - return false; - } - - protocol_tun_driver_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - - driver.state_control = &test_control; - protocol_tun_driver_stub.int8_value = 0; - ret = arm_net_phy_register(&driver); - if( ret != 0 ){ - return false; - } - - //Test re-register - ret = arm_net_phy_register(&driver); - if( ret != -1 ){ - return false; - } - - arm_net_phy_unregister(0); - - //test Id's run out scenario (quite useless test) - for (int16_t id = 0; id <= INT8_MAX+1; id++) { - nsdynmemlib_stub.returnCounter = 1; - test_s *test = ns_dyn_mem_alloc(sizeof(test_s)); - memset(test, 0, sizeof(test_s)); - nsdynmemlib_stub.returnCounter = 1; - phy_device_driver_s *drv = ns_dyn_mem_alloc(sizeof(phy_device_driver_s)); - memset(drv, 0, sizeof(phy_device_driver_s)); - drv->state_control = NULL; - drv->phy_MTU = id; - test->drv = drv; - ns_list_add_to_end(&test_list, test); - - nsdynmemlib_stub.returnCounter = 1; - ret = arm_net_phy_register(drv); - if( id <= INT8_MAX && id != ret ){ - return false; - } - } - if( ret != -1 ){ - return false; - } - - for (int16_t id = 0; id <= INT8_MAX; id++) { - arm_net_phy_unregister(id); - } - arm_net_phy_unregister(-1); - - ns_list_foreach_safe(test_s, d, &test_list){ - ns_list_remove(&test_list, d); - ns_dyn_mem_free(d->drv); - ns_dyn_mem_free(d); - d = NULL; - } - - - return true; -} - -bool test_arm_net_phy_init() -{ - int8_t ret = arm_net_phy_init(NULL, NULL, NULL); - if( -1 != ret ){ - return false; - } - phy_device_driver_s drv; - ret = arm_net_phy_init(&drv, NULL, NULL); - if( 0 != ret ){ - return false; - } - return true; -} - -bool test_arm_net_phy_driver_pointer() -{ - arm_device_driver_list_s *list = arm_net_phy_driver_pointer(0); - if( list != NULL ){ - return false; - } - return true; -} - -//bool test_dev_get_phy_datarate() -//{ -// protocol_interface_rf_mac_setup_s cur; -// arm_device_driver_list_s list; -// cur.dev_driver = &list; -// phy_device_driver_s drv; -// cur.dev_driver->phy_driver = &drv; -// phy_device_channel_page_s page[] = {{CHANNEL_PAGE_0, NULL}}; -// cur.dev_driver->phy_driver->phy_channel_pages = &page; -// uint8_t ret = dev_get_phy_datarate(&cur); -// if( 0 != ret ) { -// return false; -// } - -// const phy_rf_channel_configuration_s test_conf = {1, 2, 3, 4, M_UNDEFINED}; -// phy_device_channel_page_s page2[] = {{CHANNEL_PAGE_2, &test_conf}, {CHANNEL_PAGE_6, &test_conf}}; -// cur.dev_driver->phy_driver->phy_channel_pages = &page2; -// cur.mac_channel_list.channel_page = CHANNEL_PAGE_6; - -// ret = dev_get_phy_datarate(&cur); -// if( 3 != ret ) { -// return false; -// } - -// return true; -//} - -bool test_arm_net_phy_mac64_set() -{ - if( -1 != arm_net_phy_mac64_set(NULL, 0) ){ - return false; - } - phy_device_driver_s driver; - uint8_t mac[8]; - driver.PHY_MAC = &mac; - protocol_tun_driver_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - - driver.state_control = &test_control; - protocol_tun_driver_stub.int8_value = 0; - int8_t ret = arm_net_phy_register(&driver); - if( ret != 0 ){ - return false; - } - if( 0 != arm_net_phy_mac64_set(&mac, 0) ){ - return false; - } - - arm_net_phy_unregister(0); - - return true; -} - -bool test_arm_net_phy_mac64_get() -{ - if( arm_net_phy_mac64_get(0) ){ - return false; - } - phy_device_driver_s driver; - protocol_tun_driver_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - - driver.state_control = &test_control; - protocol_tun_driver_stub.int8_value = 0; - int8_t ret = arm_net_phy_register(&driver); - if( ret != 0 ){ - return false; - } - if( !arm_net_phy_mac64_get(0) ){ - return false; - } - - arm_net_phy_unregister(0); - - return true; -} - -bool test_arm_net_phy_rf_type() -{ - if( -1 != arm_net_phy_rf_type(0) ){ - return false; - } - phy_device_driver_s driver; - driver.link_type = PHY_LINK_15_4_2_4GHZ_TYPE; - phy_device_channel_page_s phy_channel_pages; - phy_rf_channel_configuration_s rf_channel_configuration; - memset(&rf_channel_configuration, 0, sizeof(phy_rf_channel_configuration_s)); - phy_channel_pages.rf_channel_configuration = &rf_channel_configuration; - driver.phy_channel_pages = &phy_channel_pages; - - protocol_tun_driver_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - - driver.state_control = &test_control; - protocol_tun_driver_stub.int8_value = 0; - int8_t ret = arm_net_phy_register(&driver); - if( ret != 0 ){ - return false; - } - if( PHY_LINK_15_4_2_4GHZ_TYPE != arm_net_phy_rf_type(0) ){ - return false; - } - - arm_net_phy_unregister(0); - - return true; -} -#define MLE_RAND_LOW 0x7333 // 1 - 0.1; minimum for "1+RAND" -#define MLE_RAND_HIGH 0x8CCD // 1 + 0.1; maximum for "1+RAND" -bool test_arm_net_phy_mtu_size() -{ - if( 0 != arm_net_phy_mtu_size(0) ){ - return false; - } - phy_device_driver_s driver; - driver.phy_MTU = 7; - protocol_tun_driver_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - - driver.state_control = &test_control; - protocol_tun_driver_stub.int8_value = 0; - int8_t ret = arm_net_phy_register(&driver); - if( ret != 0 ){ - return false; - } - if( 7 != arm_net_phy_mtu_size(0) ){ - return false; - } - - arm_net_phy_unregister(0); - - return true; -} - -static void teset_mib_observer(const mlme_set_t * set_req) -{ - -} - -bool test_arm_net_observer_cb_set() -{ - phy_device_driver_s driver; - protocol_tun_driver_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - - driver.state_control = &test_control; - protocol_tun_driver_stub.int8_value = 0; - arm_net_phy_register(&driver); - - - arm_net_observer_cb_set(1, teset_mib_observer); - - arm_net_observer_cb_set(0, teset_mib_observer); - - arm_net_phy_unregister(0); - - return true; -} diff --git a/test/nanostack/unittest/mac/rf_driver_storage/test_rf_driver_storage.h b/test/nanostack/unittest/mac/rf_driver_storage/test_rf_driver_storage.h deleted file mode 100644 index 7a0176913864..000000000000 --- a/test/nanostack/unittest/mac/rf_driver_storage/test_rf_driver_storage.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_RF_DRIVER_STORAGE_H -#define TEST_RF_DRIVER_STORAGE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_arm_net_phy_register(); - -bool test_arm_net_phy_init(); - -bool test_arm_net_phy_driver_pointer(); - -//bool test_dev_get_phy_datarate(); - -bool test_arm_net_phy_mac64_set(); - -bool test_arm_net_phy_mac64_get(); - -bool test_arm_net_phy_rf_type(); - -bool test_arm_net_phy_mtu_size(); - -bool test_arm_net_observer_cb_set(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_RF_DRIVER_STORAGE_H - diff --git a/test/nanostack/unittest/mac/serial_mac_api/Makefile b/test/nanostack/unittest/mac/serial_mac_api/Makefile deleted file mode 100644 index 5a17b2a7e9fa..000000000000 --- a/test/nanostack/unittest/mac/serial_mac_api/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = serial_mac_api_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/serial/serial_mac_api.c - -TEST_SRC_FILES = \ - main.cpp \ - serial_mac_apitest.cpp \ - test_serial_mac_api.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/event_stub.c \ - ../../stub/rf_driver_storage_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/serial_mac_api/main.cpp b/test/nanostack/unittest/mac/serial_mac_api/main.cpp deleted file mode 100644 index 3627c4bb80b0..000000000000 --- a/test/nanostack/unittest/mac/serial_mac_api/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(serial_mac_api); - diff --git a/test/nanostack/unittest/mac/serial_mac_api/serial_mac_apitest.cpp b/test/nanostack/unittest/mac/serial_mac_api/serial_mac_apitest.cpp deleted file mode 100644 index 8eb40c88e6db..000000000000 --- a/test/nanostack/unittest/mac/serial_mac_api/serial_mac_apitest.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_serial_mac_api.h" - -TEST_GROUP(serial_mac_api) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(serial_mac_api, test_serial_mac_create) -{ - CHECK(test_serial_mac_create()); -} - -TEST(serial_mac_api, test_data_request) -{ - CHECK(test_data_request()); -} - -TEST(serial_mac_api, test_data_indication) -{ - CHECK(test_data_indication()); -} - -TEST(serial_mac_api, test_serial_mac_api_initialize) -{ - CHECK(test_serial_mac_api_initialize()); -} - -TEST(serial_mac_api, test_serial_mac_virtual_initialize) -{ - CHECK(test_serial_mac_virtual_initialize()); -} - -TEST(serial_mac_api, test_serial_mac_net_phy_rx) -{ - CHECK(test_serial_mac_net_phy_rx()); -} - -TEST(serial_mac_api, test_serial_mac_net_phy_tx_done) -{ - CHECK(test_serial_mac_net_phy_tx_done()); -} - -TEST(serial_mac_api, test_serial_mac_virtual_data_request) -{ - CHECK(test_serial_mac_virtual_data_request()); -} diff --git a/test/nanostack/unittest/mac/serial_mac_api/test_serial_mac_api.c b/test/nanostack/unittest/mac/serial_mac_api/test_serial_mac_api.c deleted file mode 100644 index 1abe42d1c8f7..000000000000 --- a/test/nanostack/unittest/mac/serial_mac_api/test_serial_mac_api.c +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "test_serial_mac_api.h" -#include -#include "serial_mac_api.h" -#include "eventOS_event.h" - -#include "rf_driver_storage_stub.h" -#include "nsdynmemLIB_stub.h" -#include "event_stub.h" - -bool visited = false; -int8_t tx_value = 0; - -int8_t tx_cb(uint8_t *a, uint16_t b, uint8_t c, data_protocol_e d) -{ - return tx_value; -} - -void data_ind_cb(const serial_mac_api_t *api, const uint8_t *data_ptr, uint16_t data_length) -{ - visited = true; -} - -int8_t virt_rx_cb(const uint8_t *data_ptr, uint16_t data_len,int8_t driver_id) -{ - visited = true; - return 0; -} - -bool test_serial_mac_create() -{ - rf_driver_storage_stub.list_value = NULL; - if( serial_mac_create(0) ){ - return false; - } - - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - rf_driver_storage_stub.list_value = &list; - if( serial_mac_create(0) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - serial_mac_api_t *ret = serial_mac_create(0); - if( !ret ){ - return false; - } - - if( event_stub.func_ptr ){ - arm_event_s ev; - ev.event_type = 100; - event_stub.func_ptr(&ev); - } - - ns_dyn_mem_free(ret); - - return true; -} - -bool test_data_request() -{ - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - drv.tx = &tx_cb; - rf_driver_storage_stub.list_value = &list; - nsdynmemlib_stub.returnCounter = 1; - serial_mac_api_t *api = serial_mac_create(0); - - if( -1 != api->data_request_cb(NULL, NULL, 0) ){ - return false; - } - - if( -2 != api->data_request_cb(api, NULL, 0) ){ - return false; - } - - //Test generic_data_request here --> - //serial_mac_buffer_get cannot be tested here, see virtual data request test - uint8_t buf[20]; - memset(&buf, 0, 20); - if( -1 != api->data_request_cb(api, &buf, 20) ){ - return false; - } - - tx_value = 1; - nsdynmemlib_stub.returnCounter = 1; - if( 0 != api->data_request_cb(api, &buf, 20) ){ - return false; - } - - if( event_stub.func_ptr ){ //cleanup of request - arm_event_s ev; - ev.event_type = 102; //SERIAL_DATA_CNF_EVENT - event_stub.func_ptr(&ev); - } - - tx_value = 0; - nsdynmemlib_stub.returnCounter = 1; - if( 0 != api->data_request_cb(api, &buf, 20) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if( 0 != api->data_request_cb(api, &buf, 20) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if( 0 != api->data_request_cb(api, &buf, 20) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if( 0 != api->data_request_cb(api, &buf, 20) ){ - return false; - } - - if( event_stub.func_ptr ){ //cleanup of request - arm_event_s ev; - ev.event_type = 102; //SERIAL_DATA_CNF_EVENT - event_stub.func_ptr(&ev); - - event_stub.func_ptr(&ev); - - event_stub.func_ptr(&ev); - - event_stub.func_ptr(&ev); - } - //<-- Test generic_data_request here - - ns_dyn_mem_free(api); - - return true; -} - -//NOTE: This must match with internal struct!!!! -typedef struct data_ind_s { - uint16_t msduLength; - uint8_t *msdu; -}test_data_ind_t; - - -bool test_data_indication() -{ - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - drv.arm_net_virtual_rx_cb = &virt_rx_cb; - rf_driver_storage_stub.list_value = &list; - nsdynmemlib_stub.returnCounter = 1; - serial_mac_api_t *api = serial_mac_create(0); - - if (api->mac_initialize(api, &data_ind_cb) != 0) { - return false; - } - if (api->virtual_initilize(api, 0) != 0) { - return false; - } - - if( event_stub.func_ptr ){ //cleanup of request - arm_event_s ev; - ev.event_type = 101; //SERIAL_DATA_CNF_EVENT - nsdynmemlib_stub.returnCounter = 1; - test_data_ind_t *ind = ns_dyn_mem_temporary_alloc(sizeof(test_data_ind_t)); - nsdynmemlib_stub.returnCounter = 1; - uint8_t *buf = ns_dyn_mem_temporary_alloc(20); - ind->msdu = buf; - buf[0] = 0; - ind->msduLength = 20; - ev.data_ptr = ind; - visited = false; - event_stub.func_ptr(&ev); - if( !visited ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - ind = ns_dyn_mem_temporary_alloc(sizeof(test_data_ind_t)); - nsdynmemlib_stub.returnCounter = 1; - buf = ns_dyn_mem_temporary_alloc(20); - ind->msdu = buf; - buf[0] = 1; - ind->msduLength = 20; - ev.data_ptr = ind; - visited = false; - event_stub.func_ptr(&ev); - if( !visited ){ - return false; - } - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_serial_mac_api_initialize() -{ - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - rf_driver_storage_stub.list_value = &list; - nsdynmemlib_stub.returnCounter = 1; - serial_mac_api_t *api = serial_mac_create(0); - - if( -1 != api->mac_initialize(NULL, NULL) ){ - return false; - } - - if( 0 != api->mac_initialize(api, NULL) ){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_serial_mac_virtual_initialize() -{ - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - rf_driver_storage_stub.list_value = &list; - nsdynmemlib_stub.returnCounter = 1; - serial_mac_api_t *api = serial_mac_create(0); - - if( -1 != api->virtual_initilize(NULL, 0) ){ - return false; - } - - drv.arm_net_virtual_rx_cb = NULL; - if( -1 != api->virtual_initilize(api, 0) ){ - return false; - } - - drv.arm_net_virtual_rx_cb = &virt_rx_cb; - if( 0 != api->virtual_initilize(api, 0) ){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_serial_mac_net_phy_rx() -{ - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - rf_driver_storage_stub.list_value = &list; - nsdynmemlib_stub.returnCounter = 1; - serial_mac_api_t *api = serial_mac_create(0); - - if( !rf_driver_storage_stub.rx_cb ){ - return false; - } - rf_driver_storage_stub.list_value = NULL; - if( -1 != rf_driver_storage_stub.rx_cb(NULL, 0, 0, 0, 0) ){ - return false; - } - uint8_t data[20]; - rf_driver_storage_stub.list_value = &list; - list.phy_sap_identifier = NULL; - if( -1 != rf_driver_storage_stub.rx_cb(&data, 20, 0, 0, 0) ){ - return false; - } - uint8_t nothing[1]; - list.phy_sap_identifier = ¬hing; - if( -1 != rf_driver_storage_stub.rx_cb(&data, 20, 0, 0, 0) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if( -1 != rf_driver_storage_stub.rx_cb(&data, 20, 0, 0, 0) ){ - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - event_stub.int8_value = 2; - if( 2 != rf_driver_storage_stub.rx_cb(&data, 20, 0, 0, 0) ){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_serial_mac_net_phy_tx_done() -{ - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - rf_driver_storage_stub.list_value = &list; - nsdynmemlib_stub.returnCounter = 1; - serial_mac_api_t *api = serial_mac_create(0); - - if( !rf_driver_storage_stub.done_cb ){ - return false; - } - - rf_driver_storage_stub.list_value = NULL; - if( -1 != rf_driver_storage_stub.done_cb(0,0,0,0,0) ){ - return false; - } - - drv.tx = &tx_cb; - tx_value = 0; - nsdynmemlib_stub.returnCounter = 1; - uint8_t buf[20]; - if( 0 != api->data_request_cb(api, &buf, 20) ){ - return false; - } - - rf_driver_storage_stub.list_value = &list; - event_stub.int8_value = 2; - if( 2 != rf_driver_storage_stub.done_cb(0,0,0,0,0) ){ - return false; - } - - if( event_stub.func_ptr ){ //cleanup of request - arm_event_s ev; - ev.event_type = 102; //SERIAL_DATA_CNF_EVENT - event_stub.func_ptr(&ev); - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_serial_mac_virtual_data_request() -{ - arm_device_driver_list_s list; - phy_device_driver_s drv; - list.phy_driver = &drv; - rf_driver_storage_stub.list_value = &list; - nsdynmemlib_stub.returnCounter = 1; - serial_mac_api_t *api = serial_mac_create(0); - - drv.arm_net_virtual_rx_cb = &virt_rx_cb; - if( 0 != api->virtual_initilize(api, 0) ){ - return false; - } - - if(!drv.arm_net_virtual_tx_cb){ - return false; - } - - virtual_data_req_t data; - memset(&data, 0, sizeof(virtual_data_req_t)); - rf_driver_storage_stub.list_value = NULL; - drv.arm_net_virtual_tx_cb(&data, 0); - - //Test serial_mac_buffer_get here --> - - rf_driver_storage_stub.list_value = &list; - if( -1 != drv.arm_net_virtual_tx_cb(&data, 0) ){ - return false; - } - - uint8_t buf[8]; - data.msdu = &buf; - data.msduLength = 8; - data.parameter_length = 20; - - if( -1 != drv.arm_net_virtual_tx_cb(&data, 0) ){ - return false; - } - - uint8_t buf2[20]; - data.parameters = &buf2; - - drv.tx = &tx_cb; - nsdynmemlib_stub.returnCounter = 1; - if( 0 != drv.arm_net_virtual_tx_cb(&data, 0) ){ - return false; - } - - if( event_stub.func_ptr ){ //cleanup of request - arm_event_s ev; - ev.event_type = 102; //SERIAL_DATA_CNF_EVENT - event_stub.func_ptr(&ev); - } - - //<-- Test serial_mac_buffer_get here - - ns_dyn_mem_free(api); - return true; -} diff --git a/test/nanostack/unittest/mac/serial_mac_api/test_serial_mac_api.h b/test/nanostack/unittest/mac/serial_mac_api/test_serial_mac_api.h deleted file mode 100644 index 62fd62f86673..000000000000 --- a/test/nanostack/unittest/mac/serial_mac_api/test_serial_mac_api.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_SERIAL_MAC_API_H -#define TEST_SERIAL_MAC_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_serial_mac_create(); - -bool test_data_request(); - -bool test_data_indication(); - -bool test_serial_mac_api_initialize(); - -bool test_serial_mac_virtual_initialize(); - -bool test_serial_mac_net_phy_rx(); - -bool test_serial_mac_net_phy_tx_done(); - -bool test_serial_mac_virtual_data_request(); - - -#ifdef __cplusplus -} -#endif - -#endif // TEST_SERIAL_MAC_API_H - diff --git a/test/nanostack/unittest/mac/sw_mac/Makefile b/test/nanostack/unittest/mac/sw_mac/Makefile deleted file mode 100644 index 7995e1f897f1..000000000000 --- a/test/nanostack/unittest/mac/sw_mac/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = sw_mac_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/IEEE802_15_4/sw_mac.c - -TEST_SRC_FILES = \ - main.cpp \ - sw_mactest.cpp \ - test_sw_mac.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/rf_driver_storage_stub.c \ - ../../stub/mac_security_mib_stub.c \ - ../../stub/mac_mlme_stub.c \ - ../../stub/mac_pd_sap_stub.c \ - ../../stub/mac_mcps_sap_stub.c \ - ../../stub/fhss_callbacks_stub.c \ - ../../stub/fhss_mac_interface_stub.c \ - ../../stub/ns_timer_stub.c \ - ../../stub/common_functions_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/sw_mac/main.cpp b/test/nanostack/unittest/mac/sw_mac/main.cpp deleted file mode 100644 index 7f4e0a8dfe12..000000000000 --- a/test/nanostack/unittest/mac/sw_mac/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(sw_mac); - diff --git a/test/nanostack/unittest/mac/sw_mac/sw_mactest.cpp b/test/nanostack/unittest/mac/sw_mac/sw_mactest.cpp deleted file mode 100644 index 9b193285aa10..000000000000 --- a/test/nanostack/unittest/mac/sw_mac/sw_mactest.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_sw_mac.h" -#include "mac_mcps_sap_stub.h" - - -TEST_GROUP(sw_mac) -{ - void setup() - { - mac_mcps_sap_stub.int8_value = 0; - } - - void teardown() - { - } -}; - -TEST(sw_mac, test_ns_sw_mac_fhss_register) -{ - CHECK(test_ns_sw_mac_fhss_register()); -} - -TEST(sw_mac, test_ns_sw_mac_create) -{ - CHECK(test_ns_sw_mac_create()); -} - -TEST(sw_mac, test_get_sw_mac_api) -{ - CHECK(test_get_sw_mac_api()); -} - -TEST(sw_mac, test_get_sw_mac_ptr_by_mac_api) -{ - CHECK(test_get_sw_mac_ptr_by_mac_api()); -} - -TEST(sw_mac, test_get_sw_mac_ptr_by_fhss_api) -{ - CHECK(test_get_sw_mac_ptr_by_fhss_api()); -} - -TEST(sw_mac, test_get_sw_mac_ptr_by_timer) -{ - CHECK(test_get_sw_mac_ptr_by_timer()); -} - -TEST(sw_mac, test_get_sw_mac_ptr_by_driver_id) -{ - CHECK(test_get_sw_mac_ptr_by_driver_id()); -} - -TEST(sw_mac, test_initialize) -{ - CHECK(test_initialize()); -} - -TEST(sw_mac, test_mlme_req) -{ - CHECK(test_mlme_req()); -} - -TEST(sw_mac, test_mcps_data_req) -{ - CHECK(test_mcps_data_req()); -} - -TEST(sw_mac, test_mac64_get) -{ - CHECK(test_mac64_get()); -} - -TEST(sw_mac, test_mac64_set) -{ - CHECK(test_mac64_set()); -} - -TEST(sw_mac, test_sw_mac_net_phy_rx) -{ - CHECK(test_sw_mac_net_phy_rx()); -} - -TEST(sw_mac, test_sw_mac_net_phy_tx_done) -{ - CHECK(test_sw_mac_net_phy_tx_done()); -} - -TEST(sw_mac, test_sw_mac_storage_decription_sizes_get) -{ - CHECK(test_sw_mac_storage_decription_sizes_get()); -} - -TEST(sw_mac, test_ns_sw_mac_virtual_client_register) -{ - CHECK(test_ns_sw_mac_virtual_client_register()); -} - -TEST(sw_mac, test_ns_sw_mac_virtual_client_unregister) -{ - CHECK(test_ns_sw_mac_virtual_client_unregister()); -} - diff --git a/test/nanostack/unittest/mac/sw_mac/test_sw_mac.c b/test/nanostack/unittest/mac/sw_mac/test_sw_mac.c deleted file mode 100644 index 39515a73c9d1..000000000000 --- a/test/nanostack/unittest/mac/sw_mac/test_sw_mac.c +++ /dev/null @@ -1,851 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_sw_mac.h" -#include -#include "mac_api.h" -#include "fhss_api.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "MAC/IEEE802_15_4/mac_pd_sap.h" -#include "MAC/IEEE802_15_4/sw_mac_internal.h" -#include "sw_mac.h" -#include "mlme.h" -#include "rf_driver_storage_stub.h" -#include "nsdynmemLIB_stub.h" -#include "mac_mlme_stub.h" -#include "mac_security_mib_stub.h" -#include "mac_mcps_sap_stub.h" -#include "fhss_mac_interface_stub.h" - -#define C_CHECK(condition) \ - do { if (!(condition)) { printf("ERROR: %s at file %s on line %d\n", #condition, __FILE__, __LINE__); return false; } } while(0) - -void conf_cb( const mac_api_t* api, mlme_primitive id, const void *data ) -{ - -} - -static void internal_mib_observer_test(const mlme_set_t * set_req) -{ - -} - -static void driver_storage_init(arm_device_driver_list_s *list) -{ - list->mlme_observer_cb = internal_mib_observer_test; - list->id = 1; - //Init stubs - rf_driver_storage_stub.list_value = list; - mac_security_mib_stub.int8_value = 0; - mac_mcps_sap_stub.int8_value = 0; -} - -bool test_ns_sw_mac_create() -{ - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - mac_description_storage_size_t storage_sizes; - rf_driver_storage_stub.list_value = NULL; - mac_security_mib_stub.int8_value = 0; - mac_mcps_sap_stub.int8_value = 0; - mac_mlme_stub.setup_ptr = NULL; - - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - if( api ){ - return false; - } - arm_device_driver_list_s list; - driver_storage_init(&list); - - list.phy_driver = &drv; - storage_sizes.key_description_table_size = 0; - api = ns_sw_mac_create(0, &storage_sizes); - if( api ){ - return false; - } - storage_sizes.device_decription_table_size = 0; - storage_sizes.key_description_table_size = 3; - api = ns_sw_mac_create(0, &storage_sizes); - if( api ){ - return false; - } - storage_sizes.device_decription_table_size = 32; - nsdynmemlib_stub.returnCounter = 0; - api = ns_sw_mac_create(0, &storage_sizes); - if( api ){ - return false; - } - - //Test no MAC - api = ns_sw_mac_create(0, &storage_sizes); - if( api ){ - return false; - } - //Set MAC and mac class allocate fail - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - api = ns_sw_mac_create(0, &storage_sizes); - if( api ){ - return false; - } - - //Test data base allocate fail - //Enable data allocate for mac api - nsdynmemlib_stub.returnCounter = 3; - api = ns_sw_mac_create(0, &storage_sizes); - if( api ){ - return false; - } - - //Test succesfully init - protocol_interface_rf_mac_setup_s setup; - mac_mlme_stub.setup_ptr = &setup; - nsdynmemlib_stub.returnCounter = 3; - api = ns_sw_mac_create(0, &storage_sizes); - if( !api ){ - return false; - } - - ns_dyn_mem_free(api); - - return true; -} - -bool test_get_sw_mac_api() -{ - mac_mlme_stub.setup_ptr = NULL; - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - mac_api_t *orig = ns_sw_mac_create(0, &storage_sizes); - - - mac_api_t *api = get_sw_mac_api(&setup); - if( api ){ - return false; - } - - - orig->mac_initialize(orig, NULL, NULL, NULL, NULL, NULL, 0); - - api = get_sw_mac_api(&setup); - if( !api ){ - return false; - } - - ns_dyn_mem_free(orig); - - return true; -} - -bool test_get_sw_mac_ptr_by_mac_api() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - protocol_interface_rf_mac_setup_s *ret = get_sw_mac_ptr_by_mac_api(NULL); - if( ret ){ - return false; - } - - ret = get_sw_mac_ptr_by_mac_api(api); - if( !ret ){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_get_sw_mac_ptr_by_fhss_api() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - fhss_api_t fhss_api; - mac_mlme_stub.setup_ptr->fhss_api = &fhss_api; - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - // Test NULL API - protocol_interface_rf_mac_setup_s *ret = get_sw_mac_ptr_by_fhss_api(NULL); - if (ret) { - return false; - } - // Test proper API - ret = get_sw_mac_ptr_by_fhss_api(&fhss_api); - if (!ret) { - return false; - } - // Verify pointer - if (ret != mac_mlme_stub.setup_ptr) { - return false; - } - ns_dyn_mem_free(api); - return true; -} - -bool test_get_sw_mac_ptr_by_timer() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - protocol_interface_rf_mac_setup_s *ret = get_sw_mac_ptr_by_timer(6, ARM_NWK_MLME_TIMER); - C_CHECK( !ret ); - - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - ret = get_sw_mac_ptr_by_timer(6, ARM_NWK_MLME_TIMER); - C_CHECK( !ret ); - - setup.mlme_timer_id = 6; - ret = get_sw_mac_ptr_by_timer(6, ARM_NWK_MLME_TIMER); - C_CHECK( ret ); - - ret = get_sw_mac_ptr_by_timer(7, ARM_NWK_MAC_TIMER); - C_CHECK( !ret ); - - setup.mac_timer_id = 7; - ret = get_sw_mac_ptr_by_timer(7, ARM_NWK_MAC_TIMER); - C_CHECK( ret ); - - ret = get_sw_mac_ptr_by_timer(8, ARM_NWK_CCA_TIMER); - C_CHECK( !ret ); - - setup.cca_timer_id = 8; - ret = get_sw_mac_ptr_by_timer(8, ARM_NWK_CCA_TIMER); - C_CHECK( ret ); - - ret = get_sw_mac_ptr_by_timer(9, ARM_NWK_IFS_TIMER); - C_CHECK( !ret ); - - setup.ifs_timer_id = 9; - ret = get_sw_mac_ptr_by_timer(9, ARM_NWK_IFS_TIMER); - C_CHECK( ret ); - - ns_dyn_mem_free(api); - - return true; -} - -bool test_get_sw_mac_ptr_by_driver_id() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - setup.dev_driver = &list; - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - protocol_interface_rf_mac_setup_s *ret = get_sw_mac_ptr_by_driver_id(0); - if( ret ){ - return false; - } - - ret = get_sw_mac_ptr_by_driver_id(1); - if( !ret ){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_initialize() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - - if( -1 != api->mac_initialize(NULL, NULL, NULL, NULL, NULL, NULL, 0) ){ - return false; - } - - if( 0 != api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0) ){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - - -bool test_ns_sw_mac_virtual_client_register() -{ - arm_device_driver_list_s list; - mac_api_t tester_api; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - - if (-1 != ns_sw_mac_virtual_client_register(NULL, 1) ) { - return false; - } - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - - //This should not never fail - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - //SETDriver to NULL - rf_driver_storage_stub.list_value = NULL; - if (-1 != ns_sw_mac_virtual_client_register(api, 1) ) { - return false; - } - //Succesfully test - rf_driver_storage_stub.list_value = &list; - if (0 !=ns_sw_mac_virtual_client_register(api, 1) ) { - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_ns_sw_mac_virtual_client_unregister() -{ - arm_device_driver_list_s list; - mac_api_t tester_api; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - - if (-1 != ns_sw_mac_virtual_client_unregister(NULL) ) { - return false; - } - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - - //This should not never fail - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - //Register - ns_sw_mac_virtual_client_register(api, 1); - - if (0 != ns_sw_mac_virtual_client_unregister(api) ) { - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_mlme_req() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - setup.dev_driver = &list; - api->mac_initialize(api, NULL, NULL, NULL, &conf_cb, NULL, 0); - - //Just run the unsupported cases - api->mlme_req(NULL, MLME_ASSOCIATE, NULL); - api->mlme_req(api, MLME_ASSOCIATE, NULL); - api->mlme_req(api, MLME_DISASSOCIATE, NULL); - api->mlme_req(api, MLME_GTS, NULL); - api->mlme_req(api, MLME_RX_ENABLE, NULL); - api->mlme_req(api, MLME_SYNC, NULL); - api->mlme_req(api, 254, NULL); - - mac_mlme_stub.int8_value = 0; - mlme_get_t get_data; - api->mlme_req(api, MLME_GET, &get_data); - - mlme_reset_t reset_data; - api->mlme_req(api, MLME_RESET, &reset_data); - - mlme_scan_t scan_data; - api->mlme_req(api, MLME_SCAN, &scan_data); - - mlme_set_t set_data; - api->mlme_req(api, MLME_SET, &set_data); - set_data.attr = macLoadBalancingBeaconTx; - api->mlme_req(api, MLME_SET, &set_data); - - mlme_start_t start_data; - api->mlme_req(api, MLME_START, &start_data); - - mlme_poll_t poll_data; - api->mlme_req(api, MLME_POLL, &poll_data); - - ns_dyn_mem_free(api); - return true; -} - -bool test_mcps_data_req() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - setup.dev_driver = &list; - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - mcps_data_req_t data; - api->mcps_data_req(api, &data); - - ns_dyn_mem_free(api); - return true; -} - -bool test_mac64_get() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - - memset(&setup.mac64, 0, 8); - setup.dev_driver = &list; - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - if( -1 != api->mac64_get(NULL, MAC_EXTENDED_READ_ONLY, NULL)){ - return false; - } - - uint8_t buf[8]; - memset(&buf, 0, 8); - drv.PHY_MAC = &buf; - if( 0 != api->mac64_get(api, MAC_EXTENDED_READ_ONLY, &buf)){ - return false; - } - - if( 0 != api->mac64_get(api, MAC_EXTENDED_DYNAMIC, &buf)){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_mac64_set() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - setup.dev_driver = &list; - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - if( -1 != api->mac64_set(NULL, NULL)){ - return false; - } - - uint8_t buf[8]; - memset(&buf, 0, 8); - if( 0 != api->mac64_set(api, &buf)){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_sw_mac_net_phy_rx() -{ -// rf_driver_storage_stub.rx_cb = rx_cb; - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - setup.dev_driver = &list; - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - rf_driver_storage_stub.list_value = NULL; - - if( -1 != rf_driver_storage_stub.rx_cb(NULL,0,0,0,0) ){ - return false; - } - - rf_driver_storage_stub.list_value = &list; - if( 0 != rf_driver_storage_stub.rx_cb(NULL,0,0,0,1) ){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - -bool test_sw_mac_net_phy_tx_done() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - setup.dev_driver = &list; - - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - rf_driver_storage_stub.list_value = NULL; - - if( -1 != rf_driver_storage_stub.done_cb(0,0,PHY_LINK_TX_SUCCESS,0,0) ){ - return false; - } - - rf_driver_storage_stub.list_value = &list; - if( 0 != rf_driver_storage_stub.done_cb(1,0,PHY_LINK_TX_SUCCESS,0,0) ){ - return false; - } - - ns_dyn_mem_free(api); - return true; -} - - - -bool test_sw_mac_storage_decription_sizes_get() -{ - arm_device_driver_list_s list; - driver_storage_init(&list); - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - list.phy_driver = &drv; - - nsdynmemlib_stub.returnCounter = 3; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - setup.device_description_table_size = 32; - setup.key_description_table_size = 3; - setup.key_lookup_list_size = 1; - setup.key_usage_list_size = 3; - - - mac_mlme_stub.setup_ptr = &setup; - mac_description_storage_size_t storage_sizes; - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - - mac_description_storage_size_t test_storage_sizes; - memset(&test_storage_sizes, 0, sizeof(mac_description_storage_size_t)); - mac_api_t *api = ns_sw_mac_create(0, &storage_sizes); - setup.dev_driver = &list; - - api->mac_initialize(api, NULL, NULL, NULL, NULL, NULL, 0); - - if (api->mac_storage_sizes_get(NULL, &test_storage_sizes) != -1) { - return false; - } - - if (api->mac_storage_sizes_get(api, NULL) != -1) { - return false; - } - - if (api->mac_storage_sizes_get(api, &test_storage_sizes) != 0) { - return false; - } - - if (test_storage_sizes.device_decription_table_size != 32 || test_storage_sizes.key_description_table_size != 3 || - test_storage_sizes.key_lookup_size != 1 || test_storage_sizes.key_usage_size != 3) { - return false; - } - - ns_dyn_mem_free(api); - return true; - -} - -bool test_ns_sw_mac_fhss_register() -{ - fhss_api_t fhss_api; - memset(&fhss_api, 0, sizeof(fhss_api_t)); - mac_api_t dummy_mac_api; - memset(&dummy_mac_api, 0, sizeof(mac_api_t)); - mac_description_storage_size_t storage_sizes; - protocol_interface_rf_mac_setup_s setup; - memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s)); - fhss_api.init_callbacks = &fhss_init_callbacks_cb; - - phy_device_driver_s drv; - memset(&drv, 0, sizeof(phy_device_driver_s)); - uint8_t mac64[8]; - memset(mac64, 0, 8); - drv.PHY_MAC = mac64; - arm_device_driver_list_s list; - memset(&list, 0, sizeof(arm_device_driver_list_s)); - driver_storage_init(&list); - list.phy_driver = &drv; - - memset(&dummy_mac_api, 0, sizeof(mac_api_t)); - - storage_sizes.device_decription_table_size = 32; - storage_sizes.key_description_table_size = 3; - storage_sizes.key_lookup_size = 1; - storage_sizes.key_usage_size = 3; - mac_mlme_stub.setup_ptr = &setup; - nsdynmemlib_stub.returnCounter = 3; - mac_api_t *mac_api = ns_sw_mac_create(0, &storage_sizes); - if( !mac_api ){ - return false; - } - - // Test without MAC API - if (ns_sw_mac_fhss_register(NULL, &fhss_api) != -1) { - return false; - } - // Test without FHSS API - if (ns_sw_mac_fhss_register(mac_api, NULL) != -1) { - return false; - } - - // Test with dummy MAC API - if (ns_sw_mac_fhss_register(&dummy_mac_api, &fhss_api) != -2) { - return false; - } - - // Test with proper API's - if (ns_sw_mac_fhss_register(mac_api, &fhss_api) != 0) { - return false; - } - ns_dyn_mem_free(mac_api); - return true; -} diff --git a/test/nanostack/unittest/mac/sw_mac/test_sw_mac.h b/test/nanostack/unittest/mac/sw_mac/test_sw_mac.h deleted file mode 100644 index b58d0139b8a7..000000000000 --- a/test/nanostack/unittest/mac/sw_mac/test_sw_mac.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_SW_MAC_H -#define TEST_SW_MAC_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_ns_sw_mac_create(); - -bool test_get_sw_mac_api(); - -bool test_get_sw_mac_ptr_by_mac_api(); - -bool test_get_sw_mac_ptr_by_fhss_api(); - -bool test_get_sw_mac_ptr_by_timer(); - -bool test_get_sw_mac_ptr_by_driver_id(); - -//Test also mac functions -bool test_initialize(); - -bool test_mlme_req(); - -bool test_mcps_data_req(); - -bool test_mac64_get(); - -bool test_mac64_set(); - -//test low level callbacks -bool test_sw_mac_net_phy_rx(); - -bool test_sw_mac_net_phy_tx_done(); - -bool test_sw_mac_storage_decription_sizes_get(); - -bool test_ns_sw_mac_virtual_client_register(); - -bool test_ns_sw_mac_virtual_client_unregister(); -// Test registering FHSS to software MAC -bool test_ns_sw_mac_fhss_register(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_SW_MAC_H - diff --git a/test/nanostack/unittest/mac/virtual_rf_client/Makefile b/test/nanostack/unittest/mac/virtual_rf_client/Makefile deleted file mode 100644 index b5e5e288ee3c..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_client/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = virtual_rf_client_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/virtual_rf/virtual_rf_client.c - -TEST_SRC_FILES = \ - main.cpp \ - virtual_rf_clienttest.cpp \ - test_virtual_rf_client.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/rf_driver_storage_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/virtual_rf_client/main.cpp b/test/nanostack/unittest/mac/virtual_rf_client/main.cpp deleted file mode 100644 index 5373601e5a69..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_client/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(virtual_rf_client); - diff --git a/test/nanostack/unittest/mac/virtual_rf_client/test_virtual_rf_client.c b/test/nanostack/unittest/mac/virtual_rf_client/test_virtual_rf_client.c deleted file mode 100644 index b6afe3627a15..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_client/test_virtual_rf_client.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_virtual_rf_client.h" -#include -#include "ns_virtual_rf_api.h" -#include "MAC/virtual_rf/virtual_rf_defines.h" -#include "mlme.h" - -#include "rf_driver_storage_stub.h" -bool rx_test = false; -uint8_t rx_status = 0; -int8_t tx_cb(const virtual_data_req_t *data_req, int8_t driver_id) -{ - - if (rx_test) { - uint8_t *ptr = data_req->parameters; - if (*ptr++ != NAP_DATA_PHY_RAW_INDICATION) { - return -1; - } - } else { - uint8_t *ptr = data_req->msdu; - if (data_req->msduLength != 4) - return -1; - - if (*ptr++ != NAP_DATA_PHY_RAW_RESPONSE) { - return -1; - } - rx_status = *ptr++; - } - - - return 0; -} - -int8_t upper_cb(void *identifier, arm_phy_sap_msg_t *message) -{ - return 0; -} - - - -bool test_phy_rf_virtual_rx() -{ - rf_driver_storage_stub.list_value = NULL; - rf_driver_storage_stub.int8_value = 0; - if( rf_driver_storage_stub.registered_driver ){ - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(NULL, 0, 2) ){ - return false; - } - uint8_t buf[6]; - - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 6, 0) ){ - return false; - } - arm_device_driver_list_s list; - list.phy_sap_upper_cb = &upper_cb; - rf_driver_storage_stub.list_value = &list; - - buf[0] = NAP_DATA_PHY_RAW_REQUEST; - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 5, 0) ){ - return false; - } - - if( 0 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 6, 0) ){ - return false; - } - buf[0] = NAP_DATA_PHY_RAW_INDICATION; - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 5, 0) ){ - return false; - } - - buf[0] = NAP_MLME_REQUEST; - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 2, 0) ){ - return false; - } - - if( 0 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 3, 0) ){ - return false; - } - - } - return true; -} - -bool test_phy_rf_tx_done() -{ - rf_driver_storage_stub.list_value = NULL; - rf_driver_storage_stub.int8_value = 0; - if( rf_driver_storage_stub.registered_driver ){ - rf_driver_storage_stub.registered_driver->arm_net_virtual_tx_cb = NULL; - if( -1 != rf_driver_storage_stub.registered_driver->phy_tx_done_cb(0,0,0,0,0) ){ - return false; - } - rf_driver_storage_stub.registered_driver->arm_net_virtual_tx_cb = &tx_cb; - rx_test = false; - rx_status = 0xff; - if( 0 != rf_driver_storage_stub.registered_driver->phy_tx_done_cb(0,0,MLME_SUCCESS,0,0) ){ - return false; - } - - if (rx_status != PHY_LINK_TX_DONE) { - return false; - } - rx_status = 0xff; - if( 0 != rf_driver_storage_stub.registered_driver->phy_tx_done_cb(0,0,MLME_BUSY_CHAN,0,0) ){ - return false; - } - - if (rx_status != PHY_LINK_CCA_FAIL) { - return false; - } - - if( 0 != rf_driver_storage_stub.registered_driver->phy_tx_done_cb(0,0,MLME_TX_NO_ACK,0,0) ){ - return false; - } - - if (rx_status != PHY_LINK_TX_FAIL) { - return false; - } - - } - return true; -} - -bool test_phy_rf_rx() -{ - rf_driver_storage_stub.list_value = NULL; - rf_driver_storage_stub.int8_value = 0; - if( rf_driver_storage_stub.registered_driver ){ - rf_driver_storage_stub.registered_driver->arm_net_virtual_tx_cb = NULL; - if( -1 != rf_driver_storage_stub.registered_driver->phy_rx_cb(NULL, 0, 0, 0, 0) ){ - return false; - } - rf_driver_storage_stub.registered_driver->arm_net_virtual_tx_cb = &tx_cb; - rx_test = true; - uint8_t buf_temp[5]; - if( 0 != rf_driver_storage_stub.registered_driver->phy_rx_cb(buf_temp, 5, 0, 0, 0) ){ - return false; - } - } - return true; -} - -bool test_virtual_rf_client_register() -{ - rf_driver_storage_stub.list_value = NULL; - rf_driver_storage_stub.int8_value = 0; - if( 0 != virtual_rf_client_register() ){ - return false; - } - return true; -} diff --git a/test/nanostack/unittest/mac/virtual_rf_client/test_virtual_rf_client.h b/test/nanostack/unittest/mac/virtual_rf_client/test_virtual_rf_client.h deleted file mode 100644 index 4e3cc37ed2f7..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_client/test_virtual_rf_client.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_VIRTUAL_RF_CLIENT_H -#define TEST_VIRTUAL_RF_CLIENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_virtual_rf_client_register(); - -bool test_phy_rf_virtual_rx(); - -bool test_phy_rf_tx_done(); - -bool test_phy_rf_rx(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_VIRTUAL_RF_CLIENT_H - diff --git a/test/nanostack/unittest/mac/virtual_rf_client/virtual_rf_clienttest.cpp b/test/nanostack/unittest/mac/virtual_rf_client/virtual_rf_clienttest.cpp deleted file mode 100644 index ceb31db92ead..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_client/virtual_rf_clienttest.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_virtual_rf_client.h" - -TEST_GROUP(virtual_rf_client) -{ - void setup() - { - } - - void teardown() - { - } -}; - - -TEST(virtual_rf_client, test_phy_rf_virtual_rx) -{ - CHECK(test_phy_rf_virtual_rx()); -} - -TEST(virtual_rf_client, test_phy_rf_tx_done) -{ - CHECK(test_phy_rf_tx_done()); -} - -TEST(virtual_rf_client, test_phy_rf_rx) -{ - CHECK(test_phy_rf_rx()); -} - -TEST(virtual_rf_client, test_virtual_rf_client_register) -{ - CHECK(test_virtual_rf_client_register()); -} - diff --git a/test/nanostack/unittest/mac/virtual_rf_driver/Makefile b/test/nanostack/unittest/mac/virtual_rf_driver/Makefile deleted file mode 100644 index 22acbeb3105c..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_driver/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = virtual_rf_driver_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MAC/virtual_rf/virtual_rf_driver.c - -TEST_SRC_FILES = \ - main.cpp \ - virtual_rf_drivertest.cpp \ - test_virtual_rf_driver.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/rf_driver_storage_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mac/virtual_rf_driver/main.cpp b/test/nanostack/unittest/mac/virtual_rf_driver/main.cpp deleted file mode 100644 index 57a3ff11dcf8..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_driver/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(virtual_rf_driver); - diff --git a/test/nanostack/unittest/mac/virtual_rf_driver/test_virtual_rf_driver.c b/test/nanostack/unittest/mac/virtual_rf_driver/test_virtual_rf_driver.c deleted file mode 100644 index 9524a1734936..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_driver/test_virtual_rf_driver.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_virtual_rf_driver.h" -#include -#include "ns_virtual_rf_api.h" -#include "platform/arm_hal_phy.h" -#include "rf_driver_storage_stub.h" - -int8_t receive(const uint8_t *data_ptr, uint16_t data_len, uint8_t link_quality, int8_t dbm, int8_t driver_id) -{ - return 0; -} - -int8_t tx_done(int8_t driver_id, uint8_t tx_handle, phy_link_tx_status_e status, uint8_t cca_retry, uint8_t tx_retry) -{ - return 0; -} - -int8_t tx_cb(const virtual_data_req_t *data_req, int8_t driver_id) -{ - return 0; -} - -bool phy_rf_mlme_orserver_tx() -{ - rf_driver_storage_stub.list_value = NULL; - if ( rf_driver_storage_stub.registered_driver ) { - uint8_t temp_buf[16]; - mlme_set_t set_req; - set_req.attr = 0; - set_req.value_pointer = temp_buf; - set_req.value_size = 16; - rf_driver_storage_stub.mlme_observer(&set_req); - - set_req.attr = macBeaconPayload; - rf_driver_storage_stub.mlme_observer(&set_req); - } - return true; -} - -bool test_phy_rf_extension() -{ - rf_driver_storage_stub.list_value = NULL; - if ( rf_driver_storage_stub.registered_driver ) { - uint8_t data[8]; - if ( 0 != rf_driver_storage_stub.registered_driver->extension(PHY_EXTENSION_CTRL_PENDING_BIT, &data) ) { - return false; - } - - if ( 0 != rf_driver_storage_stub.registered_driver->extension(PHY_EXTENSION_READ_LAST_ACK_PENDING_STATUS, &data) ) { - return false; - } - - if ( 0 != rf_driver_storage_stub.registered_driver->extension(99, &data) ) { - return false; - } - } - return true; -} - -bool test_phy_rf_address_write() -{ - rf_driver_storage_stub.list_value = NULL; - if( rf_driver_storage_stub.registered_driver ){ - uint8_t addr[8]; - if( 0 != rf_driver_storage_stub.registered_driver->address_write(PHY_MAC_48BIT, &addr) ){ - return false; - } - - if( 0 != rf_driver_storage_stub.registered_driver->address_write(PHY_MAC_64BIT, &addr) ){ - return false; - } - } - return true; -} - -bool test_phy_rf_tx() -{ - rf_driver_storage_stub.list_value = NULL; - if( rf_driver_storage_stub.registered_driver ){ - rf_driver_storage_stub.registered_driver->arm_net_virtual_tx_cb = NULL; - if( -1 != rf_driver_storage_stub.registered_driver->tx(NULL, 0, 0, 0) ){ - return false; - } - - uint8_t data[3]; - if( -1 != rf_driver_storage_stub.registered_driver->tx(&data, 2, 0, 0) ){ - return false; - } - - rf_driver_storage_stub.registered_driver->arm_net_virtual_tx_cb = &tx_cb; - if( 0 != rf_driver_storage_stub.registered_driver->tx(&data, 2, 0, 0) ){ - return false; - } - } - return true; -} - -bool test_phy_rf_state_control() -{ - rf_driver_storage_stub.list_value = NULL; - if( rf_driver_storage_stub.registered_driver ){ - if( 0 != rf_driver_storage_stub.registered_driver->state_control( PHY_INTERFACE_RESET, 0) ){ - return false; - } - - if( 0 != rf_driver_storage_stub.registered_driver->state_control( PHY_INTERFACE_UP, 0) ){ - return false; - } - - if( 0 != rf_driver_storage_stub.registered_driver->state_control( PHY_INTERFACE_RX_ENERGY_STATE, 0) ){ - return false; - } - } - return true; -} - -bool test_phy_rf_virtual_rx() -{ - rf_driver_storage_stub.list_value = NULL; - if( rf_driver_storage_stub.registered_driver ){ - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(NULL, 0, 2) ){ - return false; - } - uint8_t buf[6]; - buf[0] = 0; - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 1, 0) ){ - return false; - } - arm_device_driver_list_s list; - rf_driver_storage_stub.list_value = &list; - - - rf_driver_storage_stub.registered_driver->phy_rx_cb = &receive; - rf_driver_storage_stub.registered_driver->phy_tx_done_cb = &tx_done; - buf[0] = 1; - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 3, 0) ){ - return false; - } - - if( 0 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 4, 0) ){ - return false; - } - - buf[0] = 2; - - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 2, 0) ){ - return false; - } - if( 0 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 4, 0) ){ - return false; - } - buf[0] = 0; - if( -1 != rf_driver_storage_stub.registered_driver->arm_net_virtual_rx_cb(&buf, 4, 0) ){ - return false; - } - } - return true; -} - -bool test_virtual_rf_device_register() -{ - rf_driver_storage_stub.int8_value = -1; - if( -1 != virtual_rf_device_register(PHY_LINK_15_4_SUBGHZ_TYPE, 0) ){ - return false; - } - - if( -1 != virtual_rf_device_register(PHY_LINK_15_4_2_4GHZ_TYPE, 0) ){ - return false; - } - - rf_driver_storage_stub.int8_value = 0; - if( 0 != virtual_rf_device_register(PHY_LINK_TUN, 0) ){ - return false; - } - return true; -} - diff --git a/test/nanostack/unittest/mac/virtual_rf_driver/test_virtual_rf_driver.h b/test/nanostack/unittest/mac/virtual_rf_driver/test_virtual_rf_driver.h deleted file mode 100644 index f92c9bd2bd02..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_driver/test_virtual_rf_driver.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_VIRTUAL_RF_DRIVER_H -#define TEST_VIRTUAL_RF_DRIVER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_virtual_rf_device_register(); - -bool test_phy_rf_extension(); - -bool test_phy_rf_address_write(); - -bool test_phy_rf_tx(); - -bool test_phy_rf_state_control(); - -bool test_phy_rf_virtual_rx(); - -bool phy_rf_mlme_orserver_tx(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_VIRTUAL_RF_DRIVER_H - diff --git a/test/nanostack/unittest/mac/virtual_rf_driver/virtual_rf_drivertest.cpp b/test/nanostack/unittest/mac/virtual_rf_driver/virtual_rf_drivertest.cpp deleted file mode 100644 index 17d1e0df0060..000000000000 --- a/test/nanostack/unittest/mac/virtual_rf_driver/virtual_rf_drivertest.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_virtual_rf_driver.h" - -TEST_GROUP(virtual_rf_driver) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(virtual_rf_driver, phy_rf_mlme_orserver_tx) -{ - CHECK(phy_rf_mlme_orserver_tx()); -} - -TEST(virtual_rf_driver, test_phy_rf_extension) -{ - CHECK(test_phy_rf_extension()); -} - -TEST(virtual_rf_driver, test_phy_rf_address_write) -{ - CHECK(test_phy_rf_address_write()); -} - -TEST(virtual_rf_driver, test_phy_rf_tx) -{ - CHECK(test_phy_rf_tx()); -} - -TEST(virtual_rf_driver, test_phy_rf_state_control) -{ - CHECK(test_phy_rf_state_control()); -} - -TEST(virtual_rf_driver, test_phy_rf_virtual_rx) -{ - CHECK(test_phy_rf_virtual_rx()); -} - -//Must be last test -TEST(virtual_rf_driver, test_virtual_rf_device_register) -{ - CHECK(test_virtual_rf_device_register()); -} - diff --git a/test/nanostack/unittest/makefile_defines.txt b/test/nanostack/unittest/makefile_defines.txt deleted file mode 100755 index e413b5b7dc98..000000000000 --- a/test/nanostack/unittest/makefile_defines.txt +++ /dev/null @@ -1,55 +0,0 @@ -#--- Inputs ----# -CPPUTEST_HOME = /usr -CPPUTEST_USE_EXTENSIONS = Y -CPPUTEST_USE_VPATH = Y -CPPUTEST_USE_GCOV = Y -CPP_PLATFORM = gcc - -INCLUDE_DIRS =\ - .\ - ../common\ - ../../stub\ - ../../../../../../nanostack/source/6LoWPAN/Thread/\ - ../../../../../../nanostack/source/6LoWPAN/Mesh/\ - ../../../../../../nanostack/source/\ - ../../../../../../nanostack/source/Core/include/\ - ../../../../../../nanostack/source/Common_Protocols/\ - ../../../../../../nanostack/source/Security/Common/\ - ../../../../../../nanostack/source/Service_Libs/blacklist/\ - ../../../../../../nanostack/source/Service_Libs/etx/\ - ../../../../../../nanostack/source/Service_Libs/load_balance/\ - ../../../../../../nanostack/source/Service_Libs/utils/\ - ../../../../../../nanostack/source/Service_Libs/mdns/\ - ../../../../../../nanostack/source/Service_Libs/mdns/fnet/fnet_stack\ - ../../../../../../nanostack/source/Service_Libs/mdns/fnet/fnet_stack/stack\ - ../../../../../../nanostack/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns\ - ../../../../../../nanostack/source/MLE/\ - ../../../../../../nanostack/source/MAC/\ - ../../../../../../nanostack/source/MAC/IEEE802_15_4/\ - ../../../../../../nanostack/source/MAC/ethernet/\ - ../../../../../../nanostack/source/6LoWPAN/MAC/\ - ../../../../../../nanostack/nanostack/\ - ../../../../../../libService/libService/\ - ../../../../../../coap-service/coap-service/\ - ../../../../../../mbed-coap/mbed-coap/\ - ../../../../../../mbed-coap/\ - ../../../../../../coap-service/source/include/\ - ../../../../../../libService/exported-libs/mbed-client-libservice/mbed-client-libservice/\ - ../../../../../../libService/exported-libs/mbed-client-randlib/mbed-client-randlib/\ - ../../../../../../libService/exported-libs/mbed-trace/\ - ../../../../../../coap-service/coap-service/\ - ../../../../../../event-loop/nanostack-event-loop/\ - ../../../../../../event-loop/source/ \ - ../../../../../../mbedtls/include/ \ - ../../../../../../nsdl-c/nsdl-c/ \ - /usr/include\ - $(CPPUTEST_HOME)/include\ - -CPPUTESTFLAGS = -D__thumb2__ -w -CPPUTEST_CFLAGS += -std=gnu99 - -#if you need to use -std=c++11 or c++0x you need to uncomment this -#CPPUTESTFLAGS += -DCPPUTEST_STD_CPP_LIB_DISABLED -#CPPUTEST_CXXFLAGS += -std=gnu++0x - -CPPUTEST_CFLAGS += -DNSCONFIG=generic diff --git a/test/nanostack/unittest/mle/mle/Makefile b/test/nanostack/unittest/mle/mle/Makefile deleted file mode 100644 index eab75ecf64a7..000000000000 --- a/test/nanostack/unittest/mle/mle/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mle_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MLE/mle.c - -TEST_SRC_FILES = \ - main.cpp \ - mle_test.cpp \ - test_mle.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/adaptation_interface_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/address_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mle_tlv_stub.c \ - ../../stub/event_stub.c \ - ../../stub/system_timer_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mle/mle/main.cpp b/test/nanostack/unittest/mle/mle/main.cpp deleted file mode 100644 index 0ecde5edcf99..000000000000 --- a/test/nanostack/unittest/mle/mle/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mle); - diff --git a/test/nanostack/unittest/mle/mle/mle_test.cpp b/test/nanostack/unittest/mle/mle/mle_test.cpp deleted file mode 100644 index 6ebed31be56d..000000000000 --- a/test/nanostack/unittest/mle/mle/mle_test.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mle.h" - - -TEST_GROUP(mle) -{ - void setup() - { - - } - - void teardown() - { - } -}; - -TEST(mle, test_mle_class_deallocate) -{ - CHECK(test_mle_class_deallocate()); -} - -TEST(mle, test_mle_class_list_clean) -{ - CHECK(test_mle_class_list_clean()); -} - - - -TEST(mle, test_mle_class_mode_set) -{ - CHECK(test_mle_class_mode_set()); -} - -TEST(mle, test_mle_class_get_entry_by_ll64) -{ - CHECK(test_mle_class_get_entry_by_ll64()); -} - -TEST(mle, test_mle_class_discover_entry_by_ll64) -{ - CHECK(test_mle_class_discover_entry_by_ll64()); -} - - - -TEST(mle, test_mle_class_get_by_link_address) -{ - CHECK(test_mle_class_get_by_link_address()); -} - -TEST(mle, test_mle_class_get_by_device_attribute_id) -{ - CHECK(test_mle_class_get_by_device_attribute_id()); -} - -TEST(mle, test_mle_class_remove_entry) -{ - CHECK(test_mle_class_remove_entry()); -} - - -TEST(mle, test_mle_class_remove_neighbour) -{ - CHECK(test_mle_class_remove_neighbour()); -} -TEST(mle, test_mle_class_free_entry_count_get) -{ - CHECK(test_mle_class_free_entry_count_get()); -} - -TEST(mle, test_mle_class_set_new_key_pending) -{ - CHECK(test_mle_class_set_new_key_pending()); -} - -TEST(mle, test_mle_class_active_list_get) -{ - CHECK(test_mle_class_active_list_get()); -} - -TEST(mle, test_mle_class_active_neigh_counter) -{ - CHECK(test_mle_class_active_neigh_counter()); -} - -TEST(mle, test_mle_refresh_entry_timeout) -{ - CHECK(test_mle_refresh_entry_timeout()); -} - -TEST(mle, test_mle_entry_timeout_update) -{ - CHECK(test_mle_entry_timeout_update()); -} - -TEST(mle, test_mle_general_write_link_layer_framecounter) -{ - CHECK(test_mle_general_write_link_layer_framecounter()); -} - -TEST(mle, test_mle_general_write_source_address) -{ - CHECK(test_mle_general_write_source_address()); -} - - -TEST(mle, test_mle_neigh_entry_frame_counter_update) -{ - CHECK(test_mle_neigh_entry_frame_counter_update()); -} - - -TEST(mle, test_mle_event_handler) -{ - CHECK(test_mle_event_handler()); -} - -//Need to be firts -TEST(mle, test_mle_class_init) -{ - CHECK(test_mle_class_init()); -} - -//Do not add anything after this - - - - - - diff --git a/test/nanostack/unittest/mle/mle/test_mle.c b/test/nanostack/unittest/mle/mle/test_mle.c deleted file mode 100644 index e06714054504..000000000000 --- a/test/nanostack/unittest/mle/mle/test_mle.c +++ /dev/null @@ -1,1060 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "MLE/mle.h" - -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_event_timer.h" -#include "socket_api.h" -#include "Core/include/socket.h" -#include "nsdynmemLIB.h" -#include "ns_trace.h" -#include "string.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/udp.h" -#include "randLIB.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#include "common_functions.h" -#include "MLE/mle_tlv.h" -#include "NWK_INTERFACE/Include/protocol_timer.h" -#include "Common_Protocols/ipv6_constants.h" -#include "Service_Libs/mle_service/mle_service_api.h" -#include "Service_Libs/etx/etx.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "mac_api.h" -#include "6LoWPAN/lowpan_adaptation_interface.h" - -#include "nsdynmemLIB_stub.h" -#include "common_functions_stub.h" -#include "event_stub.h" -#include "mle_tlv_stub.h" -#include "mac_helper_stub.h" -#include "protocol_core_stub.h" - - - -static void tester_mle_entry_user_entry_remove_notify(int8_t interface_id, mle_neigh_table_entry_t *entry_ptr) -{ - -} - -static int8_t tester_mle_entry_link_keep_alive(int8_t interface_id, const uint8_t *mac64) -{ - return 0; -} - -static bool test_interface_is_active = true; - -static bool tester_interface_is_active(int8_t interface_id) { - return test_interface_is_active; -} - - - -bool test_mle_class_deallocate() -{ - nsdynmemlib_stub.returnCounter = 0; - if (-1 != mle_class_deallocate(0) ) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - event_stub.int8_value = 0; - mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(1, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - - if (-1 != mle_class_deallocate(2) ) { - return false; - } - - if (0 != mle_class_deallocate(0) ) { - return false; - } - if (0 != mle_class_deallocate(1) ) { - return false; - } - - return true; -} - -bool test_mle_class_init() -{ - nsdynmemlib_stub.returnCounter = 0; - event_stub.int8_value = -1; - if (-2 != mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - event_stub.int8_value = 0; - if (-2 != mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if (-2 != mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - if (0 != mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if (0 != mle_class_init(0, 60, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 0; - if (-2 != mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - if (0 != mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 0; - if (0 != mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 2; - if (0 != mle_class_init(1, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if (0 != mle_class_init(1, 40, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - mle_class_deallocate(0); - mle_class_deallocate(1); - - return true; -} - - -bool test_mle_class_mode_set() -{ - if (-1 !=mle_class_mode_set(0, MLE_CLASS_ROUTER)) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - if (0 !=mle_class_mode_set(0, MLE_CLASS_ROUTER)) { - return false; - } - mle_class_deallocate(0); - return true; -} - -bool test_mle_class_set_new_key_pending() -{ - uint8_t ll64[16]; - memset(ll64, 0, sizeof(ll64)); - ll64[0] = 0xfe; - ll64[1] = 0x80; - mle_neigh_table_entry_t *mle_entry; - - if (-1 != mle_class_set_new_key_pending(0)) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - if (0 != mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,true); - if (!mle_entry) { - return false; - } - - if (0 !=mle_class_set_new_key_pending(0)) { - return false; - } - - mle_class_deallocate(0); - - return true; -} - -bool test_mle_class_free_entry_count_get() -{ - uint8_t ll64[16]; - memset(ll64, 0, sizeof(ll64)); - ll64[0] = 0xfe; - ll64[1] = 0x80; - mle_neigh_table_entry_t *mle_entry; - - if (0 != mle_class_free_entry_count_get(0)) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - if (0 != mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active)) { - return false; - } - - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,true); - - if (!mle_entry) { - return false; - } - - if (0 == mle_class_free_entry_count_get(0)) { - return false; - } - - mle_class_deallocate(0); - return true; -} - -bool test_mle_class_get_entry_by_ll64() -{ - uint8_t ll64[16]; - memset(ll64, 0, 16); - mle_neigh_table_entry_t *mle_entry; - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,false); - if (mle_entry) { - return false; - } - memset(ll64, 0, 16); - ll64[0] = 0xfe; - ll64[1] = 0x80; - memcpy(&ll64[8], ADDR_SHORT_ADR_SUFFIC, 6); - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,false); - if (mle_entry) { - return false; - } - memset(&ll64[8], 0, 6); - ll64[8] = 0x02; - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,false); - if (mle_entry) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,false); - if (mle_entry) { - return false; - } - - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,true); - if (!mle_entry) { - return false; - } - uint8_t test_tribute = mle_entry->attribute_index; - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,true); - if (!mle_entry || test_tribute != mle_entry->attribute_index) { - return false; - } - - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,false); - if (!mle_entry || test_tribute != mle_entry->attribute_index) { - return false; - } - - for (uint8_t i= 1; i< 32; i++) { - ll64[15] = i; - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,true); - if (!mle_entry ) { - return false; - } - } - - ll64[15] = 33; - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,true); - if (mle_entry ) { - return false; - } - - - mle_class_deallocate(0); - return true; -} - -bool test_mle_class_discover_entry_by_ll64() -{ - uint8_t ll64[16]; - memset(ll64, 0, 16); - mle_neigh_table_entry_t *mle_entry; - mle_entry = mle_class_discover_entry_by_ll64(0,ll64); - if (mle_entry) { - return false; - } - memset(ll64, 0, 16); - ll64[0] = 0xfe; - ll64[1] = 0x80; - memcpy(&ll64[8], ADDR_SHORT_ADR_SUFFIC, 6); - mle_entry = mle_class_discover_entry_by_ll64(0,ll64); - if (mle_entry) { - return false; - } - memset(&ll64[8], 0, 6); - ll64[8] = 0x02; - mle_entry = mle_class_discover_entry_by_ll64(0,ll64); - if (mle_entry) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - - mle_entry = mle_class_discover_entry_by_ll64(0,ll64); - if (mle_entry) { - return false; - } - //add address - mle_entry = mle_class_get_entry_by_ll64(0, 0,ll64 ,true); - - uint8_t test_tribute = mle_entry->attribute_index; - mle_entry = mle_class_discover_entry_by_ll64(0,ll64); - if (!mle_entry || test_tribute != mle_entry->attribute_index) { - return false; - } - - mle_class_deallocate(0); - return true; -} - - - -bool test_mle_class_get_by_link_address() -{ - uint8_t mac64[8]; - uint8_t mac16[2]; - memset(mac64, 0, 8); - memset(mac16, 0, 2); - - if (mle_class_get_by_link_address(0,mac64, ADDR_NONE)) { - return false; - } - - if (mle_class_get_by_link_address(0,mac64, ADDR_802_15_4_LONG)) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - - if (mle_class_get_by_link_address(0,mac64, ADDR_802_15_4_LONG)) { - return false; - } - - mle_class_get_entry_by_mac64(0,0,mac64, true); - - - mle_neigh_table_entry_t *mle_entry = mle_class_get_by_link_address(0,mac64, ADDR_802_15_4_LONG); - if (!mle_entry) { - return false; - } - - mle_entry->short_adr = 0; - common_functions_stub.uint16_value = 0; - mle_entry = mle_class_get_by_link_address(0,mac16, ADDR_802_15_4_SHORT); - if (!mle_entry) { - return false; - } - - mle_entry->short_adr = 1; - common_functions_stub.uint16_value = 2; - mle_entry = mle_class_get_by_link_address(0,mac16, ADDR_802_15_4_SHORT); - if (mle_entry) { - return false; - } - - common_functions_stub.uint16_value = 1; - mle_entry = mle_class_get_by_link_address(0,mac16, ADDR_802_15_4_SHORT); - if (!mle_entry) { - return false; - } - mac64[7] = 1; - if (mle_class_get_by_link_address(0,mac64, ADDR_802_15_4_LONG)) { - return false; - } - mle_class_get_entry_by_mac64(0,0,mac64, true); - - if (!mle_class_get_by_link_address(0,mac64, ADDR_802_15_4_LONG)) { - return false; - } - - - mle_class_deallocate(0); - return true; -} - -bool test_mle_class_get_by_device_attribute_id() -{ - uint8_t mac64_1[8]; - uint8_t mac64_2[8]; - memset(mac64_1, 0, 8); - memset(mac64_2, 0, 8); - mac64_1[7] = 1; - mac64_2[7] = 2; - uint8_t attribute1, attribute2; - if (mle_class_get_by_device_attribute_id(0, 0) ) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - - if (mle_class_get_by_device_attribute_id(0, 0) ) { - return false; - } - - - mle_neigh_table_entry_t *mle_entry = mle_class_get_entry_by_mac64(0,0,mac64_1, true); - attribute1 = mle_entry->attribute_index; - mle_entry = mle_class_get_entry_by_mac64(0,0,mac64_2, true); - attribute2 = mle_entry->attribute_index; - - - if (mle_class_get_by_device_attribute_id(0, 3) ) { - return false; - } - - mle_entry = mle_class_get_by_device_attribute_id(0, attribute1); - if (!mle_entry || memcmp(mle_entry->mac64,mac64_1, 8 ) != 0) { - return false; - } - - mle_entry = mle_class_get_by_device_attribute_id(0, attribute2); - if (!mle_entry || memcmp(mle_entry->mac64,mac64_2, 8 ) != 0) { - return false; - } - - if (mle_class_get_by_device_attribute_id(0, 17) ) { - return false; - } - - mle_class_deallocate(0); - return true; -} - -static bool tester_remove_ok = false; -static mle_neigh_table_entry_t *tester_mle_entry; -static void tester2_mle_entry_user_entry_remove_notify(int8_t interface_id, mle_neigh_table_entry_t *entry_ptr) -{ - if (tester_mle_entry == entry_ptr) { - tester_remove_ok = true; - } -} - - -bool test_mle_class_remove_entry() -{ - uint8_t mac64_1[8]; - uint8_t mac64_2[8]; - memset(mac64_1, 0, 8); - memset(mac64_2, 0, 8); - mac64_1[7] = 1; - mac64_2[7] = 2; - if (-1 != mle_class_remove_entry(0, NULL) ) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester2_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - - if (-2 != mle_class_remove_entry(0, NULL) ) { - return false; - } - - mle_neigh_table_entry_t *mle_entry_1 = mle_class_get_entry_by_mac64(0,0,mac64_1, true); - mle_neigh_table_entry_t *mle_entry_2 = mle_class_get_entry_by_mac64(0,0,mac64_2, true); - tester_mle_entry = mle_entry_1; - tester_remove_ok = false; - - mle_entry_2->short_adr = 1; - - if (0 != mle_class_remove_entry(0, mle_entry_1) ) { - return false; - } - - if (!tester_remove_ok) { - return false; - } - - if (-2 != mle_class_remove_entry(0, mle_entry_1) ) { - return false; - } - - if (mle_class_get_by_link_address(0,mac64_1, ADDR_802_15_4_LONG) ) { - return false; - } - - if (!mle_class_get_by_link_address(0,mac64_2, ADDR_802_15_4_LONG) ) { - return false; - } - - - tester_mle_entry = mle_entry_2; - tester_remove_ok = false; - //SET interface ptr stub - protocol_interface_info_entry_t interface_ptr; - memset(&interface_ptr, 0, sizeof(protocol_interface_info_entry_t)); - - protocol_core_stub.entry_ptr = &interface_ptr; - - if (0 != mle_class_remove_entry(0, mle_entry_2) ) { - protocol_core_stub.entry_ptr = NULL; - return false; - } - - if (!tester_remove_ok) { - protocol_core_stub.entry_ptr = NULL; - return false; - } - - if (-2 != mle_class_remove_entry(0, mle_entry_2) ) { - protocol_core_stub.entry_ptr = NULL; - return false; - } - protocol_core_stub.entry_ptr = NULL; - //Test Indirect free - - - mle_class_deallocate(0); - return true; -} - -bool test_mle_class_remove_neighbour() -{ - uint8_t mac64_1[8]; - uint8_t mac64_2[8]; - uint8_t mac64_3[8]; - memset(mac64_1, 0, 8); - memset(mac64_2, 0, 8); - memset(mac64_3, 0, 8); - mac64_1[7] = 1; - mac64_2[7] = 2; - mac64_3[7] = 3; - uint8_t mac16[2]; - - if (-1 != mle_class_remove_neighbour(0, mac64_1, ADDR_802_15_4_LONG)) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester2_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - - mle_neigh_table_entry_t *mle_entry_1 = mle_class_get_entry_by_mac64(0,0,mac64_1, true); - mle_neigh_table_entry_t *mle_entry_2 = mle_class_get_entry_by_mac64(0,0,mac64_2, true); - mle_neigh_table_entry_t *mle_entry_3 = mle_class_get_entry_by_mac64(0,0,mac64_3, true); - - mle_entry_1->short_adr = 1; - mle_entry_2->short_adr = 2; - mle_entry_3->short_adr = 3; - - //Delete first by MAC16 midle of device - - tester_mle_entry = mle_entry_2; - tester_remove_ok = false; - - common_functions_stub.uint16_value = 2; - if (0 != mle_class_remove_neighbour(0, mac16, ADDR_802_15_4_SHORT) ) { - return false; - } - - if (!tester_remove_ok) { - return false; - } - - if (-2 != mle_class_remove_neighbour(0, mac16, ADDR_802_15_4_SHORT) ) { - return false; - } - - if (!mle_class_get_by_link_address(0,mac64_1, ADDR_802_15_4_LONG) ) { - return false; - } - - if (mle_class_get_by_link_address(0,mac64_2, ADDR_802_15_4_LONG) ) { - return false; - } - - if (!mle_class_get_by_link_address(0,mac64_3, ADDR_802_15_4_LONG) ) { - return false; - } - - tester_mle_entry = mle_entry_1; - tester_remove_ok = false; - - if (0 != mle_class_remove_neighbour(0, mac64_1, ADDR_802_15_4_LONG) ) { - return false; - } - - if (!tester_remove_ok) { - return false; - } - - if (-2 != mle_class_remove_neighbour(0, mac64_1, ADDR_802_15_4_LONG) ) { - return false; - } - - if (mle_class_get_by_link_address(0,mac64_1, ADDR_802_15_4_LONG) ) { - return false; - } - - if (!mle_class_get_by_link_address(0,mac64_3, ADDR_802_15_4_LONG) ) { - return false; - } - - tester_mle_entry = mle_entry_3; - tester_remove_ok = false; - - if (0 != mle_class_remove_neighbour(0, mac64_3, ADDR_802_15_4_LONG) ) { - return false; - } - - if (-2 != mle_class_remove_neighbour(0, mac64_3, ADDR_802_15_4_LONG) ) { - return false; - } - - if (mle_class_get_by_link_address(0,mac64_3, ADDR_802_15_4_LONG) ) { - return false; - } - - - mle_class_deallocate(0); - return true; -} - -bool test_mle_class_active_list_get() -{ - if (mle_class_active_list_get(0) ) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester2_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - if (!mle_class_active_list_get(0)){ - return false; - } - mle_class_deallocate(0); - return true; -} - -bool test_mle_class_active_neigh_counter() -{ - uint8_t mac64_1[8]; - uint8_t mac64_2[8]; - memset(mac64_1, 0, 8); - memset(mac64_2, 0, 8); - - mac64_1[7] = 1; - mac64_2[7] = 2; - - if (0xffff != mle_class_active_neigh_counter(0)) { - return false; - } - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester2_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - - if (0 != mle_class_active_neigh_counter(0)) { - return false; - } - - mle_class_get_entry_by_mac64(0,0,mac64_1, true); - if (1 != mle_class_active_neigh_counter(0)) { - return false; - } - mle_class_get_entry_by_mac64(0,0,mac64_2, true); - if (2 != mle_class_active_neigh_counter(0)) { - return false; - } - - mle_class_deallocate(0); - return true; -} - -bool test_mle_refresh_entry_timeout() -{ - uint8_t mac64_1[8]; - memset(mac64_1, 0, 8); - mac64_1[7] = 1; - - mle_refresh_entry_timeout(0, mac64_1, ADDR_802_15_4_LONG, false); - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester2_mle_entry_user_entry_remove_notify, &tester_mle_entry_link_keep_alive, &tester_interface_is_active); - if (mle_refresh_entry_timeout(0, mac64_1, ADDR_802_15_4_LONG, false) ) { - return false; - } - mle_neigh_table_entry_t * entry1 = mle_class_get_entry_by_mac64(0,0,mac64_1, true); - - if (!mle_refresh_entry_timeout(0, mac64_1, ADDR_802_15_4_LONG, false) ) { - return false; - } - - entry1->handshakeReady = true; - entry1->timeout_rx = 20; - - entry1->ttl = 5; - - mle_neigh_table_entry_t *temp_entry = mle_refresh_entry_timeout(0, mac64_1, ADDR_802_15_4_LONG, false); - if (!temp_entry || temp_entry->ttl != 20) { - return false; - } - entry1->ttl = 3; - temp_entry = mle_refresh_entry_timeout(0, mac64_1, ADDR_802_15_4_LONG, true); - if (!temp_entry || temp_entry->ttl != 3) { - return false; - } - - entry1->ttl = 5; - temp_entry = mle_refresh_entry_timeout(0, mac64_1, ADDR_802_15_4_LONG, true); - if (!temp_entry || temp_entry->ttl != 20) { - return false; - } - - temp_entry->short_adr = 1; - common_functions_stub.uint16_value = 1; - - entry1->ttl = 5; - temp_entry = mle_refresh_entry_timeout(0, mac64_1, ADDR_802_15_4_LONG, true); - if (!temp_entry || temp_entry->ttl != 20) { - return false; - } - - mle_class_deallocate(0); - return true; -} - -bool test_mle_entry_timeout_update() -{ - mle_neigh_table_entry_t temp_entry; - memset(&temp_entry, 0, sizeof(mle_neigh_table_entry_t)); - - - mle_entry_timeout_update(&temp_entry, 0); - if (temp_entry.ttl != 500 /MLE_TIMER_TICKS_SECONDS + 1) { - return false; - } - - mle_entry_timeout_update(&temp_entry, 86401); - if (temp_entry.ttl != 86400 /MLE_TIMER_TICKS_SECONDS + 1) { - return false; - } - - mle_entry_timeout_update(&temp_entry, 200); - if (temp_entry.ttl != 200 /MLE_TIMER_TICKS_SECONDS + 1) { - return false; - } - - temp_entry.ttl = 100; - mle_entry_timeout_refresh(&temp_entry); - if (temp_entry.ttl != 200 /MLE_TIMER_TICKS_SECONDS + 1) { - return false; - } - - return true; -} - -static bool tester2_remove_ok = false; -static mle_neigh_table_entry_t *tester2_mle_entry; -static void tester3_mle_entry_user_entry_remove_notify(int8_t interface_id, mle_neigh_table_entry_t *entry_ptr) -{ - if (tester2_mle_entry == entry_ptr) { - tester2_remove_ok = true; - } -} -static int8_t keep_response = 0; -static int8_t tester2_mle_entry_link_keep_alive(int8_t interface_id, const uint8_t *mac64) -{ - return keep_response; -} - -bool test_mle_event_handler() -{ - uint8_t mac64_1[8]; - memset(mac64_1, 0, 8); - mac64_1[7] = 1; - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester3_mle_entry_user_entry_remove_notify, &tester2_mle_entry_link_keep_alive, &tester_interface_is_active); - - mle_class_mode_set(0, MLE_CLASS_ROUTER); - - mle_neigh_table_entry_t * entry1 = mle_class_get_entry_by_mac64(0,0,mac64_1, true); - - entry1->timeout_rx = 6; - entry1->ttl = 6; - - //Event send - arm_event_s event = { - .receiver = 0, - .sender = 0, - .event_id = 0, - .data_ptr = NULL, - .event_type = 1, - .priority = 0, - }; - eventOS_event_send(&event); - - if (entry1->ttl != 5) { - return false; - } - - test_interface_is_active = false; - - eventOS_event_send(&event); - - if (entry1->ttl != 5) { - return false; - } - - test_interface_is_active = true; - - entry1->ttl = 1; - tester2_remove_ok = false; - tester2_mle_entry = entry1; - eventOS_event_send(&event); - if (!tester2_remove_ok) { - return false; - } - if (mle_class_get_entry_by_mac64(0,0,mac64_1, false)) { - return false; - } - - mle_class_mode_set(0, MLE_CLASS_END_DEVICE); - - entry1 = mle_class_get_entry_by_mac64(0,0,mac64_1, true); - - entry1->ttl = 5; - entry1->priorityFlag = true; - eventOS_event_send(&event); - - if (entry1->ttl != 4) { - return false; - } - - eventOS_event_send(&event); - - if (entry1->ttl != 1) { - return false; - } - - eventOS_event_send(&event); - - if (entry1->ttl != 1) { - return false; - } - - entry1->ttl = 4; - keep_response = -1; - eventOS_event_send(&event); - - if (entry1->ttl != 3) { - return false; - } - - eventOS_event_send(&event); - if (entry1->ttl != 2) { - return false; - } - - eventOS_event_send(&event); - - if (mle_class_get_entry_by_mac64(0,0,mac64_1, false)) { - return false; - } - - entry1 = mle_class_get_entry_by_mac64(0,0,mac64_1, true); - - entry1->ttl = 3; - entry1->priorityFlag = false; - eventOS_event_send(&event); - if (entry1->ttl != 2) { - return false; - } - entry1->ttl = 1; - eventOS_event_send(&event); - if (mle_class_get_entry_by_mac64(0,0,mac64_1, false)) { - return false; - } - - mle_class_mode_set(0, MLE_CLASS_SLEEPY_END_DEVICE); - - entry1 = mle_class_get_entry_by_mac64(0,0,mac64_1, true); - - entry1->ttl = 5; - entry1->priorityFlag = true; - eventOS_event_send(&event); - - if (entry1->ttl != 4) { - return false; - } - - entry1->ttl = 1; - tester2_remove_ok = false; - tester2_mle_entry = entry1; - eventOS_event_send(&event); - if (!tester2_remove_ok) { - return false; - } - if (mle_class_get_entry_by_mac64(0,0,mac64_1, false)) { - return false; - } - - event.event_type = 0; - eventOS_event_send(&event); - - mle_class_deallocate(0); - return true; -} - -bool test_mle_neigh_entry_frame_counter_update() -{ - - protocol_interface_info_entry_t entry; - mle_neigh_table_entry_t entry_temp; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - entry.mac_api = &api; - uint8_t tem_buf[16]; - - entry.mac_parameters->SecurityEnabled = false; - - if (!mle_neigh_entry_frame_counter_update(&entry_temp,tem_buf, 16, &entry, 1)) { - return false; - } - entry.mac_parameters->SecurityEnabled = true; - - mle_tlv_stub.expectedInt = 4; - - if (!mle_neigh_entry_frame_counter_update(&entry_temp,tem_buf, 16, &entry, 1)) { - return false; - } - - mle_tlv_stub.expectedInt = 0; - - if (mle_neigh_entry_frame_counter_update(&entry_temp,tem_buf, 16, &entry, 1)) { - return false; - } - - return true; -} - -bool test_mle_general_write_source_address() -{ - protocol_interface_info_entry_t entry; - mle_neigh_table_entry_t entry_temp; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - entry.mac_api = &api; - uint8_t tem_buf[16]; - uint8_t *ptr1 = tem_buf; - uint8_t *ptr2; - - entry.global_address_available = false; - ptr2 = mle_general_write_source_address(ptr1, &entry); - if (ptr2 != ptr1) { - return false; - } - - entry.global_address_available = true; - mac_helper_stub.uint16_value = 0xffff; - ptr2 = mle_general_write_source_address(ptr1, &entry); - if (ptr2 != ptr1) { - return false; - } - - mac_helper_stub.uint16_value = 0; - ptr2 = mle_general_write_source_address(ptr1, &entry); - if (ptr2 != ptr1 + 4) { - return false; - } - return true; -} - -bool test_mle_general_write_link_layer_framecounter() -{ - protocol_interface_info_entry_t entry; - mle_neigh_table_entry_t entry_temp; - memset(&entry, 0, sizeof(protocol_interface_info_entry_t)); - arm_15_4_mac_parameters_t params; - entry.mac_parameters = ¶ms; - mac_api_t api; - entry.mac_api = &api; - uint8_t tem_buf[16]; - uint8_t *ptr1 = tem_buf; - uint8_t *ptr2; - ptr2 = mle_general_write_link_layer_framecounter(ptr1, &entry); - if (ptr2 != ptr1 + 6) { - return false; - } - - return true; -} - -bool test_mle_class_list_clean() -{ - - uint8_t mac64_1[8]; - memset(mac64_1, 0, 8); - mac64_1[7] = 1; - - if (-1 != mle_class_list_clean(0)) { - return false; - } - - - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - mle_class_init(0, 32, &tester3_mle_entry_user_entry_remove_notify, &tester2_mle_entry_link_keep_alive, &tester_interface_is_active); - - if (0 != mle_class_list_clean(0)) { - return false; - } - - mle_class_get_entry_by_mac64(0,0,mac64_1, true); - if (!mle_class_get_entry_by_mac64(0,0,mac64_1, false)) { - return false; - } - - if (0 != mle_class_list_clean(0)) { - return false; - } - - if (mle_class_get_entry_by_mac64(0,0,mac64_1, false)) { - return false; - } - - - mle_class_deallocate(0); - return true; -} - diff --git a/test/nanostack/unittest/mle/mle/test_mle.h b/test/nanostack/unittest/mle/mle/test_mle.h deleted file mode 100644 index f5dc4fc722d0..000000000000 --- a/test/nanostack/unittest/mle/mle/test_mle.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MLE_H -#define TEST_MLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - -bool test_mle_class_init(); -bool test_mle_class_deallocate(); -bool test_mle_class_mode_set(); -bool test_mle_class_list_clean(); - -bool test_mle_class_get_entry_by_ll64(); -bool test_mle_class_discover_entry_by_ll64(); -bool test_mle_class_get_by_link_address(); -bool test_mle_class_get_by_device_attribute_id(); -bool test_mle_class_remove_entry(); -bool test_mle_class_remove_neighbour(); -bool test_mle_class_active_list_get(); -bool test_mle_class_active_neigh_counter(); -bool test_mle_refresh_entry_timeout(); -bool test_mle_class_set_new_key_pending(); -bool test_mle_class_free_entry_count_get(); - -bool test_mle_entry_timeout_update(); - -bool test_mle_event_handler(); - -bool test_mle_neigh_entry_frame_counter_update(); -bool test_mle_general_write_source_address(); - -bool test_mle_general_write_link_layer_framecounter(); - - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MLE_H - diff --git a/test/nanostack/unittest/mle/mle_tlv/Makefile b/test/nanostack/unittest/mle/mle_tlv/Makefile deleted file mode 100644 index 2d5031157245..000000000000 --- a/test/nanostack/unittest/mle/mle_tlv/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mle_tlv_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/MLE/mle_tlv.c - -TEST_SRC_FILES = \ - main.cpp \ - mle_tlvtest.cpp \ - test_mle_tlv.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/mbed_trace_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/mle/mle_tlv/main.cpp b/test/nanostack/unittest/mle/mle_tlv/main.cpp deleted file mode 100644 index f1ee93c8cfe8..000000000000 --- a/test/nanostack/unittest/mle/mle_tlv/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(mle_tlv); - diff --git a/test/nanostack/unittest/mle/mle_tlv/mle_tlvtest.cpp b/test/nanostack/unittest/mle/mle_tlv/mle_tlvtest.cpp deleted file mode 100644 index f725fe39fcc1..000000000000 --- a/test/nanostack/unittest/mle/mle_tlv/mle_tlvtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_mle_tlv.h" - -TEST_GROUP(mle_tlv) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(mle_tlv, test_mle_message_malformed_check) -{ - CHECK(test_mle_message_malformed_check()); -} - diff --git a/test/nanostack/unittest/mle/mle_tlv/test_mle_tlv.c b/test/nanostack/unittest/mle/mle_tlv/test_mle_tlv.c deleted file mode 100644 index e85761cd92a1..000000000000 --- a/test/nanostack/unittest/mle/mle_tlv/test_mle_tlv.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_mle_tlv.h" -#include - - -bool test_mle_message_malformed_check() -{ - mle_message_malformed_check(NULL, 0); - return true; -} - diff --git a/test/nanostack/unittest/mle/mle_tlv/test_mle_tlv.h b/test/nanostack/unittest/mle/mle_tlv/test_mle_tlv.h deleted file mode 100644 index d04e8488d6c5..000000000000 --- a/test/nanostack/unittest/mle/mle_tlv/test_mle_tlv.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_MLE_TLV_H -#define TEST_MLE_TLV_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_mle_message_malformed_check(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_MLE_TLV_H - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core/Makefile b/test/nanostack/unittest/nwk_interface/protocol_core/Makefile deleted file mode 100644 index 7491271aafc5..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = protocol_core_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/NWK_INTERFACE/protocol_core.c - -TEST_SRC_FILES = \ - main.cpp \ - protocol_coretest.cpp \ - test_protocol_core.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/event_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/address_stub.c \ - ../../stub/neighbor_cache_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/icmpv6_radv_stub.c \ - ../../stub/protocol_timer_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/mac_mcps_sap_stub.c \ - ../../stub/mac_mlme_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/mac_response_handler_stub.c \ - ../../stub/beacon_handler_stub.c \ - ../../stub/cipv6_fragmenter_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/thread_bootstrap_stub.c \ - ../../stub/mld_stub.c \ - ../../stub/mpl_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/lowpan_context_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/ipv6_fragmentation_stub.c \ - ../../stub/adaptation_interface_stub.c \ - ../../stub/security_lib_stub.c \ - ../../stub/pan_blacklist_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/ipv6_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core/main.cpp b/test/nanostack/unittest/nwk_interface/protocol_core/main.cpp deleted file mode 100644 index 5afb6ad387c3..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(protocol_core); - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core/protocol_coretest.cpp b/test/nanostack/unittest/nwk_interface/protocol_core/protocol_coretest.cpp deleted file mode 100644 index aa7b29d054c0..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core/protocol_coretest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_protocol_core.h" - -TEST_GROUP(protocol_core) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(protocol_core, test_set_power_state) -{ - CHECK(test_set_power_state()); -} - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core/test_protocol_core.c b/test/nanostack/unittest/nwk_interface/protocol_core/test_protocol_core.c deleted file mode 100644 index 7ae98ac925ab..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core/test_protocol_core.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_protocol_core.h" -#include - - -bool test_set_power_state() -{ - set_power_state(0); - return true; -} - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core/test_protocol_core.h b/test/nanostack/unittest/nwk_interface/protocol_core/test_protocol_core.h deleted file mode 100644 index fcbad4582e50..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core/test_protocol_core.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PROTOCOL_CORE_H -#define TEST_PROTOCOL_CORE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_set_power_state(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PROTOCOL_CORE_H - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/Makefile b/test/nanostack/unittest/nwk_interface/protocol_core_sleep/Makefile deleted file mode 100644 index 9b20d183ff58..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = protocol_core_sleep_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/NWK_INTERFACE/protocol_core_sleep.c - -TEST_SRC_FILES = \ - main.cpp \ - protocol_core_sleeptest.cpp \ - test_protocol_core_sleep.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/protocol_timer_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/main.cpp b/test/nanostack/unittest/nwk_interface/protocol_core_sleep/main.cpp deleted file mode 100644 index ccf4a51d7104..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(protocol_core_sleep); - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/protocol_core_sleeptest.cpp b/test/nanostack/unittest/nwk_interface/protocol_core_sleep/protocol_core_sleeptest.cpp deleted file mode 100644 index 3d377c24b2ed..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/protocol_core_sleeptest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_protocol_core_sleep.h" - -TEST_GROUP(protocol_core_sleep) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(protocol_core_sleep, test_arm_net_check_enter_deep_sleep_possibility) -{ - CHECK(test_arm_net_check_enter_deep_sleep_possibility()); -} - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/test_protocol_core_sleep.c b/test/nanostack/unittest/nwk_interface/protocol_core_sleep/test_protocol_core_sleep.c deleted file mode 100644 index 5f6577fcf975..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/test_protocol_core_sleep.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_protocol_core_sleep.h" -#include - - -bool test_arm_net_check_enter_deep_sleep_possibility() -{ - arm_net_check_enter_deep_sleep_possibility(); - return true; -} - diff --git a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/test_protocol_core_sleep.h b/test/nanostack/unittest/nwk_interface/protocol_core_sleep/test_protocol_core_sleep.h deleted file mode 100644 index 14fccdfa31db..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_core_sleep/test_protocol_core_sleep.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PROTOCOL_CORE_SLEEP_H -#define TEST_PROTOCOL_CORE_SLEEP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_arm_net_check_enter_deep_sleep_possibility(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PROTOCOL_CORE_SLEEP_H - diff --git a/test/nanostack/unittest/nwk_interface/protocol_stats/Makefile b/test/nanostack/unittest/nwk_interface/protocol_stats/Makefile deleted file mode 100644 index 39182e4eabad..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_stats/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = protocol_stats_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/NWK_INTERFACE/protocol_stats.c - -TEST_SRC_FILES = \ - main.cpp \ - protocol_statstest.cpp \ - test_protocol_stats.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/protocol_core_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/nwk_interface/protocol_stats/main.cpp b/test/nanostack/unittest/nwk_interface/protocol_stats/main.cpp deleted file mode 100644 index b539dde77c60..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_stats/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(protocol_stats); - diff --git a/test/nanostack/unittest/nwk_interface/protocol_stats/protocol_statstest.cpp b/test/nanostack/unittest/nwk_interface/protocol_stats/protocol_statstest.cpp deleted file mode 100644 index fa482289b928..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_stats/protocol_statstest.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_protocol_stats.h" - -TEST_GROUP(protocol_stats) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(protocol_stats, test_protocol_stats_init) -{ - CHECK(test_protocol_stats_init()); -} - -TEST(protocol_stats, test_protocol_stats_update) -{ - CHECK(test_protocol_stats_update()); -} - - diff --git a/test/nanostack/unittest/nwk_interface/protocol_stats/test_protocol_stats.c b/test/nanostack/unittest/nwk_interface/protocol_stats/test_protocol_stats.c deleted file mode 100644 index 6d0022eb1919..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_stats/test_protocol_stats.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_protocol_stats.h" -#include - - -bool test_protocol_stats_init() -{ - protocol_stats_init(); - return true; -} - -bool test_protocol_stats_update() -{ - return true; -} diff --git a/test/nanostack/unittest/nwk_interface/protocol_stats/test_protocol_stats.h b/test/nanostack/unittest/nwk_interface/protocol_stats/test_protocol_stats.h deleted file mode 100644 index 670c3129cd61..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_stats/test_protocol_stats.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PROTOCOL_STATS_H -#define TEST_PROTOCOL_STATS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_protocol_stats_init(); - -bool test_protocol_stats_update(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PROTOCOL_STATS_H - diff --git a/test/nanostack/unittest/nwk_interface/protocol_timer/Makefile b/test/nanostack/unittest/nwk_interface/protocol_timer/Makefile deleted file mode 100644 index 2da7aaece6b0..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_timer/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = protocol_timer_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/NWK_INTERFACE/protocol_timer.c - -TEST_SRC_FILES = \ - main.cpp \ - protocol_timertest.cpp \ - test_protocol_timer.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/platform_stub.c \ - ../../stub/event_stub.c \ - ../../stub/ns_timer_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/nwk_interface/protocol_timer/main.cpp b/test/nanostack/unittest/nwk_interface/protocol_timer/main.cpp deleted file mode 100644 index 961047d5a4d0..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_timer/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(protocol_timer); - diff --git a/test/nanostack/unittest/nwk_interface/protocol_timer/protocol_timertest.cpp b/test/nanostack/unittest/nwk_interface/protocol_timer/protocol_timertest.cpp deleted file mode 100644 index 6d2989aa1f39..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_timer/protocol_timertest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_protocol_timer.h" - -TEST_GROUP(protocol_timer) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(protocol_timer, test_protocol_timer_init) -{ - CHECK(test_protocol_timer_init()); -} - diff --git a/test/nanostack/unittest/nwk_interface/protocol_timer/test_protocol_timer.c b/test/nanostack/unittest/nwk_interface/protocol_timer/test_protocol_timer.c deleted file mode 100644 index 2a799976f6df..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_timer/test_protocol_timer.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_protocol_timer.h" -#include - - -bool test_protocol_timer_init() -{ - protocol_timer_init(); - return true; -} - diff --git a/test/nanostack/unittest/nwk_interface/protocol_timer/test_protocol_timer.h b/test/nanostack/unittest/nwk_interface/protocol_timer/test_protocol_timer.h deleted file mode 100644 index 566f9580437c..000000000000 --- a/test/nanostack/unittest/nwk_interface/protocol_timer/test_protocol_timer.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PROTOCOL_TIMER_H -#define TEST_PROTOCOL_TIMER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_protocol_timer_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PROTOCOL_TIMER_H - diff --git a/test/nanostack/unittest/rpl/rpl_control/Makefile b/test/nanostack/unittest/rpl/rpl_control/Makefile deleted file mode 100644 index 7f60fe909d68..000000000000 --- a/test/nanostack/unittest/rpl/rpl_control/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = rpl_control_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/RPL/rpl_control.c - -TEST_SRC_FILES = \ - main.cpp \ - rpl_controltest.cpp \ - test_rpl_control.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/rpl_downward_stub.c \ - ../../stub/rpl_upward_stub.c \ - ../../stub/rpl_policy_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/address_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/etx_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - - diff --git a/test/nanostack/unittest/rpl/rpl_control/main.cpp b/test/nanostack/unittest/rpl/rpl_control/main.cpp deleted file mode 100644 index 26683eb1b561..000000000000 --- a/test/nanostack/unittest/rpl/rpl_control/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(rpl_control); - diff --git a/test/nanostack/unittest/rpl/rpl_control/rpl_controltest.cpp b/test/nanostack/unittest/rpl/rpl_control/rpl_controltest.cpp deleted file mode 100644 index 84366b3f6364..000000000000 --- a/test/nanostack/unittest/rpl/rpl_control/rpl_controltest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_rpl_control.h" - -TEST_GROUP(rpl_control) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(rpl_control, test_rpl_control_fast_timer) -{ - CHECK(test_rpl_control_fast_timer()); -} - diff --git a/test/nanostack/unittest/rpl/rpl_control/test_rpl_control.c b/test/nanostack/unittest/rpl/rpl_control/test_rpl_control.c deleted file mode 100644 index 8b4898158a85..000000000000 --- a/test/nanostack/unittest/rpl/rpl_control/test_rpl_control.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_rpl_control.h" -#include - - -bool test_rpl_control_fast_timer() -{ - rpl_control_fast_timer(0); - return true; -} - diff --git a/test/nanostack/unittest/rpl/rpl_control/test_rpl_control.h b/test/nanostack/unittest/rpl/rpl_control/test_rpl_control.h deleted file mode 100644 index b3e2c3a707dd..000000000000 --- a/test/nanostack/unittest/rpl/rpl_control/test_rpl_control.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_RPL_CONTROL_H -#define TEST_RPL_CONTROL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_rpl_control_fast_timer(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_RPL_CONTROL_H - diff --git a/test/nanostack/unittest/rpl/rpl_data/Makefile b/test/nanostack/unittest/rpl/rpl_data/Makefile deleted file mode 100644 index fb81b1992518..000000000000 --- a/test/nanostack/unittest/rpl/rpl_data/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = rpl_data_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/RPL/rpl_data.c - -TEST_SRC_FILES = \ - main.cpp \ - rpl_datatest.cpp \ - test_rpl_data.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/address_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/rpl_policy_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/ipv6_resolution_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/rpl_downward_stub.c \ - ../../stub/rpl_upward_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/rpl/rpl_data/main.cpp b/test/nanostack/unittest/rpl/rpl_data/main.cpp deleted file mode 100644 index e9d187c321c3..000000000000 --- a/test/nanostack/unittest/rpl/rpl_data/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(rpl_data); - diff --git a/test/nanostack/unittest/rpl/rpl_data/rpl_datatest.cpp b/test/nanostack/unittest/rpl/rpl_data/rpl_datatest.cpp deleted file mode 100644 index d86321966fad..000000000000 --- a/test/nanostack/unittest/rpl/rpl_data/rpl_datatest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_rpl_data.h" - -TEST_GROUP(rpl_data) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(rpl_data, test_rpl_data_init) -{ - CHECK(test_rpl_data_init()); -} - diff --git a/test/nanostack/unittest/rpl/rpl_data/test_rpl_data.c b/test/nanostack/unittest/rpl/rpl_data/test_rpl_data.c deleted file mode 100644 index 6b860e071f9d..000000000000 --- a/test/nanostack/unittest/rpl/rpl_data/test_rpl_data.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_rpl_data.h" -#include - - -bool test_rpl_data_init() -{ - rpl_data_init(); - return true; -} - diff --git a/test/nanostack/unittest/rpl/rpl_data/test_rpl_data.h b/test/nanostack/unittest/rpl/rpl_data/test_rpl_data.h deleted file mode 100644 index 45c759ef162a..000000000000 --- a/test/nanostack/unittest/rpl/rpl_data/test_rpl_data.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_RPL_DATA_H -#define TEST_RPL_DATA_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_rpl_data_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_RPL_DATA_H - diff --git a/test/nanostack/unittest/rpl/rpl_downward/Makefile b/test/nanostack/unittest/rpl/rpl_downward/Makefile deleted file mode 100644 index 86340b8ef28d..000000000000 --- a/test/nanostack/unittest/rpl/rpl_downward/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = rpl_downward_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/RPL/rpl_downward.c - -TEST_SRC_FILES = \ - main.cpp \ - rpl_downwardtest.cpp \ - test_rpl_downward.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/rpl_policy_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/rpl_upward_stub.c \ - ../../stub/rpl_data_stub.c \ - ../../stub/address_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/ip6tos_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_RPL - diff --git a/test/nanostack/unittest/rpl/rpl_downward/main.cpp b/test/nanostack/unittest/rpl/rpl_downward/main.cpp deleted file mode 100644 index fedfbca3ead3..000000000000 --- a/test/nanostack/unittest/rpl/rpl_downward/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(rpl_downward); - diff --git a/test/nanostack/unittest/rpl/rpl_downward/rpl_downwardtest.cpp b/test/nanostack/unittest/rpl/rpl_downward/rpl_downwardtest.cpp deleted file mode 100644 index 5736678fc2b3..000000000000 --- a/test/nanostack/unittest/rpl/rpl_downward/rpl_downwardtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_rpl_downward.h" - -TEST_GROUP(rpl_downward) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(rpl_downward, test_rpl_downward_dao_slow_timer) -{ - CHECK(test_rpl_downward_dao_slow_timer()); -} - diff --git a/test/nanostack/unittest/rpl/rpl_downward/test_rpl_downward.c b/test/nanostack/unittest/rpl/rpl_downward/test_rpl_downward.c deleted file mode 100644 index 931898dc522e..000000000000 --- a/test/nanostack/unittest/rpl/rpl_downward/test_rpl_downward.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_rpl_downward.h" -#include - -#include "RPL/rpl_control.h" -#include "RPL/rpl_upward.h" -#include "RPL/rpl_structures.h" - -bool test_rpl_downward_dao_slow_timer() -{ - rpl_downward_dao_slow_timer(NULL, 0); - - return true; -} - diff --git a/test/nanostack/unittest/rpl/rpl_downward/test_rpl_downward.h b/test/nanostack/unittest/rpl/rpl_downward/test_rpl_downward.h deleted file mode 100644 index 35232d67e7be..000000000000 --- a/test/nanostack/unittest/rpl/rpl_downward/test_rpl_downward.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_RPL_DOWNWARD_H -#define TEST_RPL_DOWNWARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_rpl_downward_dao_slow_timer(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_RPL_DOWNWARD_H - diff --git a/test/nanostack/unittest/rpl/rpl_mrhof/Makefile b/test/nanostack/unittest/rpl/rpl_mrhof/Makefile deleted file mode 100644 index 7742d2ea3db5..000000000000 --- a/test/nanostack/unittest/rpl/rpl_mrhof/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = rpl_mrhof_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/RPL/rpl_mrhof.c - -TEST_SRC_FILES = \ - main.cpp \ - rpl_mrhoftest.cpp \ - test_rpl_mrhof.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/rpl_policy_stub.c \ - ../../stub/rpl_downward_stub.c \ - ../../stub/rpl_upward_stub.c \ - ../../stub/rpl_objective_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/ipv6_resolution_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/rpl/rpl_mrhof/main.cpp b/test/nanostack/unittest/rpl/rpl_mrhof/main.cpp deleted file mode 100644 index 92fe5cf55f4e..000000000000 --- a/test/nanostack/unittest/rpl/rpl_mrhof/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(rpl_mrhof); - diff --git a/test/nanostack/unittest/rpl/rpl_mrhof/rpl_mrhoftest.cpp b/test/nanostack/unittest/rpl/rpl_mrhof/rpl_mrhoftest.cpp deleted file mode 100644 index afb79fbf11bc..000000000000 --- a/test/nanostack/unittest/rpl/rpl_mrhof/rpl_mrhoftest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_rpl_mrhof.h" - -TEST_GROUP(rpl_mrhof) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(rpl_mrhof, test_rpl_mrhof_init) -{ - CHECK(test_rpl_mrhof_init()); -} - diff --git a/test/nanostack/unittest/rpl/rpl_mrhof/test_rpl_mrhof.c b/test/nanostack/unittest/rpl/rpl_mrhof/test_rpl_mrhof.c deleted file mode 100644 index b203154cd06e..000000000000 --- a/test/nanostack/unittest/rpl/rpl_mrhof/test_rpl_mrhof.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_rpl_mrhof.h" -#include - - -bool test_rpl_mrhof_init() -{ - rpl_mrhof_init(); - return true; -} - diff --git a/test/nanostack/unittest/rpl/rpl_mrhof/test_rpl_mrhof.h b/test/nanostack/unittest/rpl/rpl_mrhof/test_rpl_mrhof.h deleted file mode 100644 index 60cf1c7fc969..000000000000 --- a/test/nanostack/unittest/rpl/rpl_mrhof/test_rpl_mrhof.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_RPL_MRHOF_H -#define TEST_RPL_MRHOF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_rpl_mrhof_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_RPL_MRHOF_H - diff --git a/test/nanostack/unittest/rpl/rpl_objective/Makefile b/test/nanostack/unittest/rpl/rpl_objective/Makefile deleted file mode 100644 index 632cb6aaed6f..000000000000 --- a/test/nanostack/unittest/rpl/rpl_objective/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = rpl_objective_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/RPL/rpl_objective.c - -TEST_SRC_FILES = \ - main.cpp \ - rpl_objectivetest.cpp \ - test_rpl_objective.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/rpl_downward_stub.c \ - ../../stub/rpl_upward_stub.c \ - ../../stub/rpl_policy_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/rpl/rpl_objective/main.cpp b/test/nanostack/unittest/rpl/rpl_objective/main.cpp deleted file mode 100644 index c16766b5ae2f..000000000000 --- a/test/nanostack/unittest/rpl/rpl_objective/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(rpl_objective); - diff --git a/test/nanostack/unittest/rpl/rpl_objective/rpl_objectivetest.cpp b/test/nanostack/unittest/rpl/rpl_objective/rpl_objectivetest.cpp deleted file mode 100644 index aeb53d688bcf..000000000000 --- a/test/nanostack/unittest/rpl/rpl_objective/rpl_objectivetest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_rpl_objective.h" - -TEST_GROUP(rpl_objective) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(rpl_objective, test_rpl_objective_lookup) -{ - CHECK(test_rpl_objective_lookup()); -} - diff --git a/test/nanostack/unittest/rpl/rpl_objective/test_rpl_objective.c b/test/nanostack/unittest/rpl/rpl_objective/test_rpl_objective.c deleted file mode 100644 index 8ad34f417fbd..000000000000 --- a/test/nanostack/unittest/rpl/rpl_objective/test_rpl_objective.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_rpl_objective.h" -#include - - -bool test_rpl_objective_lookup() -{ - if( rpl_objective_lookup(0) ) { - return false; - } - return true; -} - diff --git a/test/nanostack/unittest/rpl/rpl_objective/test_rpl_objective.h b/test/nanostack/unittest/rpl/rpl_objective/test_rpl_objective.h deleted file mode 100644 index bc9f14d4846e..000000000000 --- a/test/nanostack/unittest/rpl/rpl_objective/test_rpl_objective.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_RPL_OBJECTIVE_H -#define TEST_RPL_OBJECTIVE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_rpl_objective_lookup(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_RPL_OBJECTIVE_H - diff --git a/test/nanostack/unittest/rpl/rpl_of0/Makefile b/test/nanostack/unittest/rpl/rpl_of0/Makefile deleted file mode 100644 index 510640174f35..000000000000 --- a/test/nanostack/unittest/rpl/rpl_of0/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = rpl_of0_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/RPL/rpl_of0.c - -TEST_SRC_FILES = \ - main.cpp \ - rpl_of0test.cpp \ - test_rpl_of0.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/rpl_downward_stub.c \ - ../../stub/rpl_upward_stub.c \ - ../../stub/rpl_policy_stub.c \ - ../../stub/rpl_objective_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/ipv6_resolution_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/rpl/rpl_of0/main.cpp b/test/nanostack/unittest/rpl/rpl_of0/main.cpp deleted file mode 100644 index 552c2db0d190..000000000000 --- a/test/nanostack/unittest/rpl/rpl_of0/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(rpl_of0); - diff --git a/test/nanostack/unittest/rpl/rpl_of0/rpl_of0test.cpp b/test/nanostack/unittest/rpl/rpl_of0/rpl_of0test.cpp deleted file mode 100644 index 108b2f9c2cae..000000000000 --- a/test/nanostack/unittest/rpl/rpl_of0/rpl_of0test.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_rpl_of0.h" - -TEST_GROUP(rpl_of0) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(rpl_of0, test_rpl_of0_init) -{ - CHECK(test_rpl_of0_init()); -} - diff --git a/test/nanostack/unittest/rpl/rpl_of0/test_rpl_of0.c b/test/nanostack/unittest/rpl/rpl_of0/test_rpl_of0.c deleted file mode 100644 index 86e6828b0680..000000000000 --- a/test/nanostack/unittest/rpl/rpl_of0/test_rpl_of0.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_rpl_of0.h" -#include - - -bool test_rpl_of0_init() -{ - rpl_of0_init(); - return true; -} - diff --git a/test/nanostack/unittest/rpl/rpl_of0/test_rpl_of0.h b/test/nanostack/unittest/rpl/rpl_of0/test_rpl_of0.h deleted file mode 100644 index 13ecd0b4a51d..000000000000 --- a/test/nanostack/unittest/rpl/rpl_of0/test_rpl_of0.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_RPL_OF0_H -#define TEST_RPL_OF0_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_rpl_of0_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_RPL_OF0_H - diff --git a/test/nanostack/unittest/rpl/rpl_policy/Makefile b/test/nanostack/unittest/rpl/rpl_policy/Makefile deleted file mode 100644 index 66a0a3e02116..000000000000 --- a/test/nanostack/unittest/rpl/rpl_policy/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = rpl_policy_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/RPL/rpl_policy.c - -TEST_SRC_FILES = \ - main.cpp \ - rpl_policytest.cpp \ - test_rpl_policy.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/rpl_downward_stub.c \ - ../../stub/rpl_upward_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_resolution_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/rpl/rpl_policy/main.cpp b/test/nanostack/unittest/rpl/rpl_policy/main.cpp deleted file mode 100644 index 91ea56345fda..000000000000 --- a/test/nanostack/unittest/rpl/rpl_policy/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(rpl_policy); - diff --git a/test/nanostack/unittest/rpl/rpl_policy/rpl_policytest.cpp b/test/nanostack/unittest/rpl/rpl_policy/rpl_policytest.cpp deleted file mode 100644 index ff3e7ec7f1c4..000000000000 --- a/test/nanostack/unittest/rpl/rpl_policy/rpl_policytest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_rpl_policy.h" - -TEST_GROUP(rpl_policy) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(rpl_policy, test_rpl_policy_join_instance) -{ - CHECK(test_rpl_policy_join_instance()); -} - diff --git a/test/nanostack/unittest/rpl/rpl_policy/test_rpl_policy.c b/test/nanostack/unittest/rpl/rpl_policy/test_rpl_policy.c deleted file mode 100644 index 20e957451a32..000000000000 --- a/test/nanostack/unittest/rpl/rpl_policy/test_rpl_policy.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_rpl_policy.h" -#include - - -bool test_rpl_policy_join_instance() -{ - rpl_policy_join_instance(NULL, 0, NULL); - return true; -} - diff --git a/test/nanostack/unittest/rpl/rpl_policy/test_rpl_policy.h b/test/nanostack/unittest/rpl/rpl_policy/test_rpl_policy.h deleted file mode 100644 index 9d2acc24240f..000000000000 --- a/test/nanostack/unittest/rpl/rpl_policy/test_rpl_policy.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_RPL_POLICY_H -#define TEST_RPL_POLICY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_rpl_policy_join_instance(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_RPL_POLICY_H - diff --git a/test/nanostack/unittest/rpl/rpl_upward/Makefile b/test/nanostack/unittest/rpl/rpl_upward/Makefile deleted file mode 100644 index eb6bb3a1bacf..000000000000 --- a/test/nanostack/unittest/rpl/rpl_upward/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = rpl_upward_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/RPL/rpl_upward.c - -TEST_SRC_FILES = \ - main.cpp \ - rpl_upwardtest.cpp \ - test_rpl_upward.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/rpl_downward_stub.c \ - ../../stub/rpl_policy_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/rpl_objective_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/ipv6_resolution_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/icmpv6_prefix_stub.c \ - ../../stub/address_stub.c \ - ../../stub/trickle_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/ip6tos_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_RPL - diff --git a/test/nanostack/unittest/rpl/rpl_upward/main.cpp b/test/nanostack/unittest/rpl/rpl_upward/main.cpp deleted file mode 100644 index 80c90e6499ba..000000000000 --- a/test/nanostack/unittest/rpl/rpl_upward/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(rpl_upward); - diff --git a/test/nanostack/unittest/rpl/rpl_upward/rpl_upwardtest.cpp b/test/nanostack/unittest/rpl/rpl_upward/rpl_upwardtest.cpp deleted file mode 100644 index 457d29a8f258..000000000000 --- a/test/nanostack/unittest/rpl/rpl_upward/rpl_upwardtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_rpl_upward.h" - -TEST_GROUP(rpl_upward) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(rpl_upward, test_nrpl_dag_rank) -{ - CHECK(test_nrpl_dag_rank()); -} - diff --git a/test/nanostack/unittest/rpl/rpl_upward/test_rpl_upward.c b/test/nanostack/unittest/rpl/rpl_upward/test_rpl_upward.c deleted file mode 100644 index b23193d7727c..000000000000 --- a/test/nanostack/unittest/rpl/rpl_upward/test_rpl_upward.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_rpl_upward.h" -#include -#include "RPL/rpl_upward.h" -#include "RPL/rpl_control.h" -#include "RPL/rpl_structures.h" - -bool test_nrpl_dag_rank() -{ - rpl_dodag_t inst; - nrpl_dag_rank(&inst, 0); - return true; -} - diff --git a/test/nanostack/unittest/rpl/rpl_upward/test_rpl_upward.h b/test/nanostack/unittest/rpl/rpl_upward/test_rpl_upward.h deleted file mode 100644 index e74921e7a19f..000000000000 --- a/test/nanostack/unittest/rpl/rpl_upward/test_rpl_upward.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_RPL_UPWARD_H -#define TEST_RPL_UPWARD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_nrpl_dag_rank(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_RPL_UPWARD_H - diff --git a/test/nanostack/unittest/security/pana/Makefile b/test/nanostack/unittest/security/pana/Makefile deleted file mode 100644 index 85f672755e85..000000000000 --- a/test/nanostack/unittest/security/pana/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = pana_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Security/PANA/pana.c - -TEST_SRC_FILES = \ - main.cpp \ - panatest.cpp \ - test_pana.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/shalib_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/security_lib_stub.c \ - ../../stub/tls_lib_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/event_stub.c \ - ../../stub/protocol_6lowpan_bootstrap_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/socket_stub.c \ - ../../stub/ccm_security_stub.c \ - ../../stub/address_stub.c \ - ../../stub/nd_router_object_stub.c \ - ../../stub/x509_stub.c \ - ../../stub/ecc_stub.c \ - ../../stub/pana_avp_stub.c \ - ../../stub/pana_header_stub.c \ - ../../stub/eap_protocol_stub.c \ - ../../stub/socket_api_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DPANA - diff --git a/test/nanostack/unittest/security/pana/main.cpp b/test/nanostack/unittest/security/pana/main.cpp deleted file mode 100644 index 3bffb8a6b4d1..000000000000 --- a/test/nanostack/unittest/security/pana/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(pana); - diff --git a/test/nanostack/unittest/security/pana/panatest.cpp b/test/nanostack/unittest/security/pana/panatest.cpp deleted file mode 100644 index 6576bfcedbae..000000000000 --- a/test/nanostack/unittest/security/pana/panatest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_pana.h" - -TEST_GROUP(pana) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(pana, test_pana_socket_init) -{ - CHECK(test_pana_socket_init()); -} - diff --git a/test/nanostack/unittest/security/pana/test_pana.c b/test/nanostack/unittest/security/pana/test_pana.c deleted file mode 100644 index 7d6037391869..000000000000 --- a/test/nanostack/unittest/security/pana/test_pana.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "test_pana.h" -#include - - -bool test_pana_socket_init() -{ - pana_socket_init(NULL, NULL); - return true; -} - diff --git a/test/nanostack/unittest/security/pana/test_pana.h b/test/nanostack/unittest/security/pana/test_pana.h deleted file mode 100644 index ed849fd16630..000000000000 --- a/test/nanostack/unittest/security/pana/test_pana.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PANA_H -#define TEST_PANA_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_pana_socket_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PANA_H - diff --git a/test/nanostack/unittest/security/pana_relay_table/Makefile b/test/nanostack/unittest/security/pana_relay_table/Makefile deleted file mode 100644 index aae5482ab0a4..000000000000 --- a/test/nanostack/unittest/security/pana_relay_table/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = pana_relay_table_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Security/PANA/pana_relay_table.c - -TEST_SRC_FILES = \ - main.cpp \ - pana_relay_tabletest.cpp \ - test_pana_relay_table.c \ - ../../stub/nsdynmemLIB_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DPANA - diff --git a/test/nanostack/unittest/security/pana_relay_table/main.cpp b/test/nanostack/unittest/security/pana_relay_table/main.cpp deleted file mode 100644 index 2f2a5f20b381..000000000000 --- a/test/nanostack/unittest/security/pana_relay_table/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(pana_relay_table); - diff --git a/test/nanostack/unittest/security/pana_relay_table/pana_relay_tabletest.cpp b/test/nanostack/unittest/security/pana_relay_table/pana_relay_tabletest.cpp deleted file mode 100644 index 918adbf9dd4f..000000000000 --- a/test/nanostack/unittest/security/pana_relay_table/pana_relay_tabletest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_pana_relay_table.h" - -TEST_GROUP(pana_relay_table) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(pana_relay_table, test_pana_relay_table_init) -{ - CHECK(test_pana_relay_table_init()); -} - diff --git a/test/nanostack/unittest/security/pana_relay_table/test_pana_relay_table.c b/test/nanostack/unittest/security/pana_relay_table/test_pana_relay_table.c deleted file mode 100644 index 4dc66db6cc91..000000000000 --- a/test/nanostack/unittest/security/pana_relay_table/test_pana_relay_table.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_pana_relay_table.h" -#include - - -bool test_pana_relay_table_init() -{ - pana_relay_table_init(); - return true; -} - diff --git a/test/nanostack/unittest/security/pana_relay_table/test_pana_relay_table.h b/test/nanostack/unittest/security/pana_relay_table/test_pana_relay_table.h deleted file mode 100644 index eaf10abaa640..000000000000 --- a/test/nanostack/unittest/security/pana_relay_table/test_pana_relay_table.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_PANA_RELAY_TABLE_H -#define TEST_PANA_RELAY_TABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_pana_relay_table_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_PANA_RELAY_TABLE_H - diff --git a/test/nanostack/unittest/security/security_lib/Makefile b/test/nanostack/unittest/security/security_lib/Makefile deleted file mode 100644 index 8f397e968029..000000000000 --- a/test/nanostack/unittest/security/security_lib/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = security_lib_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Security/Common/security_lib.c - -TEST_SRC_FILES = \ - main.cpp \ - security_libtest.cpp \ - test_security_lib.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/pana_stub.c \ - ../../stub/pana_server_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/tls_lib_stub.c \ - ../../stub/tls_ccm_crypt_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/shalib_stub.c \ - ../../stub/ccm_security_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/x509_stub.c \ - ../../stub/ecc_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/event_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DPANA - diff --git a/test/nanostack/unittest/security/security_lib/main.cpp b/test/nanostack/unittest/security/security_lib/main.cpp deleted file mode 100644 index 61f2de20e85e..000000000000 --- a/test/nanostack/unittest/security/security_lib/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(security_lib); - diff --git a/test/nanostack/unittest/security/security_lib/security_libtest.cpp b/test/nanostack/unittest/security/security_lib/security_libtest.cpp deleted file mode 100644 index e0cd9b54bdde..000000000000 --- a/test/nanostack/unittest/security/security_lib/security_libtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_security_lib.h" - -TEST_GROUP(security_lib) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(security_lib, test_sec_check_suite_ptrs) -{ - CHECK(test_sec_check_suite_ptrs()); -} - diff --git a/test/nanostack/unittest/security/security_lib/test_security_lib.c b/test/nanostack/unittest/security/security_lib/test_security_lib.c deleted file mode 100644 index 27e08c40362c..000000000000 --- a/test/nanostack/unittest/security/security_lib/test_security_lib.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "test_security_lib.h" -#include -#include -#include "Core/include/ns_buffer.h" -#include "Security/Common/sec_lib.h" - -bool test_sec_check_suite_ptrs() -{ - sec_suite_t suite; - memset(&suite, 0,sizeof(sec_suite_t)); - if( 0 != sec_check_suite_ptrs(&suite) ) { - return false; - } - return true; -} - diff --git a/test/nanostack/unittest/security/security_lib/test_security_lib.h b/test/nanostack/unittest/security/security_lib/test_security_lib.h deleted file mode 100644 index cac48fd69935..000000000000 --- a/test/nanostack/unittest/security/security_lib/test_security_lib.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_SECURITY_LIB_H -#define TEST_SECURITY_LIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_sec_check_suite_ptrs(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_SECURITY_LIB_H - diff --git a/test/nanostack/unittest/security/tls_lib/Makefile b/test/nanostack/unittest/security/tls_lib/Makefile deleted file mode 100644 index bbaa1ab45392..000000000000 --- a/test/nanostack/unittest/security/tls_lib/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = tls_lib_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Security/TLS/tls_lib.c - -TEST_SRC_FILES = \ - main.cpp \ - tls_libtest.cpp \ - test_tls_lib.c \ - ../../stub/ccm_security_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/buffer_dyn_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_sha256_stub.c \ - ../../stub/shalib_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/security_lib_stub.c \ - ../../stub/tls_ccm_crypt_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/pana_stub.c \ - ../../stub/x509_stub.c \ - ../../stub/ecc_stub.c \ - ../../stub/ecdsa_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DPANA - diff --git a/test/nanostack/unittest/security/tls_lib/main.cpp b/test/nanostack/unittest/security/tls_lib/main.cpp deleted file mode 100644 index ee2b65dfc05c..000000000000 --- a/test/nanostack/unittest/security/tls_lib/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(tls_lib); - diff --git a/test/nanostack/unittest/security/tls_lib/test_tls_lib.c b/test/nanostack/unittest/security/tls_lib/test_tls_lib.c deleted file mode 100644 index faf83ae8217c..000000000000 --- a/test/nanostack/unittest/security/tls_lib/test_tls_lib.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "test_tls_lib.h" -#include - - -bool test_amr_tls_session_allocate() -{ - amr_tls_session_allocate(); - return true; -} - diff --git a/test/nanostack/unittest/security/tls_lib/test_tls_lib.h b/test/nanostack/unittest/security/tls_lib/test_tls_lib.h deleted file mode 100644 index 19432dcec2d3..000000000000 --- a/test/nanostack/unittest/security/tls_lib/test_tls_lib.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_TLS_LIB_H -#define TEST_TLS_LIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_amr_tls_session_allocate(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_TLS_LIB_H - diff --git a/test/nanostack/unittest/security/tls_lib/tls_libtest.cpp b/test/nanostack/unittest/security/tls_lib/tls_libtest.cpp deleted file mode 100644 index da7872f47654..000000000000 --- a/test/nanostack/unittest/security/tls_lib/tls_libtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_tls_lib.h" - -TEST_GROUP(tls_lib) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(tls_lib, test_amr_tls_session_allocate) -{ - CHECK(test_amr_tls_session_allocate()); -} - diff --git a/test/nanostack/unittest/service_libs/SHA256_Lib/Makefile b/test/nanostack/unittest/service_libs/SHA256_Lib/Makefile deleted file mode 100644 index e954699a51db..000000000000 --- a/test/nanostack/unittest/service_libs/SHA256_Lib/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = sha256_unit - -SRC_FILES = \ - ../../../../../source/Service_Libs/SHA256_Lib/ns_sha256.c - -# use GCC by default, but allow it to be overridden -ifndef $(CC) - CC = gcc -endif - -TEST_SRC_FILES = \ - main.cpp \ - shalibtest.cpp \ - test_shalib.c \ - -include ../../MakefileWorker.mk - -LD_LIBRARIES += \ - ../../../../../../libService/$(addsuffix _$(CC), libservice).a diff --git a/test/nanostack/unittest/service_libs/SHA256_Lib/main.cpp b/test/nanostack/unittest/service_libs/SHA256_Lib/main.cpp deleted file mode 100644 index b0fa656f5b6b..000000000000 --- a/test/nanostack/unittest/service_libs/SHA256_Lib/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(shalib); - diff --git a/test/nanostack/unittest/service_libs/SHA256_Lib/shalibtest.cpp b/test/nanostack/unittest/service_libs/SHA256_Lib/shalibtest.cpp deleted file mode 100644 index 365a82dbbdd7..000000000000 --- a/test/nanostack/unittest/service_libs/SHA256_Lib/shalibtest.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "CppUTest/TestHarness.h" -#include "test_shalib.h" - -TEST_GROUP(shalib) -{ - void setup() { - } - - void teardown() { - } -}; - -TEST(shalib, test_sha256_test_vectors_1) -{ - CHECK(test_sha256_test_vectors_1()); -} - -TEST(shalib, test_sha256_test_vectors_2) -{ - CHECK(test_sha256_test_vectors_2()); -} -TEST(shalib, test_sha256_test_vectors_3) -{ - CHECK(test_sha256_test_vectors_3()); -} - -TEST(shalib, test_sha256_test_vectors_4) -{ - CHECK(test_sha256_test_vectors_4()); -} diff --git a/test/nanostack/unittest/service_libs/SHA256_Lib/test_shalib.c b/test/nanostack/unittest/service_libs/SHA256_Lib/test_shalib.c deleted file mode 100644 index 340979bd5f21..000000000000 --- a/test/nanostack/unittest/service_libs/SHA256_Lib/test_shalib.c +++ /dev/null @@ -1,816 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "test_shalib.h" -#include "common_functions.h" -#include -#include -#include -#include - -#include "ns_sha256.h" - -/* Test vectors from NESSIE: https://www.cosic.esat.kuleuven.be/nessie/ */ - -typedef struct vec1 -{ - const char *input; - uint32_t count; - uint64_t expected[4]; -} vec1_t; - -static const vec1_t s1v[] = { - { "", 1, - { 0xE3B0C44298FC1C14, 0x9AFBF4C8996FB924, 0x27AE41E4649B934C, 0xA495991B7852B855 } }, - { "a", 1, - { 0xCA978112CA1BBDCA, 0xFAC231B39A23DC4D, 0xA786EFF8147C4E72, 0xB9807785AFEE48BB } }, - { "abc", 1, - { 0xBA7816BF8F01CFEA, 0x414140DE5DAE2223, 0xB00361A396177A9C, 0xB410FF61F20015AD } }, - { "message digest", 1, - { 0xF7846F55CF23E14E, 0xEBEAB5B4E1550CAD, 0x5B509E3348FBC4EF, 0xA3A1413D393CB650 } }, - { "abcdefghijklmnopqrstuvwxyz", 1, - { 0x71C480DF93D6AE2F, 0x1EFAD1447C66C952, 0x5E316218CF51FC8D, 0x9ED832F2DAF18B73 } }, - { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 1, - { 0x248D6A61D20638B8, 0xE5C026930C3E6039, 0xA33CE45964FF2167, 0xF6ECEDD419DB06C1 } }, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 1, - { 0xDB4BFCBD4DA0CD85, 0xA60C3C37D3FBD880, 0x5C77F15FC6B1FDFE, 0x614EE0A7C8FDB4C0 } }, - { "1234567890", 8, - { 0xF371BC4A311F2B00, 0x9EEF952DD83CA80E, 0x2B60026C8E935592, 0xD0F9C308453C813E } }, - { "a", 1000000, - { 0xCDC76E5C9914FB92, 0x81A1C7E284D73E67, 0xF1809A48A497200E, 0x046D39CCC7112CD0 } } -}; - -static const uint64_t s2v[128][4] = { - { 0xE3B0C44298FC1C14, 0x9AFBF4C8996FB924, 0x27AE41E4649B934C, 0xA495991B7852B855 }, /* Empty data */ - { 0x6E340B9CFFB37A98, 0x9CA544E6BB780A2C, 0x78901D3FB3373876, 0x8511A30617AFA01D }, /* 1 zero byte */ - { 0x96A296D224F285C6, 0x7BEE93C30F8A3091, 0x57F0DAA35DC5B87E, 0x410B78630A09CFC7 }, /* 2 zero bytes... */ - { 0x709E80C88487A241, 0x1E1EE4DFB9F22A86, 0x1492D20C4765150C, 0x0C794ABD70F8147C }, - { 0xDF3F619804A92FDB, 0x4057192DC43DD748, 0xEA778ADC52BC498C, 0xE80524C014B81119 }, - { 0x8855508AADE16EC5, 0x73D21E6A485DFD0A, 0x7624085C1A14B5EC, 0xDD6485DE0C6839A4 }, - { 0xB0F66ADC83641586, 0x656866813FD9DD0B, 0x8EBB63796075661B, 0xA45D1AA8089E1D44 }, - { 0x837885C8F8091AEA, 0xEB9EC3C3F85A6FF4, 0x70A415E610B8BA3E, 0x49F9B33C9CF9D619 }, - { 0xAF5570F5A1810B7A, 0xF78CAF4BC70A660F, 0x0DF51E42BAF91D4D, 0xE5B2328DE0E83DFC }, - { 0x3E7077FD2F66D689, 0xE0CEE6A7CF5B37BF, 0x2DCA7C979AF356D0, 0xA31CBC5C85605C7D }, - { 0x01D448AFD9280654, 0x58CF670B60F5A594, 0xD735AF0172C8D67F, 0x22A81680132681CA }, - { 0x71B6C1D53832F789, 0xA7F2435A7C629245, 0xFA3761AD8487775E, 0xBF4957330213A706 }, - { 0x15EC7BF0B50732B4, 0x9F8228E07D243653, 0x38F9E3AB994B00AF, 0x08E5A3BFFE55FD8B }, - { 0xDD46C3EEBB1884FF, 0x3B5258C0A2FC9398, 0xE560A29E0780D4B5, 0x3869B6254AA46A96 }, - { 0xE7ECEBBC590BC88B, 0x3761FA6CD03D749F, 0x87463DABB67021A5, 0xC6768C25EC68B3F2 }, - { 0x5322FECFC92A5E32, 0x48A297A3DF3EDDFB, 0x9BD9049504272E4F, 0x572B87FA36D4B3BD }, - { 0x374708FFF7719DD5, 0x979EC875D56CD228, 0x6F6D3CF7EC317A3B, 0x25632AAB28EC37BB }, - { 0x0A88111852095CAE, 0x045340EA1F0B2799, 0x44B2A756A213D9B5, 0x0107D7489771E159 }, - { 0x60DAA3A5F7DBFA20, 0x0F8C82840ECF5B42, 0x640B70F3B7218A4C, 0x6BBD67DB542E75A4 }, - { 0xD6FD62F5CE537D90, 0xEA3EA45841B17F34, 0xD727BCBC4128748C, 0xBA14FB87C0FFD9D1 }, - { 0xDE47C9B27EB8D300, 0xDBB5F2C353E632C3, 0x93262CF06340C4FA, 0x7F1B40C4CBD36F90 }, - { 0xC90232586B801F95, 0x58A76F2F963ECCD8, 0x31D9FE6775E4C8F1, 0x446B2331AA2132F2 }, - { 0x6A4875DDACEAA91F, 0xB3369F0F6D962F77, 0x442DAF1B1D977334, 0x57D12BCABDF79441 }, - { 0x015275E61FA0D075, 0x1C1D9F45541C7804, 0xC895404455470710, 0xADE3786F282F2DA0 }, - { 0x9D908ECFB6B256DE, 0xF8B49A7C504E6C88, 0x9C4B0E41FE6CE3E0, 0x1863DD7B61A20AA0 }, - { 0x61126DE1B795B976, 0xF3AC878F48E88FA7, 0x7A87D7308BA57C76, 0x42B9E1068403A496 }, - { 0x659D36CA563BA462, 0x2DAABB36A71DAFAF, 0x6060CDCBF89BB12E, 0x75426198496D272C }, - { 0xEA49AA9F6F6CF2D5, 0x3D454E628BA5A339, 0xCC000230C4651655, 0xD0237711D747F50B }, - { 0x3ADDFB141CD7C9C4, 0xC6543A82191A3707, 0xAC29C7A041217782, 0xE61D4D91C691AEE8 }, - { 0x11E431C215C5BD33, 0x4CECBD43148274ED, 0xF3FFDBD6CD6479FE, 0x279577FBE5F52CE6 }, - { 0x0679246D6C4216DE, 0x0DAA08E5523FB267, 0x4DB2B6599C3B72FF, 0x946B488A15290B62 }, - { 0xFD08BE957BDA07DC, 0x529AD8100DF732F9, 0xCE12AE3E42BCDA6A, 0xCABE12C02DFD6989 }, - { 0x66687AADF862BD77, 0x6C8FC18B8E9F8E20, 0x089714856EE233B3, 0x902A591D0D5F2925 }, - { 0x7F9C9E31AC8256CA, 0x2F258583DF262DBC, 0x7D6F68F2A03043D5, 0xC99A4AE5A7396CE9 }, - { 0xEB142B0CAE0BAA72, 0xA767EBC0823D1BE9, 0x4E14C5BFC52D8E41, 0x7FC4302FCEB6240C }, - { 0x0D5535E13CC9708D, 0x0FF0289AF2FAE27E, 0x564B6BCBCD9242F5, 0x140D96957744A517 }, - { 0x6DB65FD59FD356F6, 0x729140571B5BCD6B, 0xB3B83492A16E1BF0, 0xA3884442FC3C8A0E }, - { 0xAB24A95F44CECA5D, 0x2AED4B6D056ADDDD, 0x8539F44C6CD6CA50, 0x6534E830C82EA8A8 }, - { 0x762B023699A0E48A, 0xA95763F0CF7C0467, 0xF1D6E9880308C78E, 0xBBC1C423DE7072D3 }, - { 0x94C11ED3C3C73016, 0xADB92416352678E1, 0x69CBE47BB48BC27E, 0x5E9D466115B06252 }, - { 0x2C34CE1DF23B838C, 0x5ABF2A7F6437CCA3, 0xD3067ED509FF25F1, 0x1DF6B11B582B51EB }, - { 0x9E1736C43D19118E, 0x6CE4302118AF3371, 0x09491ECC52757DFB, 0x949BAD6A7940B0C2 }, - { 0x094C4931FDB2F2AF, 0x417C9E0322A97160, 0x06E8211FE9017F67, 0x1AC6E3251300ACCA }, - { 0x859732B97382A085, 0x83D6A67F58424865, 0x05E50BEE754BD9B5, 0x7AC3ABF81B9714F2 }, - { 0x85759B3811FF7DC4, 0x7B03792AC85317BE, 0x51431A3F9E01DCAF, 0xCE317ED736A391B0 }, - { 0x8A1020634191C27B, 0x63D3C2AA45B723F6, 0x96DDF2743CA8996A, 0x33ED0E47DDD7FC07 }, - { 0x878F32F76B159494, 0xF5A39F9321616C60, 0x68CDB82E88DF89BC, 0xC739BBC1EA78E1F9 }, - { 0x140EDA45FE001C0F, 0xE47EDD7FC509FF18, 0x82D46FBCB7C7437D, 0x893C1FB83012E433 }, - { 0x17B0761F87B081D5, 0xCF10757CCC89F12B, 0xE355C70E2E29DF28, 0x8B65B30710DCBCD1 }, - { 0x78877FA898F0B4C4, 0x5C9C33AE941E4061, 0x7AD7C8657A307DB6, 0x2BC5691F92F4F60E }, - { 0xCC2786E1F9910A9D, 0x811400EDCDDAF707, 0x5195F7A16B216DCB, 0xEFBA3BC7C4F2AE51 }, - { 0x8E8FE47E4A33B178, 0xBF0433D8050CB0AD, 0x7EC323FBDEEAB3EC, 0xFD857B4CE1805B7A }, - { 0x7955CB2DE90DD9EF, 0xC6DF9FDBF5F5D10C, 0x114F4135A9A6B52D, 0xB1003BE749E32F7A }, - { 0x353FD628B7F6E7D4, 0x26E5D6A27D1BC3AC, 0x22FA7F812E7594CF, 0x2EC5CA1175785B50 }, - { 0xEA659CDC838619B3, 0x767C057FDF8E6D99, 0xFDE2680C5D8517EB, 0x06761C0878D40C40 }, - { 0x02779466CDEC1638, 0x11D078815C633F21, 0x901413081449002F, 0x24AA3E80F0B88EF7 }, - { 0xD4817AA5497628E7, 0xC77E6B606107042B, 0xBBA3130888C5F47A, 0x375E6179BE789FBB }, - { 0x65A16CB7861335D5, 0xACE3C60718B5052E, 0x44660726DA4CD13B, 0xB745381B235A1785 }, - { 0x66B4A8B2A17F0463, 0xF7427C0239106EAF, 0x710EA7129F42D184, 0xA58C50CDFF614BA4 }, - { 0xDDA4668C44DF722C, 0x5A963FBBFA1FF3A5, 0x97AAEEF5F2BF0EBD, 0x5BC28C88C1383F33 }, - { 0x5DCC1B5872DD9FF1, 0xC234501F1FEFDA01, 0xF664164E1583C3E1, 0xBB3DBEA47588AB31 }, - { 0xC6E26C3E31BAC75E, 0xA556356CBBD12190, 0xE29F277EA5F9010F, 0x8F88D5AB3363A2CF }, - { 0x1EBB2BDC5CE08E6E, 0x90B3EDE72A8EF315, 0xE3E1BCED3A3C458F, 0x69B6D7EEFF9E4F3A }, - { 0xC7723FA1E0127975, 0xE49E62E753DB5392, 0x4C1BD84B8AC1AC08, 0xDF78D09270F3D971 }, - { 0xF5A5FD42D16A2030, 0x2798EF6ED309979B, 0x43003D2320D9F0E8, 0xEA9831A92759FB4B }, - { 0x98CE42DEEF51D402, 0x69D542F5314BEF2C, 0x7468D401AD5D8516, 0x8BFAB4C0108F75F7 }, - { 0xEFBB03B7A7F6FD3C, 0x29391D4D0281E183, 0x0A85CAADD831C3F0, 0x4716FACA4107A42E }, - { 0x1BE2B3990B410CA4, 0xFB38D1F79019C401, 0x8CD8820B69618646, 0xC81D22DFCBDDC802 }, - { 0x1751AC12E70E15B4, 0xF76C16775CD329AE, 0x55973B612521DAB2, 0xDE828A5CDB6C8AB3 }, - { 0xCD05C2283F62B7C7, 0x4911008DF6A66101, 0xD51ED5CB23E6B4B5, 0xC84AF4BC60DB0F3A }, - { 0x82FCFD5215175DA9, 0xE65CA7C4FB927A1F, 0xB0E61F09D54987C3, 0x68E8E16EBD9C2969 }, - { 0x0805DCDC42CA47AB, 0xDC3D8FE11F8E0C7A, 0x108602022F71AB34, 0x9648CFDD30A75AA6 }, - { 0x834A709BA2534EBE, 0x3EE1397FD4F7BD28, 0x8B2ACC1D20A08D6C, 0x862DCD99B6F04400 }, - { 0x9C56F48AE9BAFD20, 0x5262034BFCC2232B, 0x2C63348CB723D681, 0xEC39F13409F990CC }, - { 0xD0800CD15F8B8498, 0x23220F7A12FBAA66, 0x5FE426ED1DDB13B6, 0x0ECB89A5D412C1DE }, - { 0x367467F43D580C3C, 0x07040A78C7890AE4, 0x262DAD4778878F9A, 0x49D5F652C81689A5 }, - { 0xF2C0D5456A983ECD, 0x12E314FCFA198791, 0x79FC8424343BAEB1, 0x325457472AE85601 }, - { 0x075561EFF2CD3AD5, 0x86776FA904F00402, 0x82C5F6A261F6A8FD, 0x6A0A524D14CD2D2C }, - { 0x5552748B5AEB500F, 0x57B3D1F4A56E4E97, 0x89198918C663E712, 0x314EA999026EB896 }, - { 0x41681F90AE14D87D, 0xEE5D37D19500FC21, 0xD85C2B3E7B0DD697, 0xA27C36D03E3606BA }, - { 0x5B6FB58E61FA4759, 0x39767D68A446F97F, 0x1BFF02C0E5935A3E, 0xA8BB51E6515783D8 }, - { 0x6778C7C7B6B6C1C2, 0x73E668169A7652A6, 0x81DA86AD62D03F7C, 0x5AA120405069FEB2 }, - { 0x10CC3C382B13AD92, 0x46B74708D03528D2, 0x94522C558727BD2E, 0xD4A242BFB7CF0C3F }, - { 0x0080A9F772772678, 0x3617077919407CEE, 0xC77865F5AE67D908, 0xB87AB0B42EF55FC9 }, - { 0x4FEA5E6A3EC5F547, 0x4A26D858BC77B6D7, 0xBD3AB864EA02D988, 0x683FDC648602B248 }, - { 0x6A3A9301BB8DD782, 0xBB5C170BEDFA73E9, 0xE7C60235E6E1840F, 0x14BD14B812127EF2 }, - { 0x36E85B8CA5CC07B0, 0x1AD98462A7F8AFD1, 0x794A65455DC33EA4, 0x7ADCB9F50DFE5207 }, - { 0x69A4D78BD3FF7E59, 0x8BEA7FAF184809C5, 0x881D459E36DCCBF1, 0xDDEF161499C3E7B5 }, - { 0x10EEF285DEEF7A4B, 0x7C82B22AA53589B7, 0x833DF29DE3814649, 0xC772BBD5C832F365 }, - { 0xA0BF83B3948DCE6A, 0xFE987C170A5CD711, 0xA3D65FCD5C70E3B7, 0xBBFEEB1578544609 }, - { 0x988A09C9A6EE6632, 0x2F9F274FE0EDE118, 0x6EAF12B1C9FDD5F6, 0x2152F998223521DB }, - { 0x2795EC931B5B17C9, 0xE0E5E5ADB2CE787D, 0x413AB0C2BB29CFBF, 0x554668FEA090EEEA }, - { 0x62B14867E4E79D50, 0x673D2F7474335229, 0xF54C478F56D2A910, 0x235E1953C6D29206 }, - { 0xDBCFCC77F5774ED3, 0x333F3963EB84A324, 0xFD967DE4D62C9663, 0x1BE6AF1D6B3FE136 }, - { 0xD37ED83DE65B33E0, 0xA0D73E0FE3045EC6, 0x85DF14C0342D21C4, 0x76910211A95B8C46 }, - { 0x8542681424ECBA28, 0xD65569C3BE0D3962, 0x837FDF9D6CB77062, 0x0108A86CF9E8D75F }, - { 0x2EA9AB9198D16380, 0x07400CD2C3BEF1CC, 0x745B864B76011A0E, 0x1BC52180AC6452D4 }, - { 0x136DD1A7D0A62859, 0xF2077A62B7673C5C, 0x712FB750604A15F5, 0xF6140AB2C5112327 }, - { 0x30274F1A3E86D58C, 0x63C688E25AE4E342, 0x31A6F0CC07D6FC55, 0xC8B1AB154AFF2FDF }, - { 0x4B298058E1D5FD3F, 0x2FA20EAD21773912, 0xA5DC38DA3C0DA0BB, 0xC7DE1ADFB6011F1C }, - { 0xCD00E292C5970D3C, 0x5E2F0FFA5171E555, 0xBC46BFC4FADDFB4A, 0x418B6840B86E79A3 }, - { 0xE08DD9962EEDB16E, 0x12840EA2A977CC07, 0xBC5FA8D96259682E, 0xDAA080573D525E4C }, - { 0xC419A92C7DCE5225, 0x606F604F79D0D070, 0x09EBD882B5D5D41D, 0x234B71617B691774 }, - { 0x37446575700829A1, 0x1278AD3A550F244F, 0x45D5AE4FE1552778, 0xFA4F041F9EAEECF6 }, - { 0x39F37F8D1931B3BD, 0xF767E7510DD69509, 0xFBF23AF1F7654933, 0xD0A4D291CBDD4418 }, - { 0x523C41464EE47D61, 0x350E15BC091BC970, 0xD73AE2D00BFE7A88, 0xBC7FE00AE6202C75 }, - { 0x34DBD6BF55D0D075, 0xD666181D9278B838, 0x7482A8B5804E44E1, 0xDDAAFE6876DADC15 }, - { 0xA2FC9FA6E6B6D3A4, 0xB88353D579157843, 0xFAA359C96CBA77B8, 0x15BBEEAF6A966A96 }, - { 0x77133F431D5E12DD, 0x850002C0D3D4E0FE, 0xCBE3A7A699D604DC, 0x8C5EAE9976E1D260 }, - { 0xB58A85E1F3844204, 0x31F8DB86E05EC571, 0xDFC7870195EA1B05, 0xB8A5FE1B8143F634 }, - { 0xF23391587F1C9FC4, 0x8EABD1E95F4CAF16, 0xF585EF09941B7BC2, 0x4F023D228E81CCD5 }, - { 0x24B920FB2F49F521, 0xA4FCE8F8D0BCA109, 0x8AA7B380733F96FD, 0x6DE736DCA5006A2E }, - { 0xB5FDAB78D8947EAC, 0xC864BFEECB4D2100, 0x780E5AFE1CD8EFAF, 0xB124887913AC49FA }, - { 0x951B1C95584B91FD, 0x8776E1D26B25D745, 0xAD5D508F6337686B, 0x9F7131D7C2F7096A }, - { 0x802BBF1167E97E33, 0x6BC7E1D1574466DB, 0x744C7021EFE0F0FF, 0x01FF7E352C44F56B }, - { 0x23CD67852AF04FD6, 0x885D2763266F2765, 0xB5E03C6AE3A5C1C6, 0xC95F7E03E10EC10D }, - { 0x5B517952CBE9C4C1, 0x47BC3F3434F9D824, 0x09E76D09EA58905A, 0xEFE7FB5415912D9A }, - { 0xFEE3D3A17121F0DD, 0x0962D02AE385A907, 0x6D6E1CCC7B820859, 0x92FF41ECA3C2811A }, - { 0x017AB4B70EA129C2, 0x9E932D44BADDC185, 0xAD136BF719C4ADA6, 0x3A10B5BF796AF91E }, - { 0xF616B0D54E78571A, 0x9611F343C9F8E022, 0xE859E920381AB0E4, 0xD3DA01E193A7BD7E }, - { 0x6EDD9F6F9CC92CDE, 0xD36E6C4A580933F9, 0xC9F1B90562B46903, 0xB806F21902A1A54F }, - { 0xD8129DE4286DC4FD, 0x245C7776B51D76AA, 0xA727956E8FC88FF9, 0x28EB69FF7FC17E0B }, - { 0x1171666C3E0AF069, 0x667251BBB8DBAC52, 0xAEFF187A6866DAA0, 0x7C597C813AA289E0 }, - { 0x409A7F83AC6B31DC, 0x8C77E3EC18038F20, 0x9BD2F545E0F4177C, 0x2E2381AA4E067B49 }, - { 0x7B8EC8DD836B564F, 0x0C85AD088FC744DE, 0x820345204E154BC1, 0x503E04E9D6FDD9F1 }, - { 0x42D699D9E89E4398, 0x04C0981F96B1A3FA, 0x7DBE42C6BE1DBCA6, 0x211C6FAA4E0E2463 }, - { 0xEBC47D1683F1E8B6, 0xD506BF43F07F93E6, 0x4FCB54EA8310A902, 0x11336139A80E706A }, - { 0x15DAE5979058BFBF, 0x4F9166029B6E340E, 0xA3CA374FEF578A11, 0xDC9E6E923860D7AE } /* 127 zero bytes */ -}; - -static const uint64_t s3v[512][4] = { - { 0xA9E8913B13864096, 0xB9EA592F9548C876, 0x54AAF8DF24E34376, 0x45FAC174D1036E1C }, /* 1st bit set */ - { 0xF315F3F6D33215F8, 0x777A7D5A4B809F43, 0x3729D13A86FE6ADF, 0x3DA5C11137E18273 }, /* 2nd bit set */ - { 0xAE1F446791358EEB, 0x17DEBD264614CAEB, 0x7F72558C085C73BE, 0x0DDE284B4C63A957 }, - { 0x94C41AF484FFF796, 0x4969E0BDD922F82D, 0xFF0F4BE87A60D066, 0x4CC9D1FFD3ACD650 }, - { 0x2763D88A93549AF5, 0x7C701D5187E8B477, 0xD9AA99EBEFE6D1E4, 0x1A3CE07BF1A1AA50 }, - { 0xD6E497B816C27A31, 0xACD5D9F3ED670639, 0xFEF7842FEE51F044, 0xDFBFB6319C760A5F }, - { 0x8A023A9E4AFFBB25, 0x5A6B48AE85CC4A7D, 0x1A1B9E8E6809FE9E, 0x48535C01C1FC071A }, - { 0x16ABAB341FB7F370, 0xE27E4DADCF81766D, 0xD0DFD0AE64469477, 0xBB2CF6614938B2AF }, - { 0x5A42062C0EF5A54E, 0xCCF7B0B155C90BBF, 0x408AB2480EE93934, 0x2ACBEBC24E265401 }, - { 0xB5B17E5DFF8C9A4A, 0xE35D22DE24382115, 0x9C400060F0F32D8F, 0xD87914DA904AE459 }, - { 0x5CD77BAB00B0CDF1, 0x52F3B0B42287F061, 0xE5DAF3AC7806B484, 0x572DB8E0A64BEE77 }, - { 0xED5F4ED0D6617D50, 0xABD49D4C84281E17, 0x5B48A7E1EDF550A8, 0x9BF2C9B5C4CE01F0 }, - { 0xD5755A80F47671E9, 0xC3E10C007865D786, 0x8432D9942CA2CE7D, 0x60510039A281CC5C }, - { 0x335D953107E14661, 0x9C0BF52F8D650C2C, 0xDBB5DAF1E1278F51, 0x437D96215AC74DB9 }, - { 0x1A2A07EA5731313C, 0x488CD126D0C11854, 0x2516CF35A507F9E8, 0xAE4A81EA92E3F267 }, - { 0x4286DA436D65E3A2, 0x16846042CA5E0F51, 0xAC7A192E9DA271A7, 0x2A9C4097BEECD52F }, - { 0xFE882C6CF31C7A4A, 0x93A4F5A2BC5499E4, 0x43731A87F6074EB3, 0x2CEFAFA3E3B8B864 }, - { 0x5B9CD7FE975B5F78, 0x94DF930EB2351802, 0x9068F9BA7D2DAD3D, 0x8DA29B40E1AA2EF0 }, - { 0x36558C5A404A9748, 0x423F31D60FAD2373, 0xE643A9B5B2F145C4, 0x390AD8C80345DC14 }, - { 0x887BBFD20CB15B19, 0xD2483B1D56DFCF5B, 0xCD74B8D05ED44CC9, 0x12ABE80E92D1064F }, - { 0x5D434409283CDC8E, 0x500C72DE5591F50B, 0xD858C8377A7F5F97, 0x9E5F1B446E091EC0 }, - { 0x68062FA9A8B16191, 0xF44B782CBC5C35E4, 0x34965C23E7922001, 0x447B2005F5EAB033 }, - { 0xCFA4AAF2F726AD6D, 0x9726B59E8D850BA5, 0x8B688490E5214187, 0xB1766963E0DC1408 }, - { 0x2F59C313EECC21D0, 0xCAE49D92EF60246E, 0x0498BCB84FF30925, 0xF2E9BC045578B1AA }, - { 0x2E7963AF3EC7FF5C, 0xE6A4C23FF2C3D9BF, 0xA765C1A7CCF843E0, 0x3E0BE147D852E91D }, - { 0x2FF775793E4DCBAD, 0x7D20D2428BC09CEE, 0xC908628797AEFD57, 0xA958B50F3485FEA3 }, - { 0x3DAE0491CDE03D6C, 0x7FAEA715170ED251, 0x39A0F7B77F601FA2, 0x0F2A6FBAF8076610 }, - { 0x63635B0197FC6C31, 0x478B85C92748372B, 0x03C4356718B5D600, 0xB677C2F7A2A45DF9 }, - { 0xC4F689A854EFE725, 0x4FE0683DFC3ED392, 0xBB5F98656B2B9064, 0x37819416F43D190C }, - { 0xF0E43B2C47EE3CF4, 0x865CAFA6C2406CAD, 0xEF4C7AE461AA7FD2, 0x3C9F294F88AC3E23 }, - { 0xC4A8240D8711FF7C, 0x881B00324B9FB0A8, 0xBE9D90D99E7F9552, 0x5EA69EAF9F7658CB }, - { 0x18AE4CCBDA953883, 0x9D79BB18CA09E23E, 0x24AE8C1550F56CBB, 0x3D84B05331FFF401 }, - { 0x1B19FF19DB12ED9A, 0xCC13FA3A0AF2359D, 0x7F247946306E2B4B, 0xB9C33CDAFF3AF619 }, - { 0x9FC1D2FDDC3BF79E, 0xF1CD260C4DC38F90, 0x49FE9008A30361E9, 0x39FB7D3484B78913 }, - { 0x73EC741E9AAB1623, 0x95254AAA25396075, 0x3D7B2270648C47BC, 0xF88D6B56B4B21B6D }, - { 0x2E65812BD89BD114, 0x5EFEB3907772D220, 0x902C3D29DDA4DCBD, 0x5C56D956DFB3798A }, - { 0x96CBBE51E1657CEA, 0x98D8A528B326F9E1, 0x2B4EC3E96DF44248, 0x472E314378E63289 }, - { 0x0AB3F00B996C2E9B, 0x364C0180CBE26663, 0xD0270E7FBD54C6B1, 0x161A0E5AECF2730B }, - { 0x78554A3A0C8F62E3, 0x2DB9906F946B2BB3, 0xAC03B88618170E9E, 0x67C011EE4F7096D1 }, - { 0xD6DAAFE3DFBC6F26, 0xCEBBFEF13DBA8216, 0xF3CE07972F0755B0, 0xA39C92ABF6858E70 }, - { 0x55FFE1A582E6C6EC, 0x8EB546943833E4B7, 0x46B122597B0937E2, 0x65A7E2151F8EC5F1 }, - { 0xEC44B4A96BB31BE6, 0xE90B95FFAEF0FCB1, 0x650DCA2AC3687837, 0xFE0454EBCC3CF6E2 }, - { 0xE233BA3685C62E92, 0xEAE8A6A5E876426D, 0x8C384A4F0A41DD76, 0x9A2EE19156127C2B }, - { 0xC48910BEEC85E2C9, 0xE5DD94E15FB8F93F, 0xAE049199776832E7, 0x001CDC70139B24F5 }, - { 0xE810A131AB2FE5C1, 0xB224E06FB74237C5, 0x2CFC290F8BB5E7CA, 0x67704ACF26A6A8F4 }, - { 0xEB3B3D88EC46D915, 0xAF459E38EEBCFE26, 0xECD7FF2D966E99A5, 0x760A71001D4DB287 }, - { 0xA6444DCE5DEED90C, 0x057E9BF7126BF2A7, 0xDDA65FEFD19C0C83, 0x5BB6228D24319EB5 }, - { 0x384A41704D44FC9F, 0xA013A0EE0A967AC5, 0x5B303D92782D0DC1, 0xB002CE1163422B5B }, - { 0x51655DFDD09BCBB8, 0x9161EE7D934CB63F, 0x65E7F0C9BE8AF2DE, 0xAD06C909165EFAC0 }, - { 0x465B47DF86D8D660, 0x1383540EDE75E40A, 0xF1C482BBED28A2FA, 0x6415256AECA035C6 }, - { 0xFAE00DD8A3EFE9AE, 0xA394489EE5287197, 0x5DEA0B517BD7DD46, 0x4D16DD63101CFFDF }, - { 0x069AD6583EEF4D8D, 0x1595D8F9BCD5E56F, 0x84658BDE73997375, 0x88D3AD3E4C35BD83 }, - { 0x848E1411238E592C, 0x06A260F0EC88654B, 0xE43716670A0F2CEB, 0xF795D200EB6BD2B6 }, - { 0xB6DDE25E006907CA, 0xCDBB977307FFE3EC, 0xB5C1FAABD72350D1, 0x9FE635A1F68A6C63 }, - { 0x45D1133AC05424A2, 0xD9B87030B58444F4, 0x94CF37AF30C0A1F3, 0xC347537A43EC909C }, - { 0x99390D8450F44987, 0x71E12A6E19F5511A, 0x67E1FDE8034154D1, 0xCE0C6D6D1C9FA6CC }, - { 0xFA5FF9C30BF0762E, 0x0919831B82ADB7B0, 0xF817C53F97E16E23, 0x295A6AE410A30F45 }, - { 0x101664E54D067297, 0xDEB010BFA4B349DF, 0xD0F8BB29CFB9D164, 0xD8497CA7D4B364DC }, - { 0x8A4EE959DB604A64, 0x5DC87D6059B5BD2B, 0xE618F9630BCFD080, 0x2472EFEAFE161DBF }, - { 0x16A4790BEB5E658D, 0xB1EB41B0BE81E679, 0x05C4FB250DDA9586, 0x290DA8170A1F2C3B }, - { 0x238366DB6F519D12, 0x3C0368F079F5022C, 0xA613B098716521C6, 0x3DBA487382DFD706 }, - { 0x63F9E0E3EB02BC1E, 0x5D9B9914A85CA67D, 0x15379D2770018FFD, 0xD922CBF8C8499218 }, - { 0x98D66C738C93E5FC, 0xB805317BF1933E9F, 0xB6785D755947F7BC, 0x295378825D3022D3 }, - { 0x27B0F56C18180D06, 0xA1EA825A813E7EE7, 0xF68909AB503B66ED, 0x1D30FE35DE3ED5FB }, - { 0x87FE0A8DCC23EB80, 0xFC1DB6724320543E, 0x4E55F983D5ADA1C4, 0x22587E7D0F3A0376 }, - { 0x750C89EE48ADE576, 0x4BB543E267E04C32, 0xDFA5365F8188F438, 0x3BDC9BF7DFF9E862 }, - { 0x71CEC1690D152A93, 0xF13D0C4A1A2B3CDC, 0x0460ABE8AF1800EF, 0x94CD649662627B28 }, - { 0xD1C43A7FDA45CA32, 0xD2514DBD8F50F743, 0xEAA24E5F150B0836, 0x50A454DCBC3B87ED }, - { 0x04452E812B76E6BC, 0x0FA033984651AD9E, 0xFEF0DB4D56D8886C, 0x24FF24B06981FEBB }, - { 0x54CE27BA2B8D5643, 0xE2915B5089157AEA, 0xFD4FF4E813064526, 0x71E06D6C26BEB856 }, - { 0xD7E5AD6B662F02F8, 0xB634949B2A90B654, 0xFA9357E6095798F7, 0x21C4A26D42EFF4CC }, - { 0x6E384B20006C687F, 0xE6183A443D7F1569, 0x1A4D81BE5FE39D8A, 0xCB8D9EF7A8238117 }, - { 0x9E8C093CC770B108, 0xAD5D2C028CF48D3B, 0x4652548583D83389, 0xA3CFFD8F857821A2 }, - { 0x1D867F890D163C30, 0x94B6E2BA6FE16B19, 0xD8CDE95049F5CAE0, 0x095003576CF359DC }, - { 0x5C82EA174F7C99F2, 0x0FA78E4FFCD74BE8, 0x372AD83D4DDD9CE3, 0xE0D53B99A813A93F }, - { 0xC54CE44900EDE8FE, 0x1434A667CFDBFB99, 0x8180ACD3DCCA0CD7, 0x3132E32F0F0056DE }, - { 0xD04D6AB514083027, 0xC4FA071FF0ECF988, 0xF49ED5A9496E0784, 0x2944FC496CF7C685 }, - { 0x961CD2C98BB68515, 0xDA22EC681520E912, 0xC7A1E9C0F01D7497, 0x15FA229648ED02D8 }, - { 0x28E0FC7EFF7AB3F7, 0xA2F800B75BF819E2, 0x424B14ADB3DE8E35, 0xBFE500AFDB2A857D }, - { 0x68ACC3396AAABA9F, 0x0DB2CE1D7B8327FA, 0x4B3BCC8A881F8BD1, 0x6C3EE9EDEDC2E088 }, - { 0x5D987E43F6368F9B, 0x33F3AA812E785006, 0x210FF192670906C2, 0xE4A3C9DAB8096B01 }, - { 0x8DAE1338F0E9A061, 0x41FFF2E76953E0FD, 0xAE888113A5950EA5, 0xD0AF728D3744D3CF }, - { 0x385EEC3C348B1AED, 0x84CBE8015D75EB79, 0xE3F3B354CCCDE381, 0xABBE8F5C2ADDA330 }, - { 0x8DDBDBBF787F139A, 0x25C1D40D8A9108B9, 0xCF8C008FD10379B3, 0xEBEA8FB27A3B7A4C }, - { 0x1E633B490B936921, 0x3ED26FD9B920B79F, 0xC6EC5E6B8FF3DED0, 0x91C95CD5EFF6580D }, - { 0xC5A580DEC9773743, 0xAAA8DD054B9E0A25, 0x56F96100FB7618E7, 0x61BAACB5666689D5 }, - { 0x7AF26FB0A4158771, 0xED17824C894F872E, 0x3D9BE453EF1A60FE, 0x075BC3609731819B }, - { 0x4BA4FC0C8C329114, 0x035A8026CEB7088F, 0x302639D1D4D47272, 0x22BD1E67C448535E }, - { 0x1A2ACF4E303865B9, 0xE92EA408A9278510, 0xA6A6D8B200358965, 0x2EF1901691123EEF }, - { 0x0054216AC82168CF, 0x4389850D921F3297, 0xC0EB3191FF4B59D0, 0x92BEC5AFCC144B3D }, - { 0x2ACABFC631E3E54A, 0xDCA91DFF5CC7317C, 0x993926A56A986760, 0x184D7CEEA5D99B4A }, - { 0x4CE4CB88C6364B3B, 0x2C7FBA1496693D32, 0xDCDA14141D38EDEF, 0x6B89ADB59D592364 }, - { 0xD995A4726D4117E0, 0xC270EDF2C90A86CC, 0x92E707D58F829D55, 0x0390A33EF332229F }, - { 0x5B0932A24469CE65, 0x4D4B6F9336DD2C70, 0x4E76C47BCBD24676, 0x9D7A11DA87226F2E }, - { 0x22EBC262ADFC355F, 0x74DCABA5049413F9, 0x1DD6DF368256400C, 0x694DF9F9387C9170 }, - { 0x8204174FEC966193, 0x7F10FDCDC0F21D22, 0xC715CEA75E8A65EA, 0x48AA5F2656ACE73C }, - { 0x793526200C878984, 0x5B8EBF1576D81EB5, 0x8968CBA1E21DC569, 0xB77CFDD44B319724 }, - { 0x9394D8EF9CB5F345, 0x20A2D915E4413424, 0x3F37763AA6245756, 0x2FB08F833DC15EA4 }, - { 0x1E3D1BC3E1E151B5, 0x3C020F2753A31024, 0x1071A8635EBE7D73, 0xB7B403FC5249549B }, - { 0xA06F37224118DFF3, 0xAADA5F800B73E868, 0xD894A9C137ED70B1, 0xE8B11EAD10CB1025 }, - { 0xEBAB76D8BD268E02, 0x5ACFFB4C3BA37838, 0xF9D31980112F9477, 0xD96EE20F6D05F9E8 }, - { 0x8171056C199703D4, 0x80DA637C5172F0C5, 0x7636EDBD3019AF26, 0x38434022F11E68E6 }, - { 0x07CC0BD8CEFF88F2, 0x80DCF9E8DBCD5A18, 0x0C6A3C56C654896E, 0x6F9D533F56E5F12D }, - { 0xA1591A87F66ECED2, 0x86A026BE194EC87B, 0xE0FE1E9479BAF3B8, 0x5CAEBA29AAA5FF98 }, - { 0xE709390882728CEC, 0xA49604B51FF3A5B9, 0x0773E499DDE9825F, 0x9953F166B50D2171 }, - { 0x0CA4D2B8860E35EA, 0x0A6113EFDD91C757, 0x18D6722AD6DB319E, 0x1ED05F7477592E62 }, - { 0xD18C38719F01277C, 0xCF0E394AFBA35735, 0x2116D2BFA238A0C8, 0x389E8B4CB6053F13 }, - { 0x0B89A41A456BD73B, 0x36B66291604F4B27, 0x00FFC121BC5E6303, 0xD523EE9EF1A5769F }, - { 0xF7109D2565DB4422, 0x91E915E10622EBFF, 0xCFF00B7EB811B35C, 0x49356B828CFF3D09 }, - { 0x6E59F3D6E44866A8, 0x0A9F83F47F655118, 0x8529341B6DC3B28D, 0xC97066183E4F62EB }, - { 0xA96C072C03E4892D, 0xEE7C06A0E53327BC, 0x0F5A2E434DA82D44, 0x510484C158576C28 }, - { 0xCF196D6069AB8CD5, 0x6FB148363BC793D8, 0xFA4F82571E46C6F4, 0xC47D6CDE34D08E09 }, - { 0xFD6402909175BE39, 0xA851E90C8A9679AC, 0x28175DC1D1FEC3ED, 0x8B5D5633BA0FB29D }, - { 0xC1D6BB03D087AC72, 0xDFA0F60BC321EED8, 0x8C453DA67047E077, 0xE254A4AE42C5DCA6 }, - { 0x15C7F345247CB2C7, 0x4D53BFA08A410988, 0x16C3EDCABBE35226, 0xB8FBD532F37A5B3E }, - { 0xCDC2F7D71B79384B, 0xBDEB4C1BB523D0EA, 0xFB54D8B6534BA0BF, 0xD3EA509CAB6D5263 }, - { 0x9F7B018C867EF344, 0x141DC43286533AC2, 0x55C92F52D8985474, 0x00BFEC008371B739 }, - { 0x041CB84FA14B83E4, 0x4998E02443D22630, 0x873EECA3235B5B6B, 0x99757241758DF4CA }, - { 0x5048583E74D84DB8, 0x7F14455B3C3BC6DF, 0x30026A70606F0211, 0x564ED13C3681E8EE }, - { 0x6D739D8A74C3DF91, 0xA97199A7E0F5B411, 0xF90634C4390BDE23, 0xD71F72EE1DAA386E }, - { 0xC6D5A6F68BB7D53C, 0xB7304DECD22E4E83, 0x1A465DC337F077CF, 0x9207BE07A788A470 }, - { 0x928E386EA548B192, 0x2B4D284003689D5C, 0x04A26A9BCD7D876B, 0x294FFEB18062F68E }, - { 0x28B6290B52D13B0A, 0x0D6B967B98B1921E, 0x04C55FA98D45E7E1, 0x373D093C92950CE5 }, - { 0xEAB497B1F7E1FA12, 0xE3457F9C542C7B2A, 0xA47418C4BA15E7E1, 0xF2FAFD95E9B24080 }, - { 0x8A9BA0B1B781511F, 0x4FE2B9CB9E1B779B, 0x454D13F6771F0E5C, 0x088604DF18020B13 }, - { 0x151B522B45309B70, 0xB7A740D2102A9D1A, 0xFA00EB5309985A27, 0x0E72477384BD5A2A }, - { 0x413A2D719B9ECD7D, 0xAEE9B5782EA0DC4B, 0xC7DA68A36578D52F, 0x462F07C5C7CC3EBB }, - { 0x0BFBAA977CDBEC98, 0xD5208E6A39ED8084, 0xC49E9B3812AA0845, 0x6105B591B639E500 }, - { 0x11F95D879EB9E203, 0x38049F04186D8D3B, 0xD6B84AD6D168B5CB, 0x94A81F0928F76123 }, - { 0x83E869669EF1EB86, 0xAF473C27131BC104, 0x3EE2AA098171F0CB, 0x10396838B80E2852 }, - { 0xAD3923410D65B22E, 0xBE52D9241B064AEA, 0x2E9C6B1FCC1F3B87, 0xCF4FE24B6D279C81 }, - { 0xF34D63713B41A46A, 0xB57E3D58ACC1E2FB, 0x551B1ACB1464B848, 0x44495DDF3CA31C53 }, - { 0x37C4014E1190109F, 0x6AB94757573D4296, 0x9CEF35C62DB81163, 0xBCBE344F6D35952E }, - { 0x622327209A67F4F7, 0x16E21992B1AA2C2E, 0xFE291502C973B84D, 0xF66CCC594D8951B3 }, - { 0xEE022A8C4A651ADA, 0xE0C94A710342C3E3, 0x4A7EB8A144C7C68D, 0xD9E28AF6F857E8AB }, - { 0x752C03CE3316BA05, 0xCA4C9256A56F2028, 0x7FFA5CA9DE120C54, 0x083422FF0AA39484 }, - { 0x62B6821AC06AE513, 0xEBD4BB6E71905C2B, 0xE2D23D7F6F91585D, 0x25FFB4F4A7EADC82 }, - { 0x4D636023B8983886, 0x2F6C5E13323B7126, 0xD9992EB9DC116EA0, 0xFD49C07E55077AEF }, - { 0x186B0115921105FD, 0xC79642B22B975D73, 0xE8BAEF39F3DFA54D, 0x899BAB19742CD08E }, - { 0x00437FA812270E23, 0x5B565E4380108CDF, 0xCE3965B7EAB947F8, 0x85AC38625BCC05E6 }, - { 0xC4A82A95E933A100, 0x2A4D0F428E692775, 0xAF3DA97F26B4859D, 0xB4411851039E278E }, - { 0x433344AD40912C81, 0x654FBB4EE5B9DFDB, 0x40EFAE5E04701902, 0xDC2CFBD61E46406C }, - { 0xA025F9FAB4920B6E, 0x075BB27B2EDFA590, 0xCB7AAF4FBF79D624, 0x4992745C2E4CCDA7 }, - { 0x100374AB42937817, 0x2246C68FCBB03FD2, 0xF0C248CA5661D22B, 0xC57C5E11089EE0B9 }, - { 0xBD61FE93A4AFC5FC, 0x18826B72E9170D0F, 0x5A90673A4DCA6029, 0x933C1E7EE9F8A994 }, - { 0xE600FAF8F2A3ECCA, 0x343E9B2C0750C1B5, 0x55C70C48233E5FE1, 0x843319E14DB4CCA6 }, - { 0x74ABD7E3B63DA0C5, 0x0C60285ED214D5EB, 0x5685B041C04F2A57, 0x60E16CDA326E5A26 }, - { 0xCEE269F6ED2306C5, 0x0A51E8652CB16EC3, 0xF5244422E74716E7, 0xB2B496210FEC8691 }, - { 0xE111CE36766C35A4, 0xFFB51B92EC020751, 0x478FB953CFE45E4E, 0xC8F0533DE6B0E389 }, - { 0x8A9B737C2505074E, 0x365B4E93AFAE34FB, 0x5750DE584F4EA6DB, 0x410DCA4EB4A4A4B9 }, - { 0x85368C816EFFDB2A, 0xABB46BCA1A68E6BE, 0x939763A007E5D8E0, 0xC300F010E4A20950 }, - { 0xF738607462595278, 0x88883C4A156C166B, 0x1E437D9F901B20A5, 0x3C9AD38CA1A79F0F }, - { 0x1214272B5CA64919, 0xD4A5E414BE111EBA, 0xC89E38A3E7012D26, 0x6FA37059E7661A56 }, - { 0xF436C8090922DC9C, 0x9125F7946DBAD989, 0xD0F30C6937797F20, 0x1B4EF6D50978762D }, - { 0x83E1655FFECBFF4B, 0x6E9ADED0A2D1312F, 0xF900036CAEAB5C87, 0x61D7CE3CA893B688 }, - { 0xD139857DD62ED86D, 0xB019D9BC80228802, 0x1B718C7ACC4175E3, 0x3B660E2D0A397020 }, - { 0x0843449A3FE35677, 0xDFB3816FE4CFA489, 0xA8EE1AE3E5F84AE7, 0x9042B26F79B58062 }, - { 0x323B852EBB3286D8, 0x8AAD0139783166B8, 0x2A2BBA338B400C6D, 0x6B87E1E8D3F2EC46 }, - { 0xF54441B6A5C99383, 0x3062D5F66F230FBE, 0x7C81B7BF66E7C927, 0x9F91AAD94056DB82 }, - { 0xE4FB21E08A3DDDAE, 0x736792FE342E9AEA, 0xC7DDD42BB2BDAE7E, 0x650D80B0C29095F3 }, - { 0x0091715550D08BDC, 0x74C02EF3C679EF70, 0x08FCE665F24C13CD, 0x5DED432307E1B25F }, - { 0xE2D01443022CFF87, 0x71825D02812C3909, 0xE13642691422CCDF, 0x4197DAFE8E7A53ED }, - { 0x831A8C1A5EC3793D, 0xD2FEBD46B2EA9896, 0x53F26984B2DF508E, 0x94C913C5D8209B27 }, - { 0x5BD023733D2742D9, 0xDAFB53CB1E949B3F, 0x5EBB89DD0063E5C8, 0xB937E95C3B0378D0 }, - { 0x406AE8A0DA1864B4, 0x19B7196570A3B358, 0xF5E92D49FA0F2916, 0x543428D72AF6705F }, - { 0x5966231A1F9016C9, 0x46FC89CD163D2893, 0x9C28B2FA8E85FBB3, 0x071FACDD7D793B33 }, - { 0x0ADA1081AD3E0CBF, 0x690BC16623C584D5, 0xA01E5F287842D9C3, 0xA54FA05D53F57B5C }, - { 0x20FC7056C693A040, 0xCDDA479FE2383294, 0x5C771265A86A81EB, 0xB46756A0E35C8E41 }, - { 0x92B814A7A3C35BA1, 0x8DF50A8D61BDA5B9, 0x20872C8761E5127D, 0xA5FA5417979710FB }, - { 0x1C0CE1582DEA1887, 0x7BDA514F5EA714B5, 0xE1EFE47FC56F6366, 0x61AD627ECA3A88C6 }, - { 0x63CED81AAAE244ED, 0xBE9F3061EB048800, 0x81B760151102D4E3, 0xEF96CEE066A702A4 }, - { 0x7F1B4A9181213108, 0xA725E8688E1A0C89, 0xA42D669A040E642E, 0x7C50DF293C6EB286 }, - { 0xB61A30279CB9685D, 0x26F0633B942FB92D, 0x1EDCF10125155C95, 0xCCC3E4F324127F46 }, - { 0xDA0063B8AA47894F, 0xC7C2B192DF6286A7, 0xAA8AB189A75166AB, 0xA3910523F4C7343C }, - { 0xCF0BE9C1E8E5536A, 0x0063714709F3CE9B, 0x6C64870583273D15, 0x2E1AF2E9E8826437 }, - { 0xA40F4791838B9E90, 0x624E6048BD74B355, 0x222D74123F2BE4DF, 0x87C5C53E6528EDF1 }, - { 0x47FD4A2160999C34, 0x38801AE2741044C3, 0x0BFB09FA28E58833, 0x9B40EB4147A0088E }, - { 0x1633C6F7CF7DFAFC, 0x06AA6566FCF5BDBA, 0x663987DE2118BD80, 0xB90DDDC24B3E6B47 }, - { 0x48A6C26EECFE1257, 0xC905F42AD27C5AEA, 0x3E247A12D8E37168, 0xB87EC23C5A3782E7 }, - { 0x69904A58FFB51D5A, 0x523B3F7CD89B1537, 0xB9464142FC6A5581, 0x65D94C4306B36486 }, - { 0x4234E0D401967DC4, 0x8B8F8E7065F21061, 0x827D4D3E164F212D, 0x49E9D3E4F8D08203 }, - { 0x0D35CFC713B51EEC, 0xF0C7CD174AC05759, 0x8E321E59CF8BC8F6, 0x6701093451CB263D }, - { 0x8252A0DE60A97430, 0xBED19227D2601829, 0xC1A4186EF0D9EE83, 0x081B681DC62833D0 }, - { 0x12B01C4ADB167F43, 0xD5C82C5D36C20433, 0xA1999D7B69729606, 0x7325150F6B42E723 }, - { 0xFE92431BD6235C3A, 0x8E6CCD5BFF3C426A, 0x384805E20957B770, 0x9805D8B250199B0D }, - { 0x257416F289917F37, 0x47A70BA80B0F2FA4, 0x56938C5EDFD8235C, 0xFE57D241489B5A36 }, - { 0x2884586F209E5032, 0x3451F32AE31A6222, 0x02847696CE159E7D, 0xA03F9CE652244567 }, - { 0xA7F896978FDA16AE, 0xE6A05FE0E0E0A005, 0x3C05FF8EEEB94ADC, 0x2C2D80CAA5B78EF9 }, - { 0xE671DE62E823AC67, 0xD41803B68AA2E0FF, 0x74DE70C3F9C7894C, 0x69DADEEE6B102D8B }, - { 0xAFB4ABE7C93F3B90, 0xBB6A3CF07700A413, 0xEC4FFF9354F1B54F, 0xC8198DF227FEE29E }, - { 0x447FF32829FAE9AC, 0xA889CB164D52DD4A, 0x92CA6A56E303926C, 0xD9760A9B7A511062 }, - { 0x19DE25609DC348DB, 0x36FC8668F42B7813, 0x1E981774DE9AB5D6, 0x8B7FF38FAD1855BF }, - { 0x998E932CCE059900, 0x512CF7C87965D3CB, 0x55B8F6F57B026CBC, 0xC170EBD2FA685039 }, - { 0x6AA754752F588568, 0x4231557BD9A69628, 0x1ACAAB81202E3CF2, 0x42B74C4C9974E95B }, - { 0x1660EC3919278CF0, 0x63BC16C4DA6C0493, 0xB7C95187F4B1E3BE, 0x91007FCA9B258FD9 }, - { 0xD5439F4CD69F0249, 0xC5F4B669863EF07A, 0xB67059FF9F6EDF5A, 0xB8569CC5AFBD707A }, - { 0xC4B882FEBB7E9297, 0x980D45D05E7D77FD, 0xDA4FC320D39138C3, 0x89B80E3EE1F5FE93 }, - { 0xBA29EC0E1056626D, 0x9D503BE8A4180D82, 0x694BBF9E7C6F9BA8, 0x4F768337F836CEA6 }, - { 0x44FFEF2CAAC31AA5, 0x8C323E8D54C4969E, 0x805140A8068E54C6, 0x948106FDFCF39FFB }, - { 0x250575D2C5AA729F, 0x3A7A67696E93CFEC, 0xBB0C74F610F7DF30, 0x483FA77D6156EBBB }, - { 0x8463946014AF993F, 0xC53521E151DD0A5F, 0xE62DC9E4BE44B259, 0x51CE5108506E81FC }, - { 0x4210C9B91A7903E1, 0xBEDF52F002CF07E9, 0xC940101F6A2A706F, 0xA5F5C46370B69BED }, - { 0x35BCC9DDBA586ED7, 0x741840B1CC50318C, 0xBADB7D21033D49A9, 0xE13A365BDD8CF7B2 }, - { 0x1C4E0AA5721CB3FB, 0xA9619E7D3187289F, 0xE3B73FED4976C57C, 0x6B96B3FCC787E7A8 }, - { 0xD66C48F9805CA3A2, 0x3C492763E7CB0CAD, 0x4F39C2906960F707, 0x82F03D982DE658DB }, - { 0x86E32F041164B61E, 0xA3CEA4B08CC4DE1F, 0x0B372DF8DE0C70CA, 0x8912E74416C3C56B }, - { 0xFC980464CADC7083, 0x4ED870A8805297A9, 0xA134A17CE7745779, 0x29883D37986E575B }, - { 0xA960F4A548A5082B, 0x0C7A6E81CFC267EC, 0x551FF0590E7E481D, 0xBBB49D1320DB2993 }, - { 0xEB3D05BA0DBF1E46, 0x39B508A5071E048E, 0xA9537F5061D97635, 0xC278E1A42085FC4D }, - { 0x4721C0512921E73F, 0x152434D3758BEE38, 0x50FD781D1615C216, 0xC9B9548215971D60 }, - { 0x75D3942826ADEADB, 0x234C13620EAE3387, 0xAC3712A0011E73D4, 0xB43CDDC1D8A19A3B }, - { 0xB1C964DC8EF1DD6C, 0x7776F80513D20E90, 0x7D151CF85B9288C2, 0x11C43B11622ADE9C }, - { 0xD131B7F26B81998E, 0xC103602D4519D8CE, 0x666AB16B28DFC0BE, 0x3AC8905F89F5FCD8 }, - { 0x992D98B251D8434F, 0x949203946F08DC58, 0xB8E5DC8E9B1A2683, 0xEF6C147D02FF4AE1 }, - { 0x796F69162354BAB8, 0x808A8A5995366974, 0xB63EF0FC918F742E, 0x96669825D3C4B7B3 }, - { 0xE853183FE5C256B3, 0x43660C585EE24EAF, 0x3D08E7EFB03FE371, 0x53E3EFD10139210F }, - { 0x596E7B035AF0AE5D, 0xE70BCD5676201A2A, 0xF82A5F2FA4C9B6C8, 0x16179682D26C5512 }, - { 0x1AD5B174B748974B, 0x910D09AD8C69DE4B, 0xB9048616D946E7E6, 0x8EA5E7633C97E6E5 }, - { 0x467F92DB569C7931, 0x096F19DE0E29D170, 0x10CA82C3B50E85FE, 0xD08CB2D85B0B8F97 }, - { 0x9E7F02E099917E00, 0x619ED5BB9F9C7EEC, 0x2811F57ED0DAD85D, 0x2C95ED8DD0E4C08E }, - { 0x3104DDF4257DEDC2, 0x010A4705CAF03B7D, 0x504B4FCF2ED1EEC5, 0x9ADCA70BCA9310D5 }, - { 0x933883E24E576162, 0xD81D93298D58D922, 0xA8329795081D7597, 0xD4CF8010D94FA8D2 }, - { 0xD739D01F7E093569, 0x21DD36B319A81E6E, 0x5DFFE1F3A4B48357, 0x63B0E0BC7AF7D54C }, - { 0x6F9FC1387DF177C8, 0x834F70EE0935668E, 0xBADE05884B7A6133, 0x54F95ECA31071D95 }, - { 0x08FDA821CDCECD8B, 0x02CDEEF208BA7458, 0x1883AB871564E283, 0xA497007619F05FF8 }, - { 0x8B486B4DFF4E698B, 0x634905033D54646C, 0x1506D5E99FDE44EC, 0xD842629B5AEDFFDF }, - { 0x046B626BF4B91DF0, 0x948C5B424EFCC499, 0x8D399ED924514B11, 0x1BF3DA6CB804A044 }, - { 0x49F8604A06257AF4, 0xE62B76EB9BAA153C, 0x00F6205529661240, 0x440236E8596C18E4 }, - { 0x4876639F3A19CD4B, 0xAD75A47E729E99C9, 0xD431F3ACD8E0C675, 0xFCFACCC7268CDE9A }, - { 0x47B4798333287357, 0x8EDE4F3C872005FA, 0x65B88B723A8D63B6, 0x8266187FFF24C7BC }, - { 0x6A3B715A9D621F00, 0x9D0420B210B6628E, 0x0810A9B0FC5C230F, 0x5B6CB2A1CCB32521 }, - { 0x80AA5123B8E959A7, 0x8F92DD0DF9C086E7, 0xCFF95CCAE81F11EE, 0x95A9178BC97DA5C3 }, - { 0xEB2495DD75C3983B, 0x972EE86E0C44A7DC, 0xCB58BDE45AAD0118, 0x68FC1A4BA174B284 }, - { 0x52E5B0C1691841DD, 0xBFDB16B15ED91D4F, 0xD0AF5A5BAFBF8039, 0x48CC692AD15001A6 }, - { 0xB8DEA824DDCFAE01, 0x942B3ECED0925C56, 0xD8E8D713484C0198, 0xF133FD6876CC7E88 }, - { 0xF854548650BD2EE4, 0x62A221DF3F618A50, 0x7CE737946BB6111B, 0xD10DF72AA519668B }, - { 0xCE7A1418551803A5, 0x88EBF7AB1874E803, 0x918461518052667C, 0xB3E827A2C331A1B1 }, - { 0x1AAF9C4E2210C62D, 0xDF85B8A17DE97A11, 0xA8FDA73F50EF3EB0, 0x91905F4725C01890 }, - { 0x8C2BC5F4A7F1A048, 0x38B8CECA0FE1B213, 0x8298CB3E9EE8E9F3, 0xD398B9386C0EA0DC }, - { 0x883F6A2B2F5F3CE3, 0xD0719327C32BD7FD, 0xC3678F30B7C0E6C9, 0xB646E8F255B24C6F }, - { 0x97240AF3BB1ED0F4, 0xC40909902B619CEB, 0x345EBEC32FCE1A76, 0x778582F769DE5F08 }, - { 0x2E71DCDD0C32DB17, 0xD1B1A8E6CC4DA8C0, 0x9069AD7FBCE3660C, 0x038A629A54CB9E33 }, - { 0xD73D0C259438C01E, 0x5C623B1AB558AFE7, 0xE158950A3FFF4802, 0x8E9054B6A294C879 }, - { 0x9F44A53FB13DE79E, 0x4F851DE224A20905, 0xA471E4D5495BCE83, 0x2BE55A72A3A9859F }, - { 0x80577CB7D4122730, 0x20AEA6986F7E7B82, 0x096C2C191D4F3A26, 0x41C1AAF854E35A40 }, - { 0xDB93C3458D36F280, 0x0D2FB03957237190, 0xEE0FE64D35978EE7, 0xA822B272BA1DF978 }, - { 0xE548EFC34D2F70A0, 0xC730679057A4CD9A, 0x0DE2FC57E804F970, 0xB5919F946A61FCF0 }, - { 0x060FD02BCB60AE26, 0x536EB1A50A25571E, 0x9712C6106AD96645, 0x2FE5C40602BD9186 }, - { 0xD3321F207A723107, 0xAEA06879AF488D83, 0xAB99EFC7DD6AD75D, 0x2356857CBFE4D718 }, - { 0x1E8A162B8929F27D, 0x4EE0BC6DE76C4D18, 0x6EE5B7500A658EE1, 0x3BFB4429F596FFE6 }, - { 0x1CCA23F135D6A051, 0xC5BCEAB95D8BBC39, 0x83A92021783FFE35, 0x40C209F682C5C93B }, - { 0xE7125019709757B3, 0x8FD5429EB0608C03, 0xE8D939FC72134564, 0x3C5085822A3FF424 }, - { 0x2E65FAFD44BB10B4, 0x1DA06D445673A68F, 0x2441D68DAE0CBF1B, 0xA7C62C75E9FCDD5D }, - { 0x342B4F26D63BD11D, 0x5AA83A658B40191D, 0x6701CEF38D0F4001, 0x116B4358FACF2B58 }, - { 0x60066741365E8D41, 0x6FF884AF7E3EC36C, 0xC209B6CD6CEDCE89, 0x1A0B4CB88DCD1C7F }, - { 0x58E8F2A1F78F0A59, 0x1FEB75AEBECAAA81, 0x076E4290894B1C44, 0x5CC32953604DB089 }, - { 0x8F6DAB338DE16AB1, 0x2E496BF52B51D00E, 0xE1358741033FA19A, 0x8B6E3736A9E55357 }, - { 0xE7AE17EEBECD2650, 0x630473FAB6F5716D, 0x80DB238BE1F09FA9, 0x3DC004942255C08B }, - { 0x0B41C730A71A1771, 0x8B3E8EFBF741918B, 0xE3637A981F483883, 0x5F76289C00E424B9 }, - { 0xA44A029E04493B8D, 0x2FE7893391C2B3CE, 0xEFEC1603C585AAD6, 0x203F2D14E07BFEAD }, - { 0x5AC78D953211AA82, 0x2C3AE6E9B0058E42, 0x394DD32E5992F29F, 0x9C12DA3681985130 }, - { 0xD647EB2598D33D72, 0x16256356596D29CE, 0xCD31C1BA7A7FF25C, 0xCB5BE4A453410B9D }, - { 0x1205F4789155711E, 0x2542DBA1A64D2266, 0x26FE3EB43BAA8547, 0x52D0B59077E010FC }, - { 0xCB592844121D926F, 0x1CA3AD4E1D6FB9D8, 0xE260ED6E3216361F, 0x7732E975A0E8BBF6 }, - { 0xDA8358584A629196, 0x115D53EB6EE0BD6F, 0x821F5E7D8297753C, 0x5EA59767B5888EB4 }, - { 0xE16FD8C842F53FCF, 0x9167ED4153CD3319, 0x4F93BC52416883CB, 0xC70107F5A5B542F5 }, - { 0x3C4FE9CBE1ECF265, 0x1A542854BFE633C8, 0x3322A884B715322F, 0x0046F6A1FA4A6364 }, - { 0x9697FABFB4CFAD42, 0xB06912B49C656B82, 0x0455F42B0E1A99D0, 0x50857A565BB0719E }, - { 0x7C1726D8B205E09F, 0x946FC3E7A314D07C, 0x179F99F682584663, 0x5BC166C47E00AF1E }, - { 0x33333D249B819A6B, 0x651045B45B87793E, 0xEBFCC3EAD2C2CBD8, 0x559F8F636942D390 }, - { 0x0D75EF205E037BED, 0xC1D5462A17F2DCDB, 0xB408250A2273B9A8, 0x987963D76067CAD9 }, - { 0x92A91D56CB5A0D83, 0x29C902C2A61D455D, 0xC11C2ACE74144306, 0x9985D8A8761F0892 }, - { 0x9AF21D56439B23C2, 0xC133142C9D861AF9, 0x3E56A9F5066050E8, 0x4D015DB3BC9DEFBA }, - { 0xD8EC24EC81F44E47, 0x2050EC178E2B029F, 0x8E71D965F4B30D4B, 0x6BC0CE1CFBAAFA43 }, - { 0xC601F7F144E0E91F, 0xE0D81004C2CB6D12, 0x003A4D28357ED171, 0xAE2695C10EAF4367 }, - { 0x1E474F64386EB272, 0x8D754ED431DEEE8F, 0xC28634B60369187C, 0xC67069C9BAB50856 }, - { 0xCD26546D8F54998B, 0xDF990406D2DC6154, 0x1D271278847D6CF7, 0xC0129B27E18821F7 }, - { 0x589F68DCFA53A240, 0x0B5BACE56DE6B945, 0xB657D42799CE5DE9, 0x7535B956A9A7E434 }, - { 0x7DED0DE807F13086, 0x380A18D8AFC6F91D, 0x8B27C106A3192D1A, 0x63E5EE95999D11A5 }, - { 0x494CF88F702C3B6E, 0x60755D34D21B752F, 0x1B2DBDBAACDDCC39, 0x981EEBAE1A8445F9 }, - { 0x6A98BDF7ADDEF8AE, 0xB8C318585BFC9D0D, 0xBE218ECF02B6A58F, 0xD02F05F8B09FB865 }, - { 0x3CBF295A61FCF0DB, 0xE7DF7D672662CBDE, 0x5EAD4D1797BDD145, 0x075D0075BF8E8C27 }, - { 0x1440225FDE337167, 0xD85AE4B4799CCF5D, 0x3D2DCF9F5200F536, 0x8491B76A987A424D }, - { 0x97FEBBCF075BA923, 0x5E9DFB80FED98C4D, 0x208FDF1E99F6DA64, 0x27343A549FA281D0 }, - { 0x35F9358538FC9370, 0xA59EA87EC7C267F5, 0x74E67006C099828A, 0xC510C19C2ED39B31 }, - { 0x81F6394551E870E9, 0x56AB91C8FD6D50A8, 0x4CDC53809925DC78, 0xCEE6362959B7F6E8 }, - { 0x7CC54262D86AFF02, 0x7845EE4758DAFA40, 0xB7809FBF46960041, 0xF6AB252403A9B603 }, - { 0x8860B1848E82659A, 0x8F8DD96561A67000, 0x4B51648B517AADC8, 0xFCC4A6823C802799 }, - { 0xC648B6AF1B5F45B8, 0xA3A63EE029DC9F63, 0x1B0A0A196C8F6C8F, 0x99E87310FBC271A3 }, - { 0x28F186B361C89BE6, 0xA1A5365667D49291, 0xB4F393D0900864BA, 0x55B94A3741A48C8C }, - { 0xF6435CE4D01839EC, 0xB6673D8F2E8A194A, 0x8A42CD9E92598297, 0x1104ABFA00C668CB }, - { 0x1F53BCB0275B1C57, 0x43DD0DF57F6ADC62, 0x8F154823331CF730, 0x5889ACB2EFCC1964 }, - { 0xAA90D0333AE3D6B2, 0x68BB37339E2B3C9E, 0xB488819494136F9B, 0xB34B55CD5A499418 }, - { 0xA8A9CD859CD27499, 0x5D1D63A8A074486D, 0x7EF03D1F2D46C905, 0x12E10D7BCE19876B }, - { 0x4F66715E94649152, 0xF5A5FE48766BAAED, 0x641E04D18099F950, 0x78207DCB9BBB247E }, - { 0x0FA87652EFD33C81, 0xD12AFCD1ECEC2657, 0x0B5095EA17830B3A, 0x86287151D952BA1F }, - { 0xB78517D559679DD4, 0xEDE0706F7FF6DD11, 0x1E73A764809D6642, 0xBADBE2DBE0879F80 }, - { 0xA1DB1738D7FE28AF, 0x0639A2D08D788DBA, 0x39BAFFAD8A6F99EE, 0xA4CDB395C5D97BF0 }, - { 0x4CF0061C7F2059A2, 0x225AFEB31397D54F, 0xA6038CAEB09C484F, 0x998A29CA6B9D6F71 }, - { 0x50C15DE2269A9DE0, 0xBE4B4CC549D71D28, 0xC8E62ED2889B2997, 0xC959EB7320ADB02D }, - { 0x94494316271E05F1, 0xE9BD2663E53D5F42, 0x4725FCBCF661D8C2, 0x80C10BA948C44E57 }, - { 0xD02CEF06B23C7C5E, 0x2D6696488CE3C389, 0xC8D671873FE25684, 0x553B6629F0F16072 }, - { 0x8010AFB151BA35E1, 0xF5C0B5EA1F0A202C, 0x017332B225F47A58, 0x72E87B1E7106AFD9 }, - { 0x7C7E1E7D7A3C4816, 0x0E90DF669E05CD63, 0x8046097ECF515646, 0xEC726180476F6FDD }, - { 0xF3A7AAC9F3257C72, 0xEB287BC300F31388, 0xCBC670DD756E6121, 0xF4FAA148E5E3C283 }, - { 0x08FDAAE9628BB9AF, 0xFC502F3A37525483, 0x38C9CB644061CDF3, 0x2434FB5F129BF824 }, - { 0x65913DA1B10BED73, 0x812FCF578DCBAF3E, 0x7B269F42A3E17781, 0x906C09CFD3392984 }, - { 0xA465333C4427242A, 0x63D08044D70294AD, 0x3EDA1A9C257940F2, 0x138844C54225CA4E }, - { 0xA603EC80BD955208, 0x466738CAEDBB4025, 0x506C22616D4F2CD4, 0x4F575073A1B0D821 }, - { 0xB5BBE2C5E1A5672D, 0x4C6209FE64DD62D9, 0x14711C63F383FFBF, 0xAE72DC028E57B7C1 }, - { 0x90FB5D3B763D607D, 0xBD27F1C9A1031C77, 0x904FFE48F7A8262C, 0x1334C5A731BF567C }, - { 0xD4B41E7CE54C93E9, 0xC672635478360026, 0xE43160A1CEB97C69, 0x17DEB630A541C307 }, - { 0xC1E2D0385C706724, 0x9C5B9C41ECF0426A, 0x599F362CA10190FC, 0x7223A0B144F493C6 }, - { 0x0B45FA27060C1213, 0x323C6654D9663EF4, 0xD5402D3B99403415, 0xC15D9B8D5D0567F9 }, - { 0x4C0DB82FF0359478, 0xB5C97C871B14E947, 0xF62D548F16B7AF8B, 0x9EEE76A27C1B06D6 }, - { 0x3D9A7039B8EB82E9, 0xA264C318F3CA7C8D, 0xC7DEFF95E90BE79C, 0x40323B9472711AC8 }, - { 0xB73D29485284C78F, 0x56EAF2E6F72FA354, 0x556DBF473B2AB25B, 0x1A7B842C2B662692 }, - { 0x4F9E4F76899721A8, 0x6406E6B4574EB596, 0x13751CABBEE8E292, 0x8B2FA9D3341B3981 }, - { 0x5994BC49A92091DC, 0xEAF14F434F7E7F66, 0xF9DBF77BDB85615E, 0x9A6D93D6858B92C5 }, - { 0xD7272D936F77A9BF, 0x69EA39529E9A44C2, 0xC9FF052C3E495FB0, 0x85B9E4AB4B917056 }, - { 0x812CFCA1E2D5C0D1, 0x3E2C48B589FC6440, 0x1F6B85F00F03E005, 0xD486AEEDE95079AE }, - { 0x126A3867926080B9, 0x2F0EC0F62A8AF4F8, 0x247C5DEC4B46E152, 0xC14486F66BEBF7B0 }, - { 0x24ABE02E6D5255A3, 0x3125BF5FDCFF2632, 0xD671C7F009A0B85B, 0x3DAB499AF735EFEE }, - { 0xE8DDF8BCE2F4FAB6, 0x74BA59532E88E533, 0x96ADFAE195420771, 0xFE83BD97D09EEBA6 }, - { 0x722278F46850DE76, 0x2138E2F2C56BF60C, 0x07827F46E0AF48C7, 0xD6E7925327799B9F }, - { 0x28A226B83CB5316D, 0xE65E0E4CF318A836, 0xBA0620D7B35F6AB5, 0x8D18EA44FF2C52A2 }, - { 0xBA4426A74EAFA3EE, 0x62AC4F45923548B9, 0xC8D4C6CE956C8FBE, 0x264EEE1FA3442C34 }, - { 0x1919C892CF10178D, 0xDE4A38102271B31B, 0xD490EC4B40F35EDB, 0x9FD80E8E1671B0F1 }, - { 0x5254CFDFD49C0F6B, 0x02B0B55D92079A36, 0x09D7430BA70DC0DD, 0x816B3784D0427910 }, - { 0xA9236785D72393A2, 0x4EF215A461FF938B, 0x2D9F3B8CB27E1A6F, 0xF63805D5B138AA24 }, - { 0xD78D7D639249C7CD, 0x98FD3AD882C0F98C, 0x77976824DC4D8A59, 0x0D80A26148AEE507 }, - { 0x5B632F5763688227, 0xB5DF59059F3D891F, 0x00C63D23E5A895E9, 0x29DE75D8AA83D05D }, - { 0xED269E2FF14E828D, 0xD77F018700B0A460, 0xC15CC2D4AFBF0011, 0x00BE8F38D8ADAFF3 }, - { 0x62134F47786E5367, 0x9ABEBB061CF4BE74, 0x3A3AAD9108B723B8, 0xED4BEF93CCE7D253 }, - { 0xC31609F406FEB281, 0xE563F0D3BF817875, 0xD11F818CB1E38D02, 0x603DB390BF66E9BE }, - { 0x0C242E5FD9FA0F2F, 0x5FA576955E056419, 0xF9AD77E3EB3E03C5, 0xF151256C9B4146AB }, - { 0x213DA75407E6473C, 0xFE0EB8656ED03D6D, 0xCA533ACA4FF6D3F2, 0xF97127A0ED321C73 }, - { 0xAD111379642FFEE6, 0x8C7E03C4B4BD71D7, 0x3D84DAC086C961CD, 0x22BF115FF7A0E4E8 }, - { 0x06DB78D12149C22D, 0x8014A669F49192B0, 0x7D011A225B874BEE, 0x0125876F1DEC3374 }, - { 0x79B5CCAC28B1D1BB, 0xD038C6EE73057471, 0x657776F147727FB3, 0x669CB4E769C683B7 }, - { 0x8AC5DA288A81F71B, 0x7531F8824DCC409A, 0xFFCB7E88215EAA39, 0x8D9B4EE0A2A3FAFE }, - { 0x2F2D4540708C98DA, 0x1CA6F1A05DC23FE6, 0x6F5C3AECDF7265F7, 0x6816E2337C37D3F2 }, - { 0xEC035986496596EB, 0x220AE5B82F1A2AD5, 0xBB9139F80D12259D, 0x3E19D5623AAF8487 }, - { 0x67AF511E83F23FFA, 0xE30853CEF535AEB5, 0xCFBF8EDFC0F4C7E0, 0x7EA32A921DAF1269 }, - { 0x7C396CBFBD27929E, 0xD330F5ACDDF20DAD, 0x26EB6DF9D56A7066, 0xCEFFC790682B0DC5 }, - { 0xA27224D6E741AA47, 0xA7CCED9C4586658D, 0xAF47728120D00ED0, 0x4EBD719B1A5B1E71 }, - { 0x784B9E6816D4558A, 0x109828B534CD41C3, 0xB464B3C3265C93D7, 0x9E45F1E486780079 }, - { 0xD77673ADFAD62C3D, 0xCB3C38A2C2EB12B7, 0xFBB69FBC721B7E1F, 0x16FCFE38BA687912 }, - { 0xA48E2627C92ED81C, 0xCAE51F9DCBA5B8BB, 0x7A318A2CD41A6288, 0x7BF2630AB439B2D7 }, - { 0x475B05FC929E6726, 0xC09ED9CD9B445C4D, 0xC22BFAA7D79606F7, 0x2F82133D9F527215 }, - { 0x4FFC835D8AACF34C, 0x1AE717151522EAFC, 0x519E31F413A969A4, 0xD58492B73E706AC8 }, - { 0x4DD7A0B31BC12558, 0xB65CF95432F8FC74, 0xA857DB1B0B388E4A, 0x86147E5FE0708FFF }, - { 0xA911B98D9D7C6E46, 0x639356CCAA0823B6, 0xC606F2809E6B2CAE, 0xFA55297EFAF78678 }, - { 0x5E6D6133DF09E936, 0x7F607F9469292FF6, 0x88250261E8D7BED7, 0xDB369AC7BF8E5664 }, - { 0xFB10D55C127E43A0, 0x7528FBDB9C0F0ED0, 0xA1AA6820AEDC869C, 0x8859D2AECF366220 }, - { 0xDC67039743BC2554, 0xE64327EB0CCC7B3F, 0xA77E7C9896E4423D, 0x54C851699E3CB121 }, - { 0x1F1644FCD09BB5E4, 0xBD2B818BAF01F4D4, 0xA38AD41524EC3A57, 0x29FFDD44929AD1E9 }, - { 0x7D42FEE879C24591, 0x600C9EA01795C34C, 0x7AFDEABD64733F1A, 0x5A0A093286370519 }, - { 0x943801FBC4B5C4BD, 0x79E8D39E4097AF6F, 0x258A6BB23657E0EB, 0xFFCD07BF2C434CDD }, - { 0x4E05F0C58901316E, 0x1A11CED54910AA35, 0x7C0F12109F23E6D1, 0x102AA1AC249EE34A }, - { 0xA4D7A763848B6FEB, 0xDD5CC4D0EEC1E969, 0xDA0C140F2EB33AE8, 0x8019F4A09D6DD1FB }, - { 0xF6148643902CC9E2, 0xAECA25F4885256E4, 0x6AD598FFBF8E0D0E, 0x8FA2DC4D5C8FE5BF }, - { 0xCFEE5E3D7955BB67, 0xBD3E80F33FB41743, 0x020EB0BD8A86F8F4, 0x7662F86A0A820ED2 }, - { 0x1F1FCDD5C3D1E625, 0xFEB61F7EBCEDE5A9, 0x3DB10D1560149025, 0x830E35F0B21FCF96 }, - { 0x0EB66674FB59D6C6, 0x23D8604215773FF7, 0x8F888A9BF456A060, 0xD24E70F748B20FD9 }, - { 0xA8FEEC51995C4767, 0x1873A600D6ECEBC7, 0x56583FA2AA08FB43, 0x4D0183063B9620DB }, - { 0xED45C4E0EF73A84A, 0x36C1B0CDCC31B739, 0xF98B3BA5ECF1306A, 0xB1C59FEFD6B02CF5 }, - { 0xC17A382B566D1665, 0xB65F6305F34AFFB9, 0x56D1C076E1969430, 0x1C97F561DF9F3DEA }, - { 0x1D377A06F742A950, 0xE4063095ADD6635D, 0x4FF1177A448FE969, 0x7348A8A526B858AE }, - { 0x71DC2BF5E3FAEA68, 0x8971561A2E55B4C3, 0x3CD7F63C053136BF, 0x85BBB87252622A33 }, - { 0x4786FF7DE5087372, 0x1127AB8BFA27D806, 0xCE281F6C3C7751B2, 0xBDF4EDFD4890731D }, - { 0xF28E22B8ECCBDD26, 0xD017E78ACAE4C696, 0x5793F13ADB7B27F8, 0x8DD0310C1206A0F0 }, - { 0xBCAC98BA4FEDFC23, 0x8B064FCF828EEBAC, 0xE51492F58FD3E4E1, 0x99B85EDE0D001491 }, - { 0x229192E93F7FD0D8, 0xA2521F86DC3157D2, 0x620ED8B97F031833, 0x0B884E998BEE064D }, - { 0xC6ABF4C99CF38E7A, 0xCD75C212014B7EFE, 0xE61649609B7E5132, 0x63EF110B9248B177 }, - { 0x2FFAE8AFB2027308, 0x4E0539E70735D201, 0x4D1F2DB20249A713, 0x548566761308DDA0 }, - { 0xAB7DF8EA59C35904, 0x68346BC31A91ACF1, 0x18B36C4A40186A3D, 0x7573A39B18C63B18 }, - { 0x3238A57E63BECA63, 0xA8A3B7C0CE1E5B44, 0xB6360D9FD4515975, 0xB7A5E4F311A9D895 }, - { 0xD75AD243CED8727D, 0x6477CE620589DD14, 0x916C8362E452874F, 0x6D9AF0E04071B614 }, - { 0x92A8041693260B12, 0x15BDD88CE79553B5, 0x9CB8154859FA6A18, 0x0A560056DA3F657E }, - { 0xE4513878BE62ED73, 0x8445AE3C4EF5D425, 0xF2CD623333553606, 0xF32F4AE634FE35E6 }, - { 0xD55567F34047852F, 0x30E1AC975F46947A, 0x4FB29D4FC24047CF, 0x425FC6752335DD88 }, - { 0xF278DBABBA0EEB58, 0x4EF3F89C5607FA7F, 0xE10EC8C7A6E2CFE6, 0x00D14E456ACD6096 }, - { 0xDE7630EFB0AEC1EF, 0xD89DDDD9E64A7A34, 0xFF13E4B800DEEB0E, 0x3C484E87BCD603DB }, - { 0x22BB5096E785BAF8, 0x4A5BE874F3D2D8B1, 0x45391EED10F97BCF, 0x072B17D86FE9F826 }, - { 0xE15A3246FD61CDE5, 0xD29F964B7814AB43, 0xCFD26715C8D5BDDE, 0x9F0812522402C6B4 }, - { 0x118AA5245FE682EE, 0x6BF41D7F315312AF, 0x813E52FEFBBA7526, 0x72688DC079298826 }, - { 0xFA349B2AA4A31E8B, 0x110EE18FD7B0A098, 0x16B86FD60ED1CD51, 0xFD201195D3DB2082 }, - { 0xE7DA8100F1ECFF9C, 0xB0C6E5D8859D341A, 0x621B246AD4AB6E73, 0xA6F772DAEE6105B9 }, - { 0x00CB8E080067507D, 0xE84E2155F89AAED4, 0xD65811DEA96E1B5C, 0x3CC3B220825BBA67 }, - { 0xC7369912A28787EA, 0xA421384E7526E595, 0x14244343797B5338, 0x2EC3666AA8890D44 }, - { 0xA64EE51FEE017664, 0x1631EFAFDA9B15E2, 0x16AF520E34864D3D, 0x56DE61484B1B2622 }, - { 0x92F95054F54A680D, 0xB4F9BF202D1594F3, 0xD13E8A765D8E325D, 0x1CF617F26F52E7F3 }, - { 0x8FFFA25B6CFB9591, 0x2CEA1A1B3A279FC1, 0xBA2E6EF3CBE30693, 0x1C724317CFE857C0 }, - { 0x9846ECD9BFFEA659, 0x5D453973869FE2DB, 0xAABF781D36A469C5, 0xD406DD0FE4234627 }, - { 0x4E6410AAC382596D, 0x41DB9EA85575D5BE, 0xF3627E9FE72FCD41, 0x16FCCCFCF3F960B4 }, - { 0x4BDF4C2B9E79E328, 0xA356E02DCACF42C8, 0xF76FEB61952B00F7, 0x610F065F01A7F902 }, - { 0x046A9807CF2825F1, 0x57705E8344F95376, 0x33D79231DDBEE7F6, 0x026679D852F29A9F }, - { 0x1620F6DA7BF96CDF, 0x28479D1A06833199, 0x6A080AC81A957BB9, 0xBC129A61658E3A53 }, - { 0xDE7349763400FD38, 0x75C31C6B4821ED5A, 0x7C8EA4E3F9E2849B, 0x9BBE9ABD30E8DEDD }, - { 0x24E2FF048DEDF95B, 0xE439D47BDAA89130, 0xF102378404DC2D2F, 0xDD02ECE754CF3B52 }, - { 0x47EAE793E6E32E05, 0xF8828F48DC539EB2, 0x23C70630C9F8E521, 0x44DE3F951CB0A22C }, - { 0xA5387811B871DB52, 0xE76CB69D5EFF524C, 0xD42BEDDC82711729, 0xD93F4594D7C5C4A0 }, - { 0x3C98724C667A7AC9, 0x27F286F5FFE85DC3, 0x51B7FD932260D6D9, 0xCA30DB690A86CD2E }, - { 0x31E44F403C68BB77, 0xEA34FD30FB910830, 0x24CDD96CD468473D, 0x729370C0994EADEF }, - { 0x3C9A94B82CC7275C, 0x4608D689640EFBE5, 0xEBCB1B15238B85CF, 0xF27503C0B9CD39F3 }, - { 0x9FAE95E5E0609E9B, 0x4C3B925A6BEDDE8C, 0x87A9881C59550E72, 0x23A85F1E95408033 }, - { 0xCDA993D459356556, 0x95061A1CC07D54FC, 0x65286457D08BFAF8, 0x5D0CA926D7625C7E }, - { 0x5130D53891A41832, 0x3E485083E56D4A7B, 0x378EF832DB3642F7, 0x62BC07BB34F836C0 }, - { 0x537F6FD91A596BE7, 0xD2EC3C7023583829, 0x86EA0B05335AA53D, 0x0CCC017571A6A30F }, - { 0xFA06E97F589D9539, 0x82462FB433DB100B, 0x4040A95FCE8AA76F, 0x95DDED432EFF85D6 }, - { 0x2EC1D1A22B088C0D, 0xEEDA7195124509AD, 0xCE973FEBFA6C71A2, 0xF0B7232CFAA9AC05 }, - { 0x439E9948212A4445, 0xCA75DB98E16A2AEB, 0x0A172B725B827F03, 0x9426996DB514EFA9 }, - { 0x54AF89824EBB943E, 0x84D59FBBF2A85B02, 0x7201FE70FDE45894, 0xB1290A933705EB83 }, - { 0x2407BEF2180CFDEF, 0x90E12343A987E51D, 0xEBDF2C3CD0C32EB2, 0x808CCDC4B9E20F42 }, - { 0x6CA12E85BE251EEE, 0xAECBF45547E44B19, 0x132E011441B79853, 0x166D0CFA7CF7F7E0 }, - { 0x508CD52057F05CE8, 0x92BD3A15802ED0FA, 0x5D99A4253E573B8D, 0x617A531DF991EB5F }, - { 0xFD23E6436C2398DC, 0x876CD6F46B613B0C, 0x7F0D5F7CA0E6ACF3, 0x0655EAF08E9060FB }, - { 0xC207FEE5574A63EC, 0x63194FF22584D7E2, 0x3106065832FBCD59, 0xD449C8A20F268C55 }, - { 0x27ECA978EB2EF8D1, 0x2D6ACBD41DFAD9D4, 0xB8E1E7F853D0649D, 0x957C178D0598E15D }, - { 0x328456E7CB682226, 0xF01A3B9F3D41DB7B, 0x8CF8676EB90F9864, 0xC2047EA7FB2832E7 }, - { 0xB1CCDAEF68845A47, 0x29D9EF7A227AF267, 0x102C99BE23F92DA1, 0xCDA8FBCF339B2DCD }, - { 0x18BFEE62ACD1D325, 0xA51FF4FC3AE60AC8, 0x777B90A7ABA99B1A, 0xE2DA250E08E949CD }, - { 0x88E443D409725A1C, 0xF6EFA8C464F32B1E, 0xEEB0B947C6F49B1D, 0xE41D60EBAA543BF0 }, - { 0x219FFE9FD5580836, 0x98B35F6720D0B23B, 0x7A0B115ABC4339DE, 0xF7EECDB1F7D97A7F }, - { 0xFAA5C13273BD9DAF, 0x3CF6BBAD62D86BE9, 0xB84705AF6BA67789, 0x1E6049980FAA08CE }, - { 0xD387434F43051B94, 0x23F308A48AB676BC, 0x5290BC5FA95E17C3, 0x010155139FD750C6 }, - { 0xE0B6B8F5BC740A55, 0x386609AF47615059, 0x3646820D95C71B27, 0x06BF054A9B7D3C63 }, - { 0x0422011DEED25341, 0x7DA288C5095FDE62, 0xC96948F62E07F13B, 0x5857A358252F4BAD }, - { 0x232B4C03C1635E64, 0x08BA417DC91948D8, 0x2409B207F26E25A0, 0xA519600EDC7E2ADB }, - { 0xC65E004EB04929F4, 0x7B1E2FA7103D2F1E, 0x230C716219205438, 0x6B02DD77182E57C6 }, - { 0xF597DFD2EFA07D8E, 0xF7588E9DD504CEF4, 0xF898EFAD18A85619, 0xC4C04163E9D1EB0D }, - { 0xD7C0E8260510ECA4, 0xA1ECBFF9DC7A1AF7, 0xECAF59808A1210C3, 0xB3E8F2584026FDA2 }, - { 0x70F6D9037AAEDEF9, 0x97E9B66A0490F2AB, 0xC39B8BEE5A3144E6, 0x072303CA9BB187BD }, - { 0xC4A05B60568B5672, 0x34EA6F20E693C620, 0x9BD7C9FBB306A39F, 0x524622B8D7F395FE }, - { 0xD8EF13F300E5FA1E, 0x0E22767AE7173B01, 0x53EE135EC079E04B, 0xE4809B2432FAACCE }, - { 0x55E180F827E5F06C, 0x676E484F5F2F63DF, 0xB93435878A76323C, 0x4D0C34FD88358E3F }, - { 0xE40DB410675118A5, 0xEBDC75A1B14CF8F0, 0xC797128C41C21668, 0x42653A4FDC29915A }, - { 0x92DD5EC0B5EE9E18, 0xFC95EA4782DC915D, 0x14DCD14FC642332C, 0xEB5762745DD8A51E }, - { 0x14E1C7A1DA58A7AE, 0xE509426BA26CE7C0, 0x9389E2ED9823AF5B, 0x038FD1C30E8F5CDB }, - { 0x342ABA7EE53C69E5, 0x0361136EE1AEF594, 0x75C96B8ED7FAEB28, 0xA17248E5714C0C5A }, - { 0xBBDF07F2860D530A, 0x4B76B5AC74BCCF46, 0x8382530863D69489, 0x81561F7DABA4802A }, - { 0x83E7562819609C24, 0x62DDEF13D4E8F74D, 0x8F42D4B1024E17B9, 0x8309FF042A65681D }, - { 0xB68D6416FAEBE43D, 0x60F0FAB60783EDDF, 0x0A31FE5546E00714, 0x6C38E17580C998D6 }, - { 0xE7345EF688EDF71B, 0x70EAC26A766A8446, 0xCD580E38B755F9C1, 0xE041505C8EEE77A9 }, - { 0x5C5AEF56EED653B6, 0xEE2E0D6C58A8E2A2, 0x31FFD07AA6DA82EF, 0xDE73B2394F299105 }, - { 0x731764E8F75664B3, 0xF84347FF7EB6CFDA, 0x709CE0F265FAFB81, 0xA3BA23F9437F737C }, - { 0xECDD9540F7B23A82, 0xA2CD80445660AAD3, 0x9433383BF04EA8E0, 0xBDB50B4BFCABABB5 }, - { 0xAFF9039F25567512, 0x64116FB612088FB3, 0xE66640FAC1F0BC71, 0xE22BCC4F64626AC5 }, - { 0xB1858BA85A0B5DDE, 0x048EB5E258A87682, 0xBED3C112A9C6347D, 0x288F3288845DD117 }, - { 0x672D871CFFAD4A59, 0xEB5069951CEB3292, 0xE19A1EC9C5D566B0, 0xA5B98C92180C4E0A }, - { 0xDFBFFE8649ACE812, 0x6F08EFBB7F9FCC09, 0x584EC2A2A0E75D58, 0x327F2959492F7A09 }, - { 0xF48907D7DA1A4E6F, 0x47237E9EFB9BD08E, 0x4DE0CE0A73A1377A, 0xCB6069E2770FE00E }, - { 0x455E6801F3BE98F5, 0x277EBD80999063C5, 0xBC804401295C8241, 0x565FB328A39536D8 }, - { 0xBB50CD7276C60819, 0xB494898F3B63EA5E, 0xE44EAACD43B007A9, 0x8991339A93727DB1 }, - { 0x4BEBA5E9BB868F0B, 0xDE0B9F79D3C64F48, 0x2D8FD5C320DC0856, 0x5768EC0480A25593 }, - { 0x1FB97BD48FABDDD8, 0xE31719FF7C09DDB2, 0x353A97327A719A76, 0xB223FF33FBBC1A70 }, - { 0x28E5FB6347D650C0, 0x9F235C9DCEE73564, 0x5CD41D3B3CDD81CE, 0x7E20DB1AF66C7904 }, - { 0xC524EE312054C3A6, 0x8B870EC7BB9407BD, 0xDA56117DA591B4E4, 0xD97E1F53D525AF6F }, - { 0x6805383B4845FFA3, 0xE610AD3C01D37A2F, 0xFEE55D36C134D652, 0x25F5897DB73B902E }, - { 0x333F64A1FA700F2F, 0x471A991A8314FF0E, 0x8DE994CAFCDEA0A8, 0x5A42B9180D15018E }, - { 0x5E432F656AF89DF2, 0xE0EB02329E5470F8, 0xBCDEBFD21B629E78, 0x16CAA2CDD396CD67 }, - { 0x3FE7057CF28379E2, 0x26F63C28DCF99F36, 0xBB219E2E94CB2246, 0xECF193F6B12D676A }, - { 0xA9094A4844DCE0EC, 0x574C6C12361375E9, 0xF2CE70FE6316D035, 0xEFDB36B3A84B8FA6 }, - { 0x2C8D11CBEEFA2CB2, 0xC51DF0D952A71933, 0x634F029BA08F42F5, 0x03260122B6B3A942 }, - { 0x3E3E3873C86CF3B1, 0x2459F31ABA192E82, 0x5D47716EAC4063F5, 0x99FC9CDDB0D5757C }, - { 0x88F2145A165655CC, 0x7A41B2FF1E736DDA, 0x4A790ED77C194864, 0x2B1A6E1053F47697 }, - { 0xCCCC292262D66B7B, 0x90B122ECADFFA066, 0xC9101BD19AF6E361, 0x330A831F2C3C723A }, - { 0x1895A190C644D7EC, 0x155568BBA5397257, 0x11ADB9F9A17941CA, 0xC6BDC78C6440FA89 }, - { 0x293C690603FC720B, 0xBF011E5FEBFA6029, 0x74585C41FCA59B00, 0x9A090A348037795A }, - { 0xB8A8839CDAC5B33F, 0x4A02FFD8F39F6EBA, 0x95BDC61B349F7E09, 0x6980145F969D5DFD }, - { 0xFCF0D9A814A86D06, 0xF64BBDA9913851C9, 0x4FF6C20270256D9E, 0xEAA2C0EEF99C3BFC }, - { 0x1ECC6DDEDFC81718, 0xE0646A86E2191E61, 0x4A2CC7A54E90C38B, 0x893C61DE03016C92 }, - { 0xC9D9359E24690864, 0xB889B99B42B81DD5, 0x98F4B849DBE8FF4E, 0x63FC3BF15C9F66FE }, - { 0x9184476FEB6AE7D6, 0xB199D5C8EA8CE9C8, 0xB912CB4F24E15BF8, 0x81F599335C9D306E }, - { 0xE5AD5363B0FC4C49, 0xA93D8B3CFC90DE19, 0xD501645108A99BC9, 0x0C6EA577C5E3BA3F }, - { 0x6B605BF3FBB081A3, 0xAA39019EA4A8F725, 0x58E3E747B68080AC, 0x7ABB70DEB48EAD49 }, - { 0x1C107AE5077037B9, 0x8E56F87E51461DFA, 0x8DB7808BC32FA870, 0xF85146616DD98E2F }, - { 0x3FDD8713A8C9501E, 0x3CFDEB84F9F78F2E, 0x2030A7D0A34E98F2, 0x2BC6F6A1E53934DB }, - { 0xA054CAF60CDB866E, 0xB03A3AA45FADFE09, 0x6E2E0A0C6FAC7822, 0x58FF9EFE9DFBF359 }, - { 0x58D962AFA1A71EBE, 0xA20D8B5521569B9D, 0x3DDE771D269AF172, 0xAC2CC08D2FC3D9F5 }, - { 0x82C146EDD011B9E9, 0xC5B1E2EAFB88EF58, 0x6249E51FF0F58DBA, 0xEAAC7C660057B352 }, - { 0x30C0A2843400EA5A, 0xC96803D99ED57895, 0x9440E3385877A325, 0xD5603FBE9C12EAA5 }, - { 0xEE7B7F22E7CFFA37, 0xAB1E12C8493A95A6, 0xF287BED0430C4C1C, 0x0910C59989BC708B }, - { 0xA085B98CEF63C444, 0xEB74B4560C0F9DBB, 0x5645CF1E31451A22, 0x7FDF8E72D25EEF16 }, - { 0x41ED994FD3222CFD, 0x5648FE9068875836, 0xC10F04B34DA1B8D2, 0x053EB4EC7E5B38AE }, - { 0xF366F82B0177478C, 0x240783195F72602E, 0x8B14B8F4F683508E, 0xF88B05682D8ED539 }, - { 0x957329CB69DD4616, 0xDA9B2483FC83AFEA, 0x169C0B95939A930E, 0x68E913B98DE4B392 }, - { 0xD6D3A64A06ABAEF3, 0xA42FD53EDCABF7B4, 0x8C5B32C6D71BCEC9, 0xB2655583E03E2C98 }, - { 0xB90E5EAEBCE454B9, 0xB709B272BE8678ED, 0x28209B984092B32C, 0xE6CAF37F2496B19D }, - { 0xB75CF8AC5F8ACBC5, 0x04DCA1308B12424E, 0x149CABF654765B2C, 0x0FF1658D2F8F0810 }, - { 0x3E9397294BAF5631, 0x7BA92FEC1ECA9B30, 0xBF17FA7FB63E13A4, 0x7DAEB4C1AA6977D7 }, - { 0xAA968B00E653CC67, 0x3E3632610627D2BD, 0x84D2334E6ACB10DC, 0x45C1CDAAA110D7A8 }, - { 0x6E15538FDE8C96C1, 0x7311F4086739E5C2, 0x52B9A2ED0DC9727B, 0xEAC4D6AD2DFFD81A }, - { 0x8EE86705EA4EF112, 0x9FFD437017AAE253, 0xA4A5954CD96840C0, 0x3BDC52D1DB58880A }, - { 0xE3D77831072D9A49, 0xEBA90285BD68C351, 0x39A51DF1F63842DD, 0x0F890EC909DEDBF2 }, - { 0xC288D3BF4EC0D17C, 0x05697A8677D9D796, 0xF7173987D2F982C5, 0xF72D0E602A2C1C4C }, - { 0x243E5739CC3C847A, 0xFD65CB07964C2AE6, 0x0033905F00C7D0E9, 0x317B256C52A327AA }, - { 0x154F8FFA5A8E6035, 0x49964501A51C9697, 0xB8B87BF7F3805389, 0x3CC1C1F3C4817069 }, - { 0xCF9983A26C657C38, 0x99A6BEA4E2D4D378, 0x6AFCC99E303D4012, 0x4ACE80478003B9EA }, - { 0x876ABF7FF3A779AA, 0x651BE6BB6EB634E4, 0xF1A008AD167B1C6E, 0xBE416232BE5292CF }, - { 0x4AEAADDD52558BB0, 0x8EF7DD6C2EFDCF6F, 0xE7E2A1AD932508CC, 0x7C739E3D87F3AF3E }, - { 0xC448E03A131A247C, 0x6907735D0090F118, 0xFE56D43E645B9C24, 0xABD2592B5D758DDA }, - { 0xD3817E5A0D06258B, 0x73CF6D4952C64485, 0xB004B6B0F9ADCF1A, 0x6D63E6D8AD968DBA }, - { 0xABD41900B8BB0389, 0x958B0F05B3A97D21, 0xD626EF93015E02B6, 0x6272EF55BAA4FD1B }, - { 0xA86652085375A297, 0x8F419118AA9DD3CC, 0x3174F469921E5C2A, 0x2E2F236F16F99560 }, - { 0x4D38C43A7F2AFD6F, 0x005B5E73AC44C12F, 0x96E4279BFC627DF4, 0x41B3CD0FB81E041D }, - { 0x9B10B02AAA22E164, 0x0B1D8938C669F8EA, 0x9CA4B55D1F0A7C48, 0x4E1AFE46FA0BCBFE }, - { 0x37F4EBBB6F63191F, 0xC34003C2EE3CD274, 0x76FD40BDC50C642A, 0x55F47A578BAA2B12 }, - { 0x517B7AF2368FE450, 0xDB775DB95CC0745D, 0x9FFA7CB26CE7D592, 0x2BA01EC50A2C7000 }, - { 0xBDC9BD36AC7F2583, 0x51C81A3155A19EA5, 0x837B6EF164074F01, 0x89D876A5EC17F920 }, - { 0x90F4B39548DF55AD, 0x6187A1D20D731ECE, 0xE78C545B94AFD16F, 0x42EF7592D99CD365 } /* 512th bit set */ -}; - -static const uint64_t s4v1[4] = { - 0x66687AADF862BD77, 0x6C8FC18B8E9F8E20, 0x089714856EE233B3, 0x902A591D0D5F2925 /* 256 zero bits (32 bytes) */ -}; - -static const uint64_t s4v100000[4] = { - 0xB422BC9C0646A432, 0x433C2410991C95E2, 0xD89758E3B4F540AC, 0xA863389F28A11379 /* ...iterated 100000 times */ -}; - -static bool match(const uint8_t result[32], const uint64_t expected[4]) -{ - //printf("Expected %.16"PRIX64" %.16"PRIX64" %.16"PRIX64" %.16"PRIX64"\n", expected[0], expected[1], expected[2], expected[3]); - //printf("Got %.16"PRIX64" %.16"PRIX64" %.16"PRIX64" %.16"PRIX64"\n", - // common_read_64_bit(result + 0), common_read_64_bit(result + 8), common_read_64_bit(result + 16), common_read_64_bit(result + 24)); - return common_read_64_bit(result + 0) == expected[0] && - common_read_64_bit(result + 8) == expected[1] && - common_read_64_bit(result + 16) == expected[2] && - common_read_64_bit(result + 24) == expected[3]; - -} - -/* Test set 1: Miscellaneous */ -static bool check_sha256_vec1(const vec1_t *v) -{ - uint8_t result[32]; - uint16_t len = strlen(v->input); - ns_sha256_context ctx; - ns_sha256_init(&ctx); - ns_sha256_starts(&ctx); - for (uint32_t i = v->count; i; i--) { - ns_sha256_update(&ctx, v->input, len); - } - ns_sha256_finish(&ctx, result); - ns_sha256_free(&ctx); - return match(result, v->expected); -} - -bool test_sha256_test_vectors_1(void) -{ - for (int i = 0; i < sizeof s1v / sizeof s1v[0]; i++) { - if (!check_sha256_vec1(&s1v[i])) { - return false; - } - } - return true; -} - -/* Test set 2: Runs of zero bytes. */ -static bool check_sha256_vec2(int len, const uint64_t *expected) -{ - const uint8_t zeros[16] = { 0 }; - uint8_t result[32]; - - ns_sha256_context ctx; - ns_sha256_init(&ctx); - ns_sha256_starts(&ctx); - /* Stress buffering a little by feeding in random lengths, up to 16 bytes */ - while (len) { - int chunk = len < 16 ? len : 16; - chunk = (rand() % chunk) + 1; - ns_sha256_update(&ctx, zeros, chunk); - len -= chunk; - } - ns_sha256_finish(&ctx, result); - ns_sha256_free(&ctx); - - return match(result, expected); -} - -bool test_sha256_test_vectors_2(void) -{ - for (int i = 0; i < 128; i++) { - if (!check_sha256_vec2(i, &s2v[i])) { - return false; - } - } - return true; -} - -/* Test set 3: Setting each bit in 512 bits (64 bytes) in turn */ -static bool check_sha256_vec3(int bit, const uint64_t *expected) -{ - uint8_t result[32]; - uint8_t data[64] = { 0 }; - - data[bit >> 3] |= (0x80 >> (bit & 7)); - - ns_sha256(data, 64, result); - - return match(result, expected); -} - -bool test_sha256_test_vectors_3(void) -{ - for (int i = 0; i < 512; i++) { - if (!check_sha256_vec3(i, &s3v[i])) { - return false; - } - } - return true; - -} - -/* Test set 4: Iterating hash of 256 bits 100000 times */ -bool test_sha256_test_vectors_4(void) -{ - uint8_t data[32] = { 0 }; - ns_sha256(data, 32, data); - if (!match(data, s4v1)) { - return false; - } - for (int i = 1; i < 100000; i++) { - ns_sha256(data, 32, data); - } - return match(data, s4v100000); -} diff --git a/test/nanostack/unittest/service_libs/SHA256_Lib/test_shalib.h b/test/nanostack/unittest/service_libs/SHA256_Lib/test_shalib.h deleted file mode 100644 index 6808b695e432..000000000000 --- a/test/nanostack/unittest/service_libs/SHA256_Lib/test_shalib.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 TEST_ETX_H -#define TEST_ETX_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_sha256_test_vectors_1(void); -bool test_sha256_test_vectors_2(void); -bool test_sha256_test_vectors_3(void); -bool test_sha256_test_vectors_4(void); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_ETX_H - diff --git a/test/nanostack/unittest/service_libs/blacklist/Makefile b/test/nanostack/unittest/service_libs/blacklist/Makefile deleted file mode 100644 index db0e402e5997..000000000000 --- a/test/nanostack/unittest/service_libs/blacklist/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = blacklist_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/blacklist/blacklist.c \ - -TEST_SRC_FILES = \ - main.cpp \ - blacklisttest.cpp \ - test_blacklist.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/address_stub.c \ - ../../stub/protocol_core_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DEXTRA_CONSISTENCY_CHECKS diff --git a/test/nanostack/unittest/service_libs/blacklist/blacklisttest.cpp b/test/nanostack/unittest/service_libs/blacklist/blacklisttest.cpp deleted file mode 100644 index 06be0ea7ccdf..000000000000 --- a/test/nanostack/unittest/service_libs/blacklist/blacklisttest.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "CppUTest/TestHarness.h" -#include "test_blacklist.h" - -TEST_GROUP(BLACKLIST) -{ - void setup() { - } - - void teardown() { - } -}; - -TEST(BLACKLIST, test_BLACKLIST_init) -{ - CHECK(test_BLACKLIST_init()); -} - -TEST(BLACKLIST, test_BLACKLIST_reject) -{ - CHECK(test_BLACKLIST_reject()); -} - -TEST(BLACKLIST, test_BLACKLIST_update) -{ - CHECK(test_BLACKLIST_update()); -} - -TEST(BLACKLIST, test_BLACKLIST_purge_list) -{ - CHECK(test_BLACKLIST_purge_list()); -} diff --git a/test/nanostack/unittest/service_libs/blacklist/main.cpp b/test/nanostack/unittest/service_libs/blacklist/main.cpp deleted file mode 100644 index 1c90a7854e7f..000000000000 --- a/test/nanostack/unittest/service_libs/blacklist/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" - -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(BLACKLIST); diff --git a/test/nanostack/unittest/service_libs/blacklist/test_blacklist.c b/test/nanostack/unittest/service_libs/blacklist/test_blacklist.c deleted file mode 100644 index 72baab62421c..000000000000 --- a/test/nanostack/unittest/service_libs/blacklist/test_blacklist.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2017, 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 "test_blacklist.h" -#include -#include - -#include "address.h" -#include "mle.h" -#include "blacklist.h" - -#include "mle_stub.h" -#include "address_stub.h" -#include "nsdynmemLIB_stub.h" - -bool test_BLACKLIST_init() -{ - nsdynmemlib_stub.returnCounter = 0; - if (0 == blacklist_init()) { - return false; - } - - nsdynmemlib_stub.returnCounter = 1; - if (0 != blacklist_init()) { - return false; - } - - if (0 != blacklist_init()) { - return false; - } - - blacklist_params_set(1, 1, 1, 1, 1, 1); - blacklist_free(); - - return true; -} - -bool test_BLACKLIST_reject() -{ - nsdynmemlib_stub.returnCounter = 2; - - if (blacklist_reject(NULL)) { - return false; - } - - if (0 != blacklist_init()) { - return false; - } - - blacklist_params_set(60, 60, 10, 1, 3, 600); - - uint8_t addr[16] = {0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x6e, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x01}; - - blacklist_update(addr, false); - blacklist_ttl_update(5); - - if (!blacklist_reject(addr)) { - return false; - } - - blacklist_ttl_update(15); - - if (blacklist_reject(addr)) { - return false; - } - - uint8_t addr2[16] = {0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x6e, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x02}; - - if (!blacklist_reject(addr2)) { - return false; - } - - blacklist_update(addr, true); - - if (blacklist_reject(addr2)) { - return false; - } - - blacklist_clear(); - blacklist_free(); - return true; -} - -bool test_BLACKLIST_update() -{ - nsdynmemlib_stub.returnCounter = 3; - uint8_t addr[16] = {0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x6e, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x01}; - - blacklist_update(addr, false); - - if (0 != blacklist_init()) { - return false; - } - - blacklist_params_set(60, 60, 10, 1, 3, 600); - - blacklist_update(NULL, false); - - blacklist_update(addr, false); - blacklist_update(addr, false); - blacklist_update(addr, false); - blacklist_update(addr, false); - - blacklist_ttl_update(200); - - blacklist_update(addr, false); - - blacklist_clear(); - blacklist_free(); - return true; -} - -bool test_BLACKLIST_purge_list() -{ - nsdynmemlib_stub.returnCounter = 3; - - if (0 != blacklist_init()) { - return false; - } - - blacklist_params_set(60, 60, 10, 2, 2, 15); - - uint8_t addr[16] = {0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x6e, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x01}; - uint8_t addr2[16] = {0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x6e, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x02}; - - blacklist_update(addr, false); - blacklist_ttl_update(5); - - blacklist_update(addr2, false); - blacklist_ttl_update(20); - - blacklist_clear(); - blacklist_free(); - return true; -} diff --git a/test/nanostack/unittest/service_libs/blacklist/test_blacklist.h b/test/nanostack/unittest/service_libs/blacklist/test_blacklist.h deleted file mode 100644 index b60abc027f5e..000000000000 --- a/test/nanostack/unittest/service_libs/blacklist/test_blacklist.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 TEST_BLACKLIST_H -#define TEST_BLACKLIST_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_BLACKLIST_init(); -bool test_BLACKLIST_reject(); -bool test_BLACKLIST_update(); -bool test_BLACKLIST_purge_list(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_BLACKLIST_H diff --git a/test/nanostack/unittest/service_libs/channel_list/Makefile b/test/nanostack/unittest/service_libs/channel_list/Makefile deleted file mode 100644 index 443e289da566..000000000000 --- a/test/nanostack/unittest/service_libs/channel_list/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = channel_list_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/fhss/channel_list.c \ - - -TEST_SRC_FILES = \ - main.cpp \ - channeltest.cpp \ - test_channel_list.c \ - ../../stub/mbed_trace_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/service_libs/channel_list/channeltest.cpp b/test/nanostack/unittest/service_libs/channel_list/channeltest.cpp deleted file mode 100644 index 4e3137dcb776..000000000000 --- a/test/nanostack/unittest/service_libs/channel_list/channeltest.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_channel_list.h" - - -TEST_GROUP(channel_list) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(channel_list, test_channel_get) -{ - CHECK(test_channel_get()); -} - -TEST(channel_list, test_gap_in_channel_list) -{ - CHECK(test_gap_in_channel_list()); -} - -TEST(channel_list, test_channel_list_count_channels_reverse) -{ - CHECK(test_channel_list_count_channels_reverse()); -} - -TEST(channel_list, test_empty_channel_list) -{ - CHECK(test_empty_channel_list()); -} - -TEST(channel_list, test_channel_list_count_channels) -{ - CHECK(test_channel_list_count_channels()); -} diff --git a/test/nanostack/unittest/service_libs/channel_list/main.cpp b/test/nanostack/unittest/service_libs/channel_list/main.cpp deleted file mode 100644 index 6a9eb583613c..000000000000 --- a/test/nanostack/unittest/service_libs/channel_list/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(channel_list); - diff --git a/test/nanostack/unittest/service_libs/channel_list/test_channel_list.c b/test/nanostack/unittest/service_libs/channel_list/test_channel_list.c deleted file mode 100644 index d69888be35ed..000000000000 --- a/test/nanostack/unittest/service_libs/channel_list/test_channel_list.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "Service_Libs/fhss/channel_list.h" -#include "test_channel_list.h" - -bool test_channel_list_count_channels() -{ - int channel_count = 0; - int i = 0, j = 0; - uint32_t channel_mask[8]; - memset(channel_mask, 0, 8*4); - - // Test filling channel list 1-by-1 from 1 to 256 channel, starting from channel number 0 - for (i=0; i<256; i++) { - j = i / 32; - channel_mask[j] |= 1 << (i % 32); - channel_count = channel_list_count_channels(channel_mask); - - if (channel_count != i+1) { - return false; - } - } - return true; -} - -bool test_empty_channel_list() -{ - int channel_count = 0; - uint32_t channel_mask[8]; - memset(channel_mask, 0, 8*4); - // Test empty channel list - channel_count = channel_list_count_channels(channel_mask); - if (channel_count != 0) { - return false; - } - return true; -} - -bool test_channel_list_count_channels_reverse() -{ - int channel_count = 0; - int i = 255, j = 7; - uint32_t channel_mask[8]; - memset(channel_mask, 0, 8*4); - - // Test filling channel list 1-by-1 from 1 to 256 channel, starting from channel number 255 - for (i=255; i>=0; i--) { - j = i / 32; - channel_mask[j] |= 1 << (i % 32); - channel_count = channel_list_count_channels(channel_mask); - - if (channel_count != (256-i)) { - return false; - } - } - return true; -} - -bool test_gap_in_channel_list() -{ - int number_of_bits = 0; - int channel_count = 0; - int i = 0, j = 0; - uint32_t channel_mask[8]; - memset(channel_mask, 0, 8*4); - // Test channel pattern with gaps in it - channel_mask[0] = 0x80000001; - channel_mask[1] = 0xc0000003; - channel_mask[2] = 0xe0000007; - channel_mask[3] = 0xf000000f; - channel_mask[4] = 0xf800001f; - channel_mask[5] = 0xfc00003f; - channel_mask[6] = 0xfe00007f; - channel_mask[7] = 0xff0000ff; - - for (i=0; i<8; i++) { - for (j=0; j<32; j++) { - if (channel_mask[i] & (1 < - -// Test filling channel list 1-by-1 from 1 to 256 channel, starting from channel number 0 -bool test_channel_list_count_channels(); -// Test empty channel list -bool test_empty_channel_list(); -// Test filling channel list 1-by-1 from 1 to 256 channel, starting from channel number 255 -bool test_channel_list_count_channels_reverse(); -// Test if there is a gap in channel mask -bool test_gap_in_channel_list(); -// Test getting a channel using channel index -bool test_channel_get(); - - -#ifdef __cplusplus -} -#endif - -#endif // TEST_CHANNEL_LIST_H - diff --git a/test/nanostack/unittest/service_libs/etx/Makefile b/test/nanostack/unittest/service_libs/etx/Makefile deleted file mode 100644 index ebd6e39ad0c0..000000000000 --- a/test/nanostack/unittest/service_libs/etx/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = etx_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/etx/etx.c \ - -TEST_SRC_FILES = \ - main.cpp \ - etxtest.cpp \ - test_etx.c \ - ../../stub/mle_stub.c \ - ../../stub/address_stub.c \ - ../../stub/protocol_stats_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/isqrt_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DEXTRA_CONSISTENCY_CHECKS - diff --git a/test/nanostack/unittest/service_libs/etx/etxtest.cpp b/test/nanostack/unittest/service_libs/etx/etxtest.cpp deleted file mode 100644 index ed9889378471..000000000000 --- a/test/nanostack/unittest/service_libs/etx/etxtest.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "CppUTest/TestHarness.h" -#include "test_etx.h" - -TEST_GROUP(ETX) -{ - void setup() { - } - - void teardown() { - } -}; - -TEST(ETX, test_ETX_etx_transm_attempts_update_1) -{ - CHECK(test_ETX_etx_transm_attempts_update_1()); -} - -TEST(ETX, test_ETX_etx_transm_attempts_update_2) -{ - CHECK(test_ETX_etx_transm_attempts_update_2()); -} - -TEST(ETX, test_ETX_etx_transm_attempts_update_3) -{ - CHECK(test_ETX_etx_transm_attempts_update_3()); -} - -TEST(ETX, test_ETX_etx_transm_attempts_update_4) -{ - CHECK(test_ETX_etx_transm_attempts_update_4()); -} - -TEST(ETX, test_ETX_etx_transm_attempts_update_5) -{ - CHECK(test_ETX_etx_transm_attempts_update_5()); -} - -TEST(ETX, test_ETX_etx_read_1) -{ - CHECK(test_ETX_etx_read_1()); -} - -TEST(ETX, test_ETX_etx_read_2) -{ - CHECK(test_ETX_etx_read_2()); -} - -TEST(ETX, test_ETX_etx_read_3) -{ - CHECK(test_ETX_etx_read_3()); -} - -TEST(ETX, test_ETX_etx_remote_incoming_idr_update_1) -{ - CHECK(test_ETX_etx_remote_incoming_idr_update_1()); -} - -TEST(ETX, test_ETX_etx_local_incoming_idr_read_1) -{ - CHECK(test_ETX_etx_local_incoming_idr_read_1()); -} - -TEST(ETX, test_ETX_etx_local_incoming_idr_read_2) -{ - CHECK(test_ETX_etx_local_incoming_idr_read_2()); -} - -TEST(ETX, test_ETX_etx_lqi_dbm_update_1) -{ - CHECK(test_ETX_etx_lqi_dbm_update_1()); -} - -TEST(ETX, test_ETX_etx_lqi_dbm_update_2) -{ - CHECK(test_ETX_etx_lqi_dbm_update_2()); -} - -TEST(ETX, test_ETX_etx_value_change_callback_register_1) -{ - CHECK(test_ETX_etx_value_change_callback_register_1()); -} - -TEST(ETX, test_ETX_etx_accum_failures_callback_register_1) -{ - CHECK(test_ETX_etx_accum_failures_callback_register_1()); -} - -TEST(ETX, test_ETX_etx_neighbor_remove_1) -{ - CHECK(test_ETX_etx_neighbor_remove_1()); -} - -TEST(ETX, test_ETX_etx_neighbor_add_1) -{ - CHECK(test_ETX_etx_neighbor_add_1()); -} diff --git a/test/nanostack/unittest/service_libs/etx/main.cpp b/test/nanostack/unittest/service_libs/etx/main.cpp deleted file mode 100644 index 16c71e9e6e10..000000000000 --- a/test/nanostack/unittest/service_libs/etx/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(ETX); - diff --git a/test/nanostack/unittest/service_libs/etx/test_etx.c b/test/nanostack/unittest/service_libs/etx/test_etx.c deleted file mode 100644 index b17e353eb05a..000000000000 --- a/test/nanostack/unittest/service_libs/etx/test_etx.c +++ /dev/null @@ -1,718 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "test_etx.h" -#include -#include - -#include "address.h" -#include "mle.h" -#include "etx.h" - -#include "mle_stub.h" -#include "address_stub.h" - -#define NEW_ETX_MULTIPLIER ((double) 1 / ((double) (1 << ETX_MOVING_AVERAGE_FRACTION))) -#define PREV_ETX_MULTIPLIER (((double) 1) - NEW_ETX_MULTIPLIER) - -#define INT_TO_FLOAT(VAL, PRES) \ - ((double) VAL / (double) (1 << PRES)) - -#define ETX_CALLBACK_RANGE ((double) 1 / (double) ETX_MOVING_AVERAGE_FRACTION) - -// Add always ETX 1/1 -bool test_ETX_etx_transm_attempts_update_1() -{ - uint8_t i; - - uint8_t attempts = 1; - bool success = 1; - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[10] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - - mle_neigh_table_entry_t mle_neigh_table_entry; - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - - address_stub.uint8_value = true; - - for (i = 0; i < 50; i++) { - etx_transm_attempts_update(0,attempts, success, addr_type, addr); - - if (mle_neigh_table_entry.etx != 1<<12) { - return false; - } - } - - return true; -} - -// Add always ETX 1/2 -bool test_ETX_etx_transm_attempts_update_2() -{ - uint8_t i; - uint8_t attempts; - bool success; - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[10] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - double etx = 1; - double output_etx; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - address_stub.uint8_value = true; - - // 2/1 ETX - attempts = 2; - success = 1; - - for (i = 0; i < 50; i++) { - etx_transm_attempts_update(0,attempts, success, addr_type, addr); - - etx = PREV_ETX_MULTIPLIER * etx + NEW_ETX_MULTIPLIER * attempts; - - output_etx = INT_TO_FLOAT(mle_neigh_table_entry.etx, 12); - - if (fabs(etx - output_etx) > 0.01) { - return false; - } - } - - return true; -} - -// Add (rand 1 to 5)/1 ETX -bool test_ETX_etx_transm_attempts_update_3() -{ - uint8_t i; - uint8_t attempts; - bool success; - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[10] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - double etx = 1; - double output_etx; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - address_stub.uint8_value = true; - - // (rand 1 to 5)/1 ETX - attempts = 1; - success = 1; - - srand(time(NULL)); - - for (i = 0; i < 50; i++) { - - attempts = (rand() % 5) + 1; - - etx_transm_attempts_update(0,attempts, success, addr_type, addr); - - etx = PREV_ETX_MULTIPLIER * etx + NEW_ETX_MULTIPLIER * attempts; - - output_etx = INT_TO_FLOAT(mle_neigh_table_entry.etx, 12); - - if (fabs(etx - output_etx) > 0.01) { - return false; - } - } - return true; -} - -// Add (rand 1 to 5)/0 ETX -bool test_ETX_etx_transm_attempts_update_4() -{ - uint16_t i; - uint16_t attempts; - uint16_t attempts_cumul; - bool success; - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[10] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - double etx = 1; - double acc_etx = 1; - double output_etx; - uint16_t output_etx_int; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.bool_value = true; - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - address_stub.uint8_value = true; - - // (rand 1 to 5)/1 ETX - attempts = 1; - attempts_cumul = 0; - success = 1; - - srand(time(NULL)); - - for (i = 0; i < 50; i++) { - - attempts = (rand() % 5) + 1; - attempts_cumul += attempts; - - etx_transm_attempts_update(0,attempts, 0, addr_type, addr); - - if (attempts_cumul > 31) { - etx = PREV_ETX_MULTIPLIER * etx + NEW_ETX_MULTIPLIER * attempts_cumul; - acc_etx = etx; - attempts_cumul = 0; - } else { - acc_etx = etx + NEW_ETX_MULTIPLIER * attempts_cumul; - } - - output_etx_int = etx_read(0, addr_type, addr); - - output_etx = INT_TO_FLOAT(output_etx_int, 8); - - if (acc_etx < 15.99) { - if (fabs(acc_etx - output_etx) > 0.01) { - return false; - } - } - } - return true; -} - -// Add 5/0 ETX -bool test_ETX_etx_transm_attempts_update_5() -{ - uint16_t i; - uint16_t attempts; - uint16_t attempts_cumul; - bool success; - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[10] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - double etx = 1; - double acc_etx = 1; - double output_etx; - double output_idr; - double output_idr_etx; - uint16_t output_idr_int; - uint16_t output_etx_int; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.bool_value = true; - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - address_stub.uint8_value = true; - - attempts_cumul = 0; - - for (i = 0; i < 50; i++) { - - attempts = 5; - attempts_cumul += attempts; - - etx_transm_attempts_update(0,attempts, 0, addr_type, addr); - - if (attempts_cumul > 31) { - etx = PREV_ETX_MULTIPLIER * etx + NEW_ETX_MULTIPLIER * attempts_cumul; - acc_etx = etx; - attempts_cumul = 0; - } else { - acc_etx = etx + NEW_ETX_MULTIPLIER * attempts_cumul; - } - - output_etx_int = etx_read(0, addr_type, addr); - - output_etx = INT_TO_FLOAT(output_etx_int, 8); - - output_idr_int = etx_local_incoming_idr_read(0,&mle_neigh_table_entry); - - output_idr = INT_TO_FLOAT(output_idr_int, 8); - - output_idr_etx = output_idr * output_idr; - - if (acc_etx < 15.99) { - if (fabs(acc_etx - output_etx) > 0.01) { - return false; - } - - if (fabs(acc_etx - output_idr_etx) > 0.03) { - return false; - } - } - } - return true; -} - -bool test_ETX_etx_read_1() -{ - uint8_t i; - uint8_t attempts; - bool success; - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[10] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - double etx = 1; - double local_etx; - double remote_incoming_idr; - uint16_t output_etx_int; - double output_etx; - double expected_output_etx; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.bool_value = true; - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - mle_neigh_table_entry.remote_incoming_idr = 0x30; - address_stub.uint8_value = true; - - // 2/1 ETX - attempts = 2; - success = 1; - - for (i = 0; i < 50; i++) { - etx_transm_attempts_update(0,attempts, success, addr_type, addr); - - output_etx_int = etx_read(0, addr_type, addr); - - output_etx = INT_TO_FLOAT(output_etx_int, 8); - - local_etx = INT_TO_FLOAT(mle_neigh_table_entry.etx, 12); - - if (fabs(local_etx - output_etx) > 0.01) { - return false; - } - } - - return true; -} - -bool test_ETX_etx_read_2() -{ - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[8] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - uint16_t output_etx_int; - - mle_stub.bool_value = true; - mle_stub.mle_neigh_table_entry_ptr = NULL; - - output_etx_int = etx_read(0, addr_type, addr); - - if (output_etx_int == 0xffff) { - return true; - } else { - return false; - } -} - -bool test_ETX_etx_read_3() -{ - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[8] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - uint16_t output_etx_int; - - mle_stub.bool_value = false; - mle_stub.mle_neigh_table_entry_ptr = 0x1234; - - output_etx_int = etx_read(0, addr_type, addr); - - if (output_etx_int == 0x0001) { - return true; - } else { - return false; - } -} - -bool test_ETX_etx_remote_incoming_idr_update_1() -{ - uint8_t i; - uint8_t addr[8] = {0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - double expected_etx = 1; - double output_etx; - double expected_remote_incoming_idr; - uint8_t remote_incoming_idr; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.bool_value = true; - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - address_stub.uint8_value = true; - - mle_neigh_table_entry.etx = 1 << 12; - - for (i = 0; i < 20; i++) { - - remote_incoming_idr = 48; // 1.5 - - etx_remote_incoming_idr_update(0, remote_incoming_idr, &mle_neigh_table_entry); - - expected_remote_incoming_idr = INT_TO_FLOAT(remote_incoming_idr, 5); - - expected_etx = PREV_ETX_MULTIPLIER * expected_etx + NEW_ETX_MULTIPLIER * (expected_remote_incoming_idr * expected_remote_incoming_idr); - - output_etx = INT_TO_FLOAT(mle_neigh_table_entry.etx, 12); - - if (fabs(expected_etx - output_etx) > 0.01) { - return false; - } - } - - return true; -} - -bool test_ETX_etx_local_incoming_idr_read_1() -{ - uint8_t i; - uint8_t addr[8] = {0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.bool_value = true; - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - address_stub.uint8_value = true; - - double output_remote_incoming_idr; - double expected_etx; - uint16_t output_remote_incoming_idr_int; - double expected_remote_incoming_idr; - - mle_neigh_table_entry.etx = 1 << 12; - - for (i = 0; i < 100; i++) { - - output_remote_incoming_idr_int = etx_local_incoming_idr_read(0,&mle_neigh_table_entry); - - output_remote_incoming_idr = INT_TO_FLOAT(output_remote_incoming_idr_int, 8); - - expected_etx = INT_TO_FLOAT(mle_neigh_table_entry.etx, 12); - - expected_remote_incoming_idr = sqrt(expected_etx); - - if (fabs(expected_remote_incoming_idr - output_remote_incoming_idr) > 0.01) { - return false; - } - - mle_neigh_table_entry.etx += 1000; - } - - return true; -} - -bool test_ETX_etx_local_incoming_idr_read_2() -{ - uint8_t i; - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[10] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - address_stub.uint8_value = true; - - double output_remote_incoming_idr; - double expected_etx; - uint16_t output_remote_incoming_idr_int; - double expected_remote_incoming_idr; - - mle_neigh_table_entry.etx = 1 << 12; - - for (i = 0; i < 10; i++) { - output_remote_incoming_idr_int = etx_local_incoming_idr_read(0, &mle_neigh_table_entry); - - output_remote_incoming_idr = INT_TO_FLOAT(output_remote_incoming_idr_int, 8); - - expected_etx = INT_TO_FLOAT(mle_neigh_table_entry.etx, 12); - expected_etx += NEW_ETX_MULTIPLIER * (double) mle_neigh_table_entry.accumulated_failures; - - expected_remote_incoming_idr = sqrt(expected_etx); - - if (output_remote_incoming_idr < 3.99) { - if (fabs(expected_remote_incoming_idr - output_remote_incoming_idr) > 0.01) { - return false; - } - } else if (output_remote_incoming_idr < 1 || output_remote_incoming_idr > 4.0) { - return false; - } - etx_transm_attempts_update(0,5, 0, addr_type, addr); - } - - etx_transm_attempts_update(0,5, 1, addr_type, addr); - - return true; -} - -bool test_ETX_etx_lqi_dbm_update_1() -{ - uint8_t i; - uint8_t addr[8] = {0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - address_stub.uint8_value = true; - - double output_remote_incoming_idr; - double expected_etx; - uint16_t output_remote_incoming_idr_int; - double expected_remote_incoming_idr; - - uint8_t lqi = 255; - int8_t dbm = -30; - - for (i = 0; i < 10; i++) { - output_remote_incoming_idr_int = etx_lqi_dbm_update(0,lqi, dbm, &mle_neigh_table_entry); - - output_remote_incoming_idr = INT_TO_FLOAT(output_remote_incoming_idr_int, 8); - - if (output_remote_incoming_idr < 1 || output_remote_incoming_idr > 1.2) { - return false; - } - - mle_neigh_table_entry.remote_incoming_idr = 1<<5; - } - - return true; -} - -bool test_ETX_etx_lqi_dbm_update_2() -{ - uint8_t i; - uint8_t addr[8] = {0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - - mle_stub.mle_neigh_table_entry_ptr = NULL; - address_stub.uint8_value = true; - - double output_remote_incoming_idr; - double expected_etx; - uint16_t output_remote_incoming_idr_int; - double expected_remote_incoming_idr; - - uint8_t lqi = 255; - int8_t dbm = -30; - - for (i = 0; i < 10; i++) { - output_remote_incoming_idr_int = etx_lqi_dbm_update(0,lqi, dbm, NULL); - - output_remote_incoming_idr = INT_TO_FLOAT(output_remote_incoming_idr_int, 8); - - if (output_remote_incoming_idr < 1 || output_remote_incoming_idr > 1.2) { - return false; - } - } - - return true; -} - -#define CHANGE_IND_HANDLER_INDEX_MAX 10 - -typedef struct -{ - nwk_interface_id nwk_id; - uint16_t previous_etx; - uint16_t current_etx; - uint8_t *mac64_addr_ptr; - uint8_t mac16_addr; - uint8_t accumulated_failures; -} change_ind_handler_values_t; - -change_ind_handler_values_t change_ind_handler_values[CHANGE_IND_HANDLER_INDEX_MAX]; - -uint8_t change_ind_handler_index = 0; - -void etx_value_change_ind_handler(nwk_interface_id nwk_id, uint16_t previous_etx, uint16_t current_etx, const uint8_t *mac64_addr_ptr, uint16_t mac16_addr) -{ - if (change_ind_handler_index < 10) { - - change_ind_handler_values[change_ind_handler_index].nwk_id = nwk_id; - change_ind_handler_values[change_ind_handler_index].previous_etx = previous_etx; - change_ind_handler_values[change_ind_handler_index].current_etx = current_etx; - change_ind_handler_values[change_ind_handler_index].mac64_addr_ptr = mac64_addr_ptr; - change_ind_handler_values[change_ind_handler_index].mac16_addr = mac16_addr; - - change_ind_handler_index++; - } -} - -void etx_accum_failures_ind_handler(int8_t interface_id, uint8_t accumulated_failures, struct mle_neigh_table_entry_t *neigh_table_ptr) -{ - if (change_ind_handler_index < 10) { - change_ind_handler_values[change_ind_handler_index].accumulated_failures = accumulated_failures; - change_ind_handler_index++; - } -} - -bool test_ETX_etx_value_change_callback_register_1() -{ - uint8_t i; - uint8_t attempts; - bool success; - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[10] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - double etx = 1; - double output_etx; - double current_etx; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - address_stub.uint8_value = true; - - memset(change_ind_handler_values, 0, sizeof(change_ind_handler_values)); - change_ind_handler_index = 0; - - // 3/1 ETX - attempts = 3; - success = 1; - - (void) etx_value_change_callback_register(IF_6LoWPAN, 0, 128, etx_value_change_ind_handler); - - for (i = 0; i < 200; i++) { - etx_transm_attempts_update(0,attempts, success, addr_type, addr); - - etx = PREV_ETX_MULTIPLIER * etx + NEW_ETX_MULTIPLIER * attempts; - - output_etx = INT_TO_FLOAT(mle_neigh_table_entry.etx, 12); - - if (fabs(etx - output_etx) > 0.1) { - return false; - } - } - - // Checks callbacks - for (i = 0; i < 10; i++) { - if (change_ind_handler_values[i].current_etx) { - current_etx = INT_TO_FLOAT(change_ind_handler_values[i].current_etx, 8); - - etx = 1.5 + i * 0.5; - - if (fabs(etx - current_etx) > ETX_CALLBACK_RANGE) { - return false; - } - } - } - - return true; -} - -bool test_ETX_etx_accum_failures_callback_register_1() -{ - uint8_t i, j; - uint8_t attempts; - bool success; - addrtype_t addr_type = ADDR_802_15_4_LONG; - uint8_t addr[10] = {0xfa,0xce,0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - address_stub.uint8_value = true; - - memset(change_ind_handler_values, 0, sizeof(change_ind_handler_values)); - change_ind_handler_index = 0; - - attempts = 4; - success = 0; - - (void) etx_accum_failures_callback_register(IF_6LoWPAN, 0, 16, etx_accum_failures_ind_handler); - - for (i = 0; i < 10; ++i) { - etx_transm_attempts_update(0, attempts, success, addr_type, addr); - } - - // Check callbacks (total of 4 calls) - if (change_ind_handler_index != 4) { - return false; - } - - for (i = 0, j = 16; i < change_ind_handler_index; ++i, j += 4) { - if (change_ind_handler_values[i].accumulated_failures != j) { - return false; - } - } - - return true; -} - -bool test_ETX_etx_neighbor_remove_1() -{ - uint8_t i; - uint8_t attempts; - bool success; - uint8_t addr[8] = {0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - double etx = 1; - double output_etx; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - address_stub.uint8_value = true; - - memset(change_ind_handler_values, 0, sizeof(change_ind_handler_values)); - change_ind_handler_index = 0; - - // 3/1 ETX - attempts = 3; - success = 1; - - (void) etx_value_change_callback_register(IF_6LoWPAN, 0, 128, etx_value_change_ind_handler); - - etx_neighbor_remove(0, &mle_neigh_table_entry); - - if ((change_ind_handler_values[0].current_etx != 0xffff) && - (change_ind_handler_values[0].previous_etx != 0x0100)) { - return false; - } - - return true; -} - -bool test_ETX_etx_neighbor_add_1() -{ - uint8_t i; - uint8_t attempts; - bool success; - uint8_t addr[8] = {0x14,0x6e,0x0a,0x00,0x00,0x00,0x00,0x01}; - double etx = 1; - double output_etx; - mle_neigh_table_entry_t mle_neigh_table_entry; - - mle_stub.mle_neigh_table_entry_ptr = &mle_neigh_table_entry; - memset(&mle_neigh_table_entry, 0, sizeof(mle_neigh_table_entry_t)); - mle_neigh_table_entry.etx = 1 << 12; - address_stub.uint8_value = true; - - memset(change_ind_handler_values, 0, sizeof(change_ind_handler_values)); - change_ind_handler_index = 0; - - // 3/1 ETX - attempts = 3; - success = 1; - - (void) etx_value_change_callback_register(IF_6LoWPAN, 0, 128, etx_value_change_ind_handler); - - etx_neighbor_add(0,&mle_neigh_table_entry); - - if ((change_ind_handler_values[0].current_etx != 0x0100) || - (change_ind_handler_values[0].previous_etx != 0x0100)) { - return false; - } - - return true; -} diff --git a/test/nanostack/unittest/service_libs/etx/test_etx.h b/test/nanostack/unittest/service_libs/etx/test_etx.h deleted file mode 100644 index 5c5da5b3ad6b..000000000000 --- a/test/nanostack/unittest/service_libs/etx/test_etx.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 TEST_ETX_H -#define TEST_ETX_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_ETX_etx_transm_attempts_update_1(); -bool test_ETX_etx_transm_attempts_update_2(); -bool test_ETX_etx_transm_attempts_update_3(); -bool test_ETX_etx_transm_attempts_update_4(); -bool test_ETX_etx_transm_attempts_update_5(); -bool test_ETX_etx_read_1(); -bool test_ETX_etx_read_2(); -bool test_ETX_etx_read_3(); -bool test_ETX_etx_remote_incoming_idr_update_1(); -bool test_ETX_etx_local_incoming_idr_read_1(); -bool test_ETX_etx_local_incoming_idr_read_2(); -bool test_ETX_etx_lqi_dbm_update_1(); -bool test_ETX_etx_lqi_dbm_update_2(); -bool test_ETX_etx_value_change_callback_register_1(); -bool test_ETX_etx_accum_failures_callback_register_1(); -bool test_ETX_etx_neighbor_remove_1(); -bool test_ETX_etx_neighbor_add_1(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_ETX_H - diff --git a/test/nanostack/unittest/service_libs/fhss/Makefile b/test/nanostack/unittest/service_libs/fhss/Makefile deleted file mode 100644 index 97d5643bdd01..000000000000 --- a/test/nanostack/unittest/service_libs/fhss/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = fhss_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/fhss/fhss.c \ - - -TEST_SRC_FILES = \ - main.cpp \ - fhsstest.cpp \ - test_fhss.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/channel_list_stub.c \ - ../../stub/fhss_config_stub.c \ - ../../stub/fhss_channel_stub.c \ - ../../stub/fhss_platform_stub.c \ - ../../stub/fhss_mac_interface_stub.c \ - ../../stub/fhss_beacon_tasklet_stub.c \ - ../../stub/fhss_beacon_stub.c \ - ../../stub/fhss_statistics_stub.c \ - ../../stub/ns_timer_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/event_stub.c \ - ../../stub/fhss_callbacks_stub.c \ - ../../stub/ns_list_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/service_libs/fhss/fhsstest.cpp b/test/nanostack/unittest/service_libs/fhss/fhsstest.cpp deleted file mode 100644 index 3f2a85ba6985..000000000000 --- a/test/nanostack/unittest/service_libs/fhss/fhsstest.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_fhss.h" - - -TEST_GROUP(fhss) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(fhss, test_fhss_timeout_stop) -{ - CHECK(test_fhss_timeout_stop()); -} - -TEST(fhss, test_fhss_timeout_start) -{ - CHECK(test_fhss_timeout_start()); -} - -TEST(fhss, test_fhss_down) -{ - CHECK(test_fhss_down()); -} - -TEST(fhss, test_fhss_event_timer_cb) -{ - CHECK(test_fhss_event_timer_cb()); -} - -TEST(fhss, test_fhss_superframe_handler) -{ - CHECK(test_fhss_superframe_handler()); -} - -TEST(fhss, test_fhss_update_synch_parent_address) -{ - CHECK(test_fhss_update_synch_parent_address()); -} - -TEST(fhss, test_fhss_compare_with_synch_parent_address) -{ - CHECK(test_fhss_compare_with_synch_parent_address()); -} - -TEST(fhss, test_fhss_get_parent_address) -{ - CHECK(test_fhss_get_parent_address()); -} - -TEST(fhss, test_fhss_sync_with_beacon) -{ - CHECK(test_fhss_sync_with_beacon()); -} - -TEST(fhss, test_fhss_set_datarate) -{ - CHECK(test_fhss_set_datarate()); -} - -TEST(fhss, test_fhss_add_beacon_info) -{ - CHECK(test_fhss_add_beacon_info()); -} - -TEST(fhss, test_fhss_set_synch_configuration) -{ - CHECK(test_fhss_set_synch_configuration()); -} - -TEST(fhss, test_fhss_check_bad_channel) -{ - CHECK(test_fhss_check_bad_channel()); -} - -TEST(fhss, test_fhss_check_tx_allowed) -{ - CHECK(test_fhss_check_tx_allowed()); -} - -TEST(fhss, test_fhss_check_channel_type) -{ - CHECK(test_fhss_check_channel_type()); -} - -TEST(fhss, test_fhss_disable) -{ - CHECK(test_fhss_disable()); -} - -TEST(fhss, test_fhss_enable) -{ - CHECK(test_fhss_enable()); -} - -TEST(fhss, test_fhss_clear_active_event) -{ - CHECK(test_fhss_clear_active_event()); -} - -TEST(fhss, test_fhss_update_beacon_info_lifetimes) -{ - CHECK(test_fhss_update_beacon_info_lifetimes()); -} - -TEST(fhss, test_fhss_failed_handle) -{ - CHECK(test_fhss_failed_handle()); -} - -TEST(fhss, test_fhss_is_synch_root) -{ - CHECK(test_fhss_is_synch_root()); -} diff --git a/test/nanostack/unittest/service_libs/fhss/main.cpp b/test/nanostack/unittest/service_libs/fhss/main.cpp deleted file mode 100644 index 32eb65eff294..000000000000 --- a/test/nanostack/unittest/service_libs/fhss/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(fhss); - diff --git a/test/nanostack/unittest/service_libs/fhss/test_fhss.c b/test/nanostack/unittest/service_libs/fhss/test_fhss.c deleted file mode 100644 index 440f6f23eb26..000000000000 --- a/test/nanostack/unittest/service_libs/fhss/test_fhss.c +++ /dev/null @@ -1,1001 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "Service_Libs/fhss/fhss.h" -#include "Service_Libs/fhss/fhss_beacon.h" -#include "MAC/IEEE802_15_4/mac_fhss_callbacks.h" -#include "test_fhss.h" -#include "fhss_config_stub.h" -#include "fhss_channel_stub.h" -#include "fhss_platform_stub.h" -#include "channel_list_stub.h" -#include "nsdynmemLIB_stub.h" -#include "ns_timer_stub.h" -#include "fhss_callbacks_stub.h" -#include "fhss_beacon_tasklet_stub.h" - -extern fhss_structure_t *fhss_struct; - -bool test_fhss_enable() -{ - fhss_api_t *fhss_api = ns_fhss_create(0, 0); - fhss_timer_t fhss_timer; - fhss_configuration_t fhss_configuration; - memset(&fhss_timer, 0, sizeof(fhss_timer_t)); - memset(&fhss_configuration, 0, sizeof(fhss_configuration_t)); - fhss_beacon_tasklet_stub.int8_value = 0; - fhss_timer.fhss_timer_stop = &fhss_timer_stop_stub; - - // Test NULL configurations - if (fhss_enable(NULL, &fhss_configuration, &fhss_timer, NULL) != -1) { - return false; - } - if (fhss_enable(fhss_api, NULL, &fhss_timer, NULL) != -1) { - return false; - } - if (fhss_enable(fhss_api, &fhss_configuration, NULL, NULL) != -1) { - return false; - } - // Test without channels - channel_list_stub.uint8_value = 0; - if (fhss_enable(fhss_api, &fhss_configuration, &fhss_timer, NULL) != -2) { - return false; - } - // Test without memory - nsdynmemlib_stub.returnCounter = 0; - channel_list_stub.uint8_value = 50; - if (fhss_enable(fhss_api, &fhss_configuration, &fhss_timer, NULL) != -3) { - return false; - } - // Test with proper configuration - nsdynmemlib_stub.returnCounter = 1; - if (fhss_enable(fhss_api, &fhss_configuration, &fhss_timer, NULL) != 0) { - return false; - } - // Test that API is stored - if (fhss_struct != fhss_get_object_with_api(fhss_api)) { - return false; - } - // Test NULL API - if (fhss_struct == fhss_get_object_with_api(NULL)) { - return false; - } - // Test fake API - fhss_api_t fhss_fake_api; - if (fhss_struct == fhss_get_object_with_api(&fhss_fake_api)) { - return false; - } - fhss_disable(fhss_struct); - // Test tasklet creation failed - fhss_beacon_tasklet_stub.int8_value = -1; - nsdynmemlib_stub.returnCounter = 1; - if (fhss_enable(fhss_api, &fhss_configuration, &fhss_timer, NULL) != -5) { - return false; - } - fhss_disable(fhss_struct); - return true; -} - -bool test_fhss_disable() -{ - if (fhss_disable(NULL) == 0) { - return false; - } - return true; -} - -bool test_fhss_check_channel_type() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - - // Test NULL API - if (fhss_check_channel_type(NULL, true, FHSS_DATA_FRAME) == true) { - return false; - } - // Test unsynchronized state. (Should allow transmission) - fhss_struct->fhss_state = FHSS_UNSYNCHRONIZED; - if (fhss_check_channel_type(fhss_struct, true, FHSS_DATA_FRAME) == false) { - return false; - } - // Change to synchronized mode - fhss_struct->fhss_state = FHSS_SYNCHRONIZED; - - // Test data frame, broadcast destination, unicast channel. (Should deny transmission) - fhss_channel_stub.channel_bool_value = false; - if (fhss_check_channel_type(fhss_struct, true, FHSS_DATA_FRAME) == true) { - return false; - } - - // Test data frame, unicast destination, broadcast channel, waiting synchronization Beacon. (Should deny transmission) - fhss_channel_stub.channel_bool_value = true; - fhss_struct->beacons_received_timer = 1; - if (fhss_check_channel_type(fhss_struct, false, FHSS_DATA_FRAME) == true) { - return false; - } - - // Test synch request frame, currently on broadcast channel. (Should deny transmission) - fhss_channel_stub.channel_bool_value = true; - fhss_struct->synch_configuration.fhss_number_of_bc_channels = 10; - fhss_struct->number_of_channels = 50; - if (fhss_check_channel_type(fhss_struct, true, FHSS_SYNCH_REQUEST_FRAME) == true) { - return false; - } - - // Test synch request frame, currently on unicast channel, superframe is 0. (Should deny transmission) - fhss_channel_stub.channel_bool_value = false; - fhss_struct->current_superframe = 0; - fhss_struct->beacons_received_timer = 1; - fhss_struct->synch_configuration.fhss_number_of_superframes = 8; - if (fhss_check_channel_type(fhss_struct, true, FHSS_SYNCH_REQUEST_FRAME) == true) { - return false; - } - - // Test data frame, broadcast destination, broadcast channel. (Should allow transmission) - fhss_struct->synch_configuration.fhss_number_of_superframes = 8; - fhss_struct->broadcast_start_superframe = 2; - fhss_struct->current_superframe = 3; - fhss_channel_stub.channel_bool_value = true; - if (fhss_check_channel_type(fhss_struct, true, FHSS_DATA_FRAME) == false) { - return false; - } - - // Test data frame, unicast destination, unicast channel. (Should allow transmission) - fhss_channel_stub.channel_bool_value = false; - if (fhss_check_channel_type(fhss_struct, false, FHSS_DATA_FRAME) == false) { - return false; - } - - // Test data frame, unicast destination, broadcast channel, not waiting synchronization Beacon. (Should allow transmission) - fhss_channel_stub.channel_bool_value = true; - fhss_struct->beacons_received_timer = 0; - if (fhss_check_channel_type(fhss_struct, false, FHSS_DATA_FRAME) == false) { - return false; - } - - // Test immediate synch frame, sent on any channel. (Should allow transmission) - fhss_channel_stub.channel_bool_value = false; - fhss_struct->current_superframe = 1; - if (fhss_check_channel_type(fhss_struct, true, FHSS_SYNCH_FRAME) == false) { - return false; - } - - // Test synch request frame, currently on broadcast channel, number of BC channel equals number of channels, current superframe is 1. (Should allow transmission) - fhss_channel_stub.channel_bool_value = true; - fhss_struct->synch_configuration.fhss_number_of_bc_channels = 50; - fhss_struct->number_of_channels = 50; - fhss_struct->current_superframe = 1; - if (fhss_check_channel_type(fhss_struct, true, FHSS_SYNCH_REQUEST_FRAME) == false) { - return false; - } - - // Test sending broadcast when number of superframes is low. - fhss_channel_stub.channel_bool_value = true; - fhss_struct->broadcast_start_superframe = 0; - fhss_struct->current_superframe = 0; - fhss_struct->synch_configuration.fhss_number_of_superframes = 4; - if (fhss_check_channel_type(fhss_struct, true, FHSS_DATA_FRAME) == false) { - return false; - } - - // Test sending broadcast when not on broadcast sending superframe. - fhss_channel_stub.channel_bool_value = true; - fhss_struct->synch_configuration.fhss_number_of_superframes = 8; - fhss_struct->broadcast_start_superframe = 2; - fhss_struct->current_superframe = 0; - if (fhss_check_channel_type(fhss_struct, true, FHSS_DATA_FRAME) == true) { - return false; - } - - // Test sending broadcast when on broadcast sending superframe. - fhss_channel_stub.channel_bool_value = true; - fhss_struct->synch_configuration.fhss_number_of_superframes = 8; - fhss_struct->broadcast_start_superframe = 2; - fhss_struct->current_superframe = 2; - if (fhss_check_channel_type(fhss_struct, true, FHSS_DATA_FRAME) == false) { - return false; - } - - // Test synch request frame, above the middle of superframes, should return false - fhss_channel_stub.channel_bool_value = false; - fhss_struct->current_superframe = 5; - fhss_struct->beacons_received_timer = 0; - fhss_struct->synch_configuration.fhss_number_of_superframes = 8; - if (fhss_check_channel_type(fhss_struct, true, FHSS_SYNCH_REQUEST_FRAME) == true) { - return false; - } - - // Test synch request frame, when number of TX slots 1 and on first superframe, should return false - fhss_channel_stub.channel_bool_value = false; - fhss_struct->current_superframe = 0; - fhss_struct->beacons_received_timer = 0; - fhss_struct->synch_configuration.fhss_number_of_superframes = 8; - fhss_struct->synch_configuration.fhss_number_of_tx_slots = 1; - if (fhss_check_channel_type(fhss_struct, true, FHSS_SYNCH_REQUEST_FRAME) == true) { - return false; - } - - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_check_tx_allowed() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - // Initialize FHSS configuration - fhss_struct->datarate = 250000; - fhss_struct->fhss_configuration.fhss_tuning_parameters.tx_processing_delay = 1000; - fhss_struct->fhss_configuration.fhss_tuning_parameters.ack_processing_delay = 1000; - /*...| TX | TX | RX | RX | TX | TX | RX | RX |... - *...| SF n | SF n+1 | SF n+2 | SF n+3 | SF n+4 | SF n+5 | SF n+6 | SF n+7 |... - */ - fhss_struct->current_superframe = 1; // SF n+1 - fhss_struct->synch_configuration.fhss_number_of_tx_slots = 2; - fhss_struct->synch_configuration.fhss_number_of_superframes = 8; - fhss_struct->synch_configuration.fhss_superframe_length = 50000; - fhss_struct->own_hop = 2; // For even hop count TX superframes are 0, 1 and 4, 5 - fhss_struct->platform_functions.fhss_get_remaining_slots = &fhss_get_remaining_slots_stub; - fhss_struct->platform_functions.fhss_resolution_divider = 1; - - // Remaining time(us) to next superframe change. This is what get_remaining_slot -call returns - fhss_platform_stub.uint32_value = 40000; - - // When transmitting 100 bytes + Ack (+ processing delays), needed transmission time is around 7.4ms - - // FHSS is on RX slot - fhss_struct->tx_allowed = false; - // Test NULL API - if (fhss_check_tx_allowed(NULL, true, 100, FHSS_DATA_FRAME, 0, 0) == true) { - return false; - } - - // Test unsynchronized state. (Should allow transmission) - fhss_struct->fhss_state = FHSS_UNSYNCHRONIZED; - if (fhss_check_tx_allowed(fhss_struct, false, 100, FHSS_DATA_FRAME, 0, 0) == false) { - return false; - } - - // Change to synchronized mode - fhss_struct->fhss_state = FHSS_SYNCHRONIZED; - - // Test synchronization frame. (Should allow transmission) - if (fhss_check_tx_allowed(fhss_struct, false, 100, FHSS_SYNCH_FRAME, 0, 0) == false) { - return false; - } - - // Test broadcast frame. (Should allow transmission) - if (fhss_check_tx_allowed(fhss_struct, true, 100, FHSS_DATA_FRAME, 0, 0) == false) { - return false; - } - - // Test TX allowed flag. (Should deny transmission) - if (fhss_check_tx_allowed(fhss_struct, false, 100, FHSS_DATA_FRAME, 0, 0) == true) { - return false; - } - - // FHSS is on TX slot - fhss_struct->tx_allowed = true; - // Test TX allowed flag. (Should allow transmission) - if (fhss_check_tx_allowed(fhss_struct, false, 100, FHSS_DATA_FRAME, 0, 0) == false) { - return false; - } - - // Return too small remaining time(us). (Should deny transmission) - fhss_platform_stub.uint32_value = 7000; - if (fhss_check_tx_allowed(fhss_struct, false, 100, FHSS_DATA_FRAME, 0, 0) == true) { - return false; - } - - // Use higher datarate. (Should allow transmission) - fhss_struct->datarate = 300000; - if (fhss_check_tx_allowed(fhss_struct, false, 100, FHSS_DATA_FRAME, 0, 0) == false) { - return false; - } - - // Test adding header and tail bytes (100 bytes for data and ack frame means 6.4ms more TX time needed. 13.8ms total). (Should deny transmission) - fhss_struct->datarate = 250000; - fhss_platform_stub.uint32_value = 13700; - if (fhss_check_tx_allowed(fhss_struct, false, 100, FHSS_DATA_FRAME, 50, 50) == true) { - return false; - } - - // Test odd hop count. (Should deny transmission) - fhss_struct->own_hop = 1; - if (fhss_check_tx_allowed(fhss_struct, false, 100, FHSS_DATA_FRAME, 0, 0) == true) { - return false; - } - - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_check_bad_channel() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - memset(&fhss_struct->fhss_failed_tx_list, 0, sizeof(fhss_failed_tx_list_t)); - // Test NULL API - if (fhss_check_bad_channel(NULL, 0) == true) { - return false; - } - // Test with proper API - if (fhss_check_bad_channel(fhss_struct, 0) == false) { - return false; - } - // Test when bad channel is found - uint8_t handle = 10; - fhss_struct->rx_channel = 40; - ns_list_init(&fhss_struct->fhss_failed_tx_list); - nsdynmemlib_stub.returnCounter = 1; - - if (fhss_failed_handle_add(fhss_struct, handle) != 0) { - return false; - } - if (fhss_check_bad_channel(fhss_struct, handle) == true) { - return false; - } - // After channel change should return false - fhss_struct->rx_channel = 41; - if (fhss_check_bad_channel(fhss_struct, handle) == false) { - return false; - } - if (fhss_failed_handle_remove(fhss_struct, handle) != 0) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; -} - -bool test_fhss_set_synch_configuration() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - - fhss_struct->platform_functions.fhss_timer_start = &fhss_timer_start; - fhss_struct->number_of_channels = 50; - fhss_struct->datarate = 250000; - - fhss_synch_configuration_t fhss_synch_configuration; - memset(&fhss_synch_configuration, 0, sizeof(fhss_synch_configuration_t)); - - // NULL API should fail configuration check - if (fhss_set_synch_configuration(NULL, &fhss_synch_configuration) == 0) { - return false; - } - // NULL configuration should fail configuration check - if (fhss_set_synch_configuration(fhss_struct, NULL) == 0) { - return false; - } - // Test giving invalid setting - fhss_synch_configuration.fhss_number_of_bc_channels = 0; - if (fhss_set_synch_configuration(fhss_struct, &fhss_synch_configuration) != -3) { - return false; - } - fhss_synch_configuration.fhss_number_of_bc_channels = 10; - fhss_synch_configuration.fhss_number_of_superframes = 0; - if (fhss_set_synch_configuration(fhss_struct, &fhss_synch_configuration) != -3) { - return false; - } - fhss_synch_configuration.fhss_number_of_superframes = 8; - fhss_synch_configuration.fhss_number_of_tx_slots = 0; - if (fhss_set_synch_configuration(fhss_struct, &fhss_synch_configuration) != -3) { - return false; - } - fhss_synch_configuration.fhss_number_of_tx_slots = 2; - fhss_synch_configuration.fhss_superframe_length = 0; - if (fhss_set_synch_configuration(fhss_struct, &fhss_synch_configuration) != -3) { - return false; - } - fhss_synch_configuration.fhss_superframe_length = 50000; - // Test number of channels not divisible with number of broadcast channels - fhss_synch_configuration.fhss_number_of_bc_channels = 9; - if (fhss_set_synch_configuration(fhss_struct, &fhss_synch_configuration) != -4) { - return false; - } - fhss_synch_configuration.fhss_number_of_bc_channels = 10; - // Test number superframes not divisible with number of TX slots - fhss_synch_configuration.fhss_number_of_tx_slots = 3; - if (fhss_set_synch_configuration(fhss_struct, &fhss_synch_configuration) != -4) { - return false; - } - // Test number superframes = number of TX slots - fhss_synch_configuration.fhss_number_of_tx_slots = 8; - if (fhss_set_synch_configuration(fhss_struct, &fhss_synch_configuration) != -4) { - return false; - } - fhss_synch_configuration.fhss_number_of_tx_slots = 2; - // Test with proper configuration - if (fhss_set_synch_configuration(fhss_struct, &fhss_synch_configuration)) { - return false; - } - free(fhss_struct); - fhss_struct = 0; - return true; -} - -bool test_fhss_add_beacon_info() -{ - uint8_t compare_array[20]; - uint8_t mac_address[8]; - uint8_t synch_info[20]; - uint16_t panid = 0x1234; - - fhss_struct = malloc(sizeof(fhss_structure_t)); - - memset(mac_address, 0, 8); - - fhss_struct->fhss_beacon_info_store = 0; - // Test without FHSS structure - if (fhss_add_beacon_info(NULL, panid, mac_address, 0, synch_info) != -1) { - return false; - } - // Test without source address - if (fhss_add_beacon_info(fhss_struct, panid, NULL, 0, synch_info) != -1) { - return false; - } - // Test without synchronization info - if (fhss_add_beacon_info(fhss_struct, panid, mac_address, 0, NULL) != -1) { - return false; - } - // Test without memory - if (fhss_add_beacon_info(fhss_struct, panid, mac_address, 0, synch_info) != -2) { - return false; - } - // Test adding first Beacon info - nsdynmemlib_stub.returnCounter = 1; - if (fhss_add_beacon_info(fhss_struct, panid, mac_address, 0, synch_info) != 0) { - return false; - } - memset(compare_array, 0, 8); - // Verify storage by comparing pan id and source address - if ((fhss_struct->fhss_beacon_info_store->pan_id != panid) || memcmp(fhss_struct->fhss_beacon_info_store->source_address, compare_array, 8)) { - return false; - } - nsdynmemlib_stub.returnCounter = 1; - // Test adding another Beacon info (pan id is not same as first Beacon info) - if (fhss_add_beacon_info(fhss_struct, panid + 1, mac_address, 0, synch_info) != 0) { - return false; - } - memset(compare_array, 0, 8); - // Verify storage by comparing pan id - if ((fhss_struct->fhss_beacon_info_store->next->pan_id != panid + 1) || memcmp(fhss_struct->fhss_beacon_info_store->next->source_address, compare_array, 8)) { - return false; - } - nsdynmemlib_stub.returnCounter = 1; - // Test adding third Beacon info (pan id is not same as other Beacon infos) - if (fhss_add_beacon_info(fhss_struct, panid + 2, mac_address, 0, synch_info) != 0) { - return false; - } - memset(compare_array, 0, 8); - // Verify storage by comparing pan id - if ((fhss_struct->fhss_beacon_info_store->next->next->pan_id != panid + 2) || memcmp(fhss_struct->fhss_beacon_info_store->next->next->source_address, compare_array, 8)) { - return false; - } - // Test replacing first Beacon info (source address has changed) - memset(mac_address, 1, 8); - nsdynmemlib_stub.returnCounter = 1; - if (fhss_add_beacon_info(fhss_struct, panid, mac_address, 0, synch_info) != 0) { - return false; - } - memset(compare_array, 1, 8); - // Verify storage by comparing pan id and source address - if ((fhss_struct->fhss_beacon_info_store->pan_id != panid) || memcmp(fhss_struct->fhss_beacon_info_store->source_address, compare_array, 8)) { - return false; - } - // Test replacing second Beacon info (source address has changed) - memset(mac_address, 1, 8); - nsdynmemlib_stub.returnCounter = 1; - if (fhss_add_beacon_info(fhss_struct, panid + 1, mac_address, 0, synch_info) != 0) { - return false; - } - memset(compare_array, 1, 8); - // Verify storage by comparing pan id and source address - if ((fhss_struct->fhss_beacon_info_store->next->pan_id != panid + 1) || memcmp(fhss_struct->fhss_beacon_info_store->next->source_address, compare_array, 8)) { - return false; - } - // Test flushing Beacon storage without FHSS structure - if (fhss_flush_beacon_info_storage(NULL) != -1) { - return false; - } - // Test flushing Beacon storage - if (fhss_flush_beacon_info_storage(fhss_struct) != 0) { - return false; - } - free(fhss_struct); - fhss_struct = 0; - return true; -} - -bool test_fhss_set_datarate() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - // Test NULL parameter - if (!fhss_set_datarate(NULL, 250000)) { - return false; - } - // Test that zero is replaced with default datarate - if (fhss_set_datarate(fhss_struct, 0)) { - return false; - } - if (fhss_struct->datarate != 250000) { - return false; - } - // Test that proper configuration is accepted - if (fhss_set_datarate(fhss_struct, 200000)) { - return false; - } - if (fhss_struct->datarate != 200000) { - return false; - } - free(fhss_struct); - fhss_struct = 0; - return true; -} - -bool test_fhss_sync_with_beacon() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - fhss_synchronization_beacon_payload_s payload; - - fhss_struct->number_of_channels = 50; - payload.number_of_broadcast_channels = 10; - payload.superframe_length = 50000; - payload.number_of_superframes_per_channel = 8; - fhss_struct->fhss_state = FHSS_SYNCHRONIZED; - - fhss_struct->callbacks.read_mac_address = &mac_read_64bit_mac_address; - fhss_struct->callbacks.read_coord_mac_address = &mac_get_coordinator_mac_address; - fhss_struct->platform_functions.fhss_timer_stop = &fhss_timer_stop_stub; - fhss_struct->platform_functions.fhss_timer_start = &fhss_timer_start; - fhss_struct->platform_functions.fhss_get_remaining_slots = &fhss_get_remaining_slots_stub; - fhss_struct->fhss_configuration.fhss_max_synch_interval = 240; - fhss_struct->synch_interval = 150000; - - // Test that synchronization is skipped if Beacon is already received on this channel - fhss_struct->beacon_received_on_this_bc_channel = false; - fhss_channel_stub.channel_bool_value = false; - if (fhss_sync_with_beacon(fhss_struct, &payload)) { - return false; - } - fhss_struct->beacon_received_on_this_bc_channel = true; - fhss_channel_stub.channel_bool_value = true; - if (fhss_sync_with_beacon(fhss_struct, &payload)) { - return false; - } - // Test fixing synchronization - fhss_struct->beacon_received_on_this_bc_channel = false; - fhss_channel_stub.channel_bool_value = true; - if (fhss_sync_with_beacon(fhss_struct, &payload)) { - return false; - } - // Test synchronizing unsynchronized device - fhss_struct->fhss_state = FHSS_UNSYNCHRONIZED; - if (fhss_sync_with_beacon(fhss_struct, &payload)) { - return false; - } - - fhss_struct->fhss_state = FHSS_UNSYNCHRONIZED; - fhss_struct->synch_interval = 240000; - if (fhss_sync_with_beacon(fhss_struct, &payload)) { - return false; - } - - fhss_struct->fhss_state = FHSS_SYNCHRONIZED; - fhss_struct->beacon_received_on_this_bc_channel = false; - // Test superframe changed loops - fhss_struct->current_superframe = 0; - payload.current_superframe = 7; - if (fhss_sync_with_beacon(fhss_struct, &payload)) { - return false; - } - // Test synch drift compensation - fhss_struct->fhss_state = FHSS_SYNCHRONIZED; - fhss_struct->own_hop = 1; - fhss_struct->beacon_received_on_this_bc_channel = false; - fhss_struct->synch_monitor.avg_synch_fix_counter = 4; - fhss_struct->synch_monitor.avg_synch_fix = 100; - fhss_struct->platform_functions.fhss_resolution_divider = 1; - payload.remaining_slots = fhss_platform_stub.uint32_value; - if (fhss_sync_with_beacon(fhss_struct, &payload)) { - return false; - } - // Should use maximum interval - if (fhss_struct->synch_interval != 240000) { - return false; - } - - fhss_struct->fhss_state = FHSS_SYNCHRONIZED; - fhss_struct->own_hop = 1; - fhss_struct->beacon_received_on_this_bc_channel = false; - fhss_struct->synch_monitor.avg_synch_fix_counter = 4; - fhss_struct->synch_monitor.avg_synch_fix = 51000; - fhss_struct->synch_interval = 120000; - payload.remaining_slots = fhss_platform_stub.uint32_value + 1000000000; - if (fhss_sync_with_beacon(fhss_struct, &payload)) { - return false; - } - if (fhss_struct->synch_interval != 4000) { - return false; - } - - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_get_parent_address() -{ - uint8_t mac_address[8]; - uint8_t synch_parent[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - uint8_t rpl_parent[8] = {7, 6, 5, 4, 3, 2, 1, 0}; - // Test without FHSS - if (fhss_get_parent_address(NULL, mac_address) != -1) { - return false; - } - fhss_struct = malloc(sizeof(fhss_structure_t)); - memcpy(fhss_struct->synch_parent, synch_parent, 8); - memcpy(fhss_callbacks_stub.address, rpl_parent, 8); - - fhss_struct->callbacks.read_coord_mac_address = &mac_get_coordinator_mac_address; - fhss_callbacks_stub.int8_value = -1; - // Test when function pointer not set - if (fhss_get_parent_address(fhss_struct, mac_address) != 0) { - return false; - } - // MAC address should be now synch address - if (memcmp(mac_address, synch_parent, 8)) { - return false; - } - // Test when function pointer is set and RPL address can be found - fhss_platform_stub.int_value = 0; - fhss_callbacks_stub.int8_value = 0; - if (fhss_get_parent_address(fhss_struct, mac_address) != 0) { - return false; - } - // MAC address should be now rpl address - if (memcmp(mac_address, rpl_parent, 8)) { - return false; - } - // Test when RPL address can not be found - fhss_callbacks_stub.int8_value = -1; - fhss_platform_stub.int_value = -1; - if (fhss_get_parent_address(fhss_struct, mac_address) != 0) { - return false; - } - // MAC address should be now synch address - if (memcmp(mac_address, synch_parent, 8)) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_compare_with_synch_parent_address() -{ - uint8_t mac_address[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - uint8_t synch_parent[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - // Test without FHSS - if (!fhss_compare_with_synch_parent_address(NULL, mac_address)) { - return false; - } - fhss_struct = malloc(sizeof(fhss_structure_t)); - //Test when mac address is synch address - - fhss_struct->callbacks.read_coord_mac_address = &mac_get_coordinator_mac_address; - - memcpy(fhss_struct->synch_parent, synch_parent, 8); - if (fhss_compare_with_synch_parent_address(fhss_struct, mac_address)) { - return false; - } - - //Test when mac address is not synch address - mac_address[0] = 1; - fhss_callbacks_stub.int8_value = 0; - - if (!fhss_compare_with_synch_parent_address(fhss_struct, mac_address)) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_update_synch_parent_address() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - uint8_t rpl_parent[8] = {7, 6, 5, 4, 3, 2, 1, 0}; - // Test without FHSS - if (!fhss_update_synch_parent_address(NULL)) { - return false; - } - //Test when synch address is RPL parent address - memset(fhss_struct->synch_parent, 0, 8); - memcpy(fhss_callbacks_stub.address, rpl_parent, 8); - fhss_callbacks_stub.int8_value = 0; - - fhss_struct->callbacks.read_coord_mac_address = &mac_get_coordinator_mac_address; - if (fhss_update_synch_parent_address(fhss_struct)) { - return false; - } - // Synch address should be now rpl address - if (memcmp(fhss_struct->synch_parent, rpl_parent, 8)) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_superframe_handler() -{ - fhss_api_t fhss_api; - fhss_struct = malloc(sizeof(fhss_structure_t)); - fhss_struct->fhss_api = &fhss_api; - fhss_struct->platform_functions.fhss_timer_start = &fhss_timer_start; - fhss_struct->callbacks.read_tx_queue_size = &mac_read_tx_queue_sizes; - fhss_struct->callbacks.send_fhss_frame = &mac_fhss_frame_tx; - fhss_struct->synch_configuration.fhss_number_of_superframes = 8; - fhss_struct->synch_configuration.fhss_superframe_length = 50000; - fhss_struct->synch_configuration.fhss_number_of_tx_slots = 4; - fhss_struct->number_of_channels = 50; - fhss_struct->own_hop = 2; - fhss_channel_stub.channel_bool_value = true; - - // Test drift compensation; - fhss_struct->current_superframe = 0; - fhss_struct->platform_functions.fhss_resolution_divider = 64; - fhss_struct->synch_monitor.channel_counter = 63; - // Should not work without FHSS api - fhss_superframe_handler(NULL, 0); - if (fhss_struct->synch_monitor.channel_counter != 63) { - return false; - } - fhss_superframe_handler(&fhss_api, 0); - - fhss_struct->current_superframe = 7; - fhss_struct->current_channel_index = 49; - fhss_struct->synch_infos_sent_counter = 1; - fhss_struct->channel_list_counter = 999; - fhss_superframe_handler(&fhss_api, 0); - // Current superframe, channel index, Beacons sent counter and channel list counter should be cleared - if (fhss_struct->current_superframe != 0 || fhss_struct->current_channel_index != 0 || - fhss_struct->synch_infos_sent_counter != 0 || fhss_struct->channel_list_counter != 0) { - return false; - } - fhss_struct->fhss_timeout = 50000; - fhss_superframe_handler(&fhss_api, 0); - // Timeout should be handled and cleared - if (fhss_struct->fhss_timeout != 0 || fhss_struct->fhss_timer != 0) { - return false; - } - free(fhss_struct); - fhss_struct = 0; - return true; -} - -bool test_fhss_event_timer_cb() -{ - fhss_api_t fhss_api; - fhss_configuration_t fhss_configuration; - fhss_timer_t fhss_timer; - nsdynmemlib_stub.returnCounter = 1; - ns_timer_stub.cb_counter = 1; - fhss_timer.fhss_timer_stop = &fhss_timer_stop_stub; - - // To register callback, execute fhss enable - fhss_enable(&fhss_api, &fhss_configuration, &fhss_timer, NULL); - - fhss_struct->callbacks.tx_poll = mac_poll_tx_queue; - fhss_struct->fhss_event_timer = 0; - - if( ns_timer_stub.cb ){ - // Test with invalid timer id - ns_timer_stub.cb(-1, 0); - } - if( ns_timer_stub.cb ){ - // Test with wrong timer id - ns_timer_stub.cb(1, 0); - } - if( ns_timer_stub.cb ){ - // Test with proper timer id - ns_timer_stub.cb(0, 0); - } - - fhss_disable(fhss_struct); - return true; -} - -bool test_fhss_down() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - fhss_struct->platform_functions.fhss_timer_stop = &fhss_timer_stop_stub; - fhss_struct->fhss_beacon_info_store = NULL; - ns_list_init(&fhss_struct->fhss_failed_tx_list); - // Test without FHSS - if (fhss_down(NULL) == 0) { - return false; - } - // Test with proper FHSS struct - if (fhss_down(fhss_struct) != 0) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_timeout_start() -{ - uint32_t time = 1000; - fhss_struct = malloc(sizeof(fhss_structure_t)); - // Test without FHSS - if (fhss_timeout_start(NULL, 1000) == 0) { - return false; - } - // Test with proper FHSS struct - if (fhss_timeout_start(fhss_struct, time) != 0) { - return false; - } - // Check that values were set/cleared - if (fhss_struct->fhss_timeout != time || fhss_struct->fhss_timer != 0) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_timeout_stop() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - // Test without FHSS - if (fhss_timeout_stop(NULL) == 0) { - return false; - } - // Test with proper FHSS struct - if (fhss_timeout_stop(fhss_struct) != 0) { - return false; - } - // Check that values were set/cleared - if (fhss_struct->fhss_timeout != 0 || fhss_struct->fhss_timer != 0) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_clear_active_event() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - fhss_struct->active_fhss_events |= (1 << FHSS_UPDATE_SYNCH_INFO_STORAGE); - fhss_clear_active_event(fhss_struct, FHSS_UPDATE_SYNCH_INFO_STORAGE); - if (fhss_struct->active_fhss_events & (1 << FHSS_UPDATE_SYNCH_INFO_STORAGE)) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_update_beacon_info_lifetimes() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - fhss_struct->fhss_beacon_info_store = malloc(sizeof(fhss_beacon_info_t)); - fhss_struct->fhss_beacon_info_store->timestamp = 100000; - fhss_struct->fhss_beacon_info_store->next = NULL; - // Should not remove Beacon info because lifetime has not passed yet - fhss_update_beacon_info_lifetimes(fhss_struct, fhss_struct->fhss_beacon_info_store->timestamp + 100000); - if (!fhss_struct->fhss_beacon_info_store) { - return false; - } - // Should remove the Beacon info - fhss_update_beacon_info_lifetimes(fhss_struct, fhss_struct->fhss_beacon_info_store->timestamp + 600000000); - if (fhss_struct->fhss_beacon_info_store) { - return false; - } - - // Store two Beacon infos - fhss_struct->fhss_beacon_info_store = malloc(sizeof(fhss_beacon_info_t)); - fhss_struct->fhss_beacon_info_store->timestamp = 100000; - fhss_struct->fhss_beacon_info_store->pan_id = 1; - fhss_struct->fhss_beacon_info_store->next = malloc(sizeof(fhss_beacon_info_t)); - fhss_struct->fhss_beacon_info_store->next->timestamp = 100100; - fhss_struct->fhss_beacon_info_store->next->pan_id = 2; - fhss_struct->fhss_beacon_info_store->next->next = NULL; - // Only first Beacon info is removed after this call - fhss_update_beacon_info_lifetimes(fhss_struct, fhss_struct->fhss_beacon_info_store->timestamp + 600000000); - if (!fhss_struct->fhss_beacon_info_store || fhss_struct->fhss_beacon_info_store->next) { - return false; - } - // Second Beacon info is removed after this call - fhss_update_beacon_info_lifetimes(fhss_struct, fhss_struct->fhss_beacon_info_store->timestamp + 600001000); - if (fhss_struct->fhss_beacon_info_store) { - return false; - } - - // Store two Beacon infos removed in reverse order - fhss_struct->fhss_beacon_info_store = malloc(sizeof(fhss_beacon_info_t)); - fhss_struct->fhss_beacon_info_store->timestamp = 200000; - fhss_struct->fhss_beacon_info_store->pan_id = 1; - fhss_struct->fhss_beacon_info_store->next = malloc(sizeof(fhss_beacon_info_t)); - fhss_struct->fhss_beacon_info_store->next->timestamp = 100000; - fhss_struct->fhss_beacon_info_store->next->pan_id = 2; - fhss_struct->fhss_beacon_info_store->next->next = NULL; - // Only first Beacon info is removed after this call - fhss_update_beacon_info_lifetimes(fhss_struct, 600100000); - if (!fhss_struct->fhss_beacon_info_store || fhss_struct->fhss_beacon_info_store->next) { - return false; - } - // Second Beacon info is removed after this call - fhss_update_beacon_info_lifetimes(fhss_struct, fhss_struct->fhss_beacon_info_store->timestamp + 600200000); - if (fhss_struct->fhss_beacon_info_store) { - return false; - } - - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_failed_handle() -{ - uint8_t handle = 99; - fhss_struct = malloc(sizeof(fhss_structure_t)); - ns_list_init(&fhss_struct->fhss_failed_tx_list); - // Test without memory - nsdynmemlib_stub.returnCounter = 0; - if (fhss_failed_handle_add(fhss_struct, handle) != -2) { - return false; - } - // Test with memory - nsdynmemlib_stub.returnCounter = 1; - if (fhss_failed_handle_add(fhss_struct, handle) != 0) { - return false; - } - // Remove invalid handle - if (fhss_failed_handle_remove(fhss_struct, handle-1) != -1) { - return false; - } - // Remove valid handle - if (fhss_failed_handle_remove(fhss_struct, handle) != 0) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_is_synch_root() -{ - fhss_struct = malloc(sizeof(fhss_structure_t)); - // Test when is root - fhss_struct->own_hop = 0; - if (fhss_is_synch_root(fhss_struct) != true) { - return false; - } - // Test when is not root - fhss_struct->own_hop = 1; - if (fhss_is_synch_root(fhss_struct) != false) { - return false; - } - free(fhss_struct); - fhss_struct = NULL; - return true; -} diff --git a/test/nanostack/unittest/service_libs/fhss/test_fhss.h b/test/nanostack/unittest/service_libs/fhss/test_fhss.h deleted file mode 100644 index b3745b25c444..000000000000 --- a/test/nanostack/unittest/service_libs/fhss/test_fhss.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_FHSS_H -#define TEST_FHSS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// Test enabling FHSS -bool test_fhss_enable(); -// Test disabling FHSS -bool test_fhss_disable(); -// Test channel type TX condition -bool test_fhss_check_channel_type(); -// Test TX allowed TX condition -bool test_fhss_check_tx_allowed(); -// Test bad channel TX condition -bool test_fhss_check_bad_channel(); -// Test synchronization time configuration -bool test_fhss_set_synch_configuration(); -// Test storing Beacon info -bool test_fhss_add_beacon_info(); -// Test setting datarate -bool test_fhss_set_datarate(); -// Test synchronization to Beacon -bool test_fhss_sync_with_beacon(); -// Test requesting parent MAC address -bool test_fhss_get_parent_address(); -// Test comparing synch parent address -bool test_fhss_compare_with_synch_parent_address(); -// Test updating synch parent address -bool test_fhss_update_synch_parent_address(); -// Test superframe handler -bool test_fhss_superframe_handler(); -// Test event timer callback -bool test_fhss_event_timer_cb(); -// Test FHSS down -bool test_fhss_down(); -// Test starting FHSS timeout -bool test_fhss_timeout_start(); -// Test stopping FHSS timeout -bool test_fhss_timeout_stop(); -// Test clearing active event -bool test_fhss_clear_active_event(); -// Test updating lifetimes -bool test_fhss_update_beacon_info_lifetimes(); -// Test finding failed TX handle -bool test_fhss_failed_handle(); -// Test synch root check -bool test_fhss_is_synch_root(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_FHSS_H - diff --git a/test/nanostack/unittest/service_libs/fhss_beacon/Makefile b/test/nanostack/unittest/service_libs/fhss_beacon/Makefile deleted file mode 100644 index 03b1d6e3bae7..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = fhss_beacon - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/fhss/fhss_beacon.c \ - - -TEST_SRC_FILES = \ - main.cpp \ - fhssbeacontest.cpp \ - test_fhss_beacon.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/fhss_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/service_libs/fhss_beacon/fhssbeacontest.cpp b/test/nanostack/unittest/service_libs/fhss_beacon/fhssbeacontest.cpp deleted file mode 100644 index 9f8225ae5e1e..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon/fhssbeacontest.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_fhss_beacon.h" - - -TEST_GROUP(fhss_beacon) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(fhss_beacon, test_fhss_beacon_update_payload) -{ - CHECK(test_fhss_beacon_update_payload()); -} - -TEST(fhss_beacon, test_fhss_beacon_encode_raw) -{ - CHECK(test_fhss_beacon_encode_raw()); -} - -TEST(fhss_beacon, test_fhss_calculate_uc_index) -{ - CHECK(test_fhss_calculate_uc_index()); -} - -TEST(fhss_beacon, test_fhss_get_time_to_next_channel_change) -{ - CHECK(test_fhss_get_time_to_next_channel_change()); -} - -TEST(fhss_beacon, test_fhss_beacon_decode) -{ - CHECK(test_fhss_beacon_decode()); -} diff --git a/test/nanostack/unittest/service_libs/fhss_beacon/main.cpp b/test/nanostack/unittest/service_libs/fhss_beacon/main.cpp deleted file mode 100644 index 94bfe90aea4d..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(fhss_beacon); - diff --git a/test/nanostack/unittest/service_libs/fhss_beacon/test_fhss_beacon.c b/test/nanostack/unittest/service_libs/fhss_beacon/test_fhss_beacon.c deleted file mode 100644 index 38eb7ed12492..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon/test_fhss_beacon.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "Service_Libs/fhss/fhss.h" -#include "Service_Libs/fhss/fhss_beacon.h" - -uint16_t common_read_16_bit(const uint8_t data_buf[__static 2]) -{ - uint16_t temp_16; - temp_16 = (uint16_t)(*data_buf++) << 8; - temp_16 += *data_buf++; - return temp_16; -} - -uint8_t *common_write_16_bit(uint16_t value, uint8_t ptr[__static 2]) -{ - *ptr++ = value >> 8; - *ptr++ = value; - return ptr; -} - -uint32_t common_read_32_bit(const uint8_t data_buf[__static 4]) -{ - uint32_t temp_32; - temp_32 = (uint32_t)(*data_buf++) << 24; - temp_32 += (uint32_t)(*data_buf++) << 16; - temp_32 += (uint32_t)(*data_buf++) << 8; - temp_32 += *data_buf++; - return temp_32; -} - -uint8_t *common_write_32_bit(uint32_t value, uint8_t ptr[__static 4]) -{ - *ptr++ = value >> 24; - *ptr++ = value >> 16; - *ptr++ = value >> 8; - *ptr++ = value; - return ptr; -} - -bool test_fhss_beacon_update_payload() -{ - uint8_t test_value = 1; - fhss_synchronization_beacon_payload_s payload; - memset(&payload, 0, sizeof(fhss_synchronization_beacon_payload_s)); - fhss_structure_t *fhss_struct = malloc(sizeof(fhss_structure_t)); - - // Test NULL FHSS structure - if (fhss_beacon_update_payload(NULL, &payload) != -1) { - return false; - } - // Test NULL payload - if (fhss_beacon_update_payload(fhss_struct, NULL) != -1) { - return false; - } - - fhss_struct->current_channel_index = test_value; - fhss_struct->current_superframe = test_value; - fhss_struct->channel_list_counter = test_value; - fhss_struct->own_hop = test_value; - fhss_struct->synch_configuration.fhss_number_of_bc_channels = test_value; - fhss_struct->synch_configuration.fhss_number_of_tx_slots = test_value; - fhss_struct->fhss_configuration.fhss_tuning_parameters.tx_processing_delay = test_value; - fhss_struct->synch_configuration.fhss_superframe_length = test_value; - fhss_struct->synch_configuration.fhss_number_of_superframes = test_value; - - // Test "proper" parameters - if (fhss_beacon_update_payload(fhss_struct, &payload) != 0) { - return false; - } - - fhss_struct->current_channel_index = test_value; - - if (payload.channel_index != test_value) { - return false; - } - if (payload.current_superframe != test_value) { - return false; - } - if (payload.channel_list_counter != test_value) { - return false; - } - if (payload.hop_count != test_value) { - return false; - } - if (payload.number_of_broadcast_channels != test_value) { - return false; - } - if (payload.number_of_tx_slots != test_value) { - return false; - } - if (payload.processing_delay != test_value) { - return false; - } - if (payload.superframe_length != test_value) { - return false; - } - if (payload.number_of_superframes_per_channel != test_value) { - return false; - } - - free(fhss_struct); - fhss_struct = NULL; - return true; -} - -bool test_fhss_beacon_encode_raw() -{ - uint8_t test_value = 1; - uint8_t buffer[21]; - memset(buffer, 0, sizeof(buffer)); - fhss_synchronization_beacon_payload_s source; - - source.channel_index = test_value; - source.sender_unicast_channel = test_value; - source.current_superframe = test_value; - source.remaining_slots = test_value; - source.channel_list_counter = test_value; - source.hop_count = test_value; - source.number_of_broadcast_channels = test_value; - source.number_of_tx_slots = test_value; - source.time_since_last_beacon = test_value; - source.processing_delay = test_value; - source.superframe_length = test_value; - source.number_of_superframes_per_channel = test_value; - - fhss_beacon_encode_raw(buffer, &source); - // Test values that were not written using common_write -functions - if (buffer[0] != FHSS_DATA_START_DELIMETER) { - return false; - } - if (buffer[1] != test_value) { - return false; - } - if (buffer[2] != test_value) { - return false; - } - if (buffer[9] != test_value) { - return false; - } - if (buffer[10] != test_value) { - return false; - } - if (buffer[11] != test_value) { - return false; - } - if (buffer[20] != test_value) { - return false; - } - return true; -} - -bool test_fhss_calculate_uc_index() -{ - if (fhss_calculate_uc_index(0, 50, 10) != 39) { - return false; - } - if (fhss_calculate_uc_index(1, 50, 10) != 0) { - return false; - } - return true; -} - -bool test_fhss_get_time_to_next_channel_change() -{ - if (fhss_get_time_to_next_channel_change(100, 8, 5, 50000) != 100100) { - return false; - } - return true; -} - -bool test_fhss_beacon_decode() -{ - uint8_t test_value = 1; - uint8_t buffer[21]; - // Delimeter - buffer[0] = FHSS_DATA_START_DELIMETER; - // Channel index - buffer[1] = 0; - // Sender unicast - buffer[2] = 1; - // Current superframe - buffer[3] = 0; - buffer[4] = 5; - // Remaining slots - buffer[5] = 0x86; - buffer[6] = 0xa0; - // Channel list counter - buffer[7] = 0x03; - buffer[8] = 0xe7; - // Hop count - buffer[9] = 1; - // Number of broadcast channels - buffer[10] = 10; - // Number of TX slots - buffer[11] = 2; - // Time since last Beacon - buffer[12] = 0; - buffer[13] = 0; - buffer[14] = 0; - buffer[15] = 0; - // Processing delay - buffer[16] = 0; - buffer[17] = 0; - // Superframe length - buffer[18] = 0xc3; - buffer[19] = 0x50; - // Number of superframes - buffer[20] = 8; - fhss_synchronization_beacon_payload_s dest; - memset(&dest, 0, sizeof(fhss_synchronization_beacon_payload_s)); - fhss_beacon_decode(&dest, buffer, 1000, 50); - - // Test basic configuration values - if (dest.current_superframe != 5) { - return false; - } - if (dest.number_of_superframes_per_channel != 8) { - return false; - } - if (dest.superframe_length != 50000) { - return false; - } - - // Current superframe - buffer[3] = 0; - buffer[4] = 7; - // Remaining slots - buffer[5] = 0x00; - buffer[6] = 0x0f; - - memset(&dest, 0, sizeof(fhss_synchronization_beacon_payload_s)); - fhss_beacon_decode(&dest, buffer, 1000, 50); - // Test superframe oveflow - if (dest.current_superframe != 0) { - return false; - } - if (dest.channel_index != 1) { - return false; - } - - // Channel index - buffer[1] = 49; - - memset(&dest, 0, sizeof(fhss_synchronization_beacon_payload_s)); - fhss_beacon_decode(&dest, buffer, 1000, 50); - // Test channel index and channel list counter overflow - if (dest.channel_index != 0) { - return false; - } - if (dest.channel_list_counter != 0) { - return false; - } -#if 0 - printf("data_start_delimeter: %u\n" ,dest.data_start_delimeter); - printf("channel_index: %u\n" ,dest.channel_index); - printf("sender_unicast_channel: %u\n" ,dest.sender_unicast_channel); - printf("current_superframe: %u\n" ,dest.current_superframe); - printf("remaining_slots: %u\n" ,dest.remaining_slots); - printf("channel_list_counter: %u\n" ,dest.channel_list_counter); - printf("hop_count: %u\n" ,dest.hop_count); - printf("number_of_broadcast_channels: %u\n" ,dest.number_of_broadcast_channels); - printf("number_of_tx_slots: %u\n" ,dest.number_of_tx_slots); - printf("time_since_last_beacon: %u\n" ,dest.time_since_last_beacon); - printf("processing_delay: %u\n" ,dest.processing_delay); - printf("superframe_length: %u\n" ,dest.superframe_length); - printf("number_of_superframes_per_channel: %u\n" ,dest.number_of_superframes_per_channel); -#endif - return true; -} diff --git a/test/nanostack/unittest/service_libs/fhss_beacon/test_fhss_beacon.h b/test/nanostack/unittest/service_libs/fhss_beacon/test_fhss_beacon.h deleted file mode 100644 index c680f63328da..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon/test_fhss_beacon.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, 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 TEST_FHSS_BEACON_H -#define TEST_FHSS_BEACON_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_fhss_beacon_update_payload(); -bool test_fhss_beacon_encode_raw(); -bool test_fhss_calculate_uc_index(); -bool test_fhss_get_time_to_next_channel_change(); -bool test_fhss_beacon_decode(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_FHSS_BEACON_H diff --git a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/Makefile b/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/Makefile deleted file mode 100644 index b84a228b0ebd..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = fhss_beacon_tasklet - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/fhss/fhss_beacon_tasklet.c \ - - -TEST_SRC_FILES = \ - main.cpp \ - fhssbeacontasklettest.cpp \ - test_fhss_beacon_tasklet.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/fhss_stub.c \ - ../../stub/fhss_beacon_stub.c \ - ../../stub/fhss_statistics_stub.c \ - ../../stub/fhss_callbacks_stub.c \ - ../../stub/fhss_platform_stub.c \ - ../../stub/event_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/fhssbeacontasklettest.cpp b/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/fhssbeacontasklettest.cpp deleted file mode 100644 index cc2f0f718688..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/fhssbeacontasklettest.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_fhss_beacon_tasklet.h" - - -TEST_GROUP(fhss_beacon_tasklet) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(fhss_beacon_tasklet, test_fhss_beacon_tasklet_func) -{ - CHECK(test_fhss_beacon_tasklet_func()); -} - -TEST(fhss_beacon_tasklet, test_fhss_beacon_build) -{ - CHECK(test_fhss_beacon_build()); -} - -TEST(fhss_beacon_tasklet, test_fhss_beacon_received) -{ - CHECK(test_fhss_beacon_received()); -} diff --git a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/main.cpp b/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/main.cpp deleted file mode 100644 index 697f1422fb66..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(fhss_beacon_tasklet); - diff --git a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/test_fhss_beacon_tasklet.c b/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/test_fhss_beacon_tasklet.c deleted file mode 100644 index e72a6385e253..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/test_fhss_beacon_tasklet.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "Service_Libs/fhss/fhss.h" -#include "Service_Libs/fhss/fhss_beacon.h" -#include "MAC/IEEE802_15_4/mac_fhss_callbacks.h" -#include "fhss_platform_stub.h" -#include "eventOS_event.h" -#include "eventOS_event_timer.h" -#include "fhss_stub.h" - -bool test_fhss_beacon_tasklet_func() -{ - fhss_structure_t fhss_structure; - fhss_structure.beacon_tasklet_id = -1; - fhss_structure.callbacks.synch_lost_notification = mac_synch_lost; - fhss_structure.callbacks.send_fhss_frame = mac_fhss_frame_tx; - fhss_structure.callbacks.broadcast_notify = mac_broadcast_notification; - fhss_structure.platform_functions.fhss_get_timestamp = fhss_get_timestamp_stub; - fhss_structure.number_of_channels = 50; - fhss_structure.synch_configuration.fhss_number_of_bc_channels = 10; - fhss_structure.synch_monitor.avg_synch_fix_counter = 1; - - fhss_beacon_create_tasklet(&fhss_structure); - - - //Event send - arm_event_s event = { - .receiver = 0, - .sender = 0, - .event_id = 0, - .data_ptr = NULL, - .event_type = 0, - .priority = 0, - }; - // Test without fhss_struct - eventOS_event_send(&event); - event.data_ptr = &fhss_structure; - // Test FHSS timer event - fhss_stub.int_value = 0; - event.event_type = FHSS_TIMER_EVENT; - fhss_structure.beacons_received_timer = FHSS_SYNCHRONIZATION_LOST; - eventOS_event_send(&event); - fhss_structure.beacons_received_timer = FHSS_SYNCHRONIZATION_LOST - 1; - eventOS_event_send(&event); - if (fhss_structure.beacons_received_timer != FHSS_SYNCHRONIZATION_LOST) { - return false; - } - fhss_stub.int_value = -1; - fhss_structure.beacons_received_timer = FHSS_SYNCHRONIZATION_LOST - 1; - eventOS_event_send(&event); - - // Test comparing synch parent - fhss_stub.int_value = 0; - fhss_stub.int8_value = 1; - event.event_type = FHSS_COMPARE_SYNCH_PARENT; - eventOS_event_send(&event); - fhss_stub.int_value = -1; - eventOS_event_send(&event); - - // Test handling broadcast channel event - event.event_type = FHSS_BROADCAST_CHANNEL; - eventOS_event_send(&event); - - // Test handling synch info storage update - event.event_type = FHSS_UPDATE_SYNCH_INFO_STORAGE; - eventOS_event_send(&event); - - return true; -} - -bool test_fhss_beacon_build() -{ - // Not much to test in this function - fhss_beacon_build(NULL, NULL); - return true; -} - -bool test_fhss_beacon_received() -{ - fhss_structure_t fhss_structure; - uint8_t synch_info[21]; - // Test NULL parameters; - fhss_beacon_received(NULL, NULL, 0); - // Test NULL synch info - fhss_beacon_received(&fhss_structure, NULL, 0); - // Test with "proper" parameters - fhss_beacon_received(&fhss_structure, synch_info, 0); - return true; -} diff --git a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/test_fhss_beacon_tasklet.h b/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/test_fhss_beacon_tasklet.h deleted file mode 100644 index bc40417914a2..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_beacon_tasklet/test_fhss_beacon_tasklet.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2017, 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 TEST_FHSS_BEACON_TASKLET_H -#define TEST_FHSS_BEACON_TASKLET_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_fhss_beacon_tasklet_func(); -bool test_fhss_beacon_build(); -bool test_fhss_beacon_received(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_FHSS_BEACON_TASKLET_H diff --git a/test/nanostack/unittest/service_libs/fhss_channel/Makefile b/test/nanostack/unittest/service_libs/fhss_channel/Makefile deleted file mode 100644 index 8483e9d59d17..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_channel/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = fhss_channel - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/fhss/fhss_channel.c \ - - -TEST_SRC_FILES = \ - main.cpp \ - fhsschanneltest.cpp \ - test_fhss_channel.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/channel_list_stub.c \ - ../../stub/fhss_beacon_stub.c \ - ../../stub/fhss_stub.c \ - ../../stub/fhss_callbacks_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/service_libs/fhss_channel/fhsschanneltest.cpp b/test/nanostack/unittest/service_libs/fhss_channel/fhsschanneltest.cpp deleted file mode 100644 index d53f591f26b4..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_channel/fhsschanneltest.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_fhss_channel.h" - - -TEST_GROUP(fhss_channel) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(fhss_channel, test_fhss_change_to_rx_channel) -{ - CHECK(test_fhss_change_to_rx_channel()); -} - -TEST(fhss_channel, test_fhss_change_to_parent_channel) -{ - CHECK(test_fhss_change_to_parent_channel()); -} - -TEST(fhss_channel, test_fhss_change_to_tx_channel) -{ - CHECK(test_fhss_change_to_tx_channel()); -} - -TEST(fhss_channel, test_fhss_update_channel) -{ - CHECK(test_fhss_update_channel()); -} - -TEST(fhss_channel, test_fhss_is_current_channel_broadcast) -{ - CHECK(test_fhss_is_current_channel_broadcast()); -} - -TEST(fhss_channel, test_channels_used_equally) -{ - CHECK(test_channels_used_equally()); -} - -TEST(fhss_channel, test_channel_list_repeating_64_channels) -{ - CHECK(test_channel_list_repeating_64_channels()); -} - -TEST(fhss_channel, test_channel_list_repeating_50_channels) -{ - CHECK(test_channel_list_repeating_50_channels()); -} - -TEST(fhss_channel, test_channel_randomization) -{ - CHECK(test_channel_randomization()); -} - -TEST(fhss_channel, test_fhss_get_offset) -{ - CHECK(test_fhss_get_offset()); -} diff --git a/test/nanostack/unittest/service_libs/fhss_channel/main.cpp b/test/nanostack/unittest/service_libs/fhss_channel/main.cpp deleted file mode 100644 index d4a6e4c88c0e..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_channel/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(fhss_channel); - diff --git a/test/nanostack/unittest/service_libs/fhss_channel/test_fhss_channel.c b/test/nanostack/unittest/service_libs/fhss_channel/test_fhss_channel.c deleted file mode 100644 index 0c6a0ce76178..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_channel/test_fhss_channel.c +++ /dev/null @@ -1,493 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "Service_Libs/fhss/fhss.h" -#include "MAC/IEEE802_15_4/mac_fhss_callbacks.h" -#include "test_fhss_channel.h" -#include "nsdynmemLIB_stub.h" -#include "channel_list_stub.h" -#include "fhss_callbacks_stub.h" -#include "fhss_stub.h" - -static uint16_t rand_value = 0; -static int rand_call_cnt = 0; - -uint16_t randLIB_get_random_in_range(uint16_t min, uint16_t max) -{ - if (rand_call_cnt % 2){ - rand_value++; - } - rand_call_cnt++; - return rand_value; -} - -static int print_channel_table(uint16_t number_of_channels, uint16_t number_of_bc, uint8_t *channel_table) -{ - uint16_t bc_density = number_of_channels / number_of_bc; - if (!channel_table) { - return -1; - } - for (int i = 0; i < number_of_channels; i++) { - if (i && !(i%bc_density)) { - printf("\n"); - } - printf("%u ",channel_table[i]); - if (channel_table[i] < 10) { - printf(" "); - } - } - printf("\n"); - return 0; -} - -static int generate_channel_sequence(uint16_t number_of_channels, uint16_t number_of_bc, uint8_t *channel_table) -{ - uint16_t bc_density = number_of_channels / number_of_bc; - - if (!channel_table) { - return -1; - } - for (int i=0; i= (table + table_size))) { - break; - } - } - if (i == repeat_pattern) { - return count; - } - search_index++; - } - } - return 0; -} - -bool test_channel_randomization() -{ - uint16_t number_of_channels = 0; - uint16_t number_of_bc = 0; - - // Runs all allowed channel list - broadcast list combinations - for (number_of_channels = 1; number_of_channels < 257; number_of_channels++) { - for (number_of_bc = 1; number_of_bc <= number_of_channels && number_of_bc < 256; number_of_bc++) { - // number of channels must be divisible with number of broadcast channels - if (!(number_of_channels % number_of_bc)) { - uint8_t *channel_table = malloc(number_of_channels); - if (!channel_table) { - return false; - } - uint8_t *randomized_table = malloc(number_of_channels); - if (!randomized_table) { - return false; - } - if (generate_channel_sequence(number_of_channels, number_of_bc, channel_table)) { - return false; - } - for (int i = 0; i < number_of_channels; i++) { - randomized_table[i] = fhss_calc_channel_shuffle(channel_table[i], number_of_channels, number_of_bc); - } -#if 0 - printf("Number of channels: %u, ", number_of_channels); - printf("Number of BC: %u\n", number_of_bc); - printf("Channel table:\n"); - print_channel_table(number_of_channels, number_of_bc, channel_table); - printf("\n"); - printf("Randomized table:\n"); - print_channel_table(number_of_channels, number_of_bc, randomized_table); - printf("\n"); -#endif - // Test that all channels are existing only once - int channel_exists = 0; - for (int j = 0; j < number_of_channels; j++) { - for (int k = 0; k < number_of_channels; k++) { - if (randomized_table[k] == j) { - channel_exists++; - } - } - if (channel_exists != 1) { - return false; - } - channel_exists = 0; - } - free(channel_table); - free(randomized_table); - } - } - } - return true; -} - -const uint8_t scramble_table_50[20] = {3, 7, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 37, 39, 41, 43, 47, 49, 51}; -const uint8_t scramble_table_64[20] = {3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41}; -uint8_t scramble_table_test[20]; - -bool test_channel_list_repeating_50_channels() -{ - uint16_t number_of_channels = 50; - uint16_t number_of_bc = 10; - // With 50 channels, repeating cycle should start after 50000 indexes - uint32_t number_of_test_indexes = number_of_channels * number_of_channels * MAX_SCRAMBLE_TABLE_INDEXES; - uint16_t channel_list_count = number_of_test_indexes / number_of_channels; - - uint8_t *channel_table = malloc(number_of_channels); - if (!channel_table) { - return false; - } - uint8_t *randomized_table = malloc(number_of_channels); - if (!randomized_table) { - return false; - } - uint8_t *final_table = malloc(number_of_channels * channel_list_count); - if (!final_table) { - return false; - } - - if (generate_channel_sequence(number_of_channels, number_of_bc, channel_table)) { - return false; - } - for (int i = 0; i < number_of_channels; i++) { - randomized_table[i] = fhss_calc_channel_shuffle(channel_table[i], number_of_channels, number_of_bc); - } - int k = 0; - uint16_t channel_list_counter = 0; - // Create scramble table - memcpy(scramble_table_test, scramble_table_50, 20); - // Create first 50000 indexes - for (int j = 0; j < number_of_channels * channel_list_count; j++) { - final_table[j] = fhss_add_channel_list_counter(randomized_table[k], number_of_channels, channel_list_counter, scramble_table_test); - if (++k == number_of_channels) { - k = 0; - channel_list_counter++; - } - } - // Test if repeated cycle is found - if (search_repeated_sequence(number_of_channels * 2, final_table, number_of_test_indexes)) { - return false; - } - - free(channel_table); - free(randomized_table); - free(final_table); - return true; -} - -bool test_channel_list_repeating_64_channels() -{ - uint16_t number_of_channels = 64; - uint16_t number_of_bc = 8; - // With 50 channels, repeating cycle should start after 81920 indexes - uint32_t number_of_test_indexes = number_of_channels * number_of_channels * MAX_SCRAMBLE_TABLE_INDEXES; - uint16_t channel_list_count = number_of_test_indexes / number_of_channels; - - uint8_t *channel_table = malloc(number_of_channels); - if (!channel_table) { - return false; - } - uint8_t *randomized_table = malloc(number_of_channels); - if (!randomized_table) { - return false; - } - uint8_t *final_table = malloc(number_of_channels * channel_list_count); - if (!final_table) { - return false; - } - - if (generate_channel_sequence(number_of_channels, number_of_bc, channel_table)) { - return false; - } - for (int i = 0; i < number_of_channels; i++) { - randomized_table[i] = fhss_calc_channel_shuffle(channel_table[i], number_of_channels, number_of_bc); - } - int k = 0; - uint16_t channel_list_counter = 0; - // Create scramble table - memcpy(scramble_table_test, scramble_table_64, 20); - // Create first 81920 indexes - for (int j = 0; j < number_of_channels * channel_list_count; j++) { - final_table[j] = fhss_add_channel_list_counter(randomized_table[k], number_of_channels, channel_list_counter, scramble_table_test); - if (++k == number_of_channels) { - k = 0; - channel_list_counter++; - } - } - // Test if repeated cycle is found - if (search_repeated_sequence(number_of_channels * 2, final_table, number_of_test_indexes)) { - return false; - } - - free(channel_table); - free(randomized_table); - free(final_table); - return true; -} - -bool test_channels_used_equally() -{ - uint16_t number_of_channels = 50; - uint16_t number_of_bc = 10; - uint32_t number_of_test_indexes = number_of_channels * number_of_channels * MAX_SCRAMBLE_TABLE_INDEXES; - uint16_t channel_list_count = number_of_test_indexes / number_of_channels; - uint16_t channel_count[50]; - - uint8_t *channel_table = malloc(number_of_channels); - if (!channel_table) { - return false; - } - uint8_t *randomized_table = malloc(number_of_channels); - if (!randomized_table) { - return false; - } - uint8_t *final_table = malloc(number_of_channels * channel_list_count); - if (!final_table) { - return false; - } - - if (generate_channel_sequence(number_of_channels, number_of_bc, channel_table)) { - return false; - } - for (int i = 0; i < number_of_channels; i++) { - randomized_table[i] = fhss_calc_channel_shuffle(channel_table[i], number_of_channels, number_of_bc); - } - int k = 0; - uint16_t channel_list_counter = 0; - // Create scramble table - memcpy(scramble_table_test, scramble_table_64, 20); - // Create first 50000 indexes - for (int j = 0; j < number_of_channels * channel_list_count; j++) { - final_table[j] = fhss_add_channel_list_counter(randomized_table[k], number_of_channels, channel_list_counter, scramble_table_test); - if (++k == number_of_channels) { - k = 0; - channel_list_counter++; - } - } - memset(channel_count, 0, sizeof(channel_count)); - for (uint32_t l=0; l - -// Test creating of randomized channel sequence -bool test_channel_randomization(); -// Test channel sequence is not repeated too early -bool test_channel_list_repeating_50_channels(); -bool test_channel_list_repeating_64_channels(); -// Test all channels are used equally -bool test_channels_used_equally(); -// Test checking type of current channel -bool test_fhss_is_current_channel_broadcast(); -// Test channel update -bool test_fhss_update_channel(); -// Test changing to TX channel -bool test_fhss_change_to_tx_channel(); -// Test changing to parent channel -bool test_fhss_change_to_parent_channel(); -// Test changing to RX channel -bool test_fhss_change_to_rx_channel(); -// Test getting channel list offset -bool test_fhss_get_offset(); -#ifdef __cplusplus -} -#endif - -#endif // TEST_FHSS_H - diff --git a/test/nanostack/unittest/service_libs/fhss_config/Makefile b/test/nanostack/unittest/service_libs/fhss_config/Makefile deleted file mode 100644 index 9fbcb2c6b6a6..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_config/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = fhss_config_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/fhss/fhss_configuration_interface.c \ - - -TEST_SRC_FILES = \ - main.cpp \ - fhssconfigtest.cpp \ - test_fhss_config.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/fhss_stub.c \ - ../../stub/fhss_mac_interface_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/service_libs/fhss_config/fhssconfigtest.cpp b/test/nanostack/unittest/service_libs/fhss_config/fhssconfigtest.cpp deleted file mode 100644 index 70ed2d80a2b8..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_config/fhssconfigtest.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/TestHarness.h" -#include "test_fhss_config.h" - - -TEST_GROUP(fhss_config) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(fhss_config, test_ns_fhss_configuration_set) -{ - CHECK(test_ns_fhss_configuration_set()); -} - -TEST(fhss_config, test_ns_fhss_delete) -{ - CHECK(test_ns_fhss_delete()); -} - -TEST(fhss_config, test_ns_fhss_create) -{ - CHECK(test_ns_fhss_create()); -} diff --git a/test/nanostack/unittest/service_libs/fhss_config/main.cpp b/test/nanostack/unittest/service_libs/fhss_config/main.cpp deleted file mode 100644 index e25b9e75bcb6..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_config/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(fhss_config); - diff --git a/test/nanostack/unittest/service_libs/fhss_config/test_fhss_config.c b/test/nanostack/unittest/service_libs/fhss_config/test_fhss_config.c deleted file mode 100644 index 4aa7e2a86b3c..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_config/test_fhss_config.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "mac_api.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "net_fhss.h" -#include "Service_Libs/fhss/fhss.h" -#include "test_fhss_config.h" -#include "nsdynmemLIB_stub.h" -#include "fhss_mac_interface_stub.h" -#include "fhss_stub.h" - -bool test_ns_fhss_create() -{ - fhss_api_t *api; - fhss_timer_t fhss_timer; - fhss_configuration_t fhss_configuration; - - // Test creating FHSS with no memory - nsdynmemlib_stub.returnCounter = 0; - api = ns_fhss_create(&fhss_configuration, &fhss_timer, NULL); - if (api) { - return false; - } - // fhss_enable returns fail - fhss_stub.int8_value = -1; - // Able to allocate memory - nsdynmemlib_stub.returnCounter = 1; - api = ns_fhss_create(&fhss_configuration, &fhss_timer, NULL); - if (api) { - return false; - } - // fhss_enable returns success - fhss_stub.int8_value = 0; - // Able to allocate memory - nsdynmemlib_stub.returnCounter = 1; - api = ns_fhss_create(&fhss_configuration, &fhss_timer, NULL); - if (!api) { - return false; - } - // Test calling all functions - fhss_mac_interface_stub.int8_value = 0; - api->receive_frame(api, 0, NULL, 0, NULL, FHSS_SYNCH_FRAME); - if (fhss_mac_interface_stub.int8_value != 1) { - return false; - } - api->check_tx_conditions(api, true, 0, FHSS_DATA_FRAME, 100, 0, 0); - if (fhss_mac_interface_stub.int8_value != 2) { - return false; - } - api->data_tx_done(api, true, true, 0); - if (fhss_mac_interface_stub.int8_value != 3) { - return false; - } - api->data_tx_fail(api, 0, FHSS_DATA_FRAME); - if (fhss_mac_interface_stub.int8_value != 4) { - return false; - } - api->is_broadcast_channel(api); - if (fhss_mac_interface_stub.int8_value != 5) { - return false; - } - api->read_timestamp(api); - if (fhss_mac_interface_stub.int8_value != 6) { - return false; - } - api->synch_state_set(api, FHSS_UNSYNCHRONIZED, 0); - if (fhss_mac_interface_stub.int8_value != 7) { - return false; - } - api->tx_handle(api, true, NULL, FHSS_DATA_FRAME, NULL, 0, 0, 0); - if (fhss_mac_interface_stub.int8_value != 8) { - return false; - } - - free(api); - return true; -} - -bool test_ns_fhss_delete() -{ - fhss_api_t *fhss_api = malloc(sizeof(fhss_api)); - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - if (ns_fhss_delete(NULL) != -1) { - return false; - } - fhss_stub.int8_value = -1; - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - // Test without API - if (ns_fhss_delete(NULL) != -1) { - return false; - } - fhss_stub.int8_value = 0; - // Test with API - if (ns_fhss_delete(fhss_api) != 0) { - return false; - } - return true; -} - -bool test_ns_fhss_configuration_set() -{ - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - ns_fhss_configuration_set(NULL, NULL); - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - ns_fhss_configuration_set(NULL, NULL); - return true; -} diff --git a/test/nanostack/unittest/service_libs/fhss_config/test_fhss_config.h b/test/nanostack/unittest/service_libs/fhss_config/test_fhss_config.h deleted file mode 100644 index 59d49852afdf..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_config/test_fhss_config.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016, 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 TEST_FHSS_H -#define TEST_FHSS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// Test creating of FHSS instance -bool test_ns_fhss_create(); -// Test deleting (disabling) FHSS instance -bool test_ns_fhss_delete(); -// Test setting synchronization time configuration -bool test_ns_fhss_configuration_set(); - - -#ifdef __cplusplus -} -#endif - -#endif // TEST_FHSS_H - diff --git a/test/nanostack/unittest/service_libs/fhss_mac_interface/Makefile b/test/nanostack/unittest/service_libs/fhss_mac_interface/Makefile deleted file mode 100644 index 8c7bc0f5b193..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_mac_interface/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = fhss_mac_if_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/fhss/fhss_mac_interface.c \ - - -TEST_SRC_FILES = \ - main.cpp \ - fhssmaciftest.cpp \ - test_fhss_mac_interface.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/fhss_stub.c \ - ../../stub/fhss_channel_stub.c \ - ../../stub/fhss_platform_stub.c \ - ../../stub/fhss_callbacks_stub.c \ - ../../stub/fhss_beacon_tasklet_stub.c \ - ../../stub/randLIB_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/service_libs/fhss_mac_interface/fhssmaciftest.cpp b/test/nanostack/unittest/service_libs/fhss_mac_interface/fhssmaciftest.cpp deleted file mode 100644 index b8984508d832..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_mac_interface/fhssmaciftest.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_fhss_mac_interface.h" - - -TEST_GROUP(fhss_mac_if) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(fhss_mac_if, test_fhss_is_broadcast_channel_cb) -{ - CHECK(test_fhss_is_broadcast_channel_cb()); -} - -TEST(fhss_mac_if, test_fhss_use_broadcast_queue_cb) -{ - CHECK(test_fhss_use_broadcast_queue_cb()); -} - -TEST(fhss_mac_if, test_fhss_tx_handle_cb) -{ - CHECK(test_fhss_tx_handle_cb()); -} - -TEST(fhss_mac_if, test_fhss_check_tx_conditions_cb) -{ - CHECK(test_fhss_check_tx_conditions_cb()); -} - -TEST(fhss_mac_if, test_fhss_receive_frame_cb) -{ - CHECK(test_fhss_receive_frame_cb()); -} - -TEST(fhss_mac_if, test_fhss_data_tx_done_cb) -{ - CHECK(test_fhss_data_tx_done_cb()); -} - -TEST(fhss_mac_if, test_fhss_data_tx_fail_cb) -{ - CHECK(test_fhss_data_tx_fail_cb()); -} - -TEST(fhss_mac_if, test_fhss_synch_state_set_cb) -{ - CHECK(test_fhss_synch_state_set_cb()); -} - -TEST(fhss_mac_if, test_fhss_read_timestamp_cb) -{ - CHECK(test_fhss_read_timestamp_cb()); -} - -TEST(fhss_mac_if, test_fhss_init_callbacks_cb) -{ - CHECK(test_fhss_init_callbacks_cb()); -} - -TEST(fhss_mac_if, test_fhss_get_retry_period_cb) -{ - CHECK(test_fhss_get_retry_period_cb()); -} diff --git a/test/nanostack/unittest/service_libs/fhss_mac_interface/main.cpp b/test/nanostack/unittest/service_libs/fhss_mac_interface/main.cpp deleted file mode 100644 index 8f184dba6f9e..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_mac_interface/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(fhss_mac_if); - diff --git a/test/nanostack/unittest/service_libs/fhss_mac_interface/test_fhss_mac_interface.c b/test/nanostack/unittest/service_libs/fhss_mac_interface/test_fhss_mac_interface.c deleted file mode 100644 index 4041fa87aacf..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_mac_interface/test_fhss_mac_interface.c +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "mac_api.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "net_fhss.h" -#include "Service_Libs/fhss/fhss.h" -#include "Service_Libs/fhss/fhss_mac_interface.h" -#include "MAC/IEEE802_15_4/mac_fhss_callbacks.h" -#include "test_fhss_mac_interface.h" -#include "nsdynmemLIB_stub.h" -#include "fhss_stub.h" -#include "fhss_channel_stub.h" -#include "fhss_platform_stub.h" - -bool test_fhss_is_broadcast_channel_cb() -{ - fhss_api_t fhss_api; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - if (fhss_is_broadcast_channel_cb(&fhss_api) == true) { - return false; - } - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - // Should return true - fhss_channel_stub.channel_bool_value = true; - if (fhss_is_broadcast_channel_cb(&fhss_api) == false) { - return false; - } - // Should return false - fhss_channel_stub.channel_bool_value = false; - if (fhss_is_broadcast_channel_cb(&fhss_api) == true) { - return false; - } - // Should return true when unsynchronized - fhss_stub.fhss_struct.fhss_state = FHSS_UNSYNCHRONIZED; - if (fhss_is_broadcast_channel_cb(&fhss_api) == false) { - return false; - } - return true; -} -bool test_fhss_use_broadcast_queue_cb() -{ - fhss_api_t fhss_api; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - if (fhss_use_broadcast_queue_cb(&fhss_api, true, FHSS_DATA_FRAME) == true) { - return false; - } - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - // Synchronization request frame should go to unicast queue - if (fhss_use_broadcast_queue_cb(&fhss_api, true, FHSS_SYNCH_REQUEST_FRAME) == true) { - return false; - } - // Broadcast frame should go to broadcast queue - if (fhss_use_broadcast_queue_cb(&fhss_api, true, FHSS_DATA_FRAME) == false) { - return false; - } - return true; -} -bool test_fhss_tx_handle_cb() -{ - fhss_api_t fhss_api; - uint8_t synch_info[FHSS_SYNCH_INFO_LENGTH]; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - if (fhss_tx_handle_cb(&fhss_api, true, NULL, FHSS_DATA_FRAME, NULL, 0, 0, 0) != -2) { - return false; - } - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - // Broadcast data on unicast channel should return -3 - fhss_channel_stub.channel_bool_value = false; - if (fhss_tx_handle_cb(&fhss_api, true, NULL, FHSS_DATA_FRAME, NULL, 0, 0, 0) != -3) { - return false; - } - // Synch frame without synch info should return -4 - if (fhss_tx_handle_cb(&fhss_api, true, NULL, FHSS_SYNCH_FRAME, NULL, 0, 0, 0) != -4) { - return false; - } - // Test sending of Beacon - if (fhss_tx_handle_cb(&fhss_api, true, NULL, FHSS_SYNCH_FRAME, synch_info, 0, 0, 0) != 0) { - return false; - } - // When TX is not allowed, should return -1 for data frame - fhss_stub.tx_allowed_bool_value = false; - if (fhss_tx_handle_cb(&fhss_api, false, NULL, FHSS_DATA_FRAME, synch_info, 0, 0, 0) != -1) { - return false; - } - // When TX is allowed, should return 0 for data frame - fhss_stub.tx_allowed_bool_value = true; - if (fhss_tx_handle_cb(&fhss_api, false, NULL, FHSS_DATA_FRAME, synch_info, 0, 0, 0) != 0) { - return false; - } - // Test changing to parent channel to send synch request - fhss_stub.fhss_struct.fhss_state = FHSS_SYNCHRONIZED; - if (fhss_tx_handle_cb(&fhss_api, false, NULL, FHSS_SYNCH_REQUEST_FRAME, synch_info, 0, 0, 0) != 0) { - return false; - } - return true; -} -bool test_fhss_check_tx_conditions_cb() -{ - fhss_api_t fhss_api; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - if (fhss_check_tx_conditions_cb(&fhss_api, true, 1, FHSS_DATA_FRAME, 100, 0, 0) == true) { - return false; - } - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - - // Test failing bad channel check - fhss_stub.bad_channel_bool_value = false; - fhss_stub.channel_type_bool_value = true; - fhss_stub.tx_allowed_bool_value = true; - if (fhss_check_tx_conditions_cb(&fhss_api, true, 1, FHSS_DATA_FRAME, 100, 0, 0) == true) { - return false; - } - // Test failing channel type check - fhss_stub.bad_channel_bool_value = true; - fhss_stub.channel_type_bool_value = false; - fhss_stub.tx_allowed_bool_value = true; - if (fhss_check_tx_conditions_cb(&fhss_api, true, 1, FHSS_DATA_FRAME, 100, 0, 0) == true) { - return false; - } - // Test failing TX allowed check - fhss_stub.bad_channel_bool_value = true; - fhss_stub.channel_type_bool_value = true; - fhss_stub.tx_allowed_bool_value = false; - if (fhss_check_tx_conditions_cb(&fhss_api, true, 1, FHSS_DATA_FRAME, 100, 0, 0) == true) { - return false; - } - // Test TX allowed - fhss_stub.bad_channel_bool_value = true; - fhss_stub.channel_type_bool_value = true; - fhss_stub.tx_allowed_bool_value = true; - if (fhss_check_tx_conditions_cb(&fhss_api, true, 1, FHSS_DATA_FRAME, 100, 0, 0) == false) { - return false; - } - return true; -} -bool test_fhss_receive_frame_cb() -{ - fhss_api_t fhss_api; - fhss_timer_t platform_functions; - uint8_t source_address[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - - platform_functions.fhss_get_timestamp = fhss_get_timestamp_stub; - fhss_stub.fhss_struct.platform_functions = platform_functions; - fhss_api.read_timestamp = fhss_read_timestamp_cb; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - fhss_receive_frame_cb(&fhss_api, 0, NULL, 0, NULL, FHSS_SYNCH_FRAME); - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - // Test adding Beacon info when not synchronized - fhss_stub.fhss_struct.fhss_state = FHSS_UNSYNCHRONIZED; - fhss_receive_frame_cb(&fhss_api, 0, NULL, 0, NULL, FHSS_SYNCH_FRAME); - // Beacon received when synchronized - fhss_stub.fhss_struct.fhss_state = FHSS_SYNCHRONIZED; - fhss_receive_frame_cb(&fhss_api, 0, source_address, 0, NULL, FHSS_SYNCH_FRAME); - // Beacon request received - fhss_channel_stub.channel_bool_value = false; - fhss_stub.fhss_struct.fhss_state = FHSS_SYNCHRONIZED; - - fhss_stub.fhss_struct.send_synch_info_on_next_broadcast_channel = false; - fhss_receive_frame_cb(&fhss_api, 0, NULL, 0, NULL, FHSS_SYNCH_REQUEST_FRAME); - if (fhss_stub.fhss_struct.send_synch_info_on_next_broadcast_channel != true) { - return false; - } - // Test Synch info limitation - fhss_stub.fhss_struct.send_synch_info_on_next_broadcast_channel = false; - fhss_stub.fhss_struct.synch_infos_sent_counter = MAX_SYNCH_INFOS_PER_CHANNEL_LIST; - fhss_receive_frame_cb(&fhss_api, 0, NULL, 0, NULL, FHSS_SYNCH_REQUEST_FRAME); - if (fhss_stub.fhss_struct.send_synch_info_on_next_broadcast_channel != false) { - return false; - } - - return true; -} -bool test_fhss_data_tx_done_cb() -{ - fhss_api_t fhss_api; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - fhss_data_tx_done_cb(&fhss_api, true, true, 0); - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - fhss_data_tx_done_cb(&fhss_api, false, true, 0); - // Should find failed TX handle - fhss_stub.fhss_failed_tx.handle = 10; - fhss_data_tx_done_cb(&fhss_api, false, true, 10); - // Verify removed handle (255 means removed in this test) - if (fhss_stub.fhss_failed_tx.handle != 255) { - return false; - } - return true; -} -bool test_fhss_data_tx_fail_cb() -{ - fhss_api_t fhss_api; - uint8_t handle = 1; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - fhss_data_tx_fail_cb(&fhss_api, handle, FHSS_DATA_FRAME); - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - - // No channel retries should return false - fhss_stub.fhss_struct.fhss_configuration.fhss_number_of_channel_retries = 0; - if (fhss_data_tx_fail_cb(&fhss_api, handle, FHSS_DATA_FRAME) != false) { - return false; - } - // In this test 255 means no handle added - fhss_stub.fhss_failed_tx.handle = 255; - fhss_stub.fhss_struct.fhss_configuration.fhss_number_of_channel_retries = 2; - // This call should add new failed handle - if (fhss_data_tx_fail_cb(&fhss_api, handle, FHSS_DATA_FRAME) != true) { - return false; - } - // Verify added handle - if (fhss_stub.fhss_failed_tx.handle != handle) { - return false; - } - // After first retransmission should return true because one more retry left - if (fhss_data_tx_fail_cb(&fhss_api, handle, FHSS_DATA_FRAME) != true) { - return false; - } - // After last retransmission should return false - if (fhss_data_tx_fail_cb(&fhss_api, handle, FHSS_DATA_FRAME) != false) { - return false; - } - - return true; -} -bool test_fhss_synch_state_set_cb() -{ - uint16_t panid = 0xacdc; - fhss_api_t fhss_api; - fhss_timer_t platform_functions; - fhss_stub.fhss_struct.callbacks.read_datarate = mac_read_phy_datarate; - fhss_stub.fhss_struct.callbacks.read_mac_address = mac_read_64bit_mac_address; - fhss_stub.fhss_struct.synch_panid = 0; - fhss_stub.fhss_struct.own_hop = 1; - platform_functions.fhss_get_timestamp = fhss_get_timestamp_stub; - fhss_stub.fhss_struct.platform_functions = platform_functions; - fhss_api.read_timestamp = fhss_read_timestamp_cb; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - fhss_synch_state_set_cb(&fhss_api, FHSS_UNSYNCHRONIZED, 0); - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - // Test setting current state again - fhss_stub.fhss_struct.fhss_state = FHSS_SYNCHRONIZED; - fhss_synch_state_set_cb(&fhss_api, FHSS_SYNCHRONIZED, 0); - // Test setting unsynchronized state - fhss_synch_state_set_cb(&fhss_api, FHSS_UNSYNCHRONIZED, 0); - // Test setting synchronized state - fhss_stub.fhss_struct.fhss_state = FHSS_UNSYNCHRONIZED; - fhss_synch_state_set_cb(&fhss_api, FHSS_SYNCHRONIZED, 0); - // Test finding beacon info - fhss_stub.beacon_info.pan_id = panid; - fhss_synch_state_set_cb(&fhss_api, FHSS_SYNCHRONIZED, panid); - // Test if device is synch root - fhss_stub.fhss_struct.own_hop = 0; - fhss_stub.fhss_struct.synch_panid = 0; - fhss_stub.beacon_info.pan_id = 1; - fhss_stub.fhss_struct.fhss_state = FHSS_UNSYNCHRONIZED; - fhss_synch_state_set_cb(&fhss_api, FHSS_SYNCHRONIZED, panid); - - return true; -} -bool test_fhss_read_timestamp_cb() -{ - fhss_api_t fhss_api; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - if (fhss_read_timestamp_cb(&fhss_api) != 0) { - return false; - } - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - return true; -} -bool test_fhss_init_callbacks_cb() -{ - fhss_api_t fhss_api; - fhss_callback_t callbacks; - - // By setting bool value false, fhss_struct can not be found - fhss_stub.bool_value = false; - fhss_init_callbacks_cb(&fhss_api, NULL); - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - fhss_init_callbacks_cb(&fhss_api, &callbacks); - return true; -} -bool test_fhss_get_retry_period_cb() -{ - fhss_api_t fhss_api; - if (fhss_get_retry_period_cb(NULL, NULL, 1) != 1) { - return false; - } - if (fhss_get_retry_period_cb(NULL, NULL, 128) != 1) { - return false; - } - if (fhss_get_retry_period_cb(NULL, NULL, 256) != 1) { - return false; - } - // By setting bool value true, fhss_struct can be found - fhss_stub.bool_value = true; - - // With the given datarate and MTU, callback should return 896 - fhss_stub.fhss_struct.datarate = 250000; - fhss_stub.int8_value = 0; - if (fhss_get_retry_period_cb(&fhss_api, NULL, 600) != 896) { - return false; - } - return true; -} diff --git a/test/nanostack/unittest/service_libs/fhss_mac_interface/test_fhss_mac_interface.h b/test/nanostack/unittest/service_libs/fhss_mac_interface/test_fhss_mac_interface.h deleted file mode 100644 index ac5815b08cf0..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_mac_interface/test_fhss_mac_interface.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_FHSS_H -#define TEST_FHSS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -// Test broadcast channel check callback -bool test_fhss_is_broadcast_channel_cb(); -// Test broadcast queue check callback -bool test_fhss_use_broadcast_queue_cb(); -// Test TX handle callback -bool test_fhss_tx_handle_cb(); -// Test TX conditions check callback -bool test_fhss_check_tx_conditions_cb(); -// Test frame receive callback -bool test_fhss_receive_frame_cb(); -// Test TX done callback -bool test_fhss_data_tx_done_cb(); -// Test TX fail callback -bool test_fhss_data_tx_fail_cb(); -// Test state set callback -bool test_fhss_synch_state_set_cb(); -// Test timestamp callback -bool test_fhss_read_timestamp_cb(); -// Test callback init callback -bool test_fhss_init_callbacks_cb(); -// Test getting retransmission period callback -bool test_fhss_get_retry_period_cb(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_FHSS_H - diff --git a/test/nanostack/unittest/service_libs/fhss_statistics/Makefile b/test/nanostack/unittest/service_libs/fhss_statistics/Makefile deleted file mode 100644 index a7371bab31f9..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_statistics/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = fhss_statistics_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/fhss/fhss_statistics.c \ - - -TEST_SRC_FILES = \ - main.cpp \ - fhssstatisticstest.cpp \ - test_fhss_statistics.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/service_libs/fhss_statistics/fhssstatisticstest.cpp b/test/nanostack/unittest/service_libs/fhss_statistics/fhssstatisticstest.cpp deleted file mode 100644 index 5f03672aa86f..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_statistics/fhssstatisticstest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/TestHarness.h" -#include "test_fhss_statistics.h" - - -TEST_GROUP(fhss_statistics) -{ - void setup() - { - } - - void teardown() - { - } -}; - -TEST(fhss_statistics, test_fhss_stats_update) -{ - CHECK(test_fhss_stats_update()); -} diff --git a/test/nanostack/unittest/service_libs/fhss_statistics/main.cpp b/test/nanostack/unittest/service_libs/fhss_statistics/main.cpp deleted file mode 100644 index 96d475b0e34e..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_statistics/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(fhss_statistics); - diff --git a/test/nanostack/unittest/service_libs/fhss_statistics/test_fhss_statistics.c b/test/nanostack/unittest/service_libs/fhss_statistics/test_fhss_statistics.c deleted file mode 100644 index 9714a6c7b72d..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_statistics/test_fhss_statistics.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "mac_api.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "net_fhss.h" -#include "Service_Libs/fhss/fhss.h" -#include "Service_Libs/fhss/fhss_statistics.h" - - -bool test_fhss_stats_update() -{ - fhss_structure_t fhss_struct; - fhss_statistics_t fhss_stats_ptr; - memset(&fhss_stats_ptr, 0, sizeof(fhss_statistics_t)); - fhss_struct.fhss_stats_ptr = &fhss_stats_ptr; - // Test drift compensation - fhss_stats_update(&fhss_struct, STATS_FHSS_DRIFT_COMP, 10); - if (fhss_struct.fhss_stats_ptr->fhss_drift_compensation != 10) { - return false; - } - // Test hop count - fhss_stats_update(&fhss_struct, STATS_FHSS_HOP_COUNT, 1); - if (fhss_struct.fhss_stats_ptr->fhss_hop_count != 1) { - return false; - } - // Test synch interval - fhss_stats_update(&fhss_struct, STATS_FHSS_SYNCH_INTERVAL, 960); - if (fhss_struct.fhss_stats_ptr->fhss_synch_interval != 960) { - return false; - } - // Test average synch fix - fhss_stats_update(&fhss_struct, STATS_FHSS_AVG_SYNCH_FIX, 1000); - if (fhss_struct.fhss_stats_ptr->fhss_prev_avg_synch_fix != 1000) { - return false; - } - // Test synch lost count - fhss_struct.fhss_stats_ptr->fhss_synch_lost = 1; - fhss_stats_update(&fhss_struct, STATS_FHSS_SYNCH_LOST, 1); - if (fhss_struct.fhss_stats_ptr->fhss_synch_lost != 2) { - return false; - } - return true; -} diff --git a/test/nanostack/unittest/service_libs/fhss_statistics/test_fhss_statistics.h b/test/nanostack/unittest/service_libs/fhss_statistics/test_fhss_statistics.h deleted file mode 100644 index a603b58c9ac5..000000000000 --- a/test/nanostack/unittest/service_libs/fhss_statistics/test_fhss_statistics.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 TEST_FHSS_STATISTICS_H -#define TEST_FHSS_STATISTICS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// Test updating statistics -bool test_fhss_stats_update(); - - - -#ifdef __cplusplus -} -#endif - -#endif // TEST_FHSS_STATISTICS_H - diff --git a/test/nanostack/unittest/service_libs/load_balance/Makefile b/test/nanostack/unittest/service_libs/load_balance/Makefile deleted file mode 100644 index 9b3f7302c2af..000000000000 --- a/test/nanostack/unittest/service_libs/load_balance/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = load_balance_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/load_balance/load_balance.c \ - -TEST_SRC_FILES = \ - main.cpp \ - loadbalance_test.cpp \ - ../../stub/mbed_trace_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/event_stub.c \ - ../../stub/randLIB_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DEXTRA_CONSISTENCY_CHECKS - diff --git a/test/nanostack/unittest/service_libs/load_balance/loadbalance_test.cpp b/test/nanostack/unittest/service_libs/load_balance/loadbalance_test.cpp deleted file mode 100644 index 0b6d0db254fd..000000000000 --- a/test/nanostack/unittest/service_libs/load_balance/loadbalance_test.cpp +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "string.h" -#include "CppUTest/TestHarness.h" -#include "../../../../../nanostack/mlme.h" -#include "Service_Libs/load_balance/load_balance_api.h" -#include "nsdynmemLIB_stub.h" -#include "event_stub.h" - -TEST_GROUP(LoadBalance) -{ - void setup() { - nsdynmemlib_stub.returnCounter = 0; - nsdynmemlib_stub.expectedPointer = NULL; - event_stub.int8_value = -1; - } - - void teardown() { - } -}; - -static uint8_t test_priority; -static bool accept_immediately_switch = true; - -static uint16_t generated_beacons = 0; -static const void *call_back_pointer = NULL; - -static const void *call_back_pointer2 = NULL; - -static const void *call_back_pointer3 = NULL; - -static const void *call_back_pointer4 = NULL; - -static mlme_pan_descriptor_s test_PANDescriptor; - -void test_load_balance_beacon_interval_set(const void * load_balancer_user) -{ - call_back_pointer = load_balancer_user; - generated_beacons++; -} - -uint8_t test_load_balance_priority_get(const void * load_balancer_user) -{ - call_back_pointer2 = load_balancer_user; - return test_priority; -} - -bool test_load_balance_network_switch_req(void * load_balancer_user, struct mlme_pan_descriptor_s *PANDescriptor, const uint8_t *beacon_payload, uint16_t beacon_payload_length) -{ - call_back_pointer3 = load_balancer_user; - test_PANDescriptor = *PANDescriptor; - return true; -} - -bool test_load_balance_network_switch_notify(const void * load_balancer_user, load_balance_nwk_switch_operation opeartion, uint16_t *timer) -{ - call_back_pointer4 = load_balancer_user; - switch (opeartion) { - case LB_ROUTER_LEAVE: - default: - - if (timer) { - *timer = 1; - } - - } - return true; -} - -TEST(LoadBalance, test_load_balance_events) -{ - load_balance_api_t *load_balance_class; - void *lb_user = &test_priority; - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 2; - generated_beacons = 0; - call_back_pointer = NULL; - load_balance_class = load_balance_create(test_load_balance_network_switch_notify, true); - load_balance_network_threshold_set(load_balance_class, 16, 64); - load_balance_class->lb_enable(load_balance_class, true, 100, 100); - POINTERS_EQUAL(NULL, call_back_pointer); - int8_t status = load_balance_class->lb_initialize(load_balance_class, test_load_balance_beacon_interval_set, test_load_balance_priority_get, test_load_balance_network_switch_req, 50, lb_user); - BYTES_EQUAL(0, status); - //Test acticate lb - load_balance_class->lb_enable(load_balance_class, true, 100, 100); - for (int i = 0; i< 301; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(2, generated_beacons); - //test disable - load_balance_class->lb_enable(load_balance_class, false, 0, 0); - - for (int i = 0; i< 200; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(2, generated_beacons); - - load_balance_class->lb_enable(load_balance_class, true, 100, 100); - - for (int i = 0; i< 301; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(4, generated_beacons); - - //set threshold - status = load_balance_network_threshold_set(NULL,16, 64); - BYTES_EQUAL(-1, status); - - status = load_balance_network_threshold_set(load_balance_class, 0, 0); - BYTES_EQUAL(0, status); - - - - //Testing network switch - uint8_t beacon_payload[100]; - mlme_beacon_ind_t beacon_ind; - memset(&beacon_ind, 0, sizeof (mlme_beacon_ind_t)); - beacon_ind.PANDescriptor.LinkQuality = 150; - beacon_ind.beacon_data_length = 100; - beacon_ind.beacon_data = beacon_payload; - - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 16); - load_balance_class->lb_enable(load_balance_class, false, 0, 0); - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 16); - - status = load_balance_network_threshold_set(load_balance_class, 16, 64); - BYTES_EQUAL(0, status); - - load_balance_class->lb_enable(load_balance_class, true, 100, 100); - for (int i = 0; i< 101; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 16); - beacon_ind.beacon_data_length = 50; - test_priority = 0; - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 16); - test_priority = 16 + 16; - for (int i=0; i< 101; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - //Shuold not accept this yet - beacon_ind.PANDescriptor.CoordPANId = 4; - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 16); - for (int i=0; i< 101; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - test_priority = 16 + 16 + 1; // now we should switch - beacon_ind.PANDescriptor.CoordPANId = 5; - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 16); - for (int i=0; i< 101; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - POINTERS_EQUAL(lb_user, call_back_pointer4); - BYTES_EQUAL(5, test_PANDescriptor.CoordPANId); - load_balance_class->lb_enable(load_balance_class, false, 10, 10); - beacon_ind.PANDescriptor.CoordPANId = 9; - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 16); - //Test network sitch - - load_balance_class->lb_enable(load_balance_class, true, 10, 10); - for (int i=0; i< 11; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - accept_immediately_switch = false; - beacon_ind.PANDescriptor.CoordPANId = 1; - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 16); - test_priority = 17 + 16 + 1; - beacon_ind.PANDescriptor.CoordPANId = 2; - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 17); - beacon_ind.PANDescriptor.LinkQuality = 100; - beacon_ind.PANDescriptor.CoordPANId = 3; - test_priority = 16 + 16 + 1; - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 16); - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - - accept_immediately_switch = true; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - - POINTERS_EQUAL(lb_user, call_back_pointer3); - BYTES_EQUAL(1, test_PANDescriptor.CoordPANId); - load_balance_class->lb_enable(load_balance_class, false, 10, 10); - load_balance_class->lb_enable(load_balance_class, true, 10, 10); - for (int i=0; i< 11; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - - test_priority = 64+1; - beacon_ind.PANDescriptor.CoordPANId = 3; - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 48); - - beacon_ind.PANDescriptor.CoordPANId = 8; - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 32); - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - - POINTERS_EQUAL(lb_user, call_back_pointer3); - BYTES_EQUAL(8, test_PANDescriptor.CoordPANId); - load_balance_class->lb_enable(load_balance_class, false, 10, 10); - load_balance_class->lb_enable(load_balance_class, true, 10, 10); - //Test network switch over max threshold - beacon_ind.PANDescriptor.CoordPANId = 3; - test_PANDescriptor.CoordPANId = 0; - test_priority = 64+1; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - - load_balance_class->lb_beacon_notify(load_balance_class, &beacon_ind, 0); - - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(3, test_PANDescriptor.CoordPANId); - - //free memory - load_balance_delete(load_balance_class); -} - - -TEST(LoadBalance, test_load_balance) -{ - load_balance_api_t *load_balance_class; - void *lb_user = &test_priority; - - load_balance_class = load_balance_create(NULL, true); - POINTERS_EQUAL(NULL,load_balance_class); - - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - load_balance_class = load_balance_create(test_load_balance_network_switch_notify, true); - if (!load_balance_class) { - FAIL("Loadbalance create return NULL pointer"); - } - load_balance_api_t *compare = load_balance_create(test_load_balance_network_switch_notify, true); - POINTERS_EQUAL(load_balance_class, compare) - - int8_t status = compare->lb_initialize(NULL, &test_load_balance_beacon_interval_set, &test_load_balance_priority_get, &test_load_balance_network_switch_req, 50, lb_user); - BYTES_EQUAL(-1, status); - - status = compare->lb_initialize(compare, NULL, test_load_balance_priority_get, test_load_balance_network_switch_req, 50, lb_user); - BYTES_EQUAL(-1, status); - - status = compare->lb_initialize(compare, test_load_balance_beacon_interval_set, NULL, test_load_balance_network_switch_req, 50, lb_user); - BYTES_EQUAL(-1, status); - - status = compare->lb_initialize(compare, test_load_balance_beacon_interval_set, test_load_balance_priority_get, NULL, 50, lb_user); - BYTES_EQUAL(-1, status); - - status = compare->lb_initialize(compare, test_load_balance_beacon_interval_set, test_load_balance_priority_get, test_load_balance_network_switch_req, 50, NULL); - BYTES_EQUAL(-1, status); - - status = compare->lb_initialize(compare, test_load_balance_beacon_interval_set, test_load_balance_priority_get, test_load_balance_network_switch_req, 50, lb_user); - BYTES_EQUAL(-2, status); - nsdynmemlib_stub.returnCounter = 1; - status = compare->lb_initialize(compare, test_load_balance_beacon_interval_set, test_load_balance_priority_get, test_load_balance_network_switch_req, 50, lb_user); - BYTES_EQUAL(0, status); - - compare = load_balance_create(test_load_balance_network_switch_notify, true); - POINTERS_EQUAL(NULL, compare); - - status = load_balance_delete(load_balance_class); - BYTES_EQUAL(0, status); - - status = load_balance_delete(load_balance_class); - BYTES_EQUAL(-1, status); -} -static bool fail_node_cnt = false; -static uint16_t load_node_cnt = 0; -static uint8_t test_load_level = 0; - -static int8_t test_load_balance_api_get_node_count(void *lb_user, uint16_t *node_count) -{ - if (fail_node_cnt) { - return -1; - } - - *node_count = load_node_cnt; - return 0; -} - -static int8_t test_load_balance_api_get_set_load_level(void *lb_user, uint8_t load_level) -{ - test_load_level = load_level; - return 0; -} - -TEST(LoadBalance, test_load_balance_load_update) -{ - load_balance_api_t *load_balance_class; - void *lb_user = &test_priority; - - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - load_balance_class = load_balance_create(test_load_balance_network_switch_notify, true); - if (!load_balance_class) { - FAIL("Loadbalance create return NULL pointer"); - } - - nsdynmemlib_stub.returnCounter = 1; - int8_t status = load_balance_class->lb_initialize(load_balance_class, test_load_balance_beacon_interval_set, test_load_balance_priority_get, test_load_balance_network_switch_req, 20, lb_user); - BYTES_EQUAL(0, status); - //Test Enable function - status = load_balance_network_load_monitor_enable(NULL, 0, 0, NULL, NULL); - BYTES_EQUAL(-1, status); - - status = load_balance_network_load_monitor_enable(load_balance_class, 0, 0, NULL, NULL); - BYTES_EQUAL(-1, status); - - status = load_balance_network_load_monitor_enable(load_balance_class, 24, 0, NULL, NULL); - BYTES_EQUAL(-1, status); - - status = load_balance_network_load_monitor_enable(load_balance_class, 24, 30, NULL, NULL); - BYTES_EQUAL(-1, status); - - status = load_balance_network_load_monitor_enable(load_balance_class, 24, 8, NULL, NULL); - BYTES_EQUAL(-1, status); - - status = load_balance_network_load_monitor_enable(load_balance_class, 24, 8, test_load_balance_api_get_node_count, test_load_balance_api_get_set_load_level); - BYTES_EQUAL(-2, status); - nsdynmemlib_stub.returnCounter = 1; - status = load_balance_network_load_monitor_enable(load_balance_class, 24, 8, test_load_balance_api_get_node_count, test_load_balance_api_get_set_load_level); - BYTES_EQUAL(0, status); - - //Test Load level polling - load_balance_class->lb_enable(load_balance_class, true, 100, 100); - - fail_node_cnt = true; - load_node_cnt = 0; - test_load_level = 7; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(7, test_load_level); - - fail_node_cnt = false; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(0, test_load_level); - - load_node_cnt = 2; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(0, test_load_level); - - load_node_cnt = 3; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(1, test_load_level); - - load_node_cnt = 5; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(1, test_load_level); - - load_node_cnt = 7; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(2, test_load_level); - - load_node_cnt = 9; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(3, test_load_level); - - load_node_cnt = 12; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(4, test_load_level); - - load_node_cnt = 15; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(5, test_load_level); - - load_node_cnt = 18; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(6, test_load_level); - - load_node_cnt = 21; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(7, test_load_level); - - load_node_cnt = 24; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(7, test_load_level); - - load_node_cnt = 25; - for (int i=0; i< 100; i++) { - load_balance_class->lb_seconds_tick_update(load_balance_class); - } - BYTES_EQUAL(7, test_load_level); - - //Test Disable - status = load_balance_network_load_monitor_disable(NULL); - BYTES_EQUAL(-1, status); - status = load_balance_network_load_monitor_disable(load_balance_class); - BYTES_EQUAL(0, status); - - status = load_balance_network_load_monitor_disable(load_balance_class); - BYTES_EQUAL(-1, status); - - status = load_balance_delete(load_balance_class); - BYTES_EQUAL(0, status); - -} - -TEST(LoadBalance, test_load_balance_set_max_probability) -{ - load_balance_api_t *load_balance_class; - void *lb_user = &test_priority; - - event_stub.int8_value = 0; - nsdynmemlib_stub.returnCounter = 1; - - - int status; - status = load_balance_set_max_probability(NULL, 40); - BYTES_EQUAL(-1, status); - - load_balance_class = load_balance_create(test_load_balance_network_switch_notify, true); - if (!load_balance_class) { - FAIL("Loadbalance create return NULL pointer"); - } - - status = load_balance_set_max_probability(load_balance_class, 0); - BYTES_EQUAL(-1, status); - - status = load_balance_set_max_probability(load_balance_class, 101); - BYTES_EQUAL(-1, status); - - status = load_balance_set_max_probability(load_balance_class, 1); - BYTES_EQUAL(0, status); - - status = load_balance_set_max_probability(load_balance_class, 100); - BYTES_EQUAL(0, status); - - - status = load_balance_delete(load_balance_class); - BYTES_EQUAL(0, status); - - status = load_balance_set_max_probability(load_balance_class, 40); - BYTES_EQUAL(-1, status); - -} - - diff --git a/test/nanostack/unittest/service_libs/load_balance/main.cpp b/test/nanostack/unittest/service_libs/load_balance/main.cpp deleted file mode 100644 index 45074987a45c..000000000000 --- a/test/nanostack/unittest/service_libs/load_balance/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(LoadBalance); diff --git a/test/nanostack/unittest/service_libs/mdns/Makefile b/test/nanostack/unittest/service_libs/mdns/Makefile deleted file mode 100644 index aa6cb4d09eb1..000000000000 --- a/test/nanostack/unittest/service_libs/mdns/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = mdns_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/Service_Libs/mdns/ns_mdns_api.c \ - ../../../../../source/Service_Libs/mdns/ns_fnet_events.c \ - -TEST_SRC_FILES = \ - main.cpp \ - mdns_tests.cpp \ - test_ns_mdns_api.c \ - ../../stub/fnet_mdns_stub.c \ - ../../stub/fnet_poll_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/event_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT - diff --git a/test/nanostack/unittest/service_libs/mdns/main.cpp b/test/nanostack/unittest/service_libs/mdns/main.cpp deleted file mode 100644 index 1d8c56d9c02d..000000000000 --- a/test/nanostack/unittest/service_libs/mdns/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2017, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(MDNS); - diff --git a/test/nanostack/unittest/service_libs/mdns/mdns_tests.cpp b/test/nanostack/unittest/service_libs/mdns/mdns_tests.cpp deleted file mode 100644 index ce1d0fe7cd3c..000000000000 --- a/test/nanostack/unittest/service_libs/mdns/mdns_tests.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2017, 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 "CppUTest/TestHarness.h" -#include "test_ns_mdns_api.h" - -TEST_GROUP(MDNS) -{ - void setup() { - } - - void teardown() { - } -}; - -TEST(MDNS, test_ns_mdns_api_start_1) -{ - CHECK(test_ns_mdns_api_start_1()); -} - -TEST(MDNS, test_ns_mdns_api_service_1) -{ - CHECK(test_ns_mdns_api_service_1()); -} - -TEST(MDNS, test_ns_mdns_api_service_2) -{ - CHECK(test_ns_mdns_api_service_2()); -} - -TEST(MDNS, test_ns_mdns_api_announce_1) -{ - CHECK(test_ns_mdns_api_announce_1()); -} diff --git a/test/nanostack/unittest/service_libs/mdns/test_ns_mdns_api.c b/test/nanostack/unittest/service_libs/mdns/test_ns_mdns_api.c deleted file mode 100644 index b842a914a503..000000000000 --- a/test/nanostack/unittest/service_libs/mdns/test_ns_mdns_api.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2017, 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 "test_ns_mdns_api.h" -#include -#include -#include -#include "fnet.h" -#include "ns_mdns_api.h" - -#include "fnet_mdns_stub.h" -#include "nsdynmemLIB_stub.h" - -static const char service_name[] = "Instance name"; - -bool test_ns_mdns_api_start_1() -{ - ns_mdns_t ns_mdns_instance; - - // Initialize test data - fnet_mdns_data_stub.fnet_mdns_descriptor = 1; - fnet_mdns_data_stub.fnet_mdns_service_descriptor = 1; - fnet_mdns_data_stub.unregister_cnt = 0; - fnet_mdns_data_stub.release_cnt = 0; - nsdynmemlib_stub.returnCounter = 10; - - // Test NULL service name, should return NULL - ns_mdns_instance = ns_mdns_server_start(NULL, 0, 0, 1); - if (ns_mdns_instance) { - return false; - } - - // Test bad interface ID, should return NULL - ns_mdns_instance = ns_mdns_server_start(service_name, 0, 0, -1); - if (ns_mdns_instance) { - return false; - } - - // Test OOM_0, should return NULL - nsdynmemlib_stub.returnCounter = 0; - ns_mdns_instance = ns_mdns_server_start(service_name, 0, 0, 1); - if (ns_mdns_instance) { - return false; - } - - // Test OOM_1, should return NULL - nsdynmemlib_stub.returnCounter = 1; - ns_mdns_instance = ns_mdns_server_start(service_name, 0, 0, 1); - if (ns_mdns_instance) { - return false; - } - - // Test OK case, returns instance - nsdynmemlib_stub.returnCounter = 2; - ns_mdns_instance = ns_mdns_server_start(service_name, 0, 0, 1); - if (!ns_mdns_instance) { - return false; - } - - // Stop mDNS responder - ns_mdns_server_stop(ns_mdns_instance); - if (fnet_mdns_data_stub.release_cnt != 1) { - printf("Error, fnet_mdns_data_stub.release_cnt %d != 1", fnet_mdns_data_stub.release_cnt); - return false; - } - - return true; -} - -bool test_ns_mdns_api_service_1() -{ - ns_mdns_t ns_mdns_instance; - ns_mdns_service_t ns_mdns_service; - ns_mdns_service_t ns_mdns_service_2; - ns_mdns_service_param_t service = { - .service_type = "type", - .service_port = 666, - .service_get_txt = NULL - }; - fnet_mdns_data_stub.fnet_mdns_descriptor = 1; - fnet_mdns_data_stub.fnet_mdns_service_descriptor = 1; - fnet_mdns_data_stub.unregister_cnt = 0; - fnet_mdns_data_stub.release_cnt = 0; - - // Create mDNS server - nsdynmemlib_stub.returnCounter = 2; - ns_mdns_instance = ns_mdns_server_start(service_name, 0, 0, 1); - if (!ns_mdns_instance) { - return false; - } - - // Test NULL instance, registration fails - ns_mdns_service = ns_mdns_service_register(NULL, &service); - if (ns_mdns_service) { - return false; - } - - // Test NULL params, registration fails - ns_mdns_service = ns_mdns_service_register(ns_mdns_instance, NULL); - if (ns_mdns_service) { - return false; - } - - // Test bad instance, registration fails - ns_mdns_service = ns_mdns_service_register(0xffff, &service); - if (ns_mdns_service) { - return false; - } - - // Test NULL service_type, registration fails - service.service_type = NULL; - ns_mdns_service = ns_mdns_service_register(ns_mdns_instance, &service); - service.service_type = "type"; - if (ns_mdns_service) { - return false; - } - - // Test NULL callback, registration fails - service.service_get_txt = NULL; - ns_mdns_service = ns_mdns_service_register(ns_mdns_instance, &service); - service.service_get_txt = 0xf00d; - if (ns_mdns_service) { - return false; - } - - // Test OOM_0 - nsdynmemlib_stub.returnCounter = 0; - ns_mdns_service = ns_mdns_service_register(ns_mdns_instance, &service); - if (ns_mdns_service) { - return false; - } - - // Test OOM_1 - nsdynmemlib_stub.returnCounter = 1; - ns_mdns_service = ns_mdns_service_register(ns_mdns_instance, &service); - if (ns_mdns_service) { - return false; - } - - // Test OK registration - nsdynmemlib_stub.returnCounter = 2; - ns_mdns_service = ns_mdns_service_register(ns_mdns_instance, &service); - if (!ns_mdns_service) { - return false; - } - - // Test registration again - nsdynmemlib_stub.returnCounter = 2; - ns_mdns_service_2 = ns_mdns_service_register(ns_mdns_instance, &service); - if (!ns_mdns_service_2) { - return false; - } - - // Stop mDNS responder - ns_mdns_server_stop(ns_mdns_instance); - // test that unregister is called - if (fnet_mdns_data_stub.release_cnt != 1) { - printf("Error, fnet_mdns_data_stub.release_cnt %d!=1", fnet_mdns_data_stub.release_cnt); - return false; - } - - return true; -} - -bool test_ns_mdns_api_service_2() -{ - ns_mdns_t ns_mdns_instance; - ns_mdns_service_t ns_mdns_service_1; - ns_mdns_service_t ns_mdns_service_2; - ns_mdns_service_t ns_mdns_service_3; - ns_mdns_service_param_t service = { - .service_type = "type", - .service_port = 666, - .service_get_txt = 0xffff - }; - fnet_mdns_data_stub.fnet_mdns_descriptor = 1; - fnet_mdns_data_stub.fnet_mdns_service_descriptor = 1; - fnet_mdns_data_stub.unregister_cnt = 0; - fnet_mdns_data_stub.release_cnt = 0; - - // Create mDNS server - nsdynmemlib_stub.returnCounter = 2; - ns_mdns_instance = ns_mdns_server_start(service_name, 0, 0, 1); - if (!ns_mdns_instance) { - return false; - } - - // Test OK registration - nsdynmemlib_stub.returnCounter = 2; - ns_mdns_service_1 = ns_mdns_service_register(ns_mdns_instance, &service); - if (!ns_mdns_service_1) { - return false; - } - - // Test registration again - nsdynmemlib_stub.returnCounter = 2; - ns_mdns_service_2 = ns_mdns_service_register(ns_mdns_instance, &service); - if (!ns_mdns_service_2) { - return false; - } - - // Test registration again - nsdynmemlib_stub.returnCounter = 2; - ns_mdns_service_3 = ns_mdns_service_register(ns_mdns_instance, &service); - if (!ns_mdns_service_3) { - return false; - } - - ns_mdns_service_unregister(NULL); - ns_mdns_service_unregister(0xffff); - ns_mdns_service_unregister(ns_mdns_service_2); - ns_mdns_service_unregister(ns_mdns_service_1); - ns_mdns_service_unregister(ns_mdns_service_3); - if (fnet_mdns_data_stub.unregister_cnt != 3) { - printf("Error, fnet_mdns_data_stub.unregister_cnt %d!=3", fnet_mdns_data_stub.unregister_cnt); - return false; - } - - // Stop mDNS responder - ns_mdns_server_stop(ns_mdns_instance); - // test that unregister is called - if (fnet_mdns_data_stub.release_cnt != 1) { - printf("Error, fnet_mdns_data_stub.release_cnt %d!=1", fnet_mdns_data_stub.release_cnt); - return false; - } - - return true; -} - -bool test_ns_mdns_api_announce_1() -{ - ns_mdns_t ns_mdns_instance; - ns_mdns_service_t ns_mdns_service; - fnet_mdns_data_stub.fnet_mdns_descriptor = 1; - fnet_mdns_data_stub.fnet_mdns_service_descriptor = 1; - fnet_mdns_data_stub.announce_cnt = 0; - fnet_mdns_data_stub.unregister_cnt = 0; - ns_mdns_service_param_t service = { - .service_type = "type", - .service_port = 666, - .service_get_txt = NULL - }; - - // Create mDNS server - nsdynmemlib_stub.returnCounter = 2; - ns_mdns_instance = ns_mdns_server_start(service_name, 0, 0, 1); - if (!ns_mdns_instance) { - return false; - } - - // Test NULL instance - ns_mdns_announcement_send(NULL); - if (fnet_mdns_data_stub.announce_cnt != 0) { - return false; - } - - // Test illegal instance - ns_mdns_announcement_send(0xffff); - if (fnet_mdns_data_stub.announce_cnt != 0) { - return false; - } - - // Test announcement - ns_mdns_announcement_send(ns_mdns_instance); - if (fnet_mdns_data_stub.announce_cnt != 1) { - return false; - } - // Stop mDNS responder - ns_mdns_server_stop(ns_mdns_instance); - - if (fnet_mdns_data_stub.release_cnt != 1) { - printf("Error, fnet_mdns_data_stub.release_cnt %d!=1", fnet_mdns_data_stub.release_cnt); - return false; - } - - return true; -} - diff --git a/test/nanostack/unittest/service_libs/mdns/test_ns_mdns_api.h b/test/nanostack/unittest/service_libs/mdns/test_ns_mdns_api.h deleted file mode 100644 index e42c8545acd5..000000000000 --- a/test/nanostack/unittest/service_libs/mdns/test_ns_mdns_api.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, 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 TEST_NS_MDNS_API_H -#define TEST_NS_MDNS_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_ns_mdns_api_start_1(); -bool test_ns_mdns_api_service_1(); -bool test_ns_mdns_api_service_2(); -bool test_ns_mdns_api_announce_1(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_NS_MDNS_API_H - diff --git a/test/nanostack/unittest/stub/6lowpan_iphc_stub.c b/test/nanostack/unittest/stub/6lowpan_iphc_stub.c deleted file mode 100644 index 8b2e2d41971b..000000000000 --- a/test/nanostack/unittest/stub/6lowpan_iphc_stub.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#define HAVE_CIPV6 - -#ifdef HAVE_CIPV6 -#include "ns_types.h" -#include "string.h" -#include "ns_trace.h" -#include "Core/include/socket.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "ipv6_stack/protocol_ipv6.h" -#include "6LoWPAN/IPHC_Decode/iphc_compress.h" -#include "6LoWPAN/IPHC_Decode/iphc_decompress.h" -#include "6LoWPAN/Mesh/mesh.h" -#include "6LoWPAN/Thread/thread_common.h" - -#define TRACE_GROUP "iphc" - -#include "6LoWPAN/ND/nd_router_object.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "MAC/IEEE802_15_4/mac_indirect_data.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "nwk_stats_api.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "common_functions.h" - -buffer_t *lowpan_down(buffer_t *buf) -{ - return NULL; -} - -buffer_t *lowpan_up(buffer_t *buf) -{ - return NULL; -} - -#endif /* HAVE_CIPV6 */ - diff --git a/test/nanostack/unittest/stub/6lowpan_mesh_stub.c b/test/nanostack/unittest/stub/6lowpan_mesh_stub.c deleted file mode 100644 index 258f43840280..000000000000 --- a/test/nanostack/unittest/stub/6lowpan_mesh_stub.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include -#include "ns_types.h" -#define FEA_TRACE_SUPPORT -#define EXTRA_CONSISTENCY_CHECKS -#include "Core/include/ns_buffer.h" -#include "ns_list.h" -#include "mac_api.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#include "MAC/IEEE802_15_4/mac_indirect_data.h" -#include "mesh.h" - -protocol_interface_info_entry_t *protocol_stack_interface_info_get(nwk_interface_id nwk_id) -{ - return NULL; -} - -extern COMMON_FUNCTIONS_FN uint16_t common_read_16_bit(const uint8_t data_buf[__static 2]); -extern COMMON_FUNCTIONS_FN uint8_t *common_write_16_bit(uint16_t value, uint8_t ptr[__static 2]); -extern COMMON_FUNCTIONS_FN uint8_t *common_write_16_bit_inverse(uint16_t value, uint8_t ptr[__static 2]); - -bool nwk_interface_compare_mac_address(protocol_interface_info_entry_t *cur, uint_fast8_t addrlen, const uint8_t addr[]) -{ - return false; -} - -uint8_t addr_check_broadcast(const address_t addr, addrtype_t addr_type) -{ - return 0; -} - -#ifndef EXTRA_CONSISTENCY_CHECKS -uint8_t *buffer_corrupt_check(buffer_t *buf) -{ - return NULL; -} -#endif - -void protocol_stats_update(nwk_stats_type_t type, uint16_t update_val) -{ -} - -#if 0 -buffer_t *buffer_headroom(buffer_t *buf, uint16_t size) -{ - return NULL; -} -#endif diff --git a/test/nanostack/unittest/stub/adaptation_interface_stub.c b/test/nanostack/unittest/stub/adaptation_interface_stub.c deleted file mode 100644 index a1c549b97fe9..000000000000 --- a/test/nanostack/unittest/stub/adaptation_interface_stub.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "eventOS_event.h" -#include "string.h" -#include "ns_trace.h" -#include "ns_list.h" -#include "randLIB.h" -#include "nsdynmemLIB.h" -#include "Core/include/address.h" -#include "Core/include/socket.h" -#include "randLIB.h" -#include "mac_api.h" -#include "mac_mcps.h" -#include "mac_common_defines.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#include "NWK_INTERFACE/Include/protocol_timer.h" -#include "Service_Libs/etx/etx.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "6LoWPAN/Mesh/mesh.h" -#include "6LoWPAN/IPHC_Decode/iphc_decompress.h" -#include "6LoWPAN/lowpan_adaptation_interface.h" -#include "MLE/mle.h" - -#include "adaptation_interface_stub.h" - -adaptation_interface_stub_def adaptation_interface_stub; - -int8_t lowpan_adaptation_interface_init(int8_t interface_id, uint16_t mac_mtu_size) -{ - return adaptation_interface_stub.expectedInt8; -} - -int8_t lowpan_adaptation_interface_free(int8_t interface_id) -{ - return adaptation_interface_stub.expectedInt8; -} - -int8_t lowpan_adaptation_interface_reset(int8_t interface_id) -{ - return adaptation_interface_stub.expectedInt8; -} - -/** - * \brief call this before normatl TX. This function prepare buffer link spesific metadata and verify packet destination - */ -struct buffer * lowpan_adaptation_data_process_tx_preprocess(struct protocol_interface_info_entry *cur, struct buffer *buf) -{ - return NULL; -} - -int8_t lowpan_adaptation_interface_tx(struct protocol_interface_info_entry *cur, struct buffer *buf) -{ - return adaptation_interface_stub.expectedInt8; -} - -int8_t lowpan_adaptation_interface_tx_confirm(struct protocol_interface_info_entry *cur, const struct mcps_data_conf_s *confirm) -{ - return adaptation_interface_stub.expectedInt8; -} - -bool lowpan_adaptation_tx_active(int8_t interface_id) -{ - return false; -} - -int8_t lowpan_adaptation_indirect_free_messages_from_queues_by_address(struct protocol_interface_info_entry *cur, uint8_t *address_ptr, addrtype_t adr_type) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/adaptation_interface_stub.h b/test/nanostack/unittest/stub/adaptation_interface_stub.h deleted file mode 100644 index 4c7aa2253092..000000000000 --- a/test/nanostack/unittest/stub/adaptation_interface_stub.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016, 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 __ADAPTATION_INTERFACE_STUB_H__ -#define __ADAPTATION_INTERFACE_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif -#include "inttypes.h" - -typedef struct { - int8_t expectedInt8; - bool expectedBool; -} adaptation_interface_stub_def; - -extern adaptation_interface_stub_def adaptation_interface_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __ADAPTATION_INTERFACE_STUB_H__ diff --git a/test/nanostack/unittest/stub/address_stub.c b/test/nanostack/unittest/stub/address_stub.c deleted file mode 100644 index 786dc335485e..000000000000 --- a/test/nanostack/unittest/stub/address_stub.c +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (c) 2008, 2010-2017, 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. - */ -/** - * \file address.c - * \brief Utility functions concernig addresses - * - * This file contains all the utility functions that can be used to - * check, manipulate etc. addresses. - */ -#include "nsconfig.h" -#include "ns_types.h" -#include "ip6string.h" -#include "ns_trace.h" -#include "randLIB.h" -#include "string.h" -#include "nsdynmemLIB.h" -#include "socket_api.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "common_functions.h" - -#include "address_stub.h" - -#define TRACE_GROUP_ADDRESS "addr" - -address_stub_def address_stub; - -typedef struct addr_policy_table_entry_t { - uint8_t prefix[16]; - uint8_t prefix_len; - uint8_t precedence; - uint8_t label; - ns_list_link_t link; -} addr_policy_table_entry_t; - -static NS_LIST_DEFINE(addr_policy_table, addr_policy_table_entry_t, link); - -uint32_t addr_preferences_default = SOCKET_IPV6_PREFER_SRC_TMP | SOCKET_IPV6_PREFER_SRC_6LOWPAN_SHORT; - -const uint8_t ADDR_LINK_LOCAL_PREFIX[8] = { 0xfe, 0x80 }; -const uint8_t ADDR_SHORT_ADR_SUFFIC[6] = { 0x00, 0x00, 0x00, 0xff, 0xfe, 0x00}; - -const uint8_t ADDR_MULTICAST_SOLICITED[13] = { 0xff, 0x02, [11] = 0x01, 0xff}; -const uint8_t ADDR_LINK_LOCAL_MDNS[16] = { 0xff, 0x02, [15] = 0xfb }; -const uint8_t ADDR_LINK_LOCAL_ALL_NODES[16] = { 0xff, 0x02, [15] = 0x01 }; -const uint8_t ADDR_LINK_LOCAL_ALL_ROUTERS[16] = { 0xff, 0x02, [15] = 0x02 }; -const uint8_t ADDR_LINK_LOCAL_ALL_MLDV2_ROUTERS[16] = { 0xff, 0x02, [15] = 0x16 }; -const uint8_t ADDR_REALM_LOCAL_ALL_NODES[16] = { 0xff, 0x03, [15] = 0x01 }; -const uint8_t ADDR_REALM_LOCAL_ALL_ROUTERS[16] = { 0xff, 0x03, [15] = 0x02 }; -const uint8_t ADDR_SITE_LOCAL_ALL_ROUTERS[16] = { 0xff, 0x05, [15] = 0x02 }; -const uint8_t ADDR_ALL_MPL_FORWARDERS[16] = { 0xff, 0x03, [15] = 0xfc }; -const uint8_t ADDR_ALL_DHCP_RELAY_AGENTS_AND_SERVERS[16] = { 0xff, 0x02, [13] = 0x01, 0x00, 0x02 }; - -const uint8_t ADDR_IPV4_MAPPED_PREFIX[12] = { [10] = 0xff, 0xff }; -const uint8_t ADDR_LOOPBACK[16] = { [15] = 1 }; -const uint8_t ADDR_UNSPECIFIED[16] = { 0 }; -#define ADDR_IPV4_COMPATIBLE ADDR_LOOPBACK /* First 96 bits match...*/ - - -uint8_t addr_len_from_type(addrtype_t addr_type) -{ - return address_stub.uint8_value; -} - -char* trace_sockaddr(const sockaddr_t* addr, bool panid_prefix) -{ - return address_stub.char_ptr; -} - -uint8_t addr_check_broadcast(const address_t addr, addrtype_t addr_type) -{ - return address_stub.uint8_value; -} - -bool addr_is_ipv6_link_local(const uint8_t addr[__static 16]) -{ - return address_stub.bool_value; -} - -/* Scope(A), as defined in RFC 6724 plus RFC 4007 */ -uint_fast8_t addr_ipv6_scope(const uint8_t addr[__static 16], const protocol_interface_info_entry_t *interface) -{ - return address_stub.uint8_value; -} - -void address_module_init(void) -{ -} - -bool addr_multicast_fwd_list_check(if_group_fwd_list_t *list, const uint8_t group[16]) -{ - return address_stub.bool_value; -} - -bool addr_multicast_fwd_list_add(if_group_fwd_list_t *list, const uint8_t group[16]) -{ - return address_stub.bool_value; -} - -bool addr_multicast_fwd_list_remove(if_group_fwd_list_t *list, const uint8_t group[16]) -{ - return address_stub.bool_value; -} - -void addr_multicast_fwd_list_delete_entry(if_group_fwd_list_t *list, if_group_fwd_entry_t *entry) -{ -} - -int_fast8_t addr_policy_table_add_entry(const uint8_t *prefix, uint8_t len, uint8_t precedence, uint8_t label) -{ - return address_stub.int8_value; -} - -int_fast8_t addr_policy_table_delete_entry(const uint8_t *prefix, uint8_t len) -{ - return address_stub.int8_value; -} - -void addr_policy_table_print(void) -{ -} - -if_address_entry_t *addr_get_entry(const protocol_interface_info_entry_t *interface, const uint8_t addr[__static 16]) -{ - return address_stub.if_address_entry_value; -} - -bool addr_is_assigned_to_interface(const protocol_interface_info_entry_t *interface, const uint8_t addr[__static 16]) -{ - return address_stub.bool_value; -} - -bool addr_is_tentative_for_interface(const protocol_interface_info_entry_t *interface, const uint8_t addr[__static 16]) -{ - return address_stub.bool_value; -} - -if_group_entry_t *addr_add_group(protocol_interface_info_entry_t *interface, const uint8_t group[static 16]) -{ - return address_stub.if_group_entry_value; -} - -void addr_remove_group(protocol_interface_info_entry_t *interface, const uint8_t group[static 16]) -{ -} - -void addr_delete_group_entry(protocol_interface_info_entry_t *interface, if_group_entry_t *entry) -{ -} - -void addr_delete_group(protocol_interface_info_entry_t *interface, const uint8_t group[static 16]) -{ -} - -if_group_entry_t *addr_get_group_entry(const protocol_interface_info_entry_t *interface, const uint8_t group[static 16]) -{ - return address_stub.if_group_entry_value; -} - -void addr_add_router_groups(protocol_interface_info_entry_t *interface) -{ -} - -/* RFC 6724 Default source address selection */ -const uint8_t *addr_select_source(protocol_interface_info_entry_t *interface, const uint8_t dest[__static 16], uint32_t addr_preferences) -{ - return address_stub.uint8_ptr; -} - -const uint8_t *addr_select_with_prefix(protocol_interface_info_entry_t *cur, const uint8_t *prefix, uint8_t prefix_len, uint32_t addr_preferences) -{ - return address_stub.uint8_ptr; -} - -void addr_timer(protocol_interface_info_entry_t *cur, uint_fast16_t ticks) -{ -} - -void addr_fast_timer(protocol_interface_info_entry_t *cur, uint_fast16_t ticks) -{ - -} - -void addr_slow_timer(protocol_interface_info_entry_t *cur, uint_fast16_t seconds) -{ - -} - -void addr_max_slaac_entries_set(protocol_interface_info_entry_t *cur, uint8_t max_slaac_entries) -{ - -} - -if_address_entry_t *addr_add(protocol_interface_info_entry_t *cur, const uint8_t address[__static 16], uint_fast8_t prefix_len, if_address_source_t source, uint32_t valid_lifetime, uint32_t preferred_lifetime, bool skip_dad) -{ - return address_stub.if_address_entry_value; -} - -void addr_delete_entry(protocol_interface_info_entry_t *cur, if_address_entry_t *addr) -{ -} - -int_fast8_t addr_delete(protocol_interface_info_entry_t *cur, const uint8_t address[__static 16]) -{ - return address_stub.int8_value; -} - -void addr_delete_matching(protocol_interface_info_entry_t *cur, const uint8_t *prefix, uint8_t prefix_len, if_address_source_t source) -{ -} - -void addr_set_non_preferred(protocol_interface_info_entry_t *cur, if_address_source_t source) -{ -} - -void addr_duplicate_detected(struct protocol_interface_info_entry *interface, const uint8_t addr[__static 16]) -{ -} - -void addr_notification_register(if_address_notification_fn *fn) -{ - -} - -void addr_cb(protocol_interface_info_entry_t *interface, if_address_entry_t *addr, if_address_callback_t reason) -{ - -} - -void addr_set_valid_lifetime(protocol_interface_info_entry_t *interface, if_address_entry_t *addr, uint32_t valid_lifetime) -{ - -} - -void addr_set_preferred_lifetime(protocol_interface_info_entry_t *interface, if_address_entry_t *addr, uint32_t preferred_lifetime) -{ - -} - -void memswap(uint8_t *restrict a, uint8_t *restrict b, uint_fast8_t len) -{ -} - -bool addr_ipv6_equal(const uint8_t a[__static 16], const uint8_t b[__static 16]) -{ - return memcmp(a, b, 16) == 0; -} - -bool addr_iid_matches_eui64(const uint8_t iid[__static 8], const uint8_t eui64[__static 8]) -{ - return address_stub.bool_value; -} - -bool addr_iid_matches_lowpan_short(const uint8_t iid[__static 8], uint16_t short_addr) -{ - return address_stub.bool_value; -} - -bool addr_iid_reserved(const uint8_t iid[static 8]) -{ - return address_stub.bool_value; -} - -int_fast8_t addr_opaque_iid_key_set(const void *secret_key, uint8_t key_len) -{ - return address_stub.int8_value; -} - -bool addr_opaque_iid_key_is_set(void) -{ - return address_stub.bool_value; -} - -void addr_generate_opaque_iid(protocol_interface_info_entry_t *cur, uint8_t addr[static 16]) -{ - -} - -uint8_t *addr_ipv6_write_from_lowpan_short(uint8_t dst[__static 16], const uint8_t prefix[__static 8], uint16_t short_addr) -{ - return address_stub.uint8_ptr; -} - -bool addr_iid_from_outer(uint8_t iid_out[__static 8], const sockaddr_t *addr_in) -{ - return address_stub.bool_value; -} - - -int addr_interface_set_ll64(protocol_interface_info_entry_t *cur, if_address_callback_fn *cb) -{ - return address_stub.int_value; -} - -int8_t addr_interface_get_ll_address(protocol_interface_info_entry_t *cur, uint8_t *address_ptr, uint8_t address_type) -{ - return address_stub.int8_value; -} - -bool addr_interface_all_address_ready(protocol_interface_info_entry_t *cur) -{ - return address_stub.bool_value; -} - -int8_t addr_interface_get_any_gp_address(protocol_interface_info_entry_t *cur, uint8_t *address_ptr, uint8_t address_type) -{ - return address_stub.int8_value; -} - -int8_t addr_interface_gp_prefix_compare(protocol_interface_info_entry_t *cur, const uint8_t *prefix) -{ - return address_stub.int8_value; -} - -int8_t addr_interface_address_compare(protocol_interface_info_entry_t *cur, const uint8_t *addr) -{ - return address_stub.int8_value; -} - -int8_t addr_interface_select_source(protocol_interface_info_entry_t *cur, uint8_t *src_ptr, const uint8_t *dest, uint32_t addr_preferences) -{ - return address_stub.int8_value; -} -void addr_multicast_fwd_set_forwarding(struct protocol_interface_info_entry *interface, bool enable) -{ -} diff --git a/test/nanostack/unittest/stub/address_stub.h b/test/nanostack/unittest/stub/address_stub.h deleted file mode 100644 index 5f7a7f6728fa..000000000000 --- a/test/nanostack/unittest/stub/address_stub.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 __ADDRESS_STUB_H__ -#define __ADDRESS_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" -#include "NWK_INTERFACE/Include/protocol_abstract.h" -#include "Core/include/address.h" - -typedef struct { - uint8_t uint8_value; - int8_t int8_value; - int int_value; - uint8_t *uint8_ptr; - char *char_ptr; - bool bool_value; - if_address_entry_t *if_address_entry_value; - if_group_entry_t *if_group_entry_value; -} address_stub_def; - -extern address_stub_def address_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __ADDRESS_STUB_H__ diff --git a/test/nanostack/unittest/stub/beacon_handler_stub.c b/test/nanostack/unittest/stub/beacon_handler_stub.c deleted file mode 100644 index 7d7630aee21d..000000000000 --- a/test/nanostack/unittest/stub/beacon_handler_stub.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include -#include "beacon_handler.h" -#include "mlme.h" - - -void beacon_received(int8_t if_id, const mlme_beacon_ind_t* data) -{ -} - -void beacon_optional_tlv_fields_skip(uint16_t *len, uint8_t **ptr, uint8_t offset) -{ -} - -int8_t mac_beacon_link_beacon_compare_rx_callback_set(int8_t interface_id, - beacon_compare_rx_cb *beacon_compare_rx_cb_ptr) -{ - return -1; -} - -int8_t mac_beacon_link_beacon_join_priority_tx_callback_set(int8_t interface_id, - beacon_join_priority_tx_cb *beacon_join_priority_tx_cb_ptr) -{ - return -1; -} - -void beacon_join_priority_update(int8_t interface_id) -{ - -} diff --git a/test/nanostack/unittest/stub/blacklist_stub.c b/test/nanostack/unittest/stub/blacklist_stub.c deleted file mode 100644 index 858582b2d3dd..000000000000 --- a/test/nanostack/unittest/stub/blacklist_stub.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "eventOS_scheduler.h" -#include "nsdynmemLIB.h" -#include "randLIB.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Service_Libs/blacklist/blacklist.h" - -#define TRACE_GROUP "bl" - -uint8_t blacklist_init(void) -{ - return 0; -} - -void blacklist_params_set(uint16_t entry_lifetime, uint16_t timer_max_timeout, uint16_t timer_timeout, uint16_t entry_max_nbr, uint16_t purge_nbr, uint16_t purge_timer_timeout) -{ - -} - -bool blacklist_reject(const uint8_t *ll64_address) -{ - return false; -} - -void blacklist_update(const uint8_t *ll64_address, bool success) -{ - -} - -void blacklist_ttl_update(uint16_t ticks) -{ - -} - -void blacklist_clear(void) -{ - -} diff --git a/test/nanostack/unittest/stub/border_router_stub.c b/test/nanostack/unittest/stub/border_router_stub.c deleted file mode 100644 index e03a16af71c0..000000000000 --- a/test/nanostack/unittest/stub/border_router_stub.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2012-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "string.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#ifndef NO_MLE -#include "MLE/mle.h" -#endif -#include "mac_api.h" - -#include "RPL/rpl_control.h" -#include "6LoWPAN/ND/nd_router_object.h" -#include "Service_Libs/whiteboard/whiteboard.h" -#include "Service_Libs/nd_proxy/nd_proxy.h" -#include "shalib.h" - -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_prefix.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "ipv6_stack/protocol_ipv6.h" -#include "common_functions.h" -#include "net_thread_test.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "BorderRouter/border_router.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "6LoWPAN/MAC/beacon_handler.h" - -void arm_nwk_6lowpan_borderrouter_data_free(protocol_interface_info_entry_t *cur) -{ -} - -void nd_border_router_setup_refresh(nwk_interface_id id, bool fresh_abro) -{ -} - -int8_t arm_nwk_6lowpan_border_route_nd_default_prefix_timeout_set(int8_t interface_id, uint32_t time) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_border_router_context_update(int8_t interface_id, uint8_t c_id_flags, uint8_t context_len, uint16_t ttl, const uint8_t *context_ptr) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_border_router_nd_context_load(int8_t interface_id, uint8_t *contex_data) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_border_router_configure_push(int8_t interface_id) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_border_router_context_remove_by_id(int8_t interface_id, uint8_t c_id) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_border_router_context_parameter_update(int8_t interface_id, uint8_t c_id, uint8_t compress_mode, uint16_t ttl) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_border_router_init(int8_t interface_id, const border_router_setup_s *border_router_setup_ptr) -{ - return 0; -} - -int arm_border_router_proxy_state_update(int8_t caller_interface_id, int8_t handler_interface_id, bool status) -{ - return 0; -} - -void arm_border_router_ready(protocol_interface_info_entry_t *cur) -{ -} - -int8_t arm_nwk_6lowpan_borderrouter_init(protocol_interface_info_entry_t *cur) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/buffer_dyn_stub.c b/test/nanostack/unittest/stub/buffer_dyn_stub.c deleted file mode 100644 index d855f82470d7..000000000000 --- a/test/nanostack/unittest/stub/buffer_dyn_stub.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2011-2017, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "nsdynmemLIB.h" -#include "Core/include/address.h" -#include "Core/include/ns_buffer.h" -#include "platform/arm_hal_interrupt.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "ip_fsc.h" -#include "buffer_dyn_stub.h" -#include "Core/include/socket.h" - -buffer_dyn_stub_def buffer_dyn_stub; - -uint8_t *(buffer_corrupt_check)(buffer_t *buf) -{ - return buffer_data_pointer(buf); -} - -socket_t *buffer_socket_set(buffer_t *buf, socket_t *socket) -{ - return socket; -} - -buffer_t *buffer_get(uint16_t size) -{ - return buffer_dyn_stub.buffer_ptr; -} - -buffer_t *buffer_get_specific(uint16_t headroom, uint16_t size, uint16_t minspace) -{ - return buffer_dyn_stub.buffer_ptr; -} - -buffer_t *buffer_get_minimal(uint16_t size) -{ - return buffer_dyn_stub.buffer_ptr; -} - -buffer_t *buffer_headroom(buffer_t *buf, uint16_t size) -{ - return buffer_dyn_stub.buffer_ptr; -} - -buffer_t *buffer_free_route(buffer_t *buf) -{ - return buffer_dyn_stub.buffer_ptr; -} - -buffer_t *buffer_free(buffer_t *buf) -{ - return NULL; -} - -void buffer_free_list(buffer_list_t *b) -{ - -} - -buffer_t *buffer_turnaround(buffer_t *buf) -{ - return buffer_dyn_stub.buffer_ptr; -} - -void buffer_note_predecessor(buffer_t *buf, const sockaddr_t *addr) -{ - -} - -void buffer_data_add(buffer_t *buf, const uint8_t *data_ptr, uint16_t data_len) -{ -} - -buffer_t *buffer_clone(buffer_t *buf) -{ - return buffer_dyn_stub.buffer_ptr; -} - -uint16_t buffer_ipv6_fcf(const buffer_t *buf, uint8_t next_header) -{ - return buffer_dyn_stub.uint16_value; -} - -void buffer_copy_metadata(buffer_t *dst, buffer_t *src, bool non_clonable_to_dst) -{ - -} diff --git a/test/nanostack/unittest/stub/buffer_dyn_stub.h b/test/nanostack/unittest/stub/buffer_dyn_stub.h deleted file mode 100644 index c4d9be232c5d..000000000000 --- a/test/nanostack/unittest/stub/buffer_dyn_stub.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 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 __BUFFER_DYN_STUB_H__ -#define __BUFFER_DYN_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "Core/include/ns_buffer.h" - -typedef struct { - uint16_t uint16_value; - buffer_t *buffer_ptr; -} buffer_dyn_stub_def; - -extern buffer_dyn_stub_def buffer_dyn_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __BUFFER_DYN_STUB_H__ diff --git a/test/nanostack/unittest/stub/ccm_security_stub.c b/test/nanostack/unittest/stub/ccm_security_stub.c deleted file mode 100644 index 881114823a77..000000000000 --- a/test/nanostack/unittest/stub/ccm_security_stub.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 -#include -#include "ccmLIB.h" -#include "platform/arm_hal_aes.h" -#include "ccm_security_stub.h" - -ccm_security_stub_def_t ccm_security_stub_def; - -ccm_globals_t *ccm_sec_init(uint8_t sec_level, const uint8_t *ccm_key, uint8_t mode, uint8_t ccm_l) -{ - return ccm_security_stub_def.ccm_struct_ptr; -} - -int8_t ccm_process_run(ccm_globals_t *ccm_params) -{ - return ccm_security_stub_def.value_int8; -} - diff --git a/test/nanostack/unittest/stub/ccm_security_stub.h b/test/nanostack/unittest/stub/ccm_security_stub.h deleted file mode 100644 index 40a66812408b..000000000000 --- a/test/nanostack/unittest/stub/ccm_security_stub.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 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 __CCM_SECURITY_STUB_H__ -#define __CCM_SECURITY_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "ccmLIB.h" - -typedef struct { - ccm_globals_t *ccm_struct_ptr; - int8_t value_int8; -} ccm_security_stub_def_t; - -extern ccm_security_stub_def_t ccm_security_stub_def; - -#ifdef __cplusplus -} -#endif - -#endif // __CCM_SECURITY_STUB_H__ diff --git a/test/nanostack/unittest/stub/channel_list_stub.c b/test/nanostack/unittest/stub/channel_list_stub.c deleted file mode 100644 index edb7b2946a66..000000000000 --- a/test/nanostack/unittest/stub/channel_list_stub.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#include "Service_Libs/fhss/channel_list.h" - -#include "common_functions.h" -#include "ns_trace.h" -#include "channel_list_stub.h" - -#include -#include - -channel_list_stub_def channel_list_stub; - -void channel_list_print(uint8_t dlevel, const char *grp, const uint32_t* list) -{ -} - -void channel_list_clear_mask(uint32_t* list) -{ -} - -int channel_list_get_first(const uint32_t* list) -{ - return 0; -} - -uint8_t channel_list_get_channel(const uint32_t* list, int current_index) -{ - return channel_list_stub.uint8_value; -} - -int channel_list_get_next(const uint32_t* list, int current_index) -{ - return 0; -} - -int channel_list_get_next_broadcast(const uint32_t* list, int broadcast_channel_count, int current_index) -{ - return 0; -} - -int channel_list_count_channels(const uint32_t* list) -{ - return channel_list_stub.uint8_value; -} - -int channel_list_enable_channel(uint32_t* list, int channel_number) -{ - return 0; -} - -bool channel_list_is_channel_enabled(const uint32_t* list, int channel_number) -{ - return false; -} - diff --git a/test/nanostack/unittest/stub/channel_list_stub.h b/test/nanostack/unittest/stub/channel_list_stub.h deleted file mode 100644 index 38db4b8f2737..000000000000 --- a/test/nanostack/unittest/stub/channel_list_stub.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016, 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 __CHANNEL_LIST_STUB_H__ -#define __CHANNEL_LIST_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef struct { - uint8_t uint8_value; - -} channel_list_stub_def; - -extern channel_list_stub_def channel_list_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __CHANNEL_LIST_STUB_H__ diff --git a/test/nanostack/unittest/stub/cipv6_fragmenter_stub.c b/test/nanostack/unittest/stub/cipv6_fragmenter_stub.c deleted file mode 100644 index 5dbae8fb13d6..000000000000 --- a/test/nanostack/unittest/stub/cipv6_fragmenter_stub.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013-2016, 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. - */ -/** - * - * \file cipv6_fragmenter.c - * \brief Packet Fragmentation and Reasembly. - * - */ - -#include "nsconfig.h" -#include "ns_types.h" -#include "string.h" -#include "ns_trace.h" -#include "randLIB.h" -#include "Core/include/socket.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#include "6LoWPAN/Fragmentation/cipv6_fragmenter.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "nsdynmemLIB.h" -#include "6LoWPAN/Mesh/mesh.h" -#include "6LoWPAN/IPHC_Decode/iphc_decompress.h" -#include "nwk_stats_api.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "common_functions.h" -#include "6LoWPAN/MAC/mac_helper.h" - -#define TRACE_GROUP "6frg" - -#include "cipv6_fragmenter_stub.h" - -cipv6_fragmenter_stub_def cipv6_fragmenter_stub; - - -buffer_t *cipv6_frag_reassembly(int8_t interface_id, buffer_t *buf) -{ - return cipv6_fragmenter_stub.buffer_ptr; -} - -void cipv6_frag_timer(uint16_t seconds) -{ -} - -int8_t reassembly_interface_reset(int8_t interface_id) -{ - return cipv6_fragmenter_stub.int8Value; -} -int8_t reassembly_interface_init(int8_t interface_id, uint8_t reassembly_session_limit, uint16_t reassembly_timeout) -{ - return cipv6_fragmenter_stub.int8Value; -} -int8_t reassembly_interface_free(int8_t interface_id) -{ - return cipv6_fragmenter_stub.int8Value; -} - diff --git a/test/nanostack/unittest/stub/cipv6_fragmenter_stub.h b/test/nanostack/unittest/stub/cipv6_fragmenter_stub.h deleted file mode 100644 index 5f630746317c..000000000000 --- a/test/nanostack/unittest/stub/cipv6_fragmenter_stub.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __CIPV6_FRAGMENTER_STUB_H__ -#define __CIPV6_FRAGMENTER_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "6LoWPAN/Fragmentation/cipv6_fragmenter.h" -#include "Core/include/ns_buffer.h" - -typedef struct { - int8_t int8Value; - buffer_t *buffer_ptr; -} cipv6_fragmenter_stub_def; - -extern cipv6_fragmenter_stub_def cipv6_fragmenter_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __CIPV6_FRAGMENTER_STUB_H__ diff --git a/test/nanostack/unittest/stub/coap_connection_handler_stub.c b/test/nanostack/unittest/stub/coap_connection_handler_stub.c deleted file mode 100644 index ec95111a1768..000000000000 --- a/test/nanostack/unittest/stub/coap_connection_handler_stub.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2015, 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 -#include "coap_connection_handler.h" -#include "coap_security_handler.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "socket_api.h" -#include "net_interface.h" -#include "randLIB.h" -#include "eventOS_callback_timer.h" -#include "coap_connection_handler_stub.h" - -thread_conn_handler_stub_def thread_conn_handler_stub; - -int coap_connection_handler_virtual_recv(thread_conn_handler_t *handler, uint8_t address[static 16], uint16_t port, uint8_t *data_ptr, uint16_t data_len) -{ - return thread_conn_handler_stub.int_value; -} - -thread_conn_handler_t *connection_handler_create(int (*recv_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, unsigned char *, int), - int (*send_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, const unsigned char *, int), - int (*pw_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, uint8_t *pw_ptr, uint8_t *pw_len), - void(*done_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, uint8_t keyblock[static KEY_BLOCK_LEN]) ) -{ - thread_conn_handler_stub.send_to_sock_cb = send_cb; - thread_conn_handler_stub.receive_from_sock_cb = recv_cb; - thread_conn_handler_stub.get_passwd_cb = pw_cb; - thread_conn_handler_stub.sec_done_cb = done_cb; - return thread_conn_handler_stub.handler_obj; -} - -void connection_handler_destroy(thread_conn_handler_t *handler) -{ - -} - -int coap_connection_handler_open_connection(thread_conn_handler_t *handler, uint16_t listen_port, bool use_ephemeral_port, bool is_secure, bool is_real_socket, bool bypassSec) -{ - return thread_conn_handler_stub.int_value; -} - -int coap_connection_handler_send_data(thread_conn_handler_t *handler, ns_address_t *dest_addr, uint8_t *data_ptr, uint16_t data_len, bool bypass_link_sec) -{ - return thread_conn_handler_stub.int_value; -} - -bool coap_connection_handler_socket_belongs_to(thread_conn_handler_t *handler, int8_t socket_id) -{ - return thread_conn_handler_stub.bool_value; -} diff --git a/test/nanostack/unittest/stub/coap_connection_handler_stub.h b/test/nanostack/unittest/stub/coap_connection_handler_stub.h deleted file mode 100644 index ea399361da34..000000000000 --- a/test/nanostack/unittest/stub/coap_connection_handler_stub.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __COAP_CONNECTION_HANDLER_STUB_H__ -#define __COAP_CONNECTION_HANDLER_STUB_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#include "coap_connection_handler.h" - -typedef struct { - int int_value; - bool bool_value; - thread_conn_handler_t *handler_obj; - - int (*send_to_sock_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, const unsigned char *, int); - int (*receive_from_sock_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, unsigned char *, int); - int (*get_passwd_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, uint8_t *pw_ptr, uint8_t *pw_len); - void (*sec_done_cb)(int8_t socket_id, uint8_t address[static 16], uint16_t port, uint8_t keyblock[static 40]); - -} thread_conn_handler_stub_def; - -extern thread_conn_handler_stub_def thread_conn_handler_stub; - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/test/nanostack/unittest/stub/coap_security_handler_stub.c b/test/nanostack/unittest/stub/coap_security_handler_stub.c deleted file mode 100644 index 7daf2a1b958b..000000000000 --- a/test/nanostack/unittest/stub/coap_security_handler_stub.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2015, 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 -#include -#include -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "coap_connection_handler.h" -#include "randLIB.h" -#include "coap_security_handler_stub.h" - -thread_sec_def coap_security_handler_stub; - -thread_security_t *thread_security_create(int8_t socket_id, int8_t timer_id, uint8_t *address_ptr, uint16_t port, - int (*send_cb)(int8_t socket_id, uint8_t *address_ptr, uint16_t port, const unsigned char *, size_t), - int (*receive_cb)(int8_t socket_id, unsigned char *, size_t), - void (*start_timer_cb)(int8_t timer_id, uint32_t min, uint32_t fin), - int (*timer_status_cb)(int8_t timer_id)) -{ - coap_security_handler_stub.send_cb = send_cb; - coap_security_handler_stub.receive_cb = receive_cb; - coap_security_handler_stub.start_timer_cb = start_timer_cb; - coap_security_handler_stub.timer_status_cb = timer_status_cb; - return coap_security_handler_stub.sec_obj; -} - -void thread_security_destroy(thread_security_t *sec) -{ - -} - -int coap_security_handler_connect(thread_security_t *sec, bool is_server, const unsigned char *pw, uint8_t len) -{ - sec->_is_started = true; - if( coap_security_handler_stub.counter >= 0){ - return coap_security_handler_stub.values[coap_security_handler_stub.counter--]; - } - return coap_security_handler_stub.int_value; -} - -int coap_security_handler_continue_connecting(thread_security_t *sec) -{ - if( coap_security_handler_stub.counter >= 0){ - return coap_security_handler_stub.values[coap_security_handler_stub.counter--]; - } - - return coap_security_handler_stub.int_value; -} - - -int coap_security_handler_send_message(thread_security_t *sec, unsigned char *message, size_t len) -{ - if( coap_security_handler_stub.counter >= 0){ - return coap_security_handler_stub.values[coap_security_handler_stub.counter--]; - } - return coap_security_handler_stub.int_value; -} - -int thread_security_send_close_alert(thread_security_t *sec) -{ - if( coap_security_handler_stub.counter >= 0){ - return coap_security_handler_stub.values[coap_security_handler_stub.counter--]; - } - return coap_security_handler_stub.int_value; -} - -int coap_security_handler_read(thread_security_t *sec, unsigned char* buffer, size_t len) -{ - if( coap_security_handler_stub.counter >= 0){ - return coap_security_handler_stub.values[coap_security_handler_stub.counter--]; - } - return coap_security_handler_stub.int_value; -} diff --git a/test/nanostack/unittest/stub/coap_security_handler_stub.h b/test/nanostack/unittest/stub/coap_security_handler_stub.h deleted file mode 100644 index dc05a512a900..000000000000 --- a/test/nanostack/unittest/stub/coap_security_handler_stub.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2015, 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 __COAP_SECURITY_HANDLER_STUB_H__ -#define __COAP_SECURITY_HANDLER_STUB_H__ - -#include -#include "coap_security_handler.h" - -typedef struct tsh{ - thread_security_t *sec_obj; - int int_value; - int counter; - int values[10]; - - int (*send_cb)(int8_t socket_id, uint8_t *address_ptr, uint16_t port, const unsigned char *, size_t); - int (*receive_cb)(int8_t socket_id, unsigned char *, size_t); - void (*start_timer_cb)(int8_t timer_id, uint32_t min, uint32_t fin); - int (*timer_status_cb)(int8_t timer_id); -} thread_sec_def; - -extern thread_sec_def coap_security_handler_stub; - -#endif //__COAP_SECURITY_HANDLER_STUB_H__ diff --git a/test/nanostack/unittest/stub/coap_service_api_stub.c b/test/nanostack/unittest/stub/coap_service_api_stub.c deleted file mode 100644 index 8aae79672983..000000000000 --- a/test/nanostack/unittest/stub/coap_service_api_stub.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#ifdef HAVE_THREAD -#include - -#include "ns_types.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "sn_nsdl.h" -#include "sn_coap_header.h" -#include "coap_service_api.h" -#include "coap_message_handler.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_event_timer.h" -#include "common_functions.h" -#include "net_interface.h" -#include "coap_service_api_stub.h" -uint8_t callBackSent; -coap_service_api_stub_def coap_service_api_stub; - - -int8_t coap_service_initialize(int8_t interface_id, uint16_t listen_port, uint8_t service_options, - coap_service_security_start_cb *start_ptr, coap_service_security_done_cb *security_done_cb) -{ - return coap_service_api_stub.expectedInt8; -} - -void coap_service_delete(int8_t service_id) -{ -} - -int16_t coap_service_virtual_socket_recv(int8_t service_id, uint8_t source_addr_ptr[static 16], uint16_t port, uint8_t *data_ptr, uint16_t data_len) -{ - return coap_service_api_stub.expectedInt16; -} - -int16_t coap_service_virtual_socket_set_cb(int8_t service_id, coap_service_virtual_socket_send_cb *send_method_ptr) -{ - coap_service_api_stub.socket_send_cb = send_method_ptr; - return coap_service_api_stub.expectedInt16; -} - -int8_t coap_service_register_uri(int8_t service_id, const char *uri, uint8_t allowed_method, coap_service_request_recv_cb *request_recv_cb) -{ - if (coap_service_api_stub.callBackAccepted == callBackSent) { - coap_service_api_stub.register_uri_send_cb = request_recv_cb; - } - callBackSent++; - return coap_service_api_stub.expectedInt8; -} - -int8_t coap_service_unregister_uri(int8_t service_id, const char *uri) -{ - return coap_service_api_stub.expectedInt8; -} - -uint16_t coap_service_request_send(int8_t service_id, uint8_t options, const uint8_t destination_addr[static 16], uint16_t destination_port, sn_coap_msg_type_e msg_type, sn_coap_msg_code_e msg_code, const char *uri, - sn_coap_content_format_e cont_type, const uint8_t *payload_ptr, uint16_t payload_len, coap_service_response_recv *request_response_cb) -{ - coap_service_api_stub.response_resp_cb = request_response_cb; - return coap_service_api_stub.expectedUint16; -} - -int8_t coap_service_response_send(int8_t service_id, uint8_t options, sn_coap_hdr_s *request_ptr, sn_coap_msg_code_e message_code, int32_t content_type, const uint8_t *payload_ptr,uint16_t payload_len){ - return coap_service_api_stub.expectedInt8; -} -void coap_service_close_secure_connection(int8_t service_id, uint8_t destination_addr_ptr[static 16], uint16_t port) -{ - return; -} -void reset_callback() -{ - callBackSent = 1; -} - -int8_t coap_service_request_delete(int8_t service_id, uint16_t msg_id) -{ - return -1; -} - -#endif diff --git a/test/nanostack/unittest/stub/coap_service_api_stub.h b/test/nanostack/unittest/stub/coap_service_api_stub.h deleted file mode 100644 index 4602e46229e1..000000000000 --- a/test/nanostack/unittest/stub/coap_service_api_stub.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __COAP_SERVICE_API_STUB_H__ -#define __COAP_SERVICE_API_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "coap_service_api.h" - -typedef struct { - char* expectedCharPtr; - void* cb; - int8_t expectedInt8; - int16_t expectedInt16; - uint16_t expectedUint16; - uint8_t callBackAccepted; - coap_service_request_recv_cb* register_uri_send_cb; - coap_service_virtual_socket_send_cb* socket_send_cb; - coap_service_response_recv* response_resp_cb; -} coap_service_api_stub_def; - -extern coap_service_api_stub_def coap_service_api_stub; -void reset_callback(); -#ifdef __cplusplus -} -#endif - -#endif // __COAP_SERVICE_API_STUB_H__ diff --git a/test/nanostack/unittest/stub/common_functions_stub.c b/test/nanostack/unittest/stub/common_functions_stub.c deleted file mode 100644 index 0df912aed86e..000000000000 --- a/test/nanostack/unittest/stub/common_functions_stub.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 -#include -#include - -#include "ns_types.h" -//#include "common_functions.h" -#define COMMON_FUNCTIONS_FN - -#include - -#include "common_functions_stub.h" - -common_functions_stub_def common_functions_stub; - -bool bitsequal(const uint8_t *a, const uint8_t *b, uint_fast8_t bits) -{ - return common_functions_stub.bool_value; -} - -uint8_t *bitcopy(uint8_t *restrict dst, const uint8_t *restrict src, uint_fast8_t bits) -{ - return common_functions_stub.uint8_ptr; -} - -uint8_t *bitcopy0(uint8_t *restrict dst, const uint8_t *restrict src, uint_fast8_t bits) -{ - return common_functions_stub.uint8_ptr; -} - -COMMON_FUNCTIONS_FN uint8_t *common_write_64_bit(uint64_t value, uint8_t ptr[__static 8]) -{ - return ptr + 8; -} - -COMMON_FUNCTIONS_FN uint64_t common_read_64_bit(const uint8_t data_buf[__static 8]) -{ - return common_functions_stub.uint64_value; -} - -COMMON_FUNCTIONS_FN uint8_t *common_write_32_bit(uint32_t value, uint8_t ptr[__static 4]) -{ - return ptr + 4; -} - -COMMON_FUNCTIONS_FN uint32_t common_read_32_bit(const uint8_t data_buf[__static 4]) -{ - return common_functions_stub.uint32_value; -} - -COMMON_FUNCTIONS_FN uint32_t common_read_16_bit_inverse(const uint8_t data_buf[__static 4]) -{ - return common_functions_stub.uint16_value; -} - -COMMON_FUNCTIONS_FN uint8_t *common_write_32_bit_inverse(uint32_t value, uint8_t ptr[__static 4]) -{ - return ptr + 4; -} - -COMMON_FUNCTIONS_FN uint32_t common_read_32_bit_inverse(const uint8_t data_buf[__static 4]) -{ - return common_functions_stub.uint32_value; -} - -COMMON_FUNCTIONS_FN uint8_t *common_write_24_bit(uint_fast24_t value, uint8_t ptr[__static 3]) -{ - return ptr + 3; -} - -COMMON_FUNCTIONS_FN uint_fast24_t common_read_24_bit(const uint8_t data_buf[__static 3]) -{ - return common_functions_stub.uint24_value; -} - -COMMON_FUNCTIONS_FN uint8_t *common_write_16_bit(uint16_t value, uint8_t ptr[__static 2]) -{ - return ptr + 2; -} - -COMMON_FUNCTIONS_FN uint16_t common_read_16_bit(const uint8_t data_buf[__static 2]) -{ - if (common_functions_stub.readuint16_from_queue) { - common_functions_stub.readuint16_from_queue--; - return common_functions_stub.uint16_value_queue[common_functions_stub.readuint16_from_queue]; - } - return common_functions_stub.uint16_value; -} - -COMMON_FUNCTIONS_FN uint8_t *common_write_16_bit_inverse(uint16_t value, uint8_t ptr[__static 2]) -{ - return ptr + 2; -} - -COMMON_FUNCTIONS_FN uint_fast8_t common_count_bits(uint8_t byte) -{ - return common_functions_stub.uint8_value; -} - -COMMON_FUNCTIONS_FN uint_fast8_t common_count_leading_zeros_8(uint8_t byte) -{ - return common_functions_stub.uint8_value; -} - -COMMON_FUNCTIONS_FN uint_fast8_t common_count_leading_zeros_16(uint16_t value) -{ - return common_functions_stub.uint8_value; -} - -COMMON_FUNCTIONS_FN uint_fast8_t common_count_leading_zeros_32(uint32_t value) -{ - return common_functions_stub.uint8_value; -} - -COMMON_FUNCTIONS_FN bool common_serial_number_greater_8(uint8_t s1, uint8_t s2) -{ - return common_functions_stub.bool_value; -} - -COMMON_FUNCTIONS_FN bool common_serial_number_greater_16(uint16_t s1, uint16_t s2) -{ - return common_functions_stub.bool_value; -} - -COMMON_FUNCTIONS_FN bool common_serial_number_greater_32(uint32_t s1, uint32_t s2) -{ - return common_functions_stub.bool_value; -} - -COMMON_FUNCTIONS_FN bool bit_test(const uint8_t *bitset, uint_fast8_t bit) -{ - return common_functions_stub.bool_value; -} - -COMMON_FUNCTIONS_FN void bit_set(uint8_t *bitset, uint_fast8_t bit) -{ -} - -COMMON_FUNCTIONS_FN void bit_clear(uint8_t *bitset, uint_fast8_t bit) -{ -} diff --git a/test/nanostack/unittest/stub/common_functions_stub.h b/test/nanostack/unittest/stub/common_functions_stub.h deleted file mode 100644 index 6cd4a36257bc..000000000000 --- a/test/nanostack/unittest/stub/common_functions_stub.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016, 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 __COMMON_FUNCTIONS_STUB_H__ -#define __COMMON_FUNCTIONS_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - bool bool_value; - int8_t int8_value; - uint8_t uint8_value; - uint8_t *uint8_ptr; - uint16_t uint16_value; - uint32_t uint24_value; - uint32_t uint32_value; - uint64_t uint64_value; - uint8_t readuint16_from_queue; - uint16_t uint16_value_queue[4]; -} common_functions_stub_def; - -extern common_functions_stub_def common_functions_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __COMMON_FUNCTIONS_STUB_H__ diff --git a/test/nanostack/unittest/stub/crc_stub.c b/test/nanostack/unittest/stub/crc_stub.c deleted file mode 100644 index 999fc78443f8..000000000000 --- a/test/nanostack/unittest/stub/crc_stub.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "ns_crc.h" - -uint16_t crc16_ansi(uint8_t *message, int nBytes) { - return 0; -} -uint16_t crc16_ccitt(uint8_t *message, int nBytes) { - return 0; -} - -uint16_t crc16_calc(uint8_t* data, uint16_t data_length, uint16_t polynomial) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/cudp_stub.c b/test/nanostack/unittest/stub/cudp_stub.c deleted file mode 100644 index 1a5d00601c79..000000000000 --- a/test/nanostack/unittest/stub/cudp_stub.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013-2016, 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. - */ -/** - * \file cudp.c - * \brief This file contains UDP layer decode, compress. - */ -#include "nsconfig.h" -#include "ns_types.h" -//#include "Core/include/address.h" -#include "Core/include/ns_buffer.h" -//#include "string.h" -//#include "Core/include/routing_table.h" -//#include "6LoWPAN/IPHC_Decode/cipv6.h" -//#include "6LoWPAN/IPHC_Decode/cudp.h" -//#include "Common_Protocols/udp.h" -//#include "6LoWPAN/Bootstraps/network_lib.h" -//#include "common_functions.h" - -buffer_t *parse_udp_header(buffer_t *buf) -{ - return NULL; -} - -buffer_t *cudp_compres_header(buffer_t *buf) -{ - return NULL; -} - -buffer_t *cudp_decode_to_full(buffer_t *buf) -{ - return NULL; -} - - - diff --git a/test/nanostack/unittest/stub/dhcp_service_api_stub.c b/test/nanostack/unittest/stub/dhcp_service_api_stub.c deleted file mode 100644 index 96a54555a056..000000000000 --- a/test/nanostack/unittest/stub/dhcp_service_api_stub.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2013-2016, 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 "nsconfig.h" -#include -#include -#include -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_event_timer.h" -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "randLIB.h" -#include "socket_api.h" -#include "net_interface.h" -#include "common_functions.h" -#include "libDHCPv6/libDHCPv6.h" -#include "NWK_INTERFACE/Include/protocol.h" // just for protocol_core_monotonic_time - -#include "dhcp_service_api.h" - -#define TRACE_GROUP "dhcp" - -#define MAX_SERVERS 20 - -/* Fixed-point randomisation limits for randlib_randomise_base() - RFC 3315 - * says RAND is uniformly distributed between -0.1 and +0.1 - */ -#define RAND1_LOW 0x7333 // 1 - 0.1; minimum for "1+RAND" -#define RAND1_HIGH 0x8CCD // 1 + 0.1; maximum for "1+RAND" - -typedef struct { - dhcp_service_receive_req_cb *recv_req_cb; - uint16_t instance_id; - int8_t interface_id; - ns_list_link_t link; -} server_instance_t; -typedef NS_LIST_HEAD(server_instance_t, link) server_instance_list_t; - -typedef struct { - ns_address_t addr; - dhcp_service_receive_resp_cb *recv_resp_cb; - uint16_t instance_id; - int8_t interface_id; - int8_t socket; - uint8_t options; - void *client_obj_ptr; - uint32_t msg_tr_id; - uint32_t message_tr_id; - uint32_t first_transmit_time; - uint16_t timeout; - uint16_t timeout_init; - uint16_t timeout_max; - uint8_t retrans_max; - uint8_t retrans; - uint8_t *msg_ptr; - uint16_t msg_len; - ns_list_link_t link; -} msg_tr_t; -typedef NS_LIST_HEAD(msg_tr_t, link) tr_list_t; - -typedef struct { - ns_address_t src_address; - server_instance_list_t srv_list; - tr_list_t tr_list; - int8_t dhcp_server_socket; - int8_t dhcp_client_socket; - int8_t dhcpv6_socket_service_tasklet; -} dhcp_service_class_t; - -#define DHCPV6_SOCKET_SERVICE_TASKLET_INIT 1 -#define DHCPV6_SOCKET_SERVICE_TIMER 2 - -#define DHCPV6_SOCKET_SERVICE_TIMER_ID 1 - -#define DHCPV6_SOCKET_TIMER_UPDATE_PERIOD_IN_MS 100 - -dhcp_service_class_t *dhcp_service = NULL; - -void dhcp_service_send_message(msg_tr_t *msg_tr_ptr); - -void DHCPv6_socket_service_tasklet(arm_event_s *event) -{ -} - -bool dhcp_service_allocate(void) -{ - return false; -} - -msg_tr_t *dhcp_tr_find(uint32_t msg_tr_id) -{ - return NULL; -} - -msg_tr_t *dhcp_tr_create(void) -{ - return NULL; -} - -void dhcp_tr_delete(msg_tr_t *msg_ptr) -{ -} - -void dhcp_tr_set_retry_timers(msg_tr_t *msg_ptr, uint8_t msg_type) -{ -} - -server_instance_t *dhcp_service_client_find(uint16_t instance_id) -{ - return NULL; -} - -void recv_dhcp_server_msg(void *cb_res) -{ -} - -void recv_dhcp_client_msg(void *cb_res) -{ -} - -uint16_t dhcp_service_init(int8_t interface_id, dhcp_instance_type_e instance_type, dhcp_service_receive_req_cb *receive_req_cb) -{ - return 0; -} - -void dhcp_service_delete(uint16_t instance) -{ -} - -int dhcp_service_send_resp(uint32_t msg_tr_id, uint8_t options, uint8_t *msg_ptr, uint16_t msg_len) -{ - return 0; -} - -uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb) -{ - return 0; -} - -void dhcp_service_set_retry_timers(uint32_t msg_tr_id, uint16_t timeout_init, uint16_t timeout_max, uint8_t retrans_max) -{ -} - -void dhcp_service_req_remove(uint32_t msg_tr_id) -{ -} - -void dhcp_service_send_message(msg_tr_t *msg_tr_ptr) -{ -} - -bool dhcp_service_timer_tick(uint16_t ticks) -{ - return false; -} - diff --git a/test/nanostack/unittest/stub/eap_protocol_stub.c b/test/nanostack/unittest/stub/eap_protocol_stub.c deleted file mode 100644 index 494ec78924e6..000000000000 --- a/test/nanostack/unittest/stub/eap_protocol_stub.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" - -#include "ns_types.h" -#include "eventOS_event.h" -#include "ns_trace.h" -#include "string.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" - -#include "common_functions.h" -#include "Security/PANA/pana_eap_header.h" -#ifdef PANA - -#define TRACE_GROUP "eap" - -const uint8_t EAP_ANYMOUS[9] = {'a', 'n', 'o', 'n', 'y', 'm', 'o', 'u', 's'}; - -void pana_eap_identity_build(buffer_t *buf, sec_suite_t *suite) -{ - -} - -void pana_eap_tls_start_build(buffer_t *buf, sec_suite_t *suite) -{ - -} - - -void pana_eap_tls_finnish_build(buffer_t *buf, sec_suite_t *suite) -{ - -} - -bool pana_eap_frag_re_tx(sec_suite_t *suite) -{ - return true; -} - -buffer_t *eap_down(buffer_t *buf, sec_suite_t *suite) -{ - return (buf); -} - -buffer_t *eap_up(buffer_t *buf, sec_suite_t *suite) -{ - return buf; -} -#endif diff --git a/test/nanostack/unittest/stub/ecc_stub.c b/test/nanostack/unittest/stub/ecc_stub.c deleted file mode 100644 index 5d2487c6733b..000000000000 --- a/test/nanostack/unittest/stub/ecc_stub.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "ns_types.h" -#include "ecc.h" - -void ecc_init(void) -{ - return; -} -void ecc_library_free_pointer(void *ptr) -{ - return; -} -void ecc_free_memory(void){ - return; -} -int8_t ecc_state_idle_check(void) -{ - return 0; -} -int8_t ecc_calculate_signature(ECDSASignature *signature, MPint *certificate_private_key, void (*cb_ptr)(int8_t, void *)) -{ - return 0; -} -int8_t ecc_calculate_verify(ECDSASignature *signature, EllipticPoint *public_key, void (*cb_ptr)(int8_t, void *)) -{ - return 0; -} -int8_t ecc_calculate_public_key(MPint *p_key, void (*cb_ptr)(int8_t, void *)) -{ - return 0; -} -int8_t ecc_calculate_pre_master_secret(EllipticPoint *public_key, MPint *p_key, void (*cb_ptr)(int8_t, void *)) -{ - return 0; -} -int8_t ecc_run(void) -{ - return 0; -} -int8_t ecc_blocking_run_block_counter_set(uint16_t new_block_sequency_length) -{ - return 0; -} -EllipticPoint *ecc_get_elliptic_point(void) -{ - return 0; -} -ECDSASignature *ecc_get_ecdsa_signature(void) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/ecdsa_stub.c b/test/nanostack/unittest/stub/ecdsa_stub.c deleted file mode 100644 index 1e337868fc2a..000000000000 --- a/test/nanostack/unittest/stub/ecdsa_stub.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "ns_types.h" -#include "GMPNlib.h" -#include "GELAlib.h" -#include "ecdsa.h" - -ECDSASignature *ECDSA_get_signature(void) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/etx_stub.c b/test/nanostack/unittest/stub/etx_stub.c deleted file mode 100644 index 237702de9998..000000000000 --- a/test/nanostack/unittest/stub/etx_stub.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include "ns_types.h" -#include "common_functions.h" -#include "ns_trace.h" -#include "string.h" -#include "nsdynmemLIB.h" -#include "Core/include/address.h" -#include "MLE/mle.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "platform/arm_hal_phy.h" -#include "net_interface.h" -#include "Service_Libs/etx/etx.h" -#include "Service_Libs/utils/isqrt.h" - -#define TRACE_GROUP "etx" - -void etx_transm_attempts_update(int8_t interface_id, uint8_t attempts, bool success, addrtype_t addr_type, const uint8_t *addr_ptr) -{ -} - -void etx_remote_incoming_idr_update(int8_t interface_id, uint8_t remote_incoming_idr, mle_neigh_table_entry_t *neigh_table_ptr) -{ -} - -uint16_t etx_read(int8_t nwk_id, addrtype_t addr_type, const uint8_t *addr_ptr) -{ - return 0; -} - -uint16_t etx_local_incoming_idr_read(int8_t interface_id, mle_neigh_table_entry_t *neigh_table_ptr) -{ - return 0; -} - -uint16_t etx_lqi_dbm_update(int8_t interface_id, uint8_t lqi, int8_t dbm, mle_neigh_table_entry_t *neigh_table_ptr) -{ - return 0; -} - -uint8_t etx_value_change_callback_register(nwk_interface_id nwk_id, int8_t interface_id, uint16_t hysteresis, etx_value_change_handler_t *callback_ptr) -{ - return 0; -} - -uint8_t etx_accum_failures_callback_register(nwk_interface_id nwk_id, int8_t interface_id, uint8_t threshold, etx_accum_failures_handler_t *callback_ptr) -{ - return 0; -} - -void etx_neighbor_remove(int8_t interface_id, mle_neigh_table_entry_t *neigh_table_ptr) -{ -} - -void etx_neighbor_add(int8_t interface_id, mle_neigh_table_entry_t *neigh_table_ptr) -{ - -} diff --git a/test/nanostack/unittest/stub/event_stub.c b/test/nanostack/unittest/stub/event_stub.c deleted file mode 100644 index 482815e4ddcb..000000000000 --- a/test/nanostack/unittest/stub/event_stub.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 -#include -#include -#include -#include "event_stub.h" -#include "ns_types.h" -#include "ns_list.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "timer_sys.h" -#include "nsdynmemLIB.h" -#include "ns_timer.h" - -event_def event_stub; - -int8_t eventOS_event_handler_create(void (*handler_func_ptr)(arm_event_s *), uint8_t init_event_type) -{ - event_stub.func_ptr = handler_func_ptr; - return event_stub.int8_value; -} - -int8_t eventOS_event_send(const arm_event_s *event) -{ - if( event_stub.func_ptr && !event_stub.ignore_callback ){ - // Preserve const semantics - arm_event_s copy = *event; - event_stub.func_ptr(©); - } - return event_stub.int8_value; -} - -void eventOS_event_send_user_allocated(arm_event_storage_t *event) -{ - if( event_stub.func_ptr && !event_stub.ignore_callback ){ - event_stub.func_ptr(&event->data); - } -} - -void eventOS_scheduler_init(void) -{ -} - - -int8_t eventOS_scheduler_get_active_tasklet(void) -{ - return event_stub.int8_value; -} - -void eventOS_scheduler_set_active_tasklet(int8_t tasklet) -{ -} - -int eventOS_scheduler_timer_stop(void) -{ - return event_stub.int_value; -} - -int eventOS_scheduler_timer_synch_after_sleep(uint32_t sleep_ticks) -{ - return event_stub.int_value; -} - -bool eventOS_scheduler_dispatch_event(void) -{ - return event_stub.bool_value; -} - -void eventOS_scheduler_run_until_idle(void) -{ -} - -NS_NORETURN void eventOS_scheduler_run(void) -{ -} - -void eventOS_cancel(arm_event_storage_t *event) -{ -} - -arm_event_storage_t *eventOS_event_timer_request_every(const struct arm_event_s *event, int32_t period) -{ - return &event_stub.event_storage; -} - - diff --git a/test/nanostack/unittest/stub/event_stub.h b/test/nanostack/unittest/stub/event_stub.h deleted file mode 100644 index 0bad86d40152..000000000000 --- a/test/nanostack/unittest/stub/event_stub.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __EVENT_STUB_H__ -#define __EVENT_STUB_H__ - -#include "stdint.h" -#include "eventOS_event.h" - -typedef struct event { - int8_t int8_value; - bool ignore_callback; - int int_value; - bool bool_value; - void (*func_ptr)(arm_event_s *); - arm_event_storage_t event_storage; -}event_def; - -extern event_def event_stub; -#endif //__EVENT_STUB_H__ diff --git a/test/nanostack/unittest/stub/fhss_beacon_stub.c b/test/nanostack/unittest/stub/fhss_beacon_stub.c deleted file mode 100644 index 7ba2bf77a44f..000000000000 --- a/test/nanostack/unittest/stub/fhss_beacon_stub.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include -#include "nsdynmemLIB.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "fhss_channel_stub.h" -#include "Service_Libs/fhss/fhss.h" -#include "Service_Libs/fhss/fhss_beacon.h" - -uint8_t fhss_calculate_uc_index(uint8_t channel_index, uint16_t number_of_channels, uint8_t number_of_broadcast_channels) -{ - return 40; -} - -uint8_t* fhss_beacon_encode_raw(uint8_t* buffer, const fhss_synchronization_beacon_payload_s* source) -{ - return NULL; -} - -int fhss_beacon_update_payload(fhss_structure_t *fhss_structure, fhss_synchronization_beacon_payload_s *payload) -{ - return 0; -} - -void fhss_beacon_decode(fhss_synchronization_beacon_payload_s* dest, const uint8_t* buffer, uint32_t elapsed_time, uint16_t number_of_channels) -{ - -} diff --git a/test/nanostack/unittest/stub/fhss_beacon_tasklet_stub.c b/test/nanostack/unittest/stub/fhss_beacon_tasklet_stub.c deleted file mode 100644 index af0aff62455d..000000000000 --- a/test/nanostack/unittest/stub/fhss_beacon_tasklet_stub.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include "nsdynmemLIB.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "fhss_channel_stub.h" -#include "fhss_beacon_tasklet_stub.h" -#include "Service_Libs/fhss/fhss.h" - -fhss_beacon_tasklet_stub_def fhss_beacon_tasklet_stub; - -int8_t fhss_beacon_create_tasklet(fhss_structure_t *fhss_structure) -{ - return fhss_beacon_tasklet_stub.int8_value; -} - -void fhss_beacon_periodic_stop(fhss_structure_t *fhss_structure) -{ - -} - -int fhss_beacon_periodic_start(fhss_structure_t *fhss_structure, uint32_t time_to_first_beacon) -{ - return 0; -} - -void fhss_beacon_build(fhss_structure_t *fhss_structure, uint8_t* dest) -{ - -} - -void fhss_beacon_received(fhss_structure_t *fhss_structure, const uint8_t *synch_info, const uint32_t elapsed_time) -{ - -} diff --git a/test/nanostack/unittest/stub/fhss_beacon_tasklet_stub.h b/test/nanostack/unittest/stub/fhss_beacon_tasklet_stub.h deleted file mode 100644 index a1eb1090c4dc..000000000000 --- a/test/nanostack/unittest/stub/fhss_beacon_tasklet_stub.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2017, 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 __FHSS_BEACON_TASKLET_STUB_H__ -#define __FHSS_BEACON_TASKLET_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int8_t int8_value; -} fhss_beacon_tasklet_stub_def; - -extern fhss_beacon_tasklet_stub_def fhss_beacon_tasklet_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __FHSS_BEACON_TASKLET_STUB_H__ diff --git a/test/nanostack/unittest/stub/fhss_callbacks_stub.c b/test/nanostack/unittest/stub/fhss_callbacks_stub.c deleted file mode 100644 index 4feba327618b..000000000000 --- a/test/nanostack/unittest/stub/fhss_callbacks_stub.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "fhss_api.h" -#include "fhss_callbacks_stub.h" - -fhss_callbacks_stub_def fhss_callbacks_stub; - -uint16_t mac_read_tx_queue_sizes(const fhss_api_t *fhss_api, bool broadcast_queue) -{ - return fhss_callbacks_stub.uint8_value; -} - -int mac_read_64bit_mac_address(const fhss_api_t *fhss_api, uint8_t *mac_address) -{ - return 0; -} - -uint32_t mac_read_phy_datarate(const fhss_api_t *fhss_api) -{ - return 250000; -} - -int mac_set_channel(const fhss_api_t *fhss_api, uint8_t channel_number) -{ - fhss_callbacks_stub.uint8_value = channel_number; - return 0; -} - -int mac_fhss_frame_tx(const fhss_api_t *fhss_api, int frame_type) -{ - return 0; -} - -int mac_synch_lost(const fhss_api_t *fhss_api) -{ - return 0; -} - -int mac_poll_tx_queue(const fhss_api_t *fhss_api) -{ - return 0; -} - -int mac_broadcast_notification(const fhss_api_t *fhss_api, uint32_t broadcast_time) -{ - return 0; -} - -int mac_get_coordinator_mac_address(const fhss_api_t *fhss_api, uint8_t *mac_address) -{ - if (!fhss_callbacks_stub.int8_value) { - memcpy(mac_address, fhss_callbacks_stub.address, 8); - } - return fhss_callbacks_stub.int8_value; -} diff --git a/test/nanostack/unittest/stub/fhss_callbacks_stub.h b/test/nanostack/unittest/stub/fhss_callbacks_stub.h deleted file mode 100644 index ce4247e2fad1..000000000000 --- a/test/nanostack/unittest/stub/fhss_callbacks_stub.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __FHSS_CALLBACKS_STUB_H__ -#define __FHSS_CALLBACKS_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - uint8_t uint8_value; - int8_t int8_value; - uint8_t address[8]; -} fhss_callbacks_stub_def; - -extern fhss_callbacks_stub_def fhss_callbacks_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __FHSS_CALLBACKS_STUB_H__ diff --git a/test/nanostack/unittest/stub/fhss_channel_stub.c b/test/nanostack/unittest/stub/fhss_channel_stub.c deleted file mode 100644 index 041fb6acd4ef..000000000000 --- a/test/nanostack/unittest/stub/fhss_channel_stub.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include "nsdynmemLIB.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "fhss_channel_stub.h" -#include "Service_Libs/fhss/fhss.h" - -fhss_channel_stub_def fhss_channel_stub; - -bool fhss_is_current_channel_broadcast(fhss_structure_t *fhss_structure) -{ - return fhss_channel_stub.channel_bool_value; -} - -bool fhss_change_to_next_channel(fhss_structure_t *fhss_structure) -{ - return false; -} - -uint8_t fhss_get_offset(fhss_structure_t *fhss_structure, const uint8_t *ptr) -{ - return 0; -} - -int fhss_change_to_tx_channel(fhss_structure_t *fhss_structure, uint8_t *destination_address) -{ - return 0; -} - -int fhss_change_to_parent_channel(fhss_structure_t *fhss_structure) -{ - return 0; -} - -int fhss_change_to_rx_channel(fhss_structure_t *fhss_structure) -{ - return -1; -} diff --git a/test/nanostack/unittest/stub/fhss_channel_stub.h b/test/nanostack/unittest/stub/fhss_channel_stub.h deleted file mode 100644 index 09e1564b01d2..000000000000 --- a/test/nanostack/unittest/stub/fhss_channel_stub.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __FHSS_CHANNEL_STUB_H__ -#define __FHSS_CHANNEL_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - bool channel_bool_value; -} fhss_channel_stub_def; - -extern fhss_channel_stub_def fhss_channel_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __FHSS_CHANNEL_STUB_H__ diff --git a/test/nanostack/unittest/stub/fhss_config_stub.c b/test/nanostack/unittest/stub/fhss_config_stub.c deleted file mode 100644 index 16b45dbfc430..000000000000 --- a/test/nanostack/unittest/stub/fhss_config_stub.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include "nsdynmemLIB.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "fhss_mac_interface_stub.h" -#include "fhss_config_stub.h" - -fhss_config_stub_def fhss_config_stub; - -fhss_api_t *ns_fhss_create(const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer) -{ - fhss_config_stub.fhss_api_ptr.is_broadcast_channel = &fhss_is_broadcast_channel_cb; - fhss_config_stub.fhss_api_ptr.use_broadcast_queue = &fhss_use_broadcast_queue_cb; - fhss_config_stub.fhss_api_ptr.tx_handle = &fhss_tx_handle_cb; - fhss_config_stub.fhss_api_ptr.check_tx_conditions = &fhss_check_tx_conditions_cb; - fhss_config_stub.fhss_api_ptr.receive_frame = &fhss_receive_frame_cb; - fhss_config_stub.fhss_api_ptr.data_tx_done = &fhss_data_tx_done_cb; - fhss_config_stub.fhss_api_ptr.data_tx_fail = &fhss_data_tx_fail_cb; - fhss_config_stub.fhss_api_ptr.synch_state_set = &fhss_synch_state_set_cb; - fhss_config_stub.fhss_api_ptr.read_timestamp = &fhss_read_timestamp_cb; - fhss_config_stub.fhss_api_ptr.get_retry_period = &fhss_get_retry_period_cb; - fhss_config_stub.fhss_api_ptr.init_callbacks = &fhss_init_callbacks_cb; - return &fhss_config_stub.fhss_api_ptr; -} diff --git a/test/nanostack/unittest/stub/fhss_config_stub.h b/test/nanostack/unittest/stub/fhss_config_stub.h deleted file mode 100644 index 85c4a55129df..000000000000 --- a/test/nanostack/unittest/stub/fhss_config_stub.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __FHSS_CONFIG_STUB_H__ -#define __FHSS_CONFIG_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - fhss_api_t fhss_api_ptr; -} fhss_config_stub_def; - -extern fhss_config_stub_def fhss_config_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __FHSS_CONFIG_STUB_H__ diff --git a/test/nanostack/unittest/stub/fhss_mac_interface_stub.c b/test/nanostack/unittest/stub/fhss_mac_interface_stub.c deleted file mode 100644 index 2c473c4d9517..000000000000 --- a/test/nanostack/unittest/stub/fhss_mac_interface_stub.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include "nsdynmemLIB.h" -#include "fhss_api.h" -#include "fhss_mac_interface_stub.h" - -fhss_mac_interface_stub_def fhss_mac_interface_stub; - -bool fhss_is_broadcast_channel_cb(const fhss_api_t *api) -{ - fhss_mac_interface_stub.int8_value++; - return fhss_mac_interface_stub.channel_bool_value; -} - -bool fhss_use_broadcast_queue_cb(const fhss_api_t *api, bool is_broadcast_addr, int frame_type) -{ - return fhss_mac_interface_stub.queue_bool_value; -} - -int fhss_tx_handle_cb(const fhss_api_t *api, bool is_broadcast_addr, uint8_t *destination_address, int frame_type, uint8_t *synch_info, uint16_t frame_length, uint8_t phy_header_length, uint8_t phy_tail_length) -{ - fhss_mac_interface_stub.int8_value++; - return fhss_mac_interface_stub.handle_value; -} - -bool fhss_check_tx_conditions_cb(const fhss_api_t *api, bool is_broadcast_addr, uint8_t handle, int frame_type, uint16_t frame_length, uint8_t phy_header_length, uint8_t phy_tail_length) -{ - fhss_mac_interface_stub.int8_value++; - if (frame_type == FHSS_SYNCH_REQUEST_FRAME) { - return false; - } - return fhss_mac_interface_stub.cond_bool_value; -} - -void fhss_receive_frame_cb(const fhss_api_t *api, uint16_t pan_id, uint8_t *source_address, uint32_t timestamp, uint8_t *synch_info, int frame_type) -{ - fhss_mac_interface_stub.int8_value++; -} - -void fhss_data_tx_done_cb(const fhss_api_t *api, bool waiting_ack, bool tx_completed, uint8_t handle) -{ - fhss_mac_interface_stub.int8_value++; -} - -bool fhss_data_tx_fail_cb(const fhss_api_t *api, uint8_t handle, int frame_type) -{ - fhss_mac_interface_stub.int8_value++; - return true; -} - -void fhss_synch_state_set_cb(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id) -{ - fhss_mac_interface_stub.int8_value++; -} - -uint32_t fhss_read_timestamp_cb(const fhss_api_t *api) -{ - fhss_mac_interface_stub.int8_value++; - return fhss_mac_interface_stub.uint32_value; -} - -uint16_t fhss_get_retry_period_cb(const fhss_api_t *api, uint8_t *destination_address, uint16_t phy_mtu) -{ - return 0; -} -int fhss_init_callbacks_cb(const fhss_api_t *api, fhss_callback_t *callbacks) -{ - -} diff --git a/test/nanostack/unittest/stub/fhss_mac_interface_stub.h b/test/nanostack/unittest/stub/fhss_mac_interface_stub.h deleted file mode 100644 index 76f4b8234e80..000000000000 --- a/test/nanostack/unittest/stub/fhss_mac_interface_stub.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __FHSS_MAC_INTERFACE_STUB_H__ -#define __FHSS_MAC_INTERFACE_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - bool channel_bool_value; - bool cond_bool_value; - bool queue_bool_value; - int handle_value; - int8_t int8_value; - uint32_t uint32_value; -} fhss_mac_interface_stub_def; - -extern fhss_mac_interface_stub_def fhss_mac_interface_stub; - -bool fhss_is_broadcast_channel_cb(const fhss_api_t *api); -bool fhss_use_broadcast_queue_cb(const fhss_api_t *api, bool is_broadcast_addr, int frame_type); -int fhss_tx_handle_cb(const fhss_api_t *api, bool is_broadcast_addr, uint8_t *destination_address, int frame_type, uint8_t *synch_info, uint16_t frame_length, uint8_t phy_header_length, uint8_t phy_tail_length); -bool fhss_check_tx_conditions_cb(const fhss_api_t *api, bool is_broadcast_addr, uint8_t handle, int frame_type, uint16_t frame_length, uint8_t phy_header_length, uint8_t phy_tail_length); -void fhss_receive_frame_cb(const fhss_api_t *api, uint16_t pan_id, uint8_t *source_address, uint32_t timestamp, uint8_t *synch_info, int frame_type); -void fhss_data_tx_done_cb(const fhss_api_t *api, bool waiting_ack, bool tx_completed, uint8_t handle); -bool fhss_data_tx_fail_cb(const fhss_api_t *api, uint8_t handle, int frame_type); -void fhss_synch_state_set_cb(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id); -uint32_t fhss_read_timestamp_cb(const fhss_api_t *api); -uint16_t fhss_get_retry_period_cb(const fhss_api_t *api, uint8_t *destination_address, uint16_t phy_mtu); -int fhss_init_callbacks_cb(const fhss_api_t *api, fhss_callback_t *callbacks); - -#ifdef __cplusplus -} -#endif - -#endif // __FHSS_MAC_INTERFACE_STUB_H__ diff --git a/test/nanostack/unittest/stub/fhss_platform_stub.c b/test/nanostack/unittest/stub/fhss_platform_stub.c deleted file mode 100644 index 30315b2c6fba..000000000000 --- a/test/nanostack/unittest/stub/fhss_platform_stub.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include -#include "nsdynmemLIB.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "fhss_platform_stub.h" - -fhss_platform_stub_def fhss_platform_stub; - -uint32_t fhss_get_remaining_slots_stub(struct fhss_api *fhss_api) -{ - return fhss_platform_stub.uint32_value; -} - -uint32_t fhss_get_timestamp_stub(struct fhss_api *fhss_api) -{ - return fhss_platform_stub.uint32_value; -} - -int fhss_timer_stop_stub(struct fhss_api *fhss_api) -{ - return 0; -} - -int fhss_timer_start(uint32_t slots, void (*fhss_timer_callback)(const fhss_api_t *api, uint16_t), const fhss_api_t *api) -{ - return 0; -} - -int app_get_parent_mac_address_dummy(uint8_t mac_address[8]) -{ - memcpy(mac_address, fhss_platform_stub.address, 8); - return fhss_platform_stub.int_value; -} diff --git a/test/nanostack/unittest/stub/fhss_platform_stub.h b/test/nanostack/unittest/stub/fhss_platform_stub.h deleted file mode 100644 index 5b397ea57b6f..000000000000 --- a/test/nanostack/unittest/stub/fhss_platform_stub.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __FHSS_PLATFORM_STUB_H__ -#define __FHSS_PLATFORM_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - bool channel_bool_value; - uint32_t uint32_value; - uint8_t address[8]; - int int_value; -} fhss_platform_stub_def; - -extern fhss_platform_stub_def fhss_platform_stub; - -uint32_t fhss_get_remaining_slots_stub(struct fhss_api *fhss_api); -uint32_t fhss_get_timestamp_stub(struct fhss_api *fhss_api); -int fhss_timer_stop_stub(struct fhss_api *fhss_api); -int fhss_timer_start(uint32_t slots, void (*fhss_timer_callback)(const fhss_api_t *api, uint16_t), const fhss_api_t *api); -int app_get_parent_mac_address_dummy(uint8_t mac_address[8]); - -#ifdef __cplusplus -} -#endif - -#endif // __FHSS_PLATFORM_STUB_H__ diff --git a/test/nanostack/unittest/stub/fhss_statistics_stub.c b/test/nanostack/unittest/stub/fhss_statistics_stub.c deleted file mode 100644 index 0670b755b35a..000000000000 --- a/test/nanostack/unittest/stub/fhss_statistics_stub.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include -#include "fhss_api.h" -#include "fhss_config.h" -#include "fhss_channel_stub.h" -#include "Service_Libs/fhss/fhss.h" -#include "Service_Libs/fhss/fhss_statistics.h" - -void fhss_stats_update(fhss_structure_t *fhss_structure, fhss_stats_type_t type, uint32_t update_val) -{ - -} diff --git a/test/nanostack/unittest/stub/fhss_stub.c b/test/nanostack/unittest/stub/fhss_stub.c deleted file mode 100644 index 2fb01cc6f62a..000000000000 --- a/test/nanostack/unittest/stub/fhss_stub.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include "nsdynmemLIB.h" -#include "fhss_api.h" -#include "fhss_config.h" -#include "Service_Libs/fhss/fhss.h" -#include "Service_Libs/fhss/fhss_beacon.h" -#include "fhss_stub.h" - -fhss_stub_def fhss_stub; - -int8_t fhss_enable(fhss_api_t *fhss_api, const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer, fhss_statistics_t *fhss_statistics) -{ - return fhss_stub.int8_value; -} - -int8_t fhss_disable(fhss_structure_t *fhss_structure) -{ - return fhss_stub.int8_value; -} - -int8_t fhss_set_synch_configuration(fhss_structure_t *fhss_structure, const fhss_synch_configuration_t *fhss_synch_configuration) -{ - return fhss_stub.int8_value; -} - -bool fhss_check_bad_channel(fhss_structure_t *fhss_structure, uint8_t handle) -{ - return fhss_stub.bad_channel_bool_value; -} - -bool fhss_check_channel_type(fhss_structure_t *fhss_structure, bool is_bc, int frame_type) -{ - - return fhss_stub.channel_type_bool_value; -} - -bool fhss_check_tx_allowed(fhss_structure_t *fhss_structure, bool is_bc, uint16_t frame_length, int frame_type, uint8_t phy_header_length, uint8_t phy_tail_length) -{ - return fhss_stub.tx_allowed_bool_value; -} - -fhss_structure_t *fhss_get_object_with_api(const fhss_api_t *fhss_api) -{ - if (fhss_stub.bool_value == false) { - return NULL; - } - fhss_stub.fhss_struct.fhss_api = fhss_api; - return &fhss_stub.fhss_struct; -} - -int8_t fhss_set_datarate(fhss_structure_t *fhss_structure, uint32_t datarate) -{ - return 0; -} - -int fhss_add_beacon_info(fhss_structure_t *fhss_structure, uint16_t pan_id, uint8_t *source_address, uint32_t timestamp, uint8_t *synch_info) -{ - return 0; -} - -int fhss_compare_with_synch_parent_address(fhss_structure_t *fhss_structure, const uint8_t *source_addr) -{ - return fhss_stub.int8_value; -} - -fhss_beacon_info_t *fhss_get_beacon_info(fhss_structure_t *fhss_structure, uint16_t pan_id) -{ - if (fhss_stub.beacon_info.pan_id == pan_id) { - return &fhss_stub.beacon_info; - } else { - return NULL; - } -} - -int fhss_get_parent_address(fhss_structure_t *fhss_structure, uint8_t *p_addr) -{ - return fhss_stub.int_value; -} - -int fhss_flush_beacon_info_storage(fhss_structure_t *fhss_structure) -{ - return 0; -} - -int fhss_update_synch_parent_address(fhss_structure_t *fhss_structure) -{ - return 0; -} - -int fhss_down(fhss_structure_t *fhss_structure) -{ - return 0; -} - -fhss_failed_tx_t *fhss_failed_handle_find(fhss_structure_t *fhss_structure, uint8_t handle) -{ - if (fhss_stub.fhss_failed_tx.handle == handle) { - return &fhss_stub.fhss_failed_tx; - } else { - return NULL; - } -} - -int fhss_failed_handle_add(fhss_structure_t *fhss_structure, uint8_t handle) -{ - fhss_stub.fhss_failed_tx.retries_done = 0; - fhss_stub.fhss_failed_tx.handle = handle; - return 0; -} - -int fhss_failed_handle_remove(fhss_structure_t *fhss_structure, uint8_t handle) -{ - if (fhss_stub.fhss_failed_tx.handle == handle) { - fhss_stub.fhss_failed_tx.handle = 255; - } - return 0; -} - -bool fhss_is_synch_root(fhss_structure_t *fhss_structure) -{ - if (fhss_stub.fhss_struct.own_hop == 0) { - return true; - } - return false; -} - -void fhss_superframe_handler(const fhss_api_t *fhss_api, uint16_t delay) -{ - -} - -void fhss_start_timer(fhss_structure_t *fhss_structure, uint32_t time, void (*callback)(const fhss_api_t *fhss_api, uint16_t)) -{ - -} - -uint32_t fhss_get_remaining_time_to_next_superframe(const fhss_structure_t *fhss_structure) -{ - return 0; -} - -uint32_t fhss_get_tx_time(fhss_structure_t *fhss_structure, uint16_t bytes_to_send, uint8_t phy_header_length, uint8_t phy_tail_length) -{ - return 0; -} - -int fhss_timeout_start(fhss_structure_t *fhss_structure, uint32_t time) -{ - return 0; -} - -int fhss_timeout_stop(fhss_structure_t *fhss_structure) -{ - return 0; -} - -int fhss_sync_with_beacon(fhss_structure_t *fhss_structure, const fhss_synchronization_beacon_payload_s *payload) -{ - return 0; -} - -void fhss_clear_active_event(fhss_structure_t *fhss_structure, uint8_t event_type) -{ - -} - -void fhss_update_beacon_info_lifetimes(fhss_structure_t *fhss_structure, uint32_t timestamp) -{ - -} diff --git a/test/nanostack/unittest/stub/fhss_stub.h b/test/nanostack/unittest/stub/fhss_stub.h deleted file mode 100644 index acd4ab80eafe..000000000000 --- a/test/nanostack/unittest/stub/fhss_stub.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __FHSS_STUB_H__ -#define __FHSS_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int int_value; - int8_t int8_value; - bool bool_value; - bool bad_channel_bool_value; - bool channel_type_bool_value; - bool tx_allowed_bool_value; - fhss_structure_t fhss_struct; - fhss_beacon_info_t beacon_info; - fhss_failed_tx_t fhss_failed_tx; -} fhss_stub_def; - -extern fhss_stub_def fhss_stub; - -uint32_t fhss_get_remaining_slots_stub(struct fhss_api *fhss_api); - -#ifdef __cplusplus -} -#endif - -#endif // __FHSS_STUB_H__ diff --git a/test/nanostack/unittest/stub/fnet_mdns_stub.c b/test/nanostack/unittest/stub/fnet_mdns_stub.c deleted file mode 100644 index 45916702c4d6..000000000000 --- a/test/nanostack/unittest/stub/fnet_mdns_stub.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2017, 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 "fnet.h" -#include "fnet_mdns.h" -#include "fnet_mdns_stub.h" - -// Test data -fnet_mdns_data_stub_t fnet_mdns_data_stub = { - .fnet_mdns_descriptor = NULL, - .fnet_mdns_service_descriptor = NULL, - .announce_cnt = 0, - .release_cnt = 0, - .unregister_cnt = 0 -}; - -// Test cases - -fnet_mdns_desc_t fnet_mdns_init( struct fnet_mdns_params *params ) -{ - if((params == 0) || (params->netif_desc == 0) || (params->name == 0)) - { - return NULL; - } - - return fnet_mdns_data_stub.fnet_mdns_descriptor; -} - -void fnet_mdns_release(fnet_mdns_desc_t mdns_desc) -{ - fnet_mdns_data_stub.release_cnt++; -} - -fnet_mdns_service_desc_t fnet_mdns_service_register(fnet_mdns_desc_t mdns_desc, const fnet_mdns_service_t *service) -{ - return fnet_mdns_data_stub.fnet_mdns_service_descriptor; -} - -void fnet_mdns_service_unregister(fnet_mdns_service_desc_t service_desc) -{ - fnet_mdns_data_stub.unregister_cnt++; -} - -void fnet_mdns_announce(fnet_mdns_desc_t mdns_desc) -{ - fnet_mdns_data_stub.announce_cnt++; -} - diff --git a/test/nanostack/unittest/stub/fnet_mdns_stub.h b/test/nanostack/unittest/stub/fnet_mdns_stub.h deleted file mode 100644 index 5b1f92d4db04..000000000000 --- a/test/nanostack/unittest/stub/fnet_mdns_stub.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, 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 __FNET_MDNS_STUB_H__ -#define __FNET_MDNS_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - fnet_mdns_desc_t fnet_mdns_descriptor; - fnet_mdns_service_desc_t fnet_mdns_service_descriptor; - int announce_cnt; - int release_cnt; - int unregister_cnt; -} fnet_mdns_data_stub_t; - -extern fnet_mdns_data_stub_t fnet_mdns_data_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __FNET_MDNS_STUB_H__ diff --git a/test/nanostack/unittest/stub/fnet_poll_stub.c b/test/nanostack/unittest/stub/fnet_poll_stub.c deleted file mode 100644 index fe5a27ee8dc7..000000000000 --- a/test/nanostack/unittest/stub/fnet_poll_stub.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2017, 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 "fnet.h" - -void fnet_poll_service( void ) -{ -} diff --git a/test/nanostack/unittest/stub/fnv_hash_stub.c b/test/nanostack/unittest/stub/fnv_hash_stub.c deleted file mode 100644 index 589003262e05..000000000000 --- a/test/nanostack/unittest/stub/fnv_hash_stub.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "Service_Libs/fnv_hash/fnv_hash.h" - -uint32_t fnv_hash_1a_32_reverse_block(const uint8_t *data, uint16_t len) -{ - return 0; -} - -uint32_t fnv_hash_1a_32_reverse_block_update(uint32_t hash, const uint8_t *data, uint16_t len) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/icmpv6_prefix_stub.c b/test/nanostack/unittest/stub/icmpv6_prefix_stub.c deleted file mode 100644 index 63ccaf87a324..000000000000 --- a/test/nanostack/unittest/stub/icmpv6_prefix_stub.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "Common_Protocols/icmpv6_prefix.h" -#include "common_functions.h" - -prefix_entry_t *icmpv6_prefix_add(prefix_list_t *list, const uint8_t *prefixPtr, uint8_t prefix_len, uint32_t lifeTime, uint32_t prefTime, uint8_t flags) -{ - return NULL; -} - -prefix_entry_t *icmpv6_prefix_compare(prefix_list_t *list, const uint8_t *addr, uint8_t prefix_len) -{ - return NULL; -} - - -void icmpv6_prefix_list_free(prefix_list_t *list) -{ -} diff --git a/test/nanostack/unittest/stub/icmpv6_radv_stub.c b/test/nanostack/unittest/stub/icmpv6_radv_stub.c deleted file mode 100644 index 2c0e35c4b4a4..000000000000 --- a/test/nanostack/unittest/stub/icmpv6_radv_stub.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "ns_list.h" -#include "randLIB.h" -#include -#include "nsdynmemLIB.h" -#include "ns_trace.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "ipv6_stack/protocol_ipv6.h" -#include "6LoWPAN/ND/nd_router_object.h" // for nd_ra_timing() -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_radv.h" - -#ifdef RADV_TX - -typedef struct icmp_queued_ra { - uint8_t addr[16]; /* destination address */ - uint8_t abro[16]; /* RFC 6775 ABRO 6LBR address (or ADDR_UNSPECIFIED if no ABRO) */ - bool rs_triggered; /* was queued by an RS */ - uint16_t ticks; /* ticks until transmission (relative to last list entry) */ - protocol_interface_info_entry_t *interface; - ns_list_link_t link; -} icmp_queued_ra_t; - -static NS_LIST_DEFINE(icmp_ra_queue, icmp_queued_ra_t, link); - -void icmpv6_radv_init(protocol_interface_info_entry_t *cur) -{ -} - -void icmpv6_queue_ra(icmp_queued_ra_t *new_ra) -{ -} - -void icmpv6_unqueue_ra(icmp_queued_ra_t *ra) -{ -} - -/* Trigger a single RA from an RS - must be called multiple times if we have multiple ABROs */ -void icmpv6_trigger_ra_from_rs(protocol_interface_info_entry_t *cur, const uint8_t dest[16], const uint8_t abro[16]) -{ - -} - -buffer_t *icmpv6_rs_handler(buffer_t *buf, protocol_interface_info_entry_t *cur) -{ - -} - -void icmpv6_restart_router_advertisements(protocol_interface_info_entry_t *cur, const uint8_t abro[16]) -{ - -} - -void icmpv6_stop_router_advertisements(protocol_interface_info_entry_t *cur, const uint8_t *abro) -{ -} - -void icmpv6_radv_timer(uint16_t ticks) -{ - -} - -#endif /* RADV_TX */ diff --git a/test/nanostack/unittest/stub/icmpv6_stub.c b/test/nanostack/unittest/stub/icmpv6_stub.c deleted file mode 100644 index a6b7fa665b3d..000000000000 --- a/test/nanostack/unittest/stub/icmpv6_stub.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "string.h" -#include "ns_trace.h" -#include "randLIB.h" -#include "NWK_INTERFACE/Include/protocol.h" -#ifdef HAVE_RPL -#include "RPL/rpl_control.h" -#include "RPL/rpl_data.h" -#endif -#include "RPL/rpl_protocol.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_prefix.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "Common_Protocols/ip.h" -#include "Common_Protocols/ipv6.h" -#include "Core/include/socket.h" -#include "ipv6_stack/protocol_ipv6.h" -#include "ip_fsc.h" -#include "ipv6_stack/ipv6_routing_table.h" -#include "Service_Libs/nd_proxy/nd_proxy.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "common_functions.h" -#include "6LoWPAN/ND/nd_router_object.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" - -#define TRACE_GROUP "icmp" - -buffer_t *icmpv6_error(buffer_t *buf, protocol_interface_info_entry_t *cur, uint8_t type, uint8_t code, uint32_t aux) -{ - return NULL; -} - -#ifndef NO_IPV6_PMTUD - -buffer_t *icmpv6_packet_too_big_handler(buffer_t *buf) -{ - return NULL; -} -#endif - -buffer_t *icmpv6_echo_request_handler(buffer_t *buf) -{ - return NULL; -} - -buffer_t *icmpv6_ns_handler(buffer_t *buf) -{ - return NULL; - -} - -int icmpv6_slaac_prefix_update(struct protocol_interface_info_entry *cur, uint8_t *prefix_ptr, uint8_t prefix_len, uint32_t valid_lifetime, uint32_t preferred_lifetime) -{ - return -1; -} - -void icmpv6_slaac_prefix_register_trig(struct protocol_interface_info_entry *cur, uint8_t *prefix_ptr, uint8_t prefix_len) -{ -} - -if_address_entry_t *icmpv6_slaac_address_add(protocol_interface_info_entry_t *cur, uint8_t *prefix_ptr, uint8_t prefix_len, uint32_t valid_lifetime, uint32_t preferred_lifetime, bool skip_dad, slaac_src_e slaac_src) -{ - return NULL; -} - -void icmpv6_recv_ra_routes(protocol_interface_info_entry_t *cur, bool enable) -{ -} - -void icmpv6_recv_ra_prefixes(protocol_interface_info_entry_t *cur, bool enable) -{ -} - -buffer_t *icmpv6_up(buffer_t *buf) -{ - return NULL; -} - -buffer_t *icmpv6_down(buffer_t *buf) -{ - return NULL; -} - -buffer_t *icmpv6_build_rs(protocol_interface_info_entry_t *cur, const uint8_t *dest) -{ - return NULL; -} - -uint8_t *icmpv6_write_icmp_lla(protocol_interface_info_entry_t *cur, uint8_t *dptr, uint8_t icmp_opt, bool must, const uint8_t *ip_addr) -{ - return NULL; -} - -uint8_t *icmpv6_write_prefix_option(const prefix_list_t *prefixes, uint8_t *dptr, uint8_t rpl_prefix, protocol_interface_info_entry_t *cur) -{ - return NULL; -} - -uint8_t *icmpv6_write_mtu_option(uint32_t mtu, uint8_t *dptr) -{ - return NULL; -} - -buffer_t *icmpv6_build_ns(protocol_interface_info_entry_t *cur, const uint8_t target_addr[16], const uint8_t *prompting_src_addr, bool unicast, bool unspecified_source, const aro_t *aro) -{ - return NULL; -} - -void icmpv6_build_echo_req(protocol_interface_info_entry_t *cur, const uint8_t target_addr[16]) -{ -} - -buffer_t *icmpv6_build_dad(protocol_interface_info_entry_t *cur, buffer_t *buf, uint8_t type, const uint8_t dest_addr[16], const uint8_t eui64[8], const uint8_t reg_addr[16], uint8_t status, uint16_t lifetime) -{ - return NULL; -} - -buffer_t *icmpv6_build_na(protocol_interface_info_entry_t *cur, bool solicited, bool override, bool tllao_required, const uint8_t target[static 16], const aro_t *aro, const uint8_t src_addr[static 16]) -{ - return NULL; -} - -buffer_t *icmpv6_na_handler(buffer_t *buf) -{ - return NULL; -} - -buffer_t *icmpv6_build_mld(protocol_interface_info_entry_t *cur, buffer_t *buf, uint8_t type, uint16_t max_response_delay, const uint8_t address[static 16]) -{ - return NULL; -} - -/* Check whether the options section of an ICMPv6 message is well-formed */ -bool icmpv6_options_well_formed(const uint8_t *dptr, uint_fast16_t dlen) -{ - return false; -} - -bool icmpv6_options_well_formed_in_buffer(const buffer_t *buf, uint16_t offset) -{ - return false; -} - -const uint8_t *icmpv6_find_option(const uint8_t *dptr, uint_fast16_t dlen, uint8_t option, uint8_t optlen) -{ - return NULL; -} - -const uint8_t *icmpv6_find_option_in_buffer(const buffer_t *buf, uint_fast16_t offset, uint8_t option, uint8_t optlen) -{ - return NULL; -} diff --git a/test/nanostack/unittest/stub/ip6tos_stub.c b/test/nanostack/unittest/stub/ip6tos_stub.c deleted file mode 100644 index efe9a7133795..000000000000 --- a/test/nanostack/unittest/stub/ip6tos_stub.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 -#include -#include "ip6string.h" - -uint_fast8_t ip6tos(const void *ip6addr, char *p) -{ - return 0; -} - -uint_fast8_t ip6_prefix_tos(const void *prefix, uint_fast8_t prefix_len, char *p) -{ - return 0; -} - -void stoip6(const char *ip6addr, size_t len, void *dest) -{ -} - -unsigned char sipv6_prefixlength(const char *ip6addr) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/ip_fsc_stub.c b/test/nanostack/unittest/stub/ip_fsc_stub.c deleted file mode 100644 index bb2c50d19f44..000000000000 --- a/test/nanostack/unittest/stub/ip_fsc_stub.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "stdint.h" -#include "ip_fsc.h" - -uint16_t ip_fcf_v(uint_fast8_t count, const ns_iovec_t vec[static count]) -{ - return 0; -} - -uint16_t ipv6_fcf(const uint8_t src_address[static 16], const uint8_t dest_address[static 16], - uint16_t data_length, const uint8_t data_ptr[static data_length], uint8_t next_protocol) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/iphc_compress_stub.c b/test/nanostack/unittest/stub/iphc_compress_stub.c deleted file mode 100644 index bac2b34c77c7..000000000000 --- a/test/nanostack/unittest/stub/iphc_compress_stub.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include "ns_list.h" -#include "common_functions.h" -#include "nsdynmemLIB.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/ipv6.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" - -typedef struct iphc_compress_state { - protocol_interface_info_entry_t *const interface; - const uint8_t *in; - uint8_t *out; - uint16_t len; - uint16_t out_space; - uint16_t consumed; - uint16_t produced; - const uint8_t *outer_src_iid; - const uint8_t *outer_dst_iid; -} iphc_compress_state_t; - -buffer_t *iphc_compress(protocol_interface_info_entry_t *cur, buffer_t *buf, uint16_t hc_space) -{ - return NULL; -} diff --git a/test/nanostack/unittest/stub/iphc_decompress_stub.c b/test/nanostack/unittest/stub/iphc_decompress_stub.c deleted file mode 100644 index 446716f6052f..000000000000 --- a/test/nanostack/unittest/stub/iphc_decompress_stub.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include "ns_trace.h" -#include "common_functions.h" -#include "nsdynmemLIB.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#include "Common_Protocols/ipv6.h" -#include "6LoWPAN/IPHC_Decode/iphc_decompress.h" - -#define TRACE_GROUP_IPHC_DECOMPRESS "iphc" - -uint16_t iphc_header_scan(buffer_t *buf, uint16_t *uncompressed_size) -{ - if (uncompressed_size) { - *uncompressed_size = 40; - } - return 0; -} - -buffer_t *iphc_decompress(const lowpan_context_list_t *context_list, buffer_t *buf) -{ - return NULL; -} diff --git a/test/nanostack/unittest/stub/ipv6_flow_stub.c b/test/nanostack/unittest/stub/ipv6_flow_stub.c deleted file mode 100644 index cf3a817072f7..000000000000 --- a/test/nanostack/unittest/stub/ipv6_flow_stub.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" - -#include "ipv6_flow.h" - -bool ipv6_flow_auto_label = true; - -uint_fast24_t ipv6_flow_5tuple(const uint8_t src_addr[static 16], - const uint8_t dst_addr[static 16], - uint8_t protocol, - uint16_t src_port, - uint16_t dst_port) -{ - return 1; -} - -uint_fast24_t ipv6_flow_2tuple_flow(const uint8_t src_addr[static 16], - const uint8_t dst_addr[static 16], - uint_fast24_t flow) -{ - return 1; -} - -uint_fast24_t ipv6_flow_random(void) -{ - return 1; -} diff --git a/test/nanostack/unittest/stub/ipv6_fragmentation_stub.c b/test/nanostack/unittest/stub/ipv6_fragmentation_stub.c deleted file mode 100644 index aba6893ed7ae..000000000000 --- a/test/nanostack/unittest/stub/ipv6_fragmentation_stub.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "ns_types.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "common_functions.h" -#include "nsdynmemLIB.h" -#include -#include "ns_trace.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/ip.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/ipv6_fragmentation.h" - -#include "NWK_INTERFACE/Include/protocol_stats.h" - -#define TRACE_GROUP "Ifrg" - -#ifndef NO_IP_FRAGMENT_RX - -/* We would be in trouble if last fragment is < 8 bytes, and we didn't have - * room for the hole descriptor. Avoid a problem by ensuring that we always - * allocate a multiple-of-8 reassembly buffer. - */ -uint16_t ipv6_frag_set_mru(uint16_t frag_mru) -{ - return 0; -} - -void ipv6_frag_timer(uint8_t secs) -{ -} - -buffer_t *ipv6_frag_up(buffer_t *frag_buf, const uint8_t *frag_hdr, uint8_t *nh_ptr, uint16_t payload_length) -{ - return NULL; -} -#endif /* NO_IP_FRAGMENT_RX */ - -#ifndef NO_IP_FRAGMENT_TX -buffer_t *ipv6_frag_down(buffer_t *dgram_buf) -{ - return NULL; -} -#endif /* NO_IP_FRAGMENT_TX */ diff --git a/test/nanostack/unittest/stub/ipv6_resolution_stub.c b/test/nanostack/unittest/stub/ipv6_resolution_stub.c deleted file mode 100644 index 2315e384b9b3..000000000000 --- a/test/nanostack/unittest/stub/ipv6_resolution_stub.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_prefix.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "Common_Protocols/udp.h" -#include "6LoWPAN/ND/nd_router_object.h" // for gp_address_ functions - better place? -#include "ipv6_stack/ipv6_routing_table.h" -#include "ipv6_stack/protocol_ipv6.h" -#include "Common_Protocols/ipv6_resolution.h" -#ifndef NO_TCP -#include "Common_Protocols/tcp.h" -#endif -#include "Service_Libs/whiteboard/whiteboard.h" -#include "Service_Libs/etx/etx.h" -#include "platform/arm_hal_interrupt.h" -#include "common_functions.h" -#include "randLIB.h" - -#include "ipv6_resolution_stub.h" - -#define TRACE_GROUP "ip6r" - - -ipv6_resolution_stub_def ipv6_resolution_stub; - - -void ipv6_interface_resolve_send_ns(ipv6_neighbour_cache_t *cache, ipv6_neighbour_t *entry, bool unicast, uint_fast8_t seq) -{ -} - -void ipv6_interface_resolution_failed(ipv6_neighbour_cache_t *cache, ipv6_neighbour_t *entry) -{ -} - -/* Silly bit of interface glue - ipv6_routing_table.c doesn't know about interface structures, - * but it needs to be able to get from the interface id in the Routing Table and/or - * Destination Cache to the relevant Neighbour Cache - */ -ipv6_neighbour_cache_t *ipv6_neighbour_cache_by_interface_id(int8_t interface_id) -{ - ipv6_resolution_stub.uint8_input_value = interface_id; - return ipv6_resolution_stub.ipv6_neighbour_cache; -} - -void ipv6_send_queued(ipv6_neighbour_t *entry) -{ -} - - -ipv6_neighbour_t *ipv6_interface_resolve_new(protocol_interface_info_entry_t *cur, buffer_t *buf) -{ - return NULL; -} - -/* Attempt a mapping from current information (neighbour cache, hard mappings) */ -bool ipv6_map_ip_to_ll(protocol_interface_info_entry_t *cur, ipv6_neighbour_t *n, const uint8_t ip_addr[16], addrtype_t *ll_type, const uint8_t **ll_addr_out) -{ - return false; -} - -/* Attempt a mapping from current information (neighbour cache, hard mappings) */ -bool ipv6_map_ll_to_ip_link_local(protocol_interface_info_entry_t *cur, addrtype_t ll_type, const uint8_t *ll_addr, uint8_t ip_addr_out[16]) -{ - return false; -} - -/* To comply with ETX returns 0xFFFF when neighbor doesn't exist and 0 when neighbor is currently unknown. */ -uint16_t ipv6_map_ip_to_ll_and_call_ll_addr_handler(protocol_interface_info_entry_t *cur, int8_t interface_id, ipv6_neighbour_t *n, const uint8_t ipaddr[16], ll_addr_handler_t *ll_addr_handler_ptr) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/ipv6_resolution_stub.h b/test/nanostack/unittest/stub/ipv6_resolution_stub.h deleted file mode 100644 index 11b4670f1fa2..000000000000 --- a/test/nanostack/unittest/stub/ipv6_resolution_stub.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2017, 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 __IPV6_RESOLUTION_STUB_H__ -#define __IPV6_RESOLUTION_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" - -typedef struct { - uint8_t uint8_value; - int8_t int8_value; - int int_value; - uint8_t *uint8_ptr; - char *char_ptr; - bool bool_value; - uint8_t uint8_input_value; - ipv6_neighbour_cache_t *ipv6_neighbour_cache; -} ipv6_resolution_stub_def; - -extern ipv6_resolution_stub_def ipv6_resolution_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __IPV6_RESOLUTION_STUB_H__ diff --git a/test/nanostack/unittest/stub/ipv6_routing_table_stub.c b/test/nanostack/unittest/stub/ipv6_routing_table_stub.c deleted file mode 100644 index ad799c0e23fb..000000000000 --- a/test/nanostack/unittest/stub/ipv6_routing_table_stub.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2012-2017, 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. - */ -/* - * ipv6_routing_table.c - * - * Implements IPv6 Neighbour Cache (RFC 4861), Destination Cache (RFC 4861), - * and Routing Table (RFC 4191, incorporating the RFC 4861 Prefix List) - */ -#include "nsconfig.h" -#include "ns_types.h" -#include "common_functions.h" -#include "ip6string.h" -#include "randLIB.h" -#include "ns_trace.h" -#include "string.h" -#include "net_interface.h" -#include "Core/include/address.h" -#include "ipv6_stack/ipv6_routing_table.h" -#include "Common_Protocols/icmpv6.h" -#include "ipv6_stack/protocol_ipv6.h" -#include "NWK_INTERFACE/Include/protocol_abstract.h" -#include "nsdynmemLIB.h" - -#ifndef FEA_TRACE_SUPPORT -#define TRACE_LEVEL_DEBUG 0 -#endif -#define TRACE_GROUP "rout" - -#define NCACHE_MAX_LONG_TERM 8 -#define NCACHE_MAX_SHORT_TERM 32 - -#define DCACHE_MAX_LONG_TERM 16 -#define DCACHE_MAX_SHORT_TERM 64 - -#define NCACHE_GC_PERIOD 20 -#define DCACHE_GC_PERIOD 20 - -#define NCACHE_GC_AGE 600 -#define DCACHE_GC_AGE 30 - -void ipv6_router_gone(ipv6_neighbour_cache_t *cache, ipv6_neighbour_t *entry) -{ -} - -int8_t ipv6_neighbour_set_current_max_cache(uint16_t max_cache) -{ - return 0; -} - - -void ipv6_neighbour_cache_init(ipv6_neighbour_cache_t *cache, int8_t interface_id) -{ -} - -void ipv6_neighbour_cache_flush(ipv6_neighbour_cache_t *cache) -{ -} - - -ipv6_neighbour_t *ipv6_neighbour_lookup(ipv6_neighbour_cache_t *cache, const uint8_t *address) -{ - return NULL; -} - -void ipv6_neighbour_entry_remove(ipv6_neighbour_cache_t *cache, ipv6_neighbour_t *entry) -{ -} - -ipv6_neighbour_t *ipv6_neighbour_lookup_or_create(ipv6_neighbour_cache_t *cache, const uint8_t *address/*, bool tentative*/) -{ - return NULL; -} - -ipv6_neighbour_t *ipv6_neighbour_lookup_or_create_by_interface_id(int8_t interface_id, const uint8_t *address/*, bool tentative*/) -{ - return NULL; -} - -ipv6_neighbour_t *ipv6_neighbour_used(ipv6_neighbour_cache_t *cache, ipv6_neighbour_t *entry) -{ - return NULL; -} - -bool ipv6_neighbour_is_probably_reachable(ipv6_neighbour_cache_t *cache, ipv6_neighbour_t *n) -{ - return false; -} - -bool ipv6_neighbour_addr_is_probably_reachable(ipv6_neighbour_cache_t *cache, const uint8_t *address) -{ - return false; -} - -bool ipv6_neighbour_ll_addr_match(const ipv6_neighbour_t *entry, addrtype_t ll_type, const uint8_t *ll_address) -{ - return false; -} - -void ipv6_neighbour_invalidate_ll_addr(ipv6_neighbour_cache_t *cache, addrtype_t ll_type, const uint8_t *ll_address) -{ -} - -void ipv6_neighbour_set_state(ipv6_neighbour_cache_t *cache, ipv6_neighbour_t *entry, ip_neighbour_cache_state_t state) -{ -} - -/* Called when LL address information is received other than in an NA (NS source, RS source, RA source, Redirect target) */ -void ipv6_neighbour_entry_update_unsolicited(ipv6_neighbour_cache_t *cache, ipv6_neighbour_t *entry, addrtype_t type, const uint8_t *ll_address/*, bool tentative*/) -{ -} - -ipv6_neighbour_t *ipv6_neighbour_update_unsolicited(ipv6_neighbour_cache_t *cache, const uint8_t *ip_address, addrtype_t type, const uint8_t *ll_address/*, bool tentative*/) -{ - return NULL; -} - -void ipv6_neighbour_update_from_na(ipv6_neighbour_cache_t *cache, ipv6_neighbour_t *entry, uint8_t flags, addrtype_t ll_type, const uint8_t *ll_address) -{ -} - -void ipv6_neighbour_reachability_confirmation(const uint8_t ip_address[__static 16], int8_t interface_id) -{ -} - -void ipv6_neighbour_cache_print(const ipv6_neighbour_cache_t *cache, route_print_fn_t *print_fn) -{ -} - - - -void ipv6_neighbour_cache_slow_timer(ipv6_neighbour_cache_t *cache, uint8_t seconds) -{ -} - -void ipv6_neighbour_cache_fast_timer(ipv6_neighbour_cache_t *cache, uint16_t ticks) -{ -} - -void ipv6_destination_cache_print(route_print_fn_t *print_fn) -{ -} - -ipv6_destination_t *ipv6_destination_lookup_or_create(const uint8_t *address, int8_t interface_id) -{ - return NULL; -} - -void ipv6_destination_redirect(const uint8_t *dest_addr, const uint8_t *sender_addr, const uint8_t *redirect_addr, int8_t interface_id, addrtype_t ll_type, const uint8_t *ll_address) -{ -} - -void ipv6_route_table_set_predicate_fn(ipv6_route_src_t src, ipv6_route_predicate_fn_t fn) -{ -} - -void ipv6_route_table_set_next_hop_fn(ipv6_route_src_t src, ipv6_route_next_hop_fn_t fn) -{ -} - -void ipv6_destination_release(ipv6_destination_t *dest) -{ -} - -void ipv6_destination_cache_timer(uint8_t seconds) -{ -} - -void ipv6_route_table_print(route_print_fn_t *print_fn) -{ -} - -ipv6_route_t *ipv6_route_choose_next_hop(const uint8_t *dest, int8_t interface_id, ipv6_route_predicate_fn_t *predicate) -{ - return NULL; -} - -ipv6_route_t *ipv6_route_lookup_with_info(const uint8_t *prefix, uint8_t prefix_len, int8_t interface_id, const uint8_t *next_hop, ipv6_route_src_t source, void *info, int_fast16_t src_id) -{ - return NULL; -} - -uint8_t ipv6_route_pref_to_metric(int_fast8_t pref) -{ - return 0; -} - -ipv6_route_t *ipv6_route_add(const uint8_t *prefix, uint8_t prefix_len, int8_t interface_id, const uint8_t *next_hop, ipv6_route_src_t source, uint32_t lifetime, int_fast8_t pref) -{ - return NULL; -} - -ipv6_route_t *ipv6_route_add_with_info(const uint8_t *prefix, uint8_t prefix_len, int8_t interface_id, const uint8_t *next_hop, ipv6_route_src_t source, void *info, uint8_t source_id, uint32_t lifetime, int_fast8_t pref) -{ - return NULL; -} - -ipv6_route_t *ipv6_route_add_metric(const uint8_t *prefix, uint8_t prefix_len, int8_t interface_id, const uint8_t *next_hop, ipv6_route_src_t source, void *info, uint8_t source_id, uint32_t lifetime, uint8_t metric) -{ - return NULL; -} - -int_fast8_t ipv6_route_delete(const uint8_t *prefix, uint8_t prefix_len, int8_t interface_id, const uint8_t *next_hop, ipv6_route_src_t source) -{ - return -1; -} - -int_fast8_t ipv6_route_delete_with_info(const uint8_t *prefix, uint8_t prefix_len, int8_t interface_id, const uint8_t *next_hop, ipv6_route_src_t source, void *info, int_fast16_t source_id) -{ - return -1; -} - -void ipv6_route_table_remove_interface(int8_t interface_id) -{ -} - -void ipv6_route_table_modify_router_metric(int8_t interface_id, const uint8_t *addr, ipv6_route_src_t source, uint8_t keep, uint8_t toggle) -{ -} - -void ipv6_route_table_remove_info(int8_t interface_id, ipv6_route_src_t source, void *info) -{ -} - -void ipv6_route_table_ttl_update(uint16_t seconds) -{ -} - -void ipv6_neighbour_reachability_problem(const uint8_t ip_address[__static 16], int8_t interface_id) -{ -} - -void ipv6_route_table_set_max_entries(int8_t interface_id, ipv6_route_src_t source, uint8_t max_entries) -{ -} - -bool ipv6_route_table_source_was_invalidated(ipv6_route_src_t src) -{ - return false; -} - -// Called when event queue is empty - no pending buffers so can clear invalidation flags. -void ipv6_route_table_source_invalidated_reset(void) -{ - -} diff --git a/test/nanostack/unittest/stub/ipv6_stub.c b/test/nanostack/unittest/stub/ipv6_stub.c deleted file mode 100644 index 422e10e41763..000000000000 --- a/test/nanostack/unittest/stub/ipv6_stub.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#define _HAVE_IPV6 - -#ifdef _HAVE_IPV6 - -#include "ns_types.h" -#include "string.h" -#include "nsdynmemLIB.h" -#include "Core/include/socket.h" -#include "ns_trace.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/ipv6_fragmentation.h" -#include "ipv6_stack/protocol_ipv6.h" -#include "ipv6_stack/ipv6_routing_table.h" -#include "Common_Protocols/icmpv6.h" -//#include "6LoWPAN/Bootstraps/network_lib.h" -//#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "Service_Libs/whiteboard/whiteboard.h" -#include "common_functions.h" - -#define TRACE_GROUP_IPv6 "ipv6" - -bool ipv6_new_layers_for_unicast; -bool ipv6_new_layers_for_lowpan_multicast; -bool ipv6_new_layers_for_ethernet_multicast; - -bool ipv6_use_new_layers(buffer_t *buf, bool multicast) -{ - return false; -} - -void ipv6_set_exthdr_provider(ipv6_route_src_t src, ipv6_exthdr_provider_fn_t *fn) -{ -} - - -buffer_routing_info_t *ipv6_buffer_route_to(buffer_t *buf, const uint8_t *next_hop, protocol_interface_info_entry_t *next_if) -{ - -} - -buffer_routing_info_t *ipv6_buffer_route(buffer_t *buf) -{ - return NULL; -} - -buffer_t *ipv6_down(buffer_t *buf) -{ - return NULL; -} - -buffer_t *ipv6_up(buffer_t *buf) -{ - return NULL; -} - -uint16_t ipv6_header_size_required(buffer_t *buf) -{ - return 0; -} - -uint16_t ipv6_max_unfragmented_payload(buffer_t *buf, uint16_t mtu_limit) -{ - return 0; -} - -uint16_t ipv6_mtu(buffer_t *buf) -{ - return 0; -} - -buffer_t *ipv6_down_new(buffer_t *buf) -{ - return NULL; -} - -buffer_t *ipv6_forwarding_down(buffer_t *buf) -{ - return NULL; -} - -buffer_t *ipv6_consider_forwarding_received_packet(buffer_t *buf, protocol_interface_info_entry_t *cur, const sockaddr_t *ll_src) -{ - return NULL; -} - -buffer_t *ipv6_forwarding_up(buffer_t *buf) -{ - return NULL; -} - -#endif /* _HAVE_IPV6 */ - diff --git a/test/nanostack/unittest/stub/isqrt_stub.c b/test/nanostack/unittest/stub/isqrt_stub.c deleted file mode 100644 index 7588477c718f..000000000000 --- a/test/nanostack/unittest/stub/isqrt_stub.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include "ns_types.h" -#include "isqrt.h" - -uint32_t isqrt32(uint32_t n) -{ - return (uint32_t)sqrt(n); -} diff --git a/test/nanostack/unittest/stub/libDHCPv6_server_stub.c b/test/nanostack/unittest/stub/libDHCPv6_server_stub.c deleted file mode 100644 index b5b4583ce9e8..000000000000 --- a/test/nanostack/unittest/stub/libDHCPv6_server_stub.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 -#include -#include -#include "libDHCPv6/libDHCPv6_server.h" -#include "libDHCPv6/libDHCPv6.h" -#include "common_functions.h" - -void libdhcpv6_gua_servers_time_update(uint32_t timeUpdateInSeconds) -{ -} - -dhcpv6_gua_server_entry_s *libdhcpv6_server_data_get_by_prefix_and_interfaceid(int8_t interfaceId, const uint8_t *prefixPtr) -{ - return NULL; -} - -dhcpv6_gua_server_entry_s *libdhcpv6_server_data_get_by_prefix_and_socketinstance(uint16_t socketInstance, uint8_t *prefixPtr) -{ - return NULL; -} - - -dhcpv6_gua_server_entry_s *libdhcpv6_gua_server_allocate(uint8_t *prefix, int8_t interfaceId, uint8_t *serverDUID, uint16_t serverDUIDType, dhcp_address_prefer_timeout_cb *prefered_timeout_cb) -{ - return NULL; -} - -void libdhcpv6_gua_server_free_by_prefix_and_interfaceid(uint8_t *prefix, int8_t interfaceId) -{ -} - -dhcpv6_alloacted_address_entry_t *libdhcpv6_address_entry_allocate(uint32_t validLifetime) -{ - return NULL; -} - -dhcpv6_alloacted_address_entry_t *libdhcpv6_address_get_from_allocated_list(dhcpv6_gua_server_entry_s *serverInfo, const uint8_t *address) -{ - return NULL; -} - -void libdhcpv6_address_rm_from_allocated_list(dhcpv6_gua_server_entry_s *serverInfo, const uint8_t *address) -{ - -} - -dhcpv6_alloacted_address_entry_t *libdhcpv6_address_allocated_list_scan(dhcpv6_gua_server_entry_s *serverInfo, uint8_t *linkId, uint16_t linkType, uint32_t iaID, uint32_t T0, uint32_t T1, bool allocateNew) -{ - return NULL; -} - diff --git a/test/nanostack/unittest/stub/libDHCPv6_stub.c b/test/nanostack/unittest/stub/libDHCPv6_stub.c deleted file mode 100644 index 81af73537883..000000000000 --- a/test/nanostack/unittest/stub/libDHCPv6_stub.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include -#include -#include "common_functions.h" -#include "libDHCPv6/libDHCPv6.h" -#include "randLIB.h" -#include "nsdynmemLIB.h" - - - -uint32_t libdhcpv6_txid_get(void) -{ - return 0; -} - -uint32_t libdhcpv6_renew_time_define(dhcpv6_client_server_data_t *addresInfo) -{ - return 0; -} - -dhcpv6_client_server_data_t *libdhcvp6_nontemporalAddress_server_data_allocate(int8_t interfaceId, uint8_t instanceId, uint8_t *duiId, uint16_t duiLinkType, uint8_t *nonTemporalPrefix, uint8_t *serverIPv6Address) -{ - return NULL; -} - -void libdhcvp6_nontemporalAddress_server_data_free(dhcpv6_client_server_data_t *removedEntry) -{ -} - -dhcpv6_client_server_data_t *libdhcpv6_nonTemporal_entry_get_by_instance(uint8_t instanceId) -{ - return NULL; -} -uint8_t libdhcpv6_nonTemporal_entry_get_unique_instance_id(void) -{ - return 0; -} - -dhcpv6_client_server_data_t *libdhcpv6_nonTemporal_entry_get_by_iaid(uint32_t iaId) -{ - return NULL; -} - -dhcpv6_client_server_data_t *libdhcpv6_nonTemporal_entry_get_by_transactionId(uint32_t txId) -{ - return NULL; -} - -dhcpv6_client_server_data_t *libdhcpv6_nonTemporal_entry_get_by_prefix(int8_t interfaceId, uint8_t *prefix) -{ - return NULL; -} - -uint16_t libdhcpv6_duid_option_size(uint16_t linkType) -{ - return 0; -} - -uint16_t libdhcpv6_client_data_option_size(uint16_t linkType) -{ - return 0; -} - -uint16_t libdhcvp6_request_option_size(uint8_t optionCnt) -{ - return 0; -} - -uint16_t libdhcpv6_non_temporal_address_size(bool addressDefined) -{ - return 0; -} - -int libdhcpv6_message_malformed_check(uint8_t *ptr, uint16_t data_len) -{ - return 0; -} - -uint8_t *libdhcpv6_header_write(uint8_t *ptr, uint8_t msgType, uint32_t transActionId) -{ - return NULL; -} - -uint8_t *libdhcpv6_elapsed_time_option_write(uint8_t *ptr, uint16_t elapsedTime) -{ - return NULL; -} - -uint8_t *libdhcpv6_rapid_commit_option_write(uint8_t *ptr) -{ - return NULL; -} - -uint8_t *libdhcvp6_vendor_specific_option_write(uint8_t *ptr, uint8_t *data, uint16_t dataLength) -{ - return NULL; -} - -uint8_t *libdhcvp6_request_option_write(uint8_t *ptr, uint8_t optionCnt, uint16_t *optionPtr) -{ - return NULL; -} - -uint8_t *libdhcpv6_duid_option_write(uint8_t *ptr, uint16_t duidRole, const dhcp_link_options_params_t *duid) -{ - return NULL; -} - -uint8_t *libdhcpv6_prefix_delegation_info_option_write(uint8_t *ptr, uint32_t iaId) -{ - return NULL; -} - -uint8_t *libdhcpv6_identity_association_option_write(uint8_t *ptr, uint32_t iaID, uint32_t TimerT1, uint32_t TimerT2, bool withAddress) -{ - return NULL; -} - -uint8_t *libdhcpv6_ia_address_option_write(uint8_t *ptr, const uint8_t *addressPtr, uint32_t preferredValidLifeTime, uint32_t validLifeTime) -{ - return NULL; -} - -uint8_t *libdhcpv6_status_code_write(uint8_t *ptr, uint16_t statusCode) -{ - return NULL; -} - -uint8_t *libdhcpv6_client_last_transaction_time_option_write(uint8_t *ptr, uint32_t last_transaction_Time) -{ - return NULL; -} - -int libdhcpv6_message_option_discover(uint8_t *ptr, uint16_t data_len, uint16_t discovered_type, dhcp_options_msg_t *option_info) -{ - return -1; -} - -int libdhcpv6_compare_DUID(dhcp_link_options_params_t *targetId, dhcp_link_options_params_t *parsedId) -{ - return -1; -} - -int libdhcpv6_reply_message_option_validate(dhcp_link_options_params_t *clientId, dhcp_link_options_params_t *serverId, dhcp_ia_non_temporal_params_t *dhcp_ia_non_temporal_params, uint8_t *ptr, uint16_t data_length) -{ - return 0; -} - -int libdhcpv6_advertisment_message_option_validate(dhcp_link_options_params_t *clientId, dhcp_link_options_params_t *serverId, dhcp_ia_non_temporal_params_t *dhcp_ia_non_temporal_params, uint8_t *ptr, uint16_t data_length) -{ - return 0; -} - -int libdhcpv6_renew_message_options_validate(uint8_t *ptr, uint16_t data_length, dhcp_link_options_params_t *clientLinkData, dhcp_link_options_params_t *serverLinkData, dhcp_ia_non_temporal_params_t *dhcp_ia_non_temporal_params) -{ - return 0; -} - -int libdhcpv6_solication_message_options_validate(uint8_t *ptr, uint16_t data_length, dhcp_link_options_params_t *clientLink, dhcp_ia_non_temporal_params_t *dhcp_ia_non_temporal_params) -{ - return 0; -} - -bool libdhcpv6_time_elapsed_option_at_packet(uint8_t *ptr, uint16_t length) -{ - return false; -} - -bool libdhcpv6_rapid_commit_option_at_packet(uint8_t *ptr, uint16_t length) -{ - return false; -} - -int libdhcpv6_get_duid_by_selected_type_id_opt(uint8_t *ptr, uint16_t data_length, uint16_t type , dhcp_link_options_params_t *params) -{ - return -1; -} - -int libdhcpv6_get_IA_address(uint8_t *ptr, uint16_t data_length, dhcp_ia_non_temporal_params_t *params) -{ - return -1; -} - -uint16_t libdhcpv6_address_request_message_len(uint16_t clientLinkType, uint16_t serverLinkType, uint8_t requstOptionCnt) -{ - return 0; -} - -uint16_t libdhcpv6_address_reply_message_len(uint16_t clientLinkType, uint16_t serverLinkType, uint16_t vendorDataLen, bool rapidCommon, bool status) -{ - return 0; -} - -uint8_t *libdhcpv6_generic_nontemporal_address_message_write(uint8_t *ptr, dhcpv6_solication_base_packet_s *packet, dhcpv6_ia_non_temporal_address_s *nonTemporalAddress, dhcp_link_options_params_t *serverLink) -{ - return NULL; -} - -uint8_t *libdhcpv6_reply_message_write(uint8_t *ptr, dhcpv6_reply_packet_s *replyPacket, dhcpv6_ia_non_temporal_address_s *nonTemporalAddress, dhcpv6_vendor_data_packet_s *vendorData) -{ - return NULL; -} - -uint16_t libdhcpv6_solication_message_length(uint16_t clientLinkType, bool addressDefined, uint8_t requestOptionCount) -{ - return 0; -} - -bool libdhcpv6_gua_server_list_empty(void) -{ - return true; -} diff --git a/test/nanostack/unittest/stub/load_balance_stub.c b/test/nanostack/unittest/stub/load_balance_stub.c deleted file mode 100644 index b637add36fda..000000000000 --- a/test/nanostack/unittest/stub/load_balance_stub.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_callback_timer.h" -#include "string.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "randLIB.h" -#include "mlme.h" -#include "load_balance_api.h" - - -load_balance_api_t *load_balance_create(load_balance_network_switch_notify *lb_notify_cb, bool actvated_beacon_periodic_tx) -{ - return NULL; -} - -int load_balance_delete(load_balance_api_t *api) -{ - return 0; -} - -int load_balance_network_threshold_set(load_balance_api_t *api, uint8_t threshold_min, uint8_t threshold_max) -{ - return 0; -} - -int load_balance_network_load_monitor_enable(load_balance_api_t *api, uint16_t expected_node_count, uint8_t network_load_scaler, load_balance_api_get_node_count *get_count_cb, load_balance_api_set_load_level *set_new_load_cb) -{ - return 0; -} - -int load_balance_network_load_monitor_disable(load_balance_api_t *api) -{ - return 0; -} - -int load_balance_set_max_probability(load_balance_api_t *api, uint8_t max_p) -{ - return 0; -} - diff --git a/test/nanostack/unittest/stub/lowpan_context_stub.c b/test/nanostack/unittest/stub/lowpan_context_stub.c deleted file mode 100644 index bfcb6e72df79..000000000000 --- a/test/nanostack/unittest/stub/lowpan_context_stub.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "6LoWPAN/IPHC_Decode/lowpan_context.h" -#include "common_functions.h" - -#define TRACE_GROUP_LOWPAN_CONTEXT "lCon" - -lowpan_context_t *lowpan_contex_get_by_id(const lowpan_context_list_t *list, uint8_t id) -{ - return NULL; -} - -lowpan_context_t *lowpan_context_get_by_address(const lowpan_context_list_t *list, const uint8_t *ipv6Address) -{ - return NULL; -} - - -int_fast8_t lowpan_context_update(lowpan_context_list_t *list, uint8_t cid_flags, uint16_t lifetime, const uint8_t *prefix, uint_fast8_t len, bool stable) -{ - return 0; -} - -void lowpan_context_list_free(lowpan_context_list_t *list) -{ -} - -void lowpan_context_timer(lowpan_context_list_t *list, uint_fast16_t ticks) -{ -} - diff --git a/test/nanostack/unittest/stub/mac_data_poll_stub.c b/test/nanostack/unittest/stub/mac_data_poll_stub.c deleted file mode 100644 index 6799bb45b13c..000000000000 --- a/test/nanostack/unittest/stub/mac_data_poll_stub.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/MAC/mac_data_poll.h" - -void mac_data_poll_init_protocol_poll(struct protocol_interface_info_entry *rf_mac_setup) -{ - -} -void mac_data_poll_disable(struct protocol_interface_info_entry *cur) -{ - -} - -uint32_t mac_data_poll_host_poll_time_max(struct protocol_interface_info_entry *cur) -{ - return 0; -} - -void mac_data_poll_protocol_poll_mode_decrement(struct protocol_interface_info_entry *cur) -{ - -} - -void mac_data_poll_protocol_poll_mode_disable(struct protocol_interface_info_entry *cur) -{ - -} - -void mac_data_poll_enable_check(struct protocol_interface_info_entry *cur) -{ - -} - -int8_t mac_data_poll_host_mode_get(struct protocol_interface_info_entry *cur, net_host_mode_t *mode) -{ - return 0; -} - -void mac_data_poll_cb_run(int8_t interface_id) -{ - -} - -int8_t mac_data_poll_host_mode_set(struct protocol_interface_info_entry *cur, net_host_mode_t mode, uint32_t poll_time) -{ - return 0; -} - -void mac_data_poll_init(struct protocol_interface_info_entry *cur) -{ - -} - -void mac_data_poll_radio_disable_check(struct protocol_interface_rf_mac_setup *rf_mac_setup) -{ - -} - -uint32_t mac_data_poll_get_max_sleep_period(struct protocol_interface_info_entry *cur) -{ - return 0; -} - -uint32_t mac_data_poll_host_timeout(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -void mac_poll_timer_trig(uint32_t poll_time, protocol_interface_info_entry_t *cur) -{ - -} - -void mac_mlme_poll_confirm(protocol_interface_info_entry_t *cur, const mlme_poll_conf_t *confirm) -{ - -} diff --git a/test/nanostack/unittest/stub/mac_filter_stub.c b/test/nanostack/unittest/stub/mac_filter_stub.c deleted file mode 100644 index e2cc2a811c64..000000000000 --- a/test/nanostack/unittest/stub/mac_filter_stub.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include -#include "ns_types.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "common_functions.h" -#include "nsdynmemLIB.h" -#include "MAC/IEEE802_15_4/mac_header_helper_functions.h" -#include "mac_filter_api.h" -#include "mac_filter.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "mac_common_defines.h" - -#include "mac_filter_stub.h" - -mac_filter_stub_def_t mac_filter_stub_def; - -int_fast8_t mac_filter_start(int8_t interface_id, int16_t lqi_m, int16_t lqi_add, int16_t dbm_m, int16_t dbm_add) -{ - return 0; -} - -void mac_filter_stop(int8_t interface_id) -{ -} - -int_fast8_t mac_filter_set_address_mapping(int8_t interface_id, mac_filter_map_short_to_extended_cb *long_cb, mac_filter_map_extented_to_short_cb *short_cb) -{ - return 0; -} - -int_fast8_t mac_filter_clear(int8_t interface_id) -{ - return 0; -} - -int_fast8_t mac_filter_delete_short(int8_t interface_id, uint16_t mac16) -{ - return 0; -} - -int_fast8_t mac_filter_delete_long(int8_t interface_id, uint8_t mac64[8]) -{ - return 0; -} - -int_fast8_t mac_filter_add_short(int8_t interface_id, uint16_t mac16, int16_t lqi_m, int16_t lqi_add, int16_t dbm_m, int16_t dbm_add) -{ - return 0; -} - -int_fast8_t mac_filter_add_long(int8_t interface_id, uint8_t mac64[8], int16_t lqi_m, int16_t lqi_add, int16_t dbm_m, int16_t dbm_add) -{ - return 0; -} - -int_fast8_t mac_filter_modify_link_quality(int8_t interface_id, mac_pre_parsed_frame_t *mac_frame) -{ - return mac_filter_stub_def.value_int8; -} - diff --git a/test/nanostack/unittest/stub/mac_filter_stub.h b/test/nanostack/unittest/stub/mac_filter_stub.h deleted file mode 100644 index 5667e069f9a4..000000000000 --- a/test/nanostack/unittest/stub/mac_filter_stub.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016, 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 __MAC_FILTER_STUB_H__ -#define __MAC_FILTER_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int8_t value_int8; -} mac_filter_stub_def_t; - -extern mac_filter_stub_def_t mac_filter_stub_def; - - -#ifdef __cplusplus -} -#endif - -#endif // __MAC_FILTER_STUB_H__ diff --git a/test/nanostack/unittest/stub/mac_header_helper_functions_stub.c b/test/nanostack/unittest/stub/mac_header_helper_functions_stub.c deleted file mode 100644 index 1767d0559a2a..000000000000 --- a/test/nanostack/unittest/stub/mac_header_helper_functions_stub.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2016, 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 "ns_types.h" -#include "string.h" -#include "mlme.h" -#include "mac_api.h" -#include "MAC/IEEE802_15_4/mac_header_helper_functions.h" -#include "common_functions.h" -#include "mac_common_defines.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "mac_header_helper_functions_stub.h" - -mac_header_helper_functions_def mac_header_helper_functions_stub; - -uint8_t mac_security_mic_length_get(uint8_t security_level) -{ - return mac_header_helper_functions_stub.uint8_value; -} - -uint8_t mac_header_security_aux_header_length(uint8_t security_level, uint8_t keyIdmode) -{ - return mac_header_helper_functions_stub.uint8_value; -} - -uint8_t mac_header_address_length(const mac_fcf_sequence_t *fcf) -{ - return mac_header_helper_functions_stub.uint8_value; -} - - -void mac_header_security_parameter_set(mac_aux_security_header_t *header, const mlme_security_t *frame_setup) -{ - if( header ){ - *header = mac_header_helper_functions_stub.security_header; - } -} - -void mac_header_parse_fcf_dsn(mac_fcf_sequence_t *header, const uint8_t *ptr) -{ - *header = mac_header_helper_functions_stub.fcf; -} - -void mac_header_security_components_read(mac_pre_parsed_frame_t *buffer, mlme_security_t *security_params) -{ - if (security_params) { - security_params->KeyIdMode = mac_header_helper_functions_stub.security_header.KeyIdMode; - security_params->KeyIndex = mac_header_helper_functions_stub.security_header.KeyIndex; - security_params->SecurityLevel = mac_header_helper_functions_stub.security_header.securityLevel; - memcpy(security_params->Keysource, mac_header_helper_functions_stub.security_header.Keysource, 8); - - } -} - -uint16_t mac_header_get_src_panid(const mac_fcf_sequence_t *header, const uint8_t *ptr) -{ - return mac_header_helper_functions_stub.pan_src; -} - -uint16_t mac_header_get_dst_panid(const mac_fcf_sequence_t *header, const uint8_t *ptr) -{ - return mac_header_helper_functions_stub.uint16_value; -} - -void mac_header_get_src_address(const mac_fcf_sequence_t *header, const uint8_t *ptr, uint8_t *address_ptr) -{ - if (address_ptr) { - memcpy(address_ptr, mac_header_helper_functions_stub.src_address, 8); - } -} - -void mac_header_get_dst_address(const mac_fcf_sequence_t *header, const uint8_t *ptr, uint8_t *address_ptr) -{ - if (address_ptr) { - memcpy(address_ptr, mac_header_helper_functions_stub.dst_address, 8); - } -} - -uint16_t mcps_payload_length_from_received_frame(const mac_pre_parsed_frame_t *buffer) -{ - return mac_header_helper_functions_stub.uint16_value; -} - -uint8_t mcps_mac_header_length_from_received_frame(const mac_pre_parsed_frame_t *buffer) -{ - return mac_header_helper_functions_stub.uint8_value; -} - -uint8_t *mcps_mac_payload_pointer_get(const mac_pre_parsed_frame_t *buffer) -{ - return mac_header_helper_functions_stub.uint8_ptr; -} - -uint8_t *mcps_security_mic_pointer_get(const mac_pre_parsed_frame_t *buffer) -{ - return mac_header_helper_functions_stub.uint8_ptr; -} - -uint8_t *mcps_mac_security_aux_header_start_pointer_get(const mac_pre_parsed_frame_t *buffer) -{ - return mac_header_helper_functions_stub.uint8_ptr; -} - -uint8_t mcps_mac_command_frame_id_get(const mac_pre_parsed_frame_t *buffer) -{ - return mac_header_helper_functions_stub.uint8_value; -} - -uint32_t mcps_mac_security_frame_counter_read(const mac_pre_parsed_frame_t *buffer) -{ - return mac_header_helper_functions_stub.security_header.frameCounter; -} - -uint8_t * mcps_generic_header_write(uint8_t *ptr, const mac_pre_build_frame_t *buffer) -{ - return mac_header_helper_functions_stub.uint8_ptr; -} - diff --git a/test/nanostack/unittest/stub/mac_header_helper_functions_stub.h b/test/nanostack/unittest/stub/mac_header_helper_functions_stub.h deleted file mode 100644 index 9a7cfce19f06..000000000000 --- a/test/nanostack/unittest/stub/mac_header_helper_functions_stub.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 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 __MAC_HEADER_HELPER_FUNCTIONS_STUB_H__ -#define __MAC_HEADER_HELPER_FUNCTIONS_STUB_H__ - -#include "inttypes.h" -#include "mac_common_defines.h" - -typedef struct mac_header_helper_functions { - uint8_t uint8_value; - uint16_t uint16_value; - uint32_t uint32_value; - uint8_t *uint8_ptr; - uint16_t pan_src; - mac_fcf_sequence_t fcf; - mac_aux_security_header_t security_header; - uint8_t dst_address[8]; - uint8_t src_address[8]; -}mac_header_helper_functions_def; - -extern mac_header_helper_functions_def mac_header_helper_functions_stub; - -#endif //__MAC_HEADER_HELPER_FUNCTIONS_STUB_H__ diff --git a/test/nanostack/unittest/stub/mac_helper_stub.c b/test/nanostack/unittest/stub/mac_helper_stub.c deleted file mode 100644 index d47ae1b7af58..000000000000 --- a/test/nanostack/unittest/stub/mac_helper_stub.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" -#include "mlme.h" -#include "mac_helper.h" -#include "mac_common_defines.h" -#include "nsdynmemLIB.h" -#include "net_nwk_scan.h" -#include "ns_trace.h" -#include "common_functions.h" -#include "MLE/mle_tlv.h" -#include "MLE/mle.h" -#include "mac_api.h" -#include "mac_common_defines.h" -#include "mac_helper_stub.h" - -#define TRACE_GROUP "MACh" - -mac_helper_stub_def mac_helper_stub; - -void mac_create_scan_request(mac_scan_type_t type, channel_list_s *chanlist, uint8_t scan_duration, mlme_scan_t *request) -{ -} - -nwk_pan_descriptor_t *mac_helper_select_best_lqi(nwk_pan_descriptor_t *list) -{ - return mac_helper_stub.desc_ptr; -} - -void mac_helper_drop_selected_from_the_scanresult(nwk_scan_params_t *scanParams, nwk_pan_descriptor_t *selected) -{ -} - -void mac_helper_free_scan_confirm(nwk_scan_params_t *params) -{ -} - -nwk_pan_descriptor_t * mac_helper_free_pan_descriptions(nwk_pan_descriptor_t *nwk_cur_active) -{ - return mac_helper_stub.desc_ptr; -} - -int8_t mac_helper_nwk_id_filter_set(const uint8_t *nw_id, nwk_filter_params_s *filter) -{ - return mac_helper_stub.int8_value; -} - -void mac_helper_panid_set(protocol_interface_info_entry_t *interface, uint16_t panId) -{ - -} - -void mac_helper_mac16_address_set(protocol_interface_info_entry_t *interface, uint16_t mac16) -{ -} - -uint16_t mac_helper_mac16_address_get(const protocol_interface_info_entry_t *interface) -{ - return mac_helper_stub.uint16_value; -} - -uint16_t mac_helper_panid_get(const protocol_interface_info_entry_t *interface) -{ - return mac_helper_stub.uint16_value; -} - -void mac_helper_default_key_index_set(protocol_interface_info_entry_t *interface, uint8_t keyIndex) -{ -} - -uint8_t mac_helper_default_key_index_get(protocol_interface_info_entry_t *interface) -{ - return mac_helper_stub.uint8_value; -} - -void mac_helper_set_default_key_source(protocol_interface_info_entry_t *interface) -{ - -} - -void mac_helper_default_security_level_set(protocol_interface_info_entry_t *interface, uint8_t securityLevel) -{ - -} - -uint8_t mac_helper_default_security_level_get(protocol_interface_info_entry_t *interface) -{ - return mac_helper_stub.uint8_value; -} - -void mac_helper_default_security_key_id_mode_set(protocol_interface_info_entry_t *interface, uint8_t keyIdMode) -{ -} - -uint8_t mac_helper_default_security_key_id_mode_get(protocol_interface_info_entry_t *interface) -{ - return mac_helper_stub.uint8_value; -} - -int8_t mac_helper_security_default_key_set(protocol_interface_info_entry_t *interface, const uint8_t *key, uint8_t id, uint8_t keyid_mode) -{ - return mac_helper_stub.int8_value; -} - -int8_t mac_helper_security_next_key_set(protocol_interface_info_entry_t *interface, uint8_t *key, uint8_t id, uint8_t keyid_mode) -{ - return mac_helper_stub.int8_value; -} - -int8_t mac_helper_security_prev_key_set(protocol_interface_info_entry_t *interface, uint8_t *key, uint8_t id, uint8_t keyid_mode) -{ - return mac_helper_stub.int8_value; -} - -void mac_helper_security_key_swap_next_to_default(protocol_interface_info_entry_t *interface) -{ -} - -void mac_helper_security_key_clean(protocol_interface_info_entry_t *interface) -{ -} - -void mac_helper_coordinator_address_set(protocol_interface_info_entry_t *interface, addrtype_t adr_type, uint8_t *adr_ptr) -{ -} - -addrtype_t mac_helper_coordinator_address_get(protocol_interface_info_entry_t *interface, uint8_t *adr_ptr) -{ - return mac_helper_stub.uint8_value; -} - -uint8_t *mac_helper_beacon_payload_reallocate(protocol_interface_info_entry_t *interface, uint8_t len) -{ - if (mac_helper_stub.enable_storing) { - if (interface->mac_parameters->mac_beacon_payload_size != len) { - uint8_t *beacon_ptr = malloc(len); - uint8_t beacon_len; - if (len >= interface->mac_parameters->mac_beacon_payload_size) { - beacon_len = interface->mac_parameters->mac_beacon_payload_size; - } else { - beacon_len = len; - } - memcpy(beacon_ptr, interface->mac_parameters->mac_beacon_payload, beacon_len); - free(interface->mac_parameters->mac_beacon_payload); - interface->mac_parameters->mac_beacon_payload = beacon_ptr; - } - interface->mac_parameters->mac_beacon_payload_size = len; - return interface->mac_parameters->mac_beacon_payload; - } else { - return mac_helper_stub.uint8_ptr; - } -} - -int8_t mac_helper_beacon_payload_register(protocol_interface_info_entry_t *interface) -{ - return mac_helper_stub.int8_value; - -} - -uint8_t *mac_helper_beacon_payload_pointer_get(protocol_interface_info_entry_t *interface) -{ - if (mac_helper_stub.enable_storing) { - return interface->mac_parameters->mac_beacon_payload; - } else { - return mac_helper_stub.uint8_ptr; - } -} - -uint8_t mac_helper_beacon_payload_length_get(protocol_interface_info_entry_t *interface) -{ - if (mac_helper_stub.enable_storing) { - return interface->mac_parameters->mac_beacon_payload_size; - } else { - return mac_helper_stub.uint8_value; - } -} - -int8_t mac_helper_pib_boolean_set(protocol_interface_info_entry_t *interface, mlme_attr_t attribute, bool value) -{ - return mac_helper_stub.int8_value; -} - -int8_t mac_helper_mac_channel_set(protocol_interface_info_entry_t *interface, uint8_t new_channel) -{ - return mac_helper_stub.int8_value; -} - -bool mac_helper_write_our_addr(protocol_interface_info_entry_t *interface, sockaddr_t *ptr) -{ - return mac_helper_stub.bool_value; -} - -int8_t mac_helper_mac64_set(protocol_interface_info_entry_t *interface, const uint8_t *mac64) -{ - return mac_helper_stub.int8_value; -} - -uint_fast16_t mac_helper_max_payload_size(protocol_interface_info_entry_t *cur, uint_fast8_t frame_overhead) -{ - return mac_helper_stub.uint16_value; -} - -uint_fast8_t mac_helper_frame_overhead(protocol_interface_info_entry_t *cur, const buffer_t *buf) -{ - return mac_helper_stub.uint8_value; -} - -int8_t mac_helper_link_frame_counter_read(int8_t interface_id, uint32_t *seq_ptr) -{ - *seq_ptr = mac_helper_stub.uint32_value; - return mac_helper_stub.int8_value; -} - -int8_t mac_helper_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr) -{ - mac_helper_stub.uint32_value = seq_ptr; - return mac_helper_stub.int8_value; -} - -int8_t mac_helper_security_pairwisekey_set(protocol_interface_info_entry_t *interface, const uint8_t *key, const uint8_t *mac_64, uint8_t key_attribute) -{ - return mac_helper_stub.int8_value; -} - -void mac_helper_devicetable_remove(struct mac_api_s *mac_api, uint8_t attribute_index) -{ - -} - -void mac_helper_devicetable_set(mle_neigh_table_entry_t *entry_temp, protocol_interface_info_entry_t *cur, uint32_t frame_counter, uint8_t keyID) -{ - -} -int8_t mac_helper_mac_mlme_max_retry_set(int8_t interface_id, uint8_t mac_retry_set) -{ - -} diff --git a/test/nanostack/unittest/stub/mac_helper_stub.h b/test/nanostack/unittest/stub/mac_helper_stub.h deleted file mode 100644 index 3fe99d47f7d9..000000000000 --- a/test/nanostack/unittest/stub/mac_helper_stub.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __MAC_HELPER_STUB_H__ -#define __MAC_HELPER_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "net_nwk_scan.h" - -typedef struct { - bool enable_storing; - bool bool_value; - int8_t int8_value; - uint8_t uint8_value; - uint8_t *uint8_ptr; - uint16_t uint16_value; - uint32_t uint32_value; - nwk_pan_descriptor_t *desc_ptr; -} mac_helper_stub_def; - -extern mac_helper_stub_def mac_helper_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __MAC_HELPER_STUB_H__ diff --git a/test/nanostack/unittest/stub/mac_indirect_data_stub.c b/test/nanostack/unittest/stub/mac_indirect_data_stub.c deleted file mode 100644 index 169a6c922117..000000000000 --- a/test/nanostack/unittest/stub/mac_indirect_data_stub.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_callback_timer.h" -#include "nsdynmemLIB.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "MAC/IEEE802_15_4/mac_indirect_data.h" -#include "6LoWPAN/Thread/thread_common.h" -#ifndef NO_MLE -#include "MLE/mle.h" -#endif -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "common_functions.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" - -#include "mac_indirect_data_stub.h" - -indirect_data_stub_def_t indirect_data_stub_def; - -void mac_indirect_data_ttl_handle(protocol_interface_rf_mac_setup_s *cur, uint16_t tick_value) -{ -} - -uint8_t mac_indirect_data_req_handle(mac_pre_parsed_frame_t *buf, protocol_interface_rf_mac_setup_s *mac_ptr) -{ - return indirect_data_stub_def.value_uint8; -} - -void mac_indirect_queue_write(protocol_interface_rf_mac_setup_s *rf_mac_setup, mac_pre_build_frame_t *buffer) -{ - indirect_data_stub_def.indirect_buf = (void*)buffer; - buffer->next = rf_mac_setup->indirect_pd_data_request_queue; - rf_mac_setup->indirect_pd_data_request_queue = buffer; -} diff --git a/test/nanostack/unittest/stub/mac_indirect_data_stub.h b/test/nanostack/unittest/stub/mac_indirect_data_stub.h deleted file mode 100644 index c9d6a718cd69..000000000000 --- a/test/nanostack/unittest/stub/mac_indirect_data_stub.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 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 __MAC_INDIRECT_DATA_STUB_H__ -#define __MAC_INDIRECT_DATA_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - void *indirect_buf; - uint8_t value_uint8; -} indirect_data_stub_def_t; - -extern indirect_data_stub_def_t indirect_data_stub_def; - - -#ifdef __cplusplus -} -#endif - -#endif // __MAC_INDIRECT_DATA_STUB_H__ diff --git a/test/nanostack/unittest/stub/mac_mcps_sap_stub.c b/test/nanostack/unittest/stub/mac_mcps_sap_stub.c deleted file mode 100644 index 9b52ff3e781e..000000000000 --- a/test/nanostack/unittest/stub/mac_mcps_sap_stub.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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. - */ - -/* - * \file mac_mcps_sap.c - * \brief Add short description about this file!!! - * - */ -#include "nsconfig.h" -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_callback_timer.h" -#include "string.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "randLIB.h" -#include "ccmLIB.h" -#include "mlme.h" -#include "mac_api.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "MAC/IEEE802_15_4/mac_header_helper_functions.h" -#include "MAC/IEEE802_15_4/mac_timer.h" -#include "MAC/IEEE802_15_4/mac_security_mib.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "MAC/IEEE802_15_4/mac_filter.h" -#include "MAC/IEEE802_15_4/mac_pd_sap.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "MAC/IEEE802_15_4/mac_indirect_data.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "platform/arm_hal_interrupt.h" -#include "common_functions.h" -#include "sw_mac.h" - -#include "mac_mcps_sap_stub.h" - -mac_mcps_sap_stub_def mac_mcps_sap_stub; - -void mcps_sap_data_req_handler(protocol_interface_rf_mac_setup_s *rf_mac_setup , const mcps_data_req_t *data_req ) -{ -} - -void mac_mcps_trig_buffer_from_queue(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ -} - -int8_t mac_mcps_sap_tasklet_init(void) -{ - return mac_mcps_sap_stub.int8_value; -} - -mac_pre_build_frame_t * mcps_sap_prebuild_frame_buffer_get(uint16_t payload_size) -{ - return mac_mcps_sap_stub.frame_ptr; -} - -void mcps_sap_prebuild_frame_buffer_free(mac_pre_build_frame_t *buffer) -{ -} - -void mac_data_wait_timer_start(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ -} - -void mcps_sap_pd_req_queue_write(protocol_interface_rf_mac_setup_s *rf_mac_setup, mac_pre_build_frame_t *buffer) -{ - -} - -void mcps_sap_pd_indirect_queue_write(protocol_interface_rf_mac_setup_s *rf_mac_setup, mac_pre_build_frame_t *buffer) -{ -} - -mac_pre_build_frame_t * mcps_sap_pd_indirect_queue_poll(protocol_interface_rf_mac_setup_s *rf_mac_setup, uint8_t address_type, uint8_t *address_ptr) -{ - return mac_mcps_sap_stub.frame_ptr; -} - -void mcps_sap_pre_parsed_frame_buffer_free(mac_pre_parsed_frame_t *buf) -{ -} - -mac_pre_parsed_frame_t * mcps_sap_pre_parsed_frame_buffer_get(const uint8_t *data_ptr, uint16_t frame_length) -{ - if (mac_mcps_sap_stub.pre_parsed) { - memset(mac_mcps_sap_stub.pre_parsed, 0, sizeof(mac_pre_parsed_frame_t) + frame_length); - mac_mcps_sap_stub.pre_parsed->frameLength = frame_length; - memcpy(mac_header_message_start_pointer(mac_mcps_sap_stub.pre_parsed), data_ptr, frame_length); - } - return mac_mcps_sap_stub.pre_parsed; -} - -int8_t mcps_sap_pd_ind(mac_pre_parsed_frame_t *buffer) -{ - return mac_mcps_sap_stub.int8_value; -} - -void mcps_sap_pd_confirm(void *mac_ptr) -{ -} - - -void mac_generic_event_trig(uint8_t event_type, void *mac_ptr, bool low_latency) -{ -} - -void mac_mcps_buffer_queue_free(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ -} - -int8_t mac_virtual_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message) -{ - return mac_mcps_sap_stub.int8_value; -} - -void mcps_sap_trig_tx(void *mac_ptr) -{ -} - -void mcps_sap_purge_reg_handler(protocol_interface_rf_mac_setup_s *rf_mac_setup, const mcps_purge_t *data) -{ -} - -int mac_convert_frame_type_to_fhss(uint8_t frame_type) -{ - return 0; -} - -bool mac_is_ack_request_set(mac_pre_build_frame_t *buffer) -{ - return true; -} diff --git a/test/nanostack/unittest/stub/mac_mcps_sap_stub.h b/test/nanostack/unittest/stub/mac_mcps_sap_stub.h deleted file mode 100644 index 5c0c2c8d97ca..000000000000 --- a/test/nanostack/unittest/stub/mac_mcps_sap_stub.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2016, 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 __MAC_MCPS_SAP_STUB_H__ -#define __MAC_MCPS_SAP_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" -#include "mac_mcps.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" - -typedef struct { - int8_t int8_value; - mac_pre_build_frame_t *frame_ptr; - mac_pre_parsed_frame_t *pre_parsed; - mcps_data_req_t *data_ptr; -} mac_mcps_sap_stub_def; - -extern mac_mcps_sap_stub_def mac_mcps_sap_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __MAC_MCPS_SAP_STUB_H__ diff --git a/test/nanostack/unittest/stub/mac_mlme_stub.c b/test/nanostack/unittest/stub/mac_mlme_stub.c deleted file mode 100644 index 824a0c6c551e..000000000000 --- a/test/nanostack/unittest/stub/mac_mlme_stub.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_callback_timer.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "mac_api.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_timer.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_indirect_data.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "MAC/IEEE802_15_4/mac_timer.h" -#include "platform/arm_hal_interrupt.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "common_functions.h" - -#include "mac_mlme_stub.h" - -mac_mlme_stub_def mac_mlme_stub; - -uint8_t mac_mlme_beacon_req_tx(protocol_interface_rf_mac_setup_s *rf_ptr) -{ - return mac_mlme_stub.uint8_value; -} - -void mac_mlme_scan_request(const mlme_scan_t *msg, protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ -} - -int8_t mac_mlme_start_req(const mlme_start_t *s, struct protocol_interface_rf_mac_setup *rf_mac_setup) -{ - return mac_mlme_stub.int8_value; -} - -int8_t mac_mlme_reset(protocol_interface_rf_mac_setup_s *rf_mac_setup, const mlme_reset_t *reset) -{ - return mac_mlme_stub.int8_value; -} - -void mac_extended_mac_set(protocol_interface_rf_mac_setup_s *rf_mac_setup, const uint8_t *mac64) -{ -} - -int8_t mac_mlme_set_req(protocol_interface_rf_mac_setup_s *rf_mac_setup,const mlme_set_t *set_req) -{ - return mac_mlme_stub.int8_value; -} - -int8_t mac_mlme_get_req(struct protocol_interface_rf_mac_setup *rf_mac_setup, mlme_get_conf_t *get_req) -{ - return mac_mlme_stub.int8_value; -} - -void mac_frame_src_address_set_from_interface(uint8_t SrcAddrMode,protocol_interface_rf_mac_setup_s *rf_ptr, uint8_t *addressPtr) -{ -} - -void mac_mlme_active_scan_response_timer_start(void *interface) -{ -} - -void mac_mlme_event_cb(void *mac_ptr) -{ -} - -void mac_mlme_timer_cb(int8_t timer_id, uint16_t slots) -{ -} - -void mac_mlme_set_active_state(protocol_interface_rf_mac_setup_s *entry, bool new_state) -{ -} - -void mac_mlme_data_base_deallocate(struct protocol_interface_rf_mac_setup *rf_mac) -{ -} - -protocol_interface_rf_mac_setup_s *mac_mlme_data_base_allocate(uint8_t *mac64, arm_device_driver_list_s *dev_driver, mac_description_storage_size_t *storage_sizes) -{ - return mac_mlme_stub.setup_ptr; -} - -uint8_t mac_mlme_set_new_sqn(protocol_interface_rf_mac_setup_s *rf_setup) -{ - return mac_mlme_stub.uint8_value; -} - -uint8_t mac_mlme_set_new_beacon_sqn(protocol_interface_rf_mac_setup_s *rf_setup) -{ - return mac_mlme_stub.uint8_value; -} - -uint16_t mac_mlme_get_panid(protocol_interface_rf_mac_setup_s *rf_setup) -{ - return mac_mlme_stub.uint16_value; -} - -int mac_mlme_beacon_notify(protocol_interface_rf_mac_setup_s *rf_mac_setup, mlme_beacon_ind_t *data) -{ - //Copy Beacon - mac_mlme_stub.beacon_ind.BSN = data->BSN; - mac_mlme_stub.beacon_ind.PANDescriptor = data->PANDescriptor; - mac_mlme_stub.beacon_ind.PendAddrSpec = data->PendAddrSpec; - mac_mlme_stub.beacon_ind.beacon_data_length = data->beacon_data_length; - memcpy(mac_mlme_stub.beacon_payload_buffer,data->beacon_data, data->beacon_data_length); - - return mac_mlme_stub.int_value; -} - -void mac_mlme_scan_confirmation_handle(protocol_interface_rf_mac_setup_s *rf_ptr) -{ -} - -void mac_mlme_mac_radio_disabled(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ -} - -void mac_mlme_mac_radio_enable(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ -} - -int8_t mac_mlme_rf_channel_change(protocol_interface_rf_mac_setup_s *rf_mac_setup, uint8_t new_channel) -{ - return mac_mlme_stub.int8_value; -} - -void mac_mlme_poll_process_confirm(protocol_interface_rf_mac_setup_s *rf_mac_setup, uint8_t status) -{ - mac_mlme_stub.pollConfirm = status; -} - -void mac_mlme_poll_req(protocol_interface_rf_mac_setup_s *cur, const mlme_poll_t *poll_req) -{ -} - -int8_t mac_mlme_beacon_tx(protocol_interface_rf_mac_setup_s *rf_ptr) -{ - return mac_mlme_stub.int8_value; -} - -int8_t mac_mlme_link_beacon_join_priority_tx_callback_set(int8_t interface_id, beacon_join_priority_tx_cb *beacon_join_priority_tx_cb_ptr) -{ - return mac_mlme_stub.int8_value; -} - -int8_t mac_mlme_link_beacon_compare_rx_callback_set(int8_t interface_id, beacon_compare_rx_cb *beacon_compare_rx_cb_ptr) -{ - return mac_mlme_stub.int8_value; -} - -int8_t mac_mlme_virtual_confirmation_handle(int8_t driver_id, const uint8_t *data_ptr, uint16_t length) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/mac_mlme_stub.h b/test/nanostack/unittest/stub/mac_mlme_stub.h deleted file mode 100644 index b72ab588a854..000000000000 --- a/test/nanostack/unittest/stub/mac_mlme_stub.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __MAC_MLME_STUB_H__ -#define __MAC_MLME_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" -#include "mlme.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" - -typedef struct { - bool bool_value; - int int_value; - int8_t int8_value; - uint8_t uint8_value; - uint16_t uint16_value; - protocol_interface_rf_mac_setup_s *setup_ptr; - uint8_t pollConfirm; - //Beacon ind - mlme_beacon_ind_t beacon_ind; - uint8_t beacon_payload_buffer[120]; -} mac_mlme_stub_def; - -extern mac_mlme_stub_def mac_mlme_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __MAC_MLME_STUB_H__ diff --git a/test/nanostack/unittest/stub/mac_pairwise_key_stub.c b/test/nanostack/unittest/stub/mac_pairwise_key_stub.c deleted file mode 100644 index 72c54b23e2fe..000000000000 --- a/test/nanostack/unittest/stub/mac_pairwise_key_stub.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#include -#include "ns_types.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "Core/include/address.h" -#include "6LoWPAN/MAC/mac_pairwise_key.h" - -#define TRACE_GROUP "mPKe" - -int mac_pairwise_key_add(int8_t interface_id, uint32_t valid_life_time, const uint8_t eui64[static 8], const uint8_t key[static 16]) -{ - return 0; - -} - -int mac_pairwise_key_del(int8_t interface_id, const uint8_t eui64[static 8]) -{ - return 0; -} - - -int mac_pairwise_key_flush_list(int8_t interface_id) -{ - return 0; -} - - -int mac_pairwise_key_interface_register(int8_t interface_id, uint8_t mac_supported_key_decription_size, uint8_t network_key_size) { - return 0; -} - -int mac_pairwise_key_interface_unregister(int8_t interface_id) { - return 0; -} - diff --git a/test/nanostack/unittest/stub/mac_pd_sap_stub.c b/test/nanostack/unittest/stub/mac_pd_sap_stub.c deleted file mode 100644 index 05cc52c0a290..000000000000 --- a/test/nanostack/unittest/stub/mac_pd_sap_stub.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include "ns_types.h" -#include "eventOS_event.h" -#include "string.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "randLIB.h" -#include "ccmLIB.h" -#include "mac_api.h" -#include "MAC/IEEE802_15_4/mac_pd_sap.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "MAC/IEEE802_15_4/mac_header_helper_functions.h" -#include "MAC/IEEE802_15_4/mac_timer.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "MAC/IEEE802_15_4/mac_filter.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "common_functions.h" -#include "platform/arm_hal_interrupt.h" - -int8_t mac_pd_sap_req(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ - return 0; -} - -void mac_pd_sap_state_machine(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ -} - -int8_t mac_pd_sap_data_cb(void *identifier, arm_phy_sap_msg_t *message) -{ - return 0; -} - -void mac_pd_sap_rf_low_level_function_set(void *mac_ptr, void *driver) -{ -} - diff --git a/test/nanostack/unittest/stub/mac_response_handler_stub.c b/test/nanostack/unittest/stub/mac_response_handler_stub.c deleted file mode 100644 index a1ad3c63efdb..000000000000 --- a/test/nanostack/unittest/stub/mac_response_handler_stub.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include "mlme.h" -#include "common_functions.h" -#include "ns_trace.h" -#include "NWK_INTERFACE/Include/protocol_abstract.h" -#include "Service_Libs/mle_service/mle_service_api.h" -#include "Core/include/address.h" -#include "Core/include/socket.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "6LoWPAN/MAC/mac_response_handler.h" -#include "MLE/mle.h" - -#include "6LoWPAN/MAC/mac_data_poll.h" - - -#define TRACE_GROUP "MRsH" - -void mcps_data_confirm_handler( const mac_api_t* api, const mcps_data_conf_t *data ) -{ -} - -void mcps_data_indication_handler( const mac_api_t* api, const mcps_data_ind_t *data_ind ) -{ -} - -void mcps_purge_confirm_handler( const mac_api_t* api, mcps_purge_conf_t *data ) -{ -} - -void mlme_confirm_handler( const mac_api_t* api, mlme_primitive id, const void *data ) -{ -} - -void mlme_indication_handler( const mac_api_t* api, mlme_primitive id, const void *data ) -{ -} - -bool mac_data_is_broadcast_addr(const sockaddr_t *addr) -{ - return false; -} - diff --git a/test/nanostack/unittest/stub/mac_security_interface_stub.c b/test/nanostack/unittest/stub/mac_security_interface_stub.c deleted file mode 100644 index 2c7a451fad68..000000000000 --- a/test/nanostack/unittest/stub/mac_security_interface_stub.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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. - */ diff --git a/test/nanostack/unittest/stub/mac_security_mib_stub.c b/test/nanostack/unittest/stub/mac_security_mib_stub.c deleted file mode 100644 index 5e7ac24135dd..000000000000 --- a/test/nanostack/unittest/stub/mac_security_mib_stub.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include -#include "ns_types.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "sw_mac.h" -#include "mac_api.h" -#include "mac_common_defines.h" -#include "common_functions.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "MAC/IEEE802_15_4/mac_security_mib.h" - -#include "mac_security_mib_stub.h" - -mac_security_mib_stub_def mac_security_mib_stub; - -int8_t mac_sec_mib_device_description_table_deinit(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ - return mac_security_mib_stub.int8_value; -} - -int8_t mac_sec_mib_key_description_table_deinit(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ - return mac_security_mib_stub.int8_value; -} - -int8_t mac_sec_mib_device_description_table_init(protocol_interface_rf_mac_setup_s *rf_mac_setup, uint8_t table_size) -{ - return mac_security_mib_stub.int8_value; -} - -int8_t mac_sec_mib_device_description_set(uint8_t atribute_index, mlme_device_descriptor_t *device_descriptor, protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ - return mac_security_mib_stub.int8_value; -} - -int8_t mac_sec_mib_key_description_set(uint8_t atribute_index, mlme_key_descriptor_entry_t *key_descriptor, protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ - return mac_security_mib_stub.int8_value; -} - -mlme_device_descriptor_t *mac_sec_mib_device_description_get_attribute_index(protocol_interface_rf_mac_setup_s *rf_mac_setup, uint8_t attribute_index) -{ - return mac_security_mib_stub.device_ptr; -} - -mlme_device_descriptor_t *mac_sec_mib_device_description_get(protocol_interface_rf_mac_setup_s *rf_mac_setup, const uint8_t *address, uint8_t type) -{ - return mac_security_mib_stub.device_ptr; -} - -uint8_t mac_mib_device_descption_attribute_get_by_descriptor(protocol_interface_rf_mac_setup_s *rf_mac_setup, mlme_device_descriptor_t *descriptor) -{ - return mac_security_mib_stub.uint8_value; -} - -mlme_key_descriptor_t * mac_sec_key_description_get(protocol_interface_rf_mac_setup_s *rf_mac_setup, mlme_security_t *key_source, uint8_t address_mode, uint8_t *address_ptr, uint16_t pan_id) -{ - return mac_security_mib_stub.key_ptr; -} - -int8_t mac_sec_mib_init(protocol_interface_rf_mac_setup_s *rf_mac_setup,mac_description_storage_size_t *storage_sizes) -{ - return mac_security_mib_stub.int8_value; -} - -void mac_sec_mib_deinit(protocol_interface_rf_mac_setup_s *rf_mac_setup) -{ -} - -mlme_key_device_descriptor_t * mac_sec_mib_key_device_description_list_update(mlme_key_descriptor_t *key_descpription_table) -{ - return mac_security_mib_stub.key_dev_update_ptr; -} - -mlme_key_device_descriptor_t * mac_sec_mib_key_device_description_discover_from_list(mlme_key_descriptor_t *key_descpription_table, uint8_t device_descriptor_handle) -{ - return mac_security_mib_stub.key_dev_ptr; -} - -void mac_sec_mib_device_description_blacklist(protocol_interface_rf_mac_setup_s *rf_mac_setup , uint8_t device_handle) -{ -} - - diff --git a/test/nanostack/unittest/stub/mac_security_mib_stub.h b/test/nanostack/unittest/stub/mac_security_mib_stub.h deleted file mode 100644 index 808dc75abc03..000000000000 --- a/test/nanostack/unittest/stub/mac_security_mib_stub.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, 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 __MAC_SECURITY_MIB_STUB_H__ -#define __MAC_SECURITY_MIB_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" -#include "mlme.h" -#include "MAC/IEEE802_15_4/mac_security_mib.h" - -typedef struct { - int8_t int8_value; - uint8_t uint8_value; - uint32_t uint32_value; - mlme_device_descriptor_t *device_ptr; - mlme_key_descriptor_t *key_ptr; - mlme_key_device_descriptor_t *key_dev_ptr; - mlme_key_device_descriptor_t *key_dev_update_ptr; -} mac_security_mib_stub_def; - -extern mac_security_mib_stub_def mac_security_mib_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __MAC_SECURITY_MIB_STUB_H__ diff --git a/test/nanostack/unittest/stub/mac_timer_stub.c b/test/nanostack/unittest/stub/mac_timer_stub.c deleted file mode 100644 index 288e57a8cdd7..000000000000 --- a/test/nanostack/unittest/stub/mac_timer_stub.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "eventOS_callback_timer.h" -#include "platform/arm_hal_interrupt.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "MAC/IEEE802_15_4/mac_timer.h" - -void timer_mac_start(protocol_interface_rf_mac_setup_s *rf_ptr, mac_event_t event, uint16_t slots) -{ -} - -void timer_mac_stop(protocol_interface_rf_mac_setup_s *rf_ptr) -{ -} - -void timer_mac_interrupt(int8_t timer_id, uint16_t slots) -{ -} diff --git a/test/nanostack/unittest/stub/mbed_trace_stub.c b/test/nanostack/unittest/stub/mbed_trace_stub.c deleted file mode 100644 index 7fd61f2e1a28..000000000000 --- a/test/nanostack/unittest/stub/mbed_trace_stub.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 -#include -#include -#include - -#ifndef YOTTA_CFG_MBED_TRACE -#define YOTTA_CFG_MBED_TRACE 1 -#define YOTTA_CFG_MBED_TRACE_FEA_IPV6 1 -#endif - -#include "mbed-trace/mbed_trace.h" -#if YOTTA_CFG_MBED_TRACE_FEA_IPV6 == 1 -#include "mbed-client-libservice/ip6string.h" -#include "mbed-client-libservice/common_functions.h" -#endif - - -int mbed_trace_init(void) -{ - return 0; -} -void mbed_trace_free(void) -{ -} - -void mbed_trace_buffer_sizes(int lineLength, int tmpLength) -{ -} - -void mbed_trace_config_set(uint8_t config) -{ -} - -uint8_t mbed_trace_config_get(void) -{ - return 0; -} - -void mbed_trace_prefix_function_set(char *(*pref_f)(size_t)) -{ -} - -void mbed_trace_suffix_function_set(char *(*suffix_f)(void)) -{ -} - -void mbed_trace_print_function_set(void (*printf)(const char *)) -{ -} - -void mbed_trace_cmdprint_function_set(void (*printf)(const char *)) -{ -} - -void mbed_trace_exclude_filters_set(char *filters) -{ - -} - -const char *mbed_trace_exclude_filters_get(void) -{ - return NULL; -} - -const char *mbed_trace_include_filters_get(void) -{ - return NULL; -} - -void mbed_trace_include_filters_set(char *filters) -{ - -} - -void mbed_tracef(uint8_t dlevel, const char *grp, const char *fmt, ...) -{ -} - -void mbed_vtracef(uint8_t dlevel, const char *grp, const char *fmt, va_list ap) -{ -} - -const char *mbed_trace_last(void) -{ - return NULL; -} - -/* Helping functions */ -#define tmp_data_left() m_trace.tmp_data_length-(m_trace.tmp_data_ptr-m_trace.tmp_data) -#if YOTTA_CFG_MBED_TRACE_FEA_IPV6 == 1 -char *mbed_trace_ipv6(const void *addr_ptr) -{ - return NULL; -} - -char *mbed_trace_ipv6_prefix(const uint8_t *prefix, uint8_t prefix_len) -{ - return NULL; -} -#endif //YOTTA_CFG_MBED_TRACE_FEA_IPV6 - -char *mbed_trace_array(const uint8_t *buf, uint16_t len) -{ - return NULL; -} diff --git a/test/nanostack/unittest/stub/mbedtls_stub.c b/test/nanostack/unittest/stub/mbedtls_stub.c deleted file mode 100644 index e7b598b2a867..000000000000 --- a/test/nanostack/unittest/stub/mbedtls_stub.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2015, 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 "mbedtls_stub.h" - -mbedtls_stub_def mbedtls_stub; - -//From ssl.h -int mbedtls_ssl_handshake_step( mbedtls_ssl_context *ssl ) -{ - if( mbedtls_stub.useCounter ){ - if( mbedtls_stub.retArray[mbedtls_stub.counter] == HANDSHAKE_FINISHED_VALUE){ - ssl->state = MBEDTLS_SSL_HANDSHAKE_OVER; - } - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -int mbedtls_ssl_close_notify( mbedtls_ssl_context *a ) -{ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -void mbedtls_ssl_init( mbedtls_ssl_context *a ){ - -} - -void mbedtls_ssl_config_init( mbedtls_ssl_config *a ){ - -} - -void mbedtls_ssl_conf_handshake_timeout( mbedtls_ssl_config *a, uint32_t b, uint32_t c) -{ - -} - -void mbedtls_ssl_free( mbedtls_ssl_context *a ){ - -} - -int mbedtls_ssl_conf_own_cert( mbedtls_ssl_config *a, - mbedtls_x509_crt *b, - mbedtls_pk_context *c ){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -void mbedtls_ssl_conf_authmode( mbedtls_ssl_config *a, int c ){ - -} - -void mbedtls_ssl_conf_ca_chain( mbedtls_ssl_config *a, - mbedtls_x509_crt *b, - mbedtls_x509_crl *c ){ - -} - -int mbedtls_ssl_conf_psk( mbedtls_ssl_config *a, - const unsigned char *b, size_t c, - const unsigned char *d, size_t e ){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -int mbedtls_ssl_config_defaults( mbedtls_ssl_config *a, - int b, int c, int d){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -void mbedtls_ssl_conf_rng( mbedtls_ssl_config *a, - int (*f_rng)(void *, unsigned char *, size_t), - void *b ){ - -} - -void mbedtls_ssl_conf_ciphersuites( mbedtls_ssl_config *a, - const int *b) -{ - -} - -int mbedtls_ssl_setup( mbedtls_ssl_context *a, - const mbedtls_ssl_config *b ){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -void mbedtls_ssl_set_bio( mbedtls_ssl_context *ssl, - void *p_bio, - int (*f_send)(void *, const unsigned char *, size_t), - int (*f_recv)(void *, unsigned char *, size_t), - int (*f_recv_timeout)(void *, unsigned char *, size_t, uint32_t) ){ - if( p_bio != NULL ){ - if( f_send ) - f_send( p_bio, NULL, 0 ); - if( f_recv ) - f_recv( p_bio, NULL, 0 ); - if( f_recv_timeout ) - f_recv_timeout( p_bio, NULL, 0, 0 ); - } -} - -void mbedtls_ssl_set_timer_cb( mbedtls_ssl_context *a, - void *ctx, - void (*f_set_timer)(void *, uint32_t int_ms, uint32_t fin_ms), - int (*f_get_timer)(void *) ){ - f_set_timer(ctx, 1, 2); - f_get_timer(ctx); - if(mbedtls_stub.invalidate_timer){ - f_set_timer(ctx, 0, 0); - } - f_get_timer(ctx); -} - -int mbedtls_ssl_handshake( mbedtls_ssl_context *ssl ){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -uint32_t mbedtls_ssl_get_verify_result( const mbedtls_ssl_context *a ){ - return mbedtls_stub.uint32_value; -} - -int mbedtls_ssl_read( mbedtls_ssl_context *a, unsigned char *b, size_t c){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -int mbedtls_ssl_write( mbedtls_ssl_context *a, const unsigned char *b, size_t c ){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - - - -//From crt_drbg.h -int mbedtls_ctr_drbg_seed( mbedtls_ctr_drbg_context *a, - int (*f_entropy)(void *, unsigned char *, size_t), - void *b, - const unsigned char *c, - size_t d ){ - return mbedtls_stub.crt_expected_int; -} - -void mbedtls_ctr_drbg_init( mbedtls_ctr_drbg_context *a ){ - -} - -void mbedtls_ctr_drbg_free( mbedtls_ctr_drbg_context *a ){ - -} - -int mbedtls_ctr_drbg_random_with_add( void *a, - unsigned char *b, size_t c, - const unsigned char *d, size_t e ){ - return mbedtls_stub.crt_expected_int; -} - -int mbedtls_ctr_drbg_random( void *p_rng, - unsigned char *output, size_t output_len ){ - return mbedtls_stub.crt_expected_int; -} - -//From x509_crt.h -void mbedtls_x509_crt_init( mbedtls_x509_crt *a ){ - -} - -void mbedtls_x509_crt_free( mbedtls_x509_crt *a ){ - -} - -int mbedtls_x509_crt_parse( mbedtls_x509_crt *a, const unsigned char *b, size_t c ){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -//From entropy.h -void mbedtls_entropy_init( mbedtls_entropy_context *a ){ - -} - -void mbedtls_entropy_free( mbedtls_entropy_context *ctx ){ - -} - -int mbedtls_entropy_func( void *a, unsigned char *b, size_t c ){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -int mbedtls_entropy_add_source( mbedtls_entropy_context *a, - mbedtls_entropy_f_source_ptr f_source, void *b, - size_t c, int d ){ - unsigned char buf[2]; - size_t len; - f_source(NULL, buf, 1, &len); - - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -//From pk.h -int mbedtls_pk_parse_key( mbedtls_pk_context *a, - const unsigned char *b, size_t c, - const unsigned char *d, size_t e ){ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -void mbedtls_pk_init( mbedtls_pk_context *ctx ) -{ - -} - -void mbedtls_pk_free( mbedtls_pk_context *ctx ) -{ - -} - -void mbedtls_ssl_config_free( mbedtls_ssl_config *a) -{ - -} - -int mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl, - const unsigned char *pw, - size_t pw_len ) -{ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} - -void mbedtls_ssl_conf_dtls_cookies( mbedtls_ssl_config *conf, - mbedtls_ssl_cookie_write_t *f_cookie_write, - mbedtls_ssl_cookie_check_t *f_cookie_check, - void *p_cookie ) -{ - if( mbedtls_stub.cookie_obj && f_cookie_check && mbedtls_stub.cookie_len > 0 ){ - f_cookie_check(mbedtls_stub.cookie_obj, &mbedtls_stub.cookie_value, mbedtls_stub.cookie_len, NULL, 0); - } - if( mbedtls_stub.cookie_obj && f_cookie_write && mbedtls_stub.cookie_len > 0 ){ - unsigned char out[16]; - unsigned char *ptr = &out; - f_cookie_write(mbedtls_stub.cookie_obj, &ptr, ptr+mbedtls_stub.cookie_len, NULL, 0); - } -} - -void mbedtls_ssl_conf_export_keys_cb( mbedtls_ssl_config *conf, - mbedtls_ssl_export_keys_t *f_export_keys, - void *p_export_keys ) -{ - if( f_export_keys && p_export_keys){ - unsigned char value[40]; - memset(&value, 1, 40); - f_export_keys(p_export_keys, &value, "", 0, 0,0); //failure case - - f_export_keys(p_export_keys, &value, "", 0, 20,0); //success case - } -} - -int mbedtls_ssl_session_reset( mbedtls_ssl_context *ssl ) -{ - if( mbedtls_stub.useCounter ){ - return mbedtls_stub.retArray[mbedtls_stub.counter++]; - } - return mbedtls_stub.expected_int; -} diff --git a/test/nanostack/unittest/stub/mbedtls_stub.h b/test/nanostack/unittest/stub/mbedtls_stub.h deleted file mode 100644 index adf3f8b33c2e..000000000000 --- a/test/nanostack/unittest/stub/mbedtls_stub.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2015, 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 MBEDTLS_STUB_H -#define MBEDTLS_STUB_H - -#define MBEDTLS_SSL_EXPORT_KEYS - -#include -#include -#include "mbedtls/ssl.h" -#include "mbedtls/ctr_drbg.h" -#include "mbedtls/x509_crt.h" -#include "mbedtls/sha256.h" -#include "mbedtls/entropy.h" -#include "mbedtls/pk.h" - - - -#define HANDSHAKE_FINISHED_VALUE 8888 - -typedef struct { - int crt_expected_int; - bool useCounter; - int counter; - int retArray[20]; - int expected_int; - uint32_t uint32_value; - bool invalidate_timer; - void *cookie_obj; - unsigned char cookie_value[8]; - size_t cookie_len; -} mbedtls_stub_def; - -extern mbedtls_stub_def mbedtls_stub; - -#endif // MBEDTLS_STUB_H diff --git a/test/nanostack/unittest/stub/mesh_stub.c b/test/nanostack/unittest/stub/mesh_stub.c deleted file mode 100644 index 890fb35ad019..000000000000 --- a/test/nanostack/unittest/stub/mesh_stub.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include -#include -#include "ns_trace.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#include "Core/include/socket.h" -#include "6LoWPAN/Mesh/mesh.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "mesh_stub.h" - -mesh_stub_def mesh_stub; - -buffer_t *mesh_up(buffer_t *buf) -{ - return NULL; -} -buffer_t *mesh_down(buffer_t *buf) -{ - - return NULL; -} - -bool mesh_address_map(protocol_interface_info_entry_t *cur, addrtype_t *addr_type, uint8_t *addr) -{ - return mesh_stub.bool_value; -} - -bool mesh_forwardable_address(const protocol_interface_info_entry_t *cur, addrtype_t addr_type, const uint8_t *addr) -{ - return mesh_stub.bool_value; -} - -bool mesh_header_needed(const buffer_t *buf) -{ - return mesh_stub.bool_value; -} -bool mesh_supports_multicast(void) -{ - return mesh_stub.bool_value; -} -void mesh_all_addresses_unicast(bool flag) -{ - -} -bool mesh_short_address_is_multicast(uint16_t addr) -{ - return mesh_stub.bool_value; -} -bool mesh_short_address_is_broadcast_or_multicast(uint16_t addr) -{ - return mesh_stub.bool_value; -} - -void mesh_rewrite_bc0_header(uint8_t *header) -{ -} - -uint_fast8_t mesh_header_size(const buffer_t *buf) -{ - return mesh_stub.uint8_value; -} - -uint_fast8_t mesh_header_len_from_type_byte(uint8_t type) -{ - return mesh_stub.uint8_value; -} -uint_fast8_t mesh_header_len_from_buffer_type_byte(const buffer_t *buf) -{ - return mesh_stub.uint8_value; -} diff --git a/test/nanostack/unittest/stub/mesh_stub.h b/test/nanostack/unittest/stub/mesh_stub.h deleted file mode 100644 index 6f9924c54d7c..000000000000 --- a/test/nanostack/unittest/stub/mesh_stub.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 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 __MESH_STUB_H__ -#define __MESH_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" - -typedef struct { - bool bool_value; - uint8_t uint8_value; -} mesh_stub_def; - -extern mesh_stub_def mesh_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __MESH_STUB_H__ diff --git a/test/nanostack/unittest/stub/mld_stub.c b/test/nanostack/unittest/stub/mld_stub.c deleted file mode 100644 index 6230a71f5047..000000000000 --- a/test/nanostack/unittest/stub/mld_stub.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "ns_types.h" - -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/mld.h" - -buffer_t *mld_build(protocol_interface_info_entry_t *cur, uint8_t type, uint16_t max_response_delay, const uint8_t address[static 16]) -{ - return NULL; -} - -buffer_t *mld_query_handler(buffer_t *buf, protocol_interface_info_entry_t *cur) -{ - return NULL; -} - -buffer_t *mld_report_handler(buffer_t *buf, protocol_interface_info_entry_t *cur) -{ - return NULL; -} - -void mld_start_listening(protocol_interface_info_entry_t *interface, if_group_entry_t *entry) -{ -} - -void mld_stop_listening(protocol_interface_info_entry_t *interface, if_group_entry_t *entry) -{ -} - -void mld_slow_timer(protocol_interface_info_entry_t *interface, uint_fast16_t seconds) -{ -} - -void mld_fast_timer(protocol_interface_info_entry_t *interface, uint_fast16_t ticks) -{ -} diff --git a/test/nanostack/unittest/stub/mle_service_buffer_stub.c b/test/nanostack/unittest/stub/mle_service_buffer_stub.c deleted file mode 100644 index 49cd25b67aaa..000000000000 --- a/test/nanostack/unittest/stub/mle_service_buffer_stub.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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. - */ - -/* - * \file mle_service_buffer.c - * \brief Add short description about this file!!! - * - */ -#include "nsconfig.h" -#include -#include -#include "ns_trace.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_event_timer.h" -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "randLIB.h" -#include "Service_Libs/mle_service/mle_service_buffer.h" -#include "Service_Libs/mle_service/mle_service_interface.h" - -#define TRACE_GROUP "msbu" - -typedef NS_LIST_HEAD(mle_service_msg_buf_t, link) mle_service_msg_list_t; - -mle_service_msg_buf_t *mle_service_buffer_find(uint16_t id) -{ - return NULL; -} - -mle_service_msg_buf_t * mle_service_buffer_find_for_response(uint8_t *responseData, uint16_t length) -{ - return NULL; -} - -uint8_t * mle_service_buffer_get_data_pointer(uint16_t msgId) -{ - return NULL; -} - -int mle_service_buffer_update_length(uint16_t msgId, uint16_t tail_length) -{ - return 0; -} - -int mle_service_buffer_update_length_by_ptr(uint16_t msgId, uint8_t *data_end_ptr) -{ - return 0; -} - -int mle_service_buffer_tail_get(uint16_t msgId, uint16_t tail_length) -{ - return 0; -} - -int mle_service_buffer_set_msg_type(uint16_t msgId, uint8_t message_type) -{ - return 0; -} - -int mle_service_buffer_set_response(uint16_t msgId) -{ - return 0; -} - -bool mle_service_check_msg_response(uint16_t msgId) -{ - return false; -} - -int mle_service_buffer_set_timeout_cb(uint16_t msgId, mle_service_message_timeout_cb *cb) -{ - return 0; -} - -uint8_t * mle_service_buffer_get_msg_destination_address_pointer(uint16_t msgId) -{ - return NULL; -} - -int mle_service_buffer_set_msg_destination_address(uint16_t msgId, uint8_t *address_ptr) -{ - return 0; -} - -void mle_service_buffer_clean_buffers_by_interface_id(int8_t interface_id) -{ -} - - -mle_service_msg_buf_t * mle_service_buffer_get(uint16_t data_length) -{ - return NULL; -} - -int mle_service_buffer_free(mle_service_msg_buf_t *buf) -{ - return 0; -} - -uint16_t mle_service_buffer_tokens_delay_count(void) -{ - return 0; -} - -bool mle_service_buffer_timer_tick(uint16_t ticks, mle_service_buffer_timeout_cb *timeout_cb) -{ - return false; -} - -int mle_service_buffer_set_msg_rf_channel(uint16_t msgId, uint8_t channel) -{ - return 0; -} - - diff --git a/test/nanostack/unittest/stub/mle_service_stub.c b/test/nanostack/unittest/stub/mle_service_stub.c deleted file mode 100644 index 013a0c44f4c0..000000000000 --- a/test/nanostack/unittest/stub/mle_service_stub.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include -#include -#include "ns_trace.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_event_timer.h" -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "randLIB.h" -#include "socket_api.h" -#include "Core/include/socket.h" -#include "net_interface.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" // just for protocol_core_monotonic_time -#include "Service_Libs/mle_service/mle_service_api.h" -#include "Service_Libs/mle_service/mle_service_security.h" -#include "Service_Libs/mle_service/mle_service_buffer.h" -#include "Service_Libs/mle_service/mle_service_interface.h" -#include "MLE/mle.h" -#include "MLE/mle_tlv.h" -#include "mle_service_stub.h" - -#define TRACE_GROUP "mleS" - -/* Fixed-point randomisation limits for randlib_randomise_base() - RFC 3315 - * says RAND is uniformly distributed between -0.1 and +0.1 - */ -#define MLE_RAND_LOW 0x7333 // 1 - 0.1; minimum for "1+RAND" -#define MLE_RAND_HIGH 0x8CCD // 1 + 0.1; maximum for "1+RAND" - -typedef struct { - int8_t mle_socket; - int8_t mle_socket_service_tasklet; - uint8_t mle_adata[46]; - uint8_t mle_adata_length; - bool mle_frame_counter_check; -} mle_service_class_t; - -mle_service_msg_buf_def mle_service_msg_buf; -/** - * MLE service transaction timeout and retry handling - */ -bool mle_service_timer_tick(uint16_t ticks) -{ - return false; - -} - -int mle_service_interface_register(int8_t interface_id, mle_service_receive_cb *receive_cb, uint8_t *mac64, uint8_t challengeLength) -{ - return 0; -} - -bool mle_service_interface_registeration_validate(int8_t interface_id) -{ - return false; -} - - -int mle_service_interface_receiver_handler_update(int8_t interface_id, mle_service_receive_cb *receive_cb) -{ - return 0; -} - -void mle_service_interface_unregister(int8_t interface_id) -{ -} - -void mle_service_interface_tx_queue_clean(int8_t interface_id) -{ -} - -uint16_t mle_service_interface_tx_queue_size(int8_t interface_id) -{ - return 0; -} - -int mle_service_interface_token_bucket_settings_set(int8_t interface_id, uint8_t size, uint8_t rate, uint8_t count) -{ - return 0; -} - -uint16_t mle_service_msg_allocate(int8_t interface_id, uint16_t data_length, bool challengeAllocate, uint8_t type) -{ - return 0; -} - -uint8_t * mle_service_get_data_pointer(uint16_t msgId) -{ - return NULL; -} - -uint8_t * mle_service_get_payload_start_point(uint16_t msgId) -{ - return NULL; -} - -uint16_t mle_service_get_payload_length(uint16_t msgId) -{ - return 0; -} - -int mle_service_update_length(uint16_t msgId, uint16_t tail_length) -{ - return 0; -} - -int mle_service_update_length_by_ptr(uint16_t msgId, uint8_t *data_end_ptr) -{ - return 0; -} - -int mle_service_msg_update_security_params(uint16_t msgId, uint8_t security_level, uint8_t key_id_mode, uint32_t keysequence) -{ - return 0; -} - -int mle_service_set_packet_callback(uint16_t msgId, mle_service_message_timeout_cb *cb) -{ - return 0; -} - -int mle_service_set_msg_response_true(uint16_t msgId) -{ - return 0; -} - -uint8_t * mle_service_get_msg_destination_address_pointer(uint16_t msgId) -{ - return 0; -} - -int mle_service_set_msg_destination_address(uint16_t msgId, const uint8_t *dstAddress) -{ - return 0; -} - -int mle_service_set_msg_panid(uint16_t msgId, uint16_t panid) -{ - return 0; -} - -int mle_service_msg_free(uint16_t msgId) -{ - return 0; -} - -bool mle_service_transaction_buffer_get_for_response(uint8_t *responseData, uint16_t length, uint16_t *msgId) -{ - return false; -} - -bool mle_service_check_msg_sent(uint16_t msgId) -{ - return false; -} - -int mle_service_message_tail_get(uint16_t msgId, uint16_t tail_length) -{ - return 0; -} - -int mle_service_set_msg_timeout_parameters(uint16_t msgId, mle_message_timeout_params_t *timeout_params) -{ - return 0; -} - -int mle_service_set_msg_token_bucket_priority(uint16_t msgId) -{ - return 0; -} - -int mle_service_send_message(uint16_t msgId) -{ - return 0; -} - -int mle_service_security_init(int8_t interfaceId, uint8_t security_level, uint32_t security_frame_counter, mle_service_key_request_by_counter_cb * key_counter_req, mle_service_security_notify_cb *notify) -{ - return 0; -} - -bool mle_service_security_set_frame_counter(int8_t interfaceId, uint32_t frame_counter) -{ - return false; -} - -uint8_t * mle_service_security_default_key_get(int8_t interfaceId) -{ - return 0; -} - -uint8_t mle_service_security_default_key_id_get(int8_t interfaceId) -{ - return 0; -} - -uint8_t * mle_service_security_next_key_get(int8_t interfaceId) -{ - return 0; -} - -uint8_t mle_service_security_next_key_id_get(int8_t interfaceId) -{ - return 0; -} - -uint8_t mle_service_security_level_get(int8_t interfaceId) -{ - return 0; -} - -bool mle_service_security_key_trig(int8_t interfaceId, uint8_t keyId) -{ - return false; - -} - -int mle_service_security_instance_allocate(int8_t interface_id) -{ - return mle_service_msg_buf.msg_id; -} - -bool mle_service_security_set_security_key(int8_t interfaceId, const uint8_t *security_key, uint8_t keyId, bool primary) -{ - return false; -} - - -int mle_service_reject_message_build(int8_t interfaceId, uint8_t *dstIpv6, bool force_unsecure) -{ - - uint16_t buf_id = mle_service_msg_allocate(interfaceId, 32, false, MLE_COMMAND_REJECT); - if (buf_id == 0) { - return -1; - } - tr_debug("MLE Reject MSG Build"); - //SET Destination address - mle_service_set_msg_destination_address(buf_id, dstIpv6); - mle_service_send_message(buf_id); - - return 0; -} -uint32_t mle_service_security_get_frame_counter(int8_t interfaceId) -{ - return 0; -} -void mle_service_set_frame_counter_check(bool value) -{ -} - -int mle_service_interface_receiver_bypass_handler_update(int8_t interface_id, mle_service_receive_security_bypass_cb *receive_cb) -{ - return 0; -} - -void mle_service_set_fragmented_msg_ll_security(bool value) -{ -} - -int mle_service_set_msg_rf_channel(uint16_t msgId, uint8_t channel) -{ - return 0; -} -int mle_service_set_msg_link_layer_security_mode(uint16_t msgId, bool use_key_id_mode_2) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/mle_service_stub.h b/test/nanostack/unittest/stub/mle_service_stub.h deleted file mode 100644 index 44ccfc3d73fa..000000000000 --- a/test/nanostack/unittest/stub/mle_service_stub.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, 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 __MLE_SERVICE_STUB_H__ -#define __MLE_SERVICE_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" - -typedef struct { - uint16_t msg_id; /*!< Buffer Id what could be used for update or free message */ -} mle_service_msg_buf_def; - - -extern mle_service_msg_buf_def mle_service_msg_buf; - -#ifdef __cplusplus -} -#endif - -#endif // __MLE_SERVICE_STUB_H__ \ No newline at end of file diff --git a/test/nanostack/unittest/stub/mle_stub.c b/test/nanostack/unittest/stub/mle_stub.c deleted file mode 100644 index ee5d145ccc61..000000000000 --- a/test/nanostack/unittest/stub/mle_stub.c +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include "MLE/mle.h" - -#ifndef NO_MLE - -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_event_timer.h" -#include "socket_api.h" -#include "Core/include/socket.h" -#include "nsdynmemLIB.h" -#include "ns_trace.h" -#include "string.h" -#include "mac_api.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/udp.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "shalib.h" -#include "randLIB.h" -#include "6LoWPAN/Thread/thread_network_data_storage.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "thread_management_if.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_nd.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#include "platform/arm_hal_interrupt.h" -#include "platform/topo_trace.h" -#include "common_functions.h" -#include "MLE/mle_tlv.h" -#include "NWK_INTERFACE/Include/protocol_timer.h" -#include "Common_Protocols/ipv6.h" - -#include "mle_stub.h" - -#define MLE_UNICAST_CHALLENGE_TIMEOUT 20 - -#define TRACE_GROUP "mle" - -mle_stub_def mle_stub; - -typedef enum { - ARM_MLE_INIT = 0, - ARM_MLE_TTL_TIMER -} arm_mle_event_id_e; - - -/** - * Generic Type/Length beader, no value - */ -typedef struct { - uint8_t type; - uint8_t length; -} mle_tlv_tl; - -/** - * Source address structure - */ -typedef struct { - uint8_t type; - uint8_t length; - uint8_t src_address[2]; -} mle_tlv_src_address_s; - -/** - * Mode structure - */ -typedef struct { - uint8_t type; - uint8_t length; - uint8_t mode; -} mle_tlv_mode_s; - -/** - * Timeout structure - */ -typedef struct { - uint8_t type; - uint8_t length; - uint8_t timeout; -} mle_tlv_timeout_s; - -/** - * Link layer frame counter structure - */ -typedef struct { - uint8_t type; - uint8_t length; - uint8_t ll_frm_counter[4]; -} mle_tlv_ll_frame_counter_s; - -/** - * MLE frame counter structure - */ -typedef struct { - uint8_t type; - uint8_t length; - uint8_t mle_frm_counter[4]; -} mle_tlv_mle_frame_counter_s; - -typedef union { - uint8_t *u8ptr; - mle_tlv_tl *tl; - mle_tlv_src_address_s *src_address; - mle_tlv_mode_s *mode; - mle_tlv_timeout_s *timeout; - mle_tlv_ll_frame_counter_s *ll_frm_counter; - mle_tlv_mle_frame_counter_s *mle_frm_counter; -} tlv_value_ptr_u; - -void mle_table_ttl(uint16_t ticks, protocol_interface_info_entry_t *cur_interface); - -NS_LARGE uint8_t mle_update_timer = 0; - -typedef struct { - uint8_t queu_update_event; - uint8_t active_params; - uint16_t pan_id; /*!< PAN-ID */ - uint32_t pan_time; - uint8_t channel; /*!< Channel */ - uint32_t chan_time; - uint8_t allow_join; /*!< Permit Join */ - uint32_t allow_time; - uint8_t *beacon_payload; - uint8_t beacon_payload_len; - uint32_t beacon_payload_delay; -} mle_nwk_param_t; - -void mle_set_max_allow_join_time(uint16_t new_max_allow_join_time) -{ -} - -void mle_event_handler(arm_event_s *event) -{ -} - -uint8_t mle_mode_get_by_interface_ptr(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -uint8_t mle_challenge(uint8_t *addr, protocol_interface_info_entry_t *cur) -{ - return 1; -} - -int mle_child_update_generation(uint8_t *parentAddress, struct protocol_interface_info_entry *cur, uint8_t mode) -{ - return 0; -} - -int8_t mle_host_link_configuration(bool rx_on_idle, protocol_interface_info_entry_t *cur) -{ - return -1; -} - -uint8_t mle_router_synch(protocol_interface_info_entry_t *cur, const uint8_t *destAddress) -{ - return 1; -} - -uint8_t mle_neigh_advertise(protocol_interface_info_entry_t *cur) -{ - return 1; -} - -uint8_t mle_reed_advertise (protocol_interface_info_entry_t *cur) -{ - return 0; -} - -int mle_attach_parent_request_build(protocol_interface_info_entry_t *cur, uint8_t scanMask) -{ - return -1; -} - - -uint8_t *mle_linkquality_write(uint8_t *buffer) -{ - return NULL; -} - -int mle_attach_parent_response_build(protocol_interface_info_entry_t *cur, sockaddr_t *dstAddress, uint8_t *challenge, uint8_t chalLen, uint8_t linkMargin) -{ - return -1; -} -void mle_network_data_push_to_sleep_child(protocol_interface_info_entry_t *cur, bool stableDataUpdate) -{ -} - -void mle_multicast_push_to_sleep_child(protocol_interface_info_entry_t *cur, buffer_t *buf) -{ - -} - -int mle_network_data_propagation(protocol_interface_info_entry_t *cur, uint8_t *childUnicastAddress, bool fullList) -{ -} - -uint8_t *mle_general_write_link_layer_framecounter(uint8_t *ptr, protocol_interface_info_entry_t *cur) -{ - return NULL; -} - -bool mle_neigh_entry_frame_counter_update(mle_neigh_table_entry_t *entry_temp, uint8_t *tlv_ptr, uint16_t tlv_length, protocol_interface_info_entry_t *cur, uint8_t key_id) -{ - return false; -} - -void mle_entry_timeout_update(mle_neigh_table_entry_t *entry_temp, uint32_t timeout_tlv) -{ -} - -void mle_entry_timeout_refresh(mle_neigh_table_entry_t *entry_temp) -{ - -} - -void mle_neigh_entry_update_by_mle_tlv_list(mle_neigh_table_entry_t *entry_temp, uint8_t *tlv_ptr, uint16_t tlv_length, uint8_t lqi) -{ -} - -static mle_neigh_table_entry_t *mle_entry_scan_long(const uint8_t *address) -{ - return NULL; -} - -mle_neigh_table_entry_t *mle_table_rpl_advert(void) -{ - return NULL; -} - -void mle_table_ttl(uint16_t ticks, protocol_interface_info_entry_t *cur_interface) -{ -} - -mle_neigh_table_entry_t *mle_refresh_entry_timeout(int8_t interfaceId, const uint8_t *addressPtr, addrtype_t addressType, bool dataPollConfirmation) -{ - return NULL; -} - -mle_neigh_table_entry_t *mle_class_get_by_link_address(int8_t interface_id, const uint8_t *address, addrtype_t type) -{ - mle_stub.expectedUint8ptr = address; - mle_stub.expectedUint8 = type; - - return mle_stub.mle_neigh_table_entry_ptr; -} - -mle_neigh_table_list_t *mle_class_active_list_get(int8_t interface_id) -{ - return NULL; -} - -uint8_t mle_thread_end_device_synch_to_router(protocol_interface_info_entry_t *cur, uint8_t *router_ll64) -{ - return 0; -} - -uint8_t mle_thread_end_device_synch(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -uint8_t *mle_general_write_source_address(uint8_t *ptr, protocol_interface_info_entry_t *cur) -{ - return 0; -} - -mle_neigh_table_entry_t *mle_class_get_entry_by_mac64(int8_t interface_id, uint8_t linkMargin, const uint8_t *mac64, bool allocateNew) -{ - return mle_stub.mle_neigh_table_entry_ptr; -} - -mle_neigh_table_entry_t *mle_class_get_by_device_attribute_id(int8_t interface_id, uint8_t device_attibute) -{ - return mle_stub.mle_neigh_table_entry_ptr; -} - -uint16_t mle_class_active_neigh_counter(int8_t interface_id) -{ - return 0; -} - -int8_t mle_class_mode_set(int8_t interface_id,mle_class_user_mode mode) -{ - return 0; -} - -int16_t mle_class_free_entry_count_get(int8_t interface_id) -{ - return 0; -} -mle_neigh_table_entry_t *mle_class_get_entry_by_ll64(int8_t interface_id, uint8_t linkMargin, const uint8_t *ipv6Address, bool allocateNew) -{ - return mle_stub.mle_neigh_table_entry_ptr; -} - -int8_t mle_class_remove_entry(int8_t interface_id, mle_neigh_table_entry_t *entry) -{ - return 0; -} - -int8_t mle_class_remove_neighbour(int8_t interface_id, const uint8_t *address, addrtype_t type) -{ - return 0; -} - -int8_t mle_class_deallocate(int8_t interface_id) -{ - return 0; -} - -int8_t mle_class_list_clean(int8_t interface_id) -{ - return 0; -} - -int8_t mle_class_init(int8_t interface_id, uint8_t table_size, mle_entry_user_entry_remove_notify *remove_cb, mle_entry_link_keep_alive *keep_alive_cb, mle_entry_interface_activate *interface_is_active) -{ - return 0; -} - -int8_t mle_class_router_challenge(int8_t interface_id,mle_entry_link_keep_alive *challenge_cb) -{ - return 0; -} - -bool mle_class_exists_for_interface(int8_t interface_id) -{ - return mle_stub.bool_value; -} - -mle_neigh_table_entry_t *mle_class_discover_entry_by_ll64(int8_t interface_id, const uint8_t *ipv6Address) -{ - return NULL; -} - -int16_t mle_class_sleepy_entry_count_get(int8_t interface_id) -{ - return 0; -} - -int16_t mle_class_rfd_entry_count_get(int8_t interface_id) -{ - return 0; -} - -#endif /* NO_MLE */ diff --git a/test/nanostack/unittest/stub/mle_stub.h b/test/nanostack/unittest/stub/mle_stub.h deleted file mode 100644 index 35fd1465fa79..000000000000 --- a/test/nanostack/unittest/stub/mle_stub.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 __MLE_STUB_H__ -#define __MLE_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - bool bool_value; - uint8_t expectedUint8; - uint16_t expectedUint16; - uint8_t *expectedUint8ptr; - mle_neigh_table_entry_t *mle_neigh_table_entry_ptr; -} mle_stub_def; - -extern mle_stub_def mle_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __MLE_STUB_H__ diff --git a/test/nanostack/unittest/stub/mle_tlv_stub.c b/test/nanostack/unittest/stub/mle_tlv_stub.c deleted file mode 100644 index a22806b5f205..000000000000 --- a/test/nanostack/unittest/stub/mle_tlv_stub.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include "string.h" -#include "MLE/mle.h" -#include "MLE/mle_tlv.h" -#include "common_functions.h" -#include "mle_tlv_stub.h" - -mle_tlv_stub_def mle_tlv_stub; - -int mle_message_malformed_check(uint8_t *ptr, uint16_t data_len) -{ - return 0; -} - -int mle_tlv_option_discover(uint8_t *ptr, uint16_t data_len, mle_tlv_type_t discovered_type, mle_tlv_info_t *option_info) -{ - return mle_tlv_stub.expectedInt; -} - -int mle_validate_advertisment_message(uint8_t *ptr, uint16_t data_len) -{ - return 0; -} - -int mle_validate_router_link_accept_request_message(uint8_t *ptr, uint16_t data_len) -{ - return 0; -} - -int mle_validate_router_link_accept_message(uint8_t *ptr, uint16_t data_len) -{ - return 0; -} - -bool mle_tlv_type_requested(uint8_t reqType, uint8_t *ptr, uint16_t data_len) -{ - return false; -} - -bool mle_tlv_read_8_bit_tlv(mle_tlv_type_t reqType, uint8_t *ptr, uint16_t data_len, uint8_t *buffer) -{ - return false; -} - -bool mle_tlv_read_16_bit_tlv(mle_tlv_type_t reqType, uint8_t *ptr, uint16_t data_len, uint16_t *buffer) -{ - return false; -} - -bool mle_tlv_read_32_bit_tlv(mle_tlv_type_t reqType, uint8_t *ptr, uint16_t data_len, uint32_t *buffer) -{ - return false; -} - -bool mle_tlv_read_tlv(mle_tlv_type_t reqType, uint8_t *ptr, uint16_t data_len, mle_tlv_info_t *tlv_info) -{ - return false; -} - -int mle_validate_child_keep_alive_message(uint8_t *ptr, uint16_t data_len) -{ - return 0; -} - -int mle_validate_child_update_message(uint8_t *ptr, uint16_t data_len) -{ - return 0; -} - -uint8_t *mle_tlv_write_response(uint8_t *ptr, uint8_t *response_ptr, uint8_t responseLen) -{ - return ptr + responseLen + 2; -} - -uint8_t *mle_tlv_write_source_address(uint8_t *ptr, uint16_t shortAddress) -{ - return ptr + 4; -} - -uint8_t *mle_tlv_write_short_address(uint8_t *ptr, uint16_t shortAddress) -{ - return ptr + 4; -} - -uint8_t *mle_tlv_write_mode(uint8_t *ptr, uint8_t mode) -{ - return ptr + 3; -} - -uint8_t *mle_tlv_write_timeout(uint8_t *ptr, uint32_t timeOut) -{ - return ptr + 6; -} - -uint8_t *mle_tlv_write_holdtime(uint8_t *ptr, uint16_t holdTime) -{ - return ptr + 4; -} - -uint8_t *mle_tlv_write_challenge(uint8_t *ptr, uint8_t *challengePtr, uint8_t challenLen) -{ - return ptr + challenLen + 2; -} - -uint8_t *mle_tlv_write_link_layer_framecount(uint8_t *ptr, uint32_t frameCount) -{ - return ptr + 6; -} - -uint8_t *mle_tlv_write_scan_mask(uint8_t *ptr, uint8_t scanMask) -{ - return ptr + 3; -} - -uint8_t *mle_tlv_req_tlv(uint8_t *ptr, uint8_t *mle_req_tlv_list, uint8_t req_list_len) -{ - return NULL; -} -uint8_t *mle_tlv_rssi_tlv(uint8_t *ptr, uint8_t linkMargin) -{ - return NULL; -} - -uint8_t *mle_tlv_write_version(uint8_t *ptr, uint16_t version) -{ - return ptr + 4; -} - -uint8_t *mle_tlv_write_link_quality(uint8_t *ptr, uint8_t incoming_idr, uint8_t *mac64, uint16_t short_address, uint8_t priority_flag) -{ - if( mac64 ) { - return ptr + 13; - } else { - return ptr + 7; - } -} - -uint16_t mle_tlv_validate_response(uint8_t *ptr, uint16_t data_len) -{ - return 0; -} - diff --git a/test/nanostack/unittest/stub/mle_tlv_stub.h b/test/nanostack/unittest/stub/mle_tlv_stub.h deleted file mode 100644 index 12811413e4f0..000000000000 --- a/test/nanostack/unittest/stub/mle_tlv_stub.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 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 __MLE_TLV_STUB_H__ -#define __MLE_TLV_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - uint8_t expectedUint8; - uint16_t expectedUint16; - uint8_t *expectedUint8ptr; - uint8_t expectedInt; -} mle_tlv_stub_def; - -extern mle_tlv_stub_def mle_tlv_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __MLE_TLV_STUB_H__ diff --git a/test/nanostack/unittest/stub/mpl_stub.c b/test/nanostack/unittest/stub/mpl_stub.c deleted file mode 100644 index 817e85940da8..000000000000 --- a/test/nanostack/unittest/stub/mpl_stub.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "nsconfig.h" - -#include "ns_types.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "common_functions.h" -#include "nsdynmemLIB.h" -#include "randLIB.h" -#include -#include "Core/include/ns_buffer.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_timer.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "Service_Libs/Trickle/trickle.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "MPL/mpl.h" - -#define MPL_TICK_MS 50 - -#define MS_TO_TICKS(t) (((t) + MPL_TICK_MS - 1) / MPL_TICK_MS) - -/* Timing is in 50 ms (1/20 s) ticks */ -const trickle_params_t rfc7731_default_data_message_trickle_params = { - .Imin = MS_TO_TICKS(512), /* RFC 7731 says 10 * expected link latency; ZigBee IP says 512 ms */ - .Imax = MS_TO_TICKS(512), /* RFC 7731 says equal to Imin; ZigBee IP says 512 ms */ - .k = 1, /* RFC 7731 says 1; ZigBee IP says infinite */ - .TimerExpirations = 3 /* RFC 7731 says 3; ZigBee IP says 2 for routers, 0 for hosts */ -}; - -const trickle_params_t rfc7731_default_control_message_trickle_params = { - .Imin = MS_TO_TICKS(512), /* RFC 7731 says 10 * worst-case link latency */ - .Imax = MS_TO_TICKS(300000), /* 5 minutes, as per RFC 7731 */ - .k = 1, - .TimerExpirations = 10 -}; - -mpl_domain_t *mpl_domain_create(protocol_interface_info_entry_t *cur, const uint8_t address[16], - const uint8_t *seed_id, multicast_mpl_seed_id_mode_e seed_id_mode, - int_fast8_t proactive_forwarding, - uint16_t seed_set_entry_lifetime, - const trickle_params_t *data_trickle_params, - const trickle_params_t *control_trickle_params) -{ - return NULL; -} - -buffer_t *mpl_control_handler(buffer_t *buf, protocol_interface_info_entry_t *cur) -{ - return NULL; -} - -void mpl_slow_timer(uint16_t seconds) -{ -} diff --git a/test/nanostack/unittest/stub/multicast_api_stub.c b/test/nanostack/unittest/stub/multicast_api_stub.c deleted file mode 100644 index 2df531a09dc7..000000000000 --- a/test/nanostack/unittest/stub/multicast_api_stub.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "ip6string.h" -#include "ns_trace.h" -#include "randLIB.h" -#include "string.h" -#include "nsdynmemLIB.h" -#include "ns_sha256.h" -#include "socket_api.h" -#include "Common_Protocols/ipv6_constants.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/mld.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "common_functions.h" - -#include "RPL/rpl_control.h" - - -int8_t multicast_fwd_set_forwarding(int8_t interface_id, bool enable) -{ - return 0; -} - -int8_t multicast_fwd_set_proxy_upstream(int8_t interface_id) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/nd_proxy.c b/test/nanostack/unittest/stub/nd_proxy.c deleted file mode 100644 index 73e282a79acd..000000000000 --- a/test/nanostack/unittest/stub/nd_proxy.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013-2016, 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 "nsconfig.h" -#include "ns_types.h" - -int nd_proxy_downstream_interface_unregister(int8_t interface_id) -{ - return 0; -} - -bool nd_proxy_enabled_for_upstream(int8_t interface_id) -{ - return false; -} - -bool nd_proxy_upstream_route_onlink(int8_t downstream_id, uint8_t *address) -{ - return false; -} diff --git a/test/nanostack/unittest/stub/nd_proxy_stub.c b/test/nanostack/unittest/stub/nd_proxy_stub.c deleted file mode 100644 index fa117fed2baf..000000000000 --- a/test/nanostack/unittest/stub/nd_proxy_stub.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#ifdef HAVE_ND_PROXY -#include "ns_types.h" -#include "common_functions.h" -#include "ns_trace.h" -#include "string.h" -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "Service_Libs/nd_proxy/nd_proxy.h" - - -int nd_proxy_downstream_interface_register(int8_t interface_id, nd_proxy_req_cb *nd_proxy_req, bridge_state_update_cb * bridge_state_update) -{ - return 0; -} - -int nd_proxy_downstream_interface_unregister(int8_t interface_id) -{ - return 0; -} - -int nd_proxy_upstream_interface_register(int8_t interface_id, nd_proxy_req_cb *route_validation_req) -{ - return 0; -} - -int nd_proxy_upstream_interface_unregister(int8_t interface_id) -{ - return 0; -} - -bool nd_proxy_enabled_for_downstream(int8_t interface_id) -{ - return false; -} - -bool nd_proxy_enabled_for_upstream(int8_t interface_id) -{ - return false; -} - -bool nd_proxy_target_address_validation(int8_t upstream_id, uint8_t *address, int8_t *downstream_id_ptr) -{ - return false; -} - -bool nd_proxy_upstream_route_onlink(int8_t downstream_id, uint8_t *address) -{ - return false; -} -#endif /* HAVE_ND_PROXY */ - diff --git a/test/nanostack/unittest/stub/nd_router_object_stub.c b/test/nanostack/unittest/stub/nd_router_object_stub.c deleted file mode 100644 index 35b9400f8e39..000000000000 --- a/test/nanostack/unittest/stub/nd_router_object_stub.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "string.h" -#include "nsdynmemLIB.h" -#include "ns_trace.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_prefix.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "randLIB.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#include "6LoWPAN/ND/nd_router_object.h" -#include "6LoWPAN/Bootstraps/network_lib.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#include "Service_Libs/whiteboard/whiteboard.h" -#include "common_functions.h" - -#define TRACE_GROUP_LOWPAN_ND "loND" - -void icmp_nd_router_object_release(nd_router_t *router_object); -uint8_t icmp_nd_router_prefix_ttl_update(nd_router_t *nd_router_object, protocol_interface_info_entry_t *cur_interface); - -uint8_t nd_rs_build(nd_router_t *cur, protocol_interface_info_entry_t *cur_interface); -bool icmp_nd_compare_to_def_next_hop(nd_router_next_hop *hop, sockaddr_t *adr); -void icmp_nd_router_context_ttl_update(nd_router_t *nd_router_object); -extern void nd_border_router_setup_refresh(nwk_interface_id id, bool fresh_abro); - -nd_parameters_s nd_params; - -uint8_t nd_base_tick = 1; - -int8_t nd_set_br(nd_router_t *br) -{ - return -1; -} - -bool nd_object_active(void) -{ - return false; -} - -void icmp_nd_routers_init(void) -{ -} - - -void icmp_nd_set_nd_def_router_address(uint8_t *ptr, nd_router_t *cur) -{ - -} - -void nd_ns_trig(nd_router_t *router_object, protocol_interface_info_entry_t *cur) -{ - -} - -void nd_router_base_init(nd_router_t *new_entry) -{ - -} - -nd_router_t *icmp_nd_router_object_get(const uint8_t *border_router, nwk_interface_id nwk_id) -{ - return NULL; -} - -void icmp_nd_router_object_reset(nd_router_t *router_object) -{ - -} - -int8_t icmp_nd_router_prefix_proxy_update(uint8_t *dptr, nd_router_setup_t *nd_router_object) -{ - return -1; -} - -uint8_t icmp_nd_router_prefix_valid(nd_router_t *nd_router_object) -{ - return 0; -} - -uint8_t icmp_nd_router_prefix_ttl_update(nd_router_t *nd_router_object, protocol_interface_info_entry_t *cur_interface) -{ - return 0; -} - -int8_t icmp_nd_router_prefix_update(uint8_t *dptr, nd_router_t *nd_router_object, protocol_interface_info_entry_t *cur_interface) -{ - return 0; -} - -void icmp_nd_router_context_ttl_update(nd_router_t *nd_router_object) -{ - -} - -int8_t icmp_nd_router_context_update(const uint8_t *dptr, nd_router_t *router_object) -{ - return -1; -} - -void icmp_nd_router_object_release(nd_router_t *router_object) -{ -} - - -void icmp_nd_border_router_release(nd_router_t *router_object) -{ -} - - - -void gp_address_list_free(gp_ipv6_address_list_t *list) -{ -} - -void icmp_nd_prefixs_parse(buffer_t *buf, nd_router_t *nd_router_object, protocol_interface_info_entry_t *cur_interface) -{ - -} - - -void icmp_nd_set_next_hop(nd_router_next_hop *hop, sockaddr_t *adr) -{ - -} - -bool icmp_nd_compare_to_def_next_hop(nd_router_next_hop *hop, sockaddr_t *adr) -{ - return false; -} - -uint8_t nd_rs_build(nd_router_t *cur, protocol_interface_info_entry_t *cur_interface) -{ - return 0; -} - -void nd_ns_build(nd_router_t *cur, protocol_interface_info_entry_t *cur_interface, uint8_t *address_ptr) -{ -} - -buffer_t *nd_dar_parse(buffer_t *buf, protocol_interface_info_entry_t *cur_interface) -{ - return NULL; -} - -bool nd_ns_aro_handler(protocol_interface_info_entry_t *cur_interface, const uint8_t *aro_opt, const uint8_t *slla_opt, const uint8_t *src_addr, aro_t *aro_out) -{ - return false; -} - -buffer_t *nd_dac_handler(buffer_t *buf, protocol_interface_info_entry_t *cur) -{ - return NULL; -} - -static void nd_ns_forward_timer_reset(uint8_t *root_adr) -{ - -} - -bool nd_ra_process_abro(protocol_interface_info_entry_t *cur, buffer_t *buf, const uint8_t *dptr, uint8_t ra_flags, uint16_t router_lifetime) -{ - return false; -} - -void nd_ra_process_lowpan_context_option(protocol_interface_info_entry_t *cur, const uint8_t *opt) -{ -} - -void nd_ra_build_by_abro(const uint8_t *abro, const uint8_t *dest, protocol_interface_info_entry_t *cur_interface) -{ -} - -void nd_trigger_ras_from_rs(const uint8_t *unicast_adr, protocol_interface_info_entry_t *cur_interface) -{ -} - -void nd_na_aro_handler(protocol_interface_info_entry_t *cur_interface, const uint8_t *dptr, const uint8_t *dst_addr) -{ -} - -void gp_address_add_to_end(gp_ipv6_address_list_t *list, const uint8_t address[__static 16]) -{ -} - -void nd_object_timer(struct protocol_interface_info_entry *cur_interface, uint16_t ticks_update) -{ -} - -ipv6_ra_timing_t *nd_ra_timing(const uint8_t abro[16]) -{ - return NULL; -} - -uint32_t nd_object_time_to_next_nd_reg(void) -{ - return 0; -} - - -void nd_object_timer_balance(uint16_t sleep_time, protocol_interface_info_entry_t *cur_interface) -{ -} - -uint8_t nd_prefix_dst_check(uint8_t *ptr) -{ - return 0; -} - -int8_t nd_parent_loose_indcate(uint8_t *neighbor_address, protocol_interface_info_entry_t *cur_interface) -{ - return -1; -} - -nd_router_t *nd_get_object_by_nwk_id(nwk_interface_id nwk_id) -{ - return NULL; -} - -nd_router_t *nd_get_pana_address(void) -{ - return NULL; -} - -void nd_remove_registration(protocol_interface_info_entry_t *cur_interface, addrtype_t ll_type, const uint8_t *ll_address) -{ - -} - -void nd_6lowpan_set_radv_params(protocol_interface_info_entry_t *cur_interface) -{ - -} diff --git a/test/nanostack/unittest/stub/neighbor_cache_stub.c b/test/nanostack/unittest/stub/neighbor_cache_stub.c deleted file mode 100644 index 0bce6ba01ce9..000000000000 --- a/test/nanostack/unittest/stub/neighbor_cache_stub.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include "ns_types.h" -#include "common_functions.h" -#include "string.h" -#include "nsdynmemLIB.h" -#include "Service_Libs/Neighbor_cache/neighbor_table_definition.h" - -void neighbor_cache_init(neigh_cache_s *neigh_cache) -{ -} - -int neighbor_cache_flush(neigh_cache_s *neigh_cache) -{ - return 0; -} - - -neigh_cache_entry_s *neighbor_cache_entry_get(neigh_cache_s *neigh_cache, neighbor_address_type_e address_type, const void *address_ptr) -{ - return NULL; -} - -neigh_cache_entry_s *neighbor_cache_entry_create(neigh_cache_s *neigh_cache, const uint8_t address_ptr[8]) -{ - return NULL; -} - -int8_t neighbor_cache_entry_delete(neigh_cache_s *neigh_cache, neighbor_address_type_e address_type, const void *address_ptr) -{ - return 0; -} - -neigh_cache_entry_s *neighbor_cache_entry_delete_by_entry_pointer(neigh_cache_s *neigh_cache, neigh_cache_entry_s *entry) -{ - return NULL; -} - -int neighbor_cache_ttl_update(neigh_cache_s *neigh_cache, uint16_t ticks) -{ - return 0; -} - -neigh_cache_entry_s *neighbor_cache_entry_get_timed_out(neigh_cache_s *neigh_cache) -{ - return NULL; -} diff --git a/test/nanostack/unittest/stub/net_load_balance_stub.c b/test/nanostack/unittest/stub/net_load_balance_stub.c deleted file mode 100644 index 2fb6f240ad89..000000000000 --- a/test/nanostack/unittest/stub/net_load_balance_stub.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include -#include "net_load_balance_api.h" -#include "Service_Libs/load_balance/load_balance_api.h" -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" - - - -int8_t net_load_balance_network_switch_cb_set(int8_t interface_id,net_load_balance_network_switch_notify *network_switch_notify) -{ - return 0; -} - - -int8_t net_load_balance_create(int8_t interface_id, bool enable_periodic_beacon_interval) -{ - return 0; -} - - -int8_t net_load_balance_delete(int8_t interface_id) -{ - return 0; -} - -int8_t net_load_balance_threshold_set(int8_t interface_id, uint8_t threshold_min, uint8_t threshold_max) -{ - return 0; -} - -void net_load_balance_internal_state_activate(protocol_interface_info_entry_t *interface_ptr, bool state) -{ - -} diff --git a/test/nanostack/unittest/stub/net_mle_stub.c b/test/nanostack/unittest/stub/net_mle_stub.c deleted file mode 100644 index 22388b4209d5..000000000000 --- a/test/nanostack/unittest/stub/net_mle_stub.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016, 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. - */ - -/* - * \file net_mle.c - * \brief 6LoWPAN MLE options control API - * - */ -#include "nsconfig.h" -#include "ns_types.h" -#include "string.h" -#include "ns_trace.h" -#include "net_mle_api.h" -#include "Core/include/address.h" -#include "net_interface.h" -#include "MLE/mle.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Service_Libs/mle_service/mle_service_api.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" - - -int8_t arm_nwk_6lowpan_mle_router_lifetime_set(int8_t interface_id, uint16_t lifetime) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_mle_host_lifetime_set(int8_t interface_id, uint16_t lifetime) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_mle_neighbor_limits_set(int8_t interface_id, uint16_t lower_threshold, uint16_t upper_threshold, uint16_t max) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_mle_token_bucket_settings_set(int8_t interface_id, uint8_t size, uint8_t rate, uint8_t count) -{ - return 0; -} - diff --git a/test/nanostack/unittest/stub/net_rpl_stub.c b/test/nanostack/unittest/stub/net_rpl_stub.c deleted file mode 100644 index 87fd4bfbfec5..000000000000 --- a/test/nanostack/unittest/stub/net_rpl_stub.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include "ns_types.h" -#include - -#include "Core/include/address.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "RPL/rpl_protocol.h" -#include "RPL/rpl_control.h" -#include "RPL/rpl_data.h" -#ifdef OLD_RPL -#include "6LoWPAN/RPL/rpl_definition.h"l -#include "6LoWPAN/RPL/rpl_obj.h" -#endif - -#include "net_rpl.h" - - -int8_t arm_nwk_6lowpan_rpl_dodag_init(int8_t interface_id, const uint8_t *dodag_id, const dodag_config_t *config, uint8_t instance_id, uint8_t flags) -{ - return -1; -} - -int8_t arm_nwk_6lowpan_rpl_dodag_remove(int8_t interface_id) -{ - return -1; -} - -int8_t arm_nwk_6lowpan_rpl_dodag_start(int8_t interface_id) -{ - return -1; -} - -int8_t arm_nwk_6lowpan_rpl_dodag_prefix_update(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_len, uint8_t flags, uint32_t lifetime) -{ - return -1; -} - -int8_t arm_nwk_6lowpan_rpl_dodag_route_update(int8_t interface_id, uint8_t *route_ptr, uint8_t prefix_len, uint8_t flags, uint32_t lifetime) -{ - return -1; -} - -int8_t arm_nwk_6lowpan_rpl_dodag_poison(int8_t interface_id) { - return -1; -} - -int8_t arm_nwk_6lowpan_rpl_dodag_dao_trig(int8_t interface_id) { - return -1; -} - -int8_t arm_nwk_6lowpan_rpl_dodag_version_increment(int8_t interface_id) { - return -1; -} - -uint8_t rpl_instance_list_read(uint8_t *cache_ptr, uint8_t cache_size) { - return 0; -} - -uint8_t rpl_read_dodag_info(rpl_dodag_info_t *dodag_ptr, uint8_t instance_id) { - return 0; -} - -int8_t arm_nwk_6lowpan_rpl_dodag_pref_set(int8_t interface_id, uint8_t preference) { - return 0; -} diff --git a/test/nanostack/unittest/stub/net_stub.c b/test/nanostack/unittest/stub/net_stub.c deleted file mode 100644 index 5f77be2ce3f9..000000000000 --- a/test/nanostack/unittest/stub/net_stub.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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. - */ -/** - * \file net.c - * \brief Network API for library model - * - * The network API functions for library model - */ -#include "nsconfig.h" -#include "ns_types.h" -#include "eventOS_scheduler.h" -#include "string.h" -#include "ns_trace.h" -#include "socket_api.h" -#include "socket.h" -#include "nsdynmemLIB.h" -#include "mac_api.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "ccmLIB.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "6LoWPAN/Bootstraps/network_lib.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#include "6LoWPAN/ND/nd_router_object.h" -#ifndef NO_MLE -#include "MLE/mle.h" -#endif - -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "platform/arm_hal_interrupt.h" -#include "common_functions.h" -#include "Service_Libs/whiteboard/whiteboard.h" -#include "net_pana_parameters_api.h" -#ifdef PANA -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#endif -#include "nwk_stats_api.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "Security/Common/sec_lib_definitions.h" -#include "ipv6_stack/protocol_ipv6.h" -#include "ipv6_stack/ipv6_routing_table.h" -#include "net_thread_test.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "BorderRouter/border_router.h" - - -int8_t arm_net_energy_scan(int8_t interface_id, channel_list_s *scan_list, void (*passed_fptr)(int8_t if_id, const mlme_scan_conf_t* conf), uint8_t energy_tresshold) -{ - return 0; -} - -int8_t arm_net_nwk_scan(int8_t interface_id, channel_list_s *scan_list, void (*passed_fptr)(int8_t if_id, const mlme_scan_conf_t* conf), uint8_t scan_level) -{ - return 0; -} - -nwk_pan_descriptor_t *arm_net_get_scanned_nwk_list(int8_t interface_id) -{ - return NULL; -} - -uint16_t arm_net_get_nwk_pan_id_filter(int8_t interface_id) -{ - return 0; -} - -int8_t arm_nwk_param_read(int8_t interface_id, link_layer_setups_s *network_params) -{ - return 0; -} - -int8_t arm_nwk_mac_address_read(int8_t interface_id, link_layer_address_s *mac_params) -{ - return 0; -} - -int8_t arm_nwk_nd_address_read(int8_t interface_id, network_layer_address_s *nd_addr_info) -{ - return 0; -} - -int16_t arm_net_get_current_channel(int8_t interface_id) -{ - return 0; -} - -void arm_net_host_enter_sleep_state_set(int8_t interface_id, uint8_t state) -{ -} - - -void net_get_version_information(uint8_t *ptr) -{ -} - -int8_t arm_nwk_6lowpan_gp_address_mode(int8_t interface_id, net_6lowpan_gp_address_mode_e mode, uint16_t short_address_base, uint8_t define_new_short_address_at_DAD) -{ - return 0; -} - -int8_t arm_net_address_get(int8_t interface_id, net_address_t addr_id, uint8_t *address) -{ - return 0; -} - -int8_t arm_net_interface_address_list_size(int8_t interface_id, uint16_t *address_count) -{ - return 0; -} - -int8_t arm_net_address_list_get(int8_t interface_id, uint8_t address_buf_size, uint8_t *address_buffer, int *writed_address_count) -{ - return 0; -} - -#ifdef HAVE_ETHERNET -#include "ethernet_mac_api.h" -int8_t arm_nwk_interface_ethernet_init(eth_mac_api_t *api, const char *interface_name_ptr) -{ - return 0; -} -#endif - -int8_t arm_nwk_interface_network_driver_set(int8_t interface_id, const channel_list_s *nwk_channel_list, network_driver_setup_s *link_setup) -{ - return 0; -} - -int8_t arm_nwk_interface_up(int8_t interface_id) -{ - return 0; -} - -int8_t arm_nwk_interface_down(int8_t interface_id) -{ - return 0; -} - -int8_t arm_nwk_link_layer_security_mode(int8_t interface_id, net_6lowpan_link_layer_sec_mode_e mode, uint8_t sec_level, const net_link_layer_psk_security_info_s *psk_key_info) -{ - return 0; -} - -int8_t arm_network_certificate_chain_set(const arm_certificate_chain_entry_s *chain_info) -{ - return 0; -} - -int8_t arm_network_key_get(int8_t interface_id, ns_keys_t *key) -{ - return 0; -} - -int8_t arm_pana_server_library_init(int8_t interface_id, net_tls_cipher_e cipher_mode, const uint8_t *key_material, uint32_t time_period_before_activate_key) -{ - return 0; -} - -int8_t arm_pana_activate_new_key(int8_t interface_id) -{ - return 0; -} - -int8_t arm_pana_server_key_update(int8_t interface_id, const uint8_t *network_key_material) -{ - return 0; -} - -int8_t net_pana_parameter_set(const pana_lib_parameters_s *parameter_ptr) -{ - return 0; -} - -int8_t net_pana_parameter_read(pana_lib_parameters_s *parameter_ptr) -{ - return 0; -} - - -int8_t arm_pana_client_library_init(int8_t interface_id, net_tls_cipher_e cipher_mode, uint32_t psk_key_id) -{ - return 0; -} - - -int8_t arm_nwk_interface_configure_ipv6_bootstrap_set(int8_t interface_id, net_ipv6_mode_e bootstrap_mode, const uint8_t *ipv6_prefix_pointer) -{ - return 0; -} - -int8_t arm_nwk_interface_configure_6lowpan_bootstrap_set(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode, net_6lowpan_mode_extension_e net_6lowpan_mode_extension) -{ - return 0; -} - - -int8_t arm_nwk_6lowpan_link_scan_parameter_set(int8_t interface_id, uint8_t scan_time) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_link_panid_filter_for_nwk_scan(int8_t interface_id, uint16_t pan_id_filter) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_link_nwk_id_filter_for_nwk_scan(int8_t interface_id, const uint8_t *nwk_id_filter) -{ - return 0; -} - -int8_t arm_nwk_6lowpan_link_protocol_id_filter_for_nwk_scan(int8_t interface_id, uint8_t protocol_ID) -{ - return 0; -} - -int8_t net_init_core(void) -{ - return 0; -} - -int8_t arm_nwk_host_mode_set(int8_t interface_id, net_host_mode_t mode, uint32_t poll_time) -{ - return 0; -} - -int8_t arm_nwk_host_mode_get(int8_t interface_id, net_host_mode_t *mode) -{ - return 0; -} - -int8_t net_nvm_data_clean(int8_t interface_id) -{ - return 0; -} - -void arm_print_routing_table(void) -{ -} - -void arm_ncache_flush(void) -{ -} diff --git a/test/nanostack/unittest/stub/network_lib_stub.c b/test/nanostack/unittest/stub/network_lib_stub.c deleted file mode 100644 index af34126ef19f..000000000000 --- a/test/nanostack/unittest/stub/network_lib_stub.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include -#include "Core/include/socket.h" -#include "nsdynmemLIB.h" -#include "ns_trace.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/udp.h" -#include "6LoWPAN/Bootstraps/network_lib.h" -#include "MLE/mle.h" -#include "shalib.h" - -#ifdef PANA -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" -#include "ccmLIB.h" -#endif -#include "6LoWPAN/ND/nd_router_object.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#include "net_nwk_scan.h" - -#include "nwk_stats_api.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#ifdef HAVE_RPL -#include "RPL/rpl_data.h" -#endif - -#include "platform/arm_hal_interrupt.h" -#include "common_functions.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" - -#define MAC_MLME_SACN_PERIO_PARAM 5 - -#define TRACE_GROUP "nw" - -uint8_t nwk_ready(nwk_interface_id id) -{ - return 0; -} - -void nwk_parent_poll_fail_cb(int8_t id) -{ -} - -void network_library_init(void) -{ -} - -buffer_t *nwk_udp_rx_security_check(buffer_t *buf) -{ - return NULL; -} - diff --git a/test/nanostack/unittest/stub/ns_file_system_stub.c b/test/nanostack/unittest/stub/ns_file_system_stub.c deleted file mode 100644 index 37d21bcf58b2..000000000000 --- a/test/nanostack/unittest/stub/ns_file_system_stub.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2017, 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 -#include "ns_types.h" -#include "nsdynmemLIB.h" -#include "ns_file_system.h" - -static char *file_system_root; - -int ns_file_system_set_root_path(const char *root_path) -{ - return 0; -} - -char *ns_file_system_get_root_path(void) -{ - return file_system_root; -} - diff --git a/test/nanostack/unittest/stub/ns_list_stub.c b/test/nanostack/unittest/stub/ns_list_stub.c deleted file mode 100644 index 6544065d9088..000000000000 --- a/test/nanostack/unittest/stub/ns_list_stub.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ - -#define NS_LIST_FN extern - -#include "ns_list.h" - - diff --git a/test/nanostack/unittest/stub/ns_sha256_stub.c b/test/nanostack/unittest/stub/ns_sha256_stub.c deleted file mode 100644 index 3d5b3e136c9c..000000000000 --- a/test/nanostack/unittest/stub/ns_sha256_stub.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2016, 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 "ns_sha256.h" - -void ns_sha256_init( ns_sha256_context *ctx ) -{ - -} - -void ns_sha256_free( ns_sha256_context *ctx ) -{ - -} - -void ns_sha256_clone( ns_sha256_context *dst, - const ns_sha256_context *src ) -{ - -} - -void ns_sha256_starts( ns_sha256_context *ctx ) -{ - -} - -void ns_sha256_update( ns_sha256_context *ctx, const void *input, - size_t ilen ) -{ - -} - -void ns_sha256_finish( ns_sha256_context *ctx, void *output ) -{ - -} - -void ns_sha256_finish_nbits( ns_sha256_context *ctx, - void *output, unsigned obits ) -{ - -} - - -void ns_sha256( const void *input, size_t ilen, - void *output ) -{ - -} - -void ns_sha256_nbits( const void *input, size_t ilen, - void *output, unsigned obits ) -{ - -} diff --git a/test/nanostack/unittest/stub/ns_timer_stub.c b/test/nanostack/unittest/stub/ns_timer_stub.c deleted file mode 100644 index 158b940f41d3..000000000000 --- a/test/nanostack/unittest/stub/ns_timer_stub.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "ns_types.h" -#include "ns_list.h" -#include "ns_timer.h" -#include "ns_timer_stub.h" -#include "eventOS_callback_timer.h" -#include "platform/arm_hal_interrupt.h" -#include "platform/arm_hal_timer.h" -#include "nsdynmemLIB.h" - -ns_timer_stub_def ns_timer_stub; - -int8_t ns_timer_init(void) -{ - return ns_timer_stub.int8_value; -} - -int8_t eventOS_callback_timer_register(void (*timer_interrupt_handler)(int8_t, uint16_t)) -{ - if( ns_timer_stub.cb_counter > 0 ){ - ns_timer_stub.cb = timer_interrupt_handler; - ns_timer_stub.cb_counter--; - } - return ns_timer_stub.int8_value; -} - -int8_t eventOS_callback_timer_unregister(int8_t ns_timer_id) -{ - return ns_timer_stub.int8_value; -} - - -int8_t ns_timer_sleep(void) -{ - return ns_timer_stub.int8_value; -} - -int8_t eventOS_callback_timer_start(int8_t ns_timer_id, uint16_t slots) -{ - return ns_timer_stub.int8_value; -} - -int8_t eventOS_callback_timer_stop(int8_t ns_timer_id) -{ - return ns_timer_stub.int8_value; -} diff --git a/test/nanostack/unittest/stub/ns_timer_stub.h b/test/nanostack/unittest/stub/ns_timer_stub.h deleted file mode 100644 index c698adca6ae7..000000000000 --- a/test/nanostack/unittest/stub/ns_timer_stub.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __NS_TIMER_STUB_H__ -#define __NS_TIMER_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int8_t int8_value; - uint8_t cb_counter; - void (*cb)(int8_t, uint16_t); -} ns_timer_stub_def; - -extern ns_timer_stub_def ns_timer_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __NS_TIMER_STUB_H__ diff --git a/test/nanostack/unittest/stub/nsdynmemLIB_stub.c b/test/nanostack/unittest/stub/nsdynmemLIB_stub.c deleted file mode 100644 index 70073fd3771a..000000000000 --- a/test/nanostack/unittest/stub/nsdynmemLIB_stub.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014-2015, 2017, 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 "nsdynmemLIB_stub.h" -#include -#include -#include -#include "platform/arm_hal_interrupt.h" -#ifdef STANDARD_MALLOC -#include -#endif - -nsdynmemlib_stub_data_t nsdynmemlib_stub; - -#if NSDYNMEMLIB_API_VERSION < 2 -typedef int16_t ns_mem_block_size_t; -typedef int16_t ns_mem_heap_size_t; -void ns_dyn_mem_init(uint8_t *heap, uint16_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr) -{ -} -#else -void ns_dyn_mem_init(void *heap, uint16_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr) -{ -} -#endif - -void *ns_dyn_mem_alloc(ns_mem_block_size_t alloc_size) -{ - if (nsdynmemlib_stub.returnCounter > 0) - { - nsdynmemlib_stub.returnCounter--; - return malloc(alloc_size); - } - else - { - return(nsdynmemlib_stub.expectedPointer); - } -} - -void *ns_dyn_mem_temporary_alloc(ns_mem_block_size_t alloc_size) -{ - if (nsdynmemlib_stub.returnCounter > 0) - { - nsdynmemlib_stub.returnCounter--; - return malloc(alloc_size); - } - else - { - return(nsdynmemlib_stub.expectedPointer); - } -} - -void ns_dyn_mem_free(void *block) -{ - free(block); -} diff --git a/test/nanostack/unittest/stub/nsdynmemLIB_stub.h b/test/nanostack/unittest/stub/nsdynmemLIB_stub.h deleted file mode 100644 index 80eb5c5d38bb..000000000000 --- a/test/nanostack/unittest/stub/nsdynmemLIB_stub.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __NSDYNMEMLIB_STUB_H__ -#define __NSDYNMEMLIB_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "stdint.h" - -typedef struct { - uint8_t returnCounter; - void* expectedPointer; -} nsdynmemlib_stub_data_t; - -extern nsdynmemlib_stub_data_t nsdynmemlib_stub; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/test/nanostack/unittest/stub/nwk_nvm_stub.c b/test/nanostack/unittest/stub/nwk_nvm_stub.c deleted file mode 100644 index bc8b16051a93..000000000000 --- a/test/nanostack/unittest/stub/nwk_nvm_stub.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" - -#include "ns_types.h" -#include "eventOS_event.h" -#include "ns_trace.h" -#include "string.h" -#include "randLIB.h" -#include "nsdynmemLIB.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "6LoWPAN/NVM/nwk_nvm.h" -#include "Service_Libs/mle_service/mle_service_api.h" - -#define TRACE_GROUP "nNVM" - -#define COUNTER_NVM_UPDATE_INCREMENT 1000 - - -int8_t net_nvm_wpan_params_storage_enable(int8_t interface_id, wpan_params_updated *nvm_update_cb, wpan_params_get *nvm_get_cb) -{ - return 0; -} - - -int8_t net_nvm_wpan_params_storage_disable(int8_t interface_id) -{ - return 0; -} - - diff --git a/test/nanostack/unittest/stub/pan_blacklist_stub.c b/test/nanostack/unittest/stub/pan_blacklist_stub.c deleted file mode 100644 index de22642ce59f..000000000000 --- a/test/nanostack/unittest/stub/pan_blacklist_stub.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include -#include -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "Service_Libs/pan_blacklist/pan_blacklist_api.h" - -void pan_blacklist_cache_init(pan_blaclist_cache_s *blacklist_cache) -{ - -} - -void pan_coordinator_blacklist_cache_init(pan_coordinator_blaclist_cache_s *blacklist_cache) -{ - -} - -void pan_blacklist_pan_set(pan_blaclist_cache_s *list_ptr, uint16_t panid, uint16_t timeout) -{ - -} - -void pan_blacklist_time_update(pan_blaclist_cache_s *list_ptr, uint16_t time_update_in_seconds) -{ - -} - -void pan_coordinator_blacklist_time_update(pan_coordinator_blaclist_cache_s *list_ptr, uint16_t time_update_in_seconds) -{ - -} - -bool pan_blacklist_filter(pan_blaclist_cache_s *list_ptr, uint16_t panid) -{ - - return false; -} - -bool pan_cordinator_blacklist_filter(pan_coordinator_blaclist_cache_s *list_ptr, uint8_t *compare_data) -{ - return false; -} - -void pan_cordinator_blacklist_pan_set(pan_coordinator_blaclist_cache_s *list_ptr, uint8_t *cordinator_data, uint16_t timeout) -{ - -} diff --git a/test/nanostack/unittest/stub/pana_avp_stub.c b/test/nanostack/unittest/stub/pana_avp_stub.c deleted file mode 100644 index 086d6f2a527e..000000000000 --- a/test/nanostack/unittest/stub/pana_avp_stub.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "common_functions.h" -#include "Security/PANA/pana_avp.h" - -#define ZIGBEE_VENDOR_ID 0x0000917c - - -uint8_t *pana_avp_base_write(uint8_t avp_type, uint16_t length, uint8_t *dptr, uint16_t flags, uint32_t vendor_id) -{ - return dptr; -} - -uint8_t *pana_avp_32_bit_write(uint8_t avp_type, uint32_t value, uint8_t *dptr) -{ - return dptr; -} - - - -uint8_t *pana_avp_write_n_bytes(uint16_t avp_type, uint16_t length, const uint8_t *value, uint8_t *dptr) -{ - - return dptr; -} - -uint8_t *pana_avp_vendor_id_write_n_bytes(uint16_t avp_type, uint16_t length, const uint8_t *value, uint8_t *dptr, uint32_t vendor_id) -{ - return dptr; - -} - -bool pana_avp_discover(uint8_t *dptr, uint16_t data_len, pana_avp_t *avp) -{ - return false; -} diff --git a/test/nanostack/unittest/stub/pana_client_stub.c b/test/nanostack/unittest/stub/pana_client_stub.c deleted file mode 100644 index 9df1bf7fd4ac..000000000000 --- a/test/nanostack/unittest/stub/pana_client_stub.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" - -#include "ns_types.h" -#include "eventOS_event.h" -#include "ns_trace.h" -#include "string.h" -#include "randLIB.h" -#include "nsdynmemLIB.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "ccmLIB.h" -#include "shalib.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "6LoWPAN/ND/nd_router_object.h" -#include "Common_Protocols/udp.h" - -#ifdef ECC -#include "ecc.h" -#endif -#include "common_functions.h" -#include "Security/PANA/pana_nvm.h" -#include "Security/PANA/pana_avp.h" -#include "Security/PANA/pana_eap_header.h" -#include "Security/PANA/pana_header.h" -#include "Security/PANA/eap_protocol.h" -#include "net_pana_parameters_api.h" -#include "Service_Libs/mle_service/mle_service_api.h" - -#ifdef PANA -#define TRACE_GROUP "PaCli" - -void (*pana_client_nvm_storage_cb)(pana_client_nvm_update_process_t) = 0; -static uint8_t *pana_client_nvm_buffer = 0; - -static nwk_pana_params_s pana_params; - -static sec_suite_t tempsuite; - -bool pana_check_address(buffer_t *buf) -{ - return false; -} - -sec_suite_t *pana_client_init(auth_info_t *auth_ptr, uint8_t *session_address_ptr, pana_tls_setup_s *setup) -{ - return &tempsuite; -} - -void pana_reset_client_session(void) -{ - -} - -int8_t pana_client_interface_init(int8_t interface_id, net_tls_cipher_e cipher_mode, uint32_t psk_key_id) -{ - return 0; -} - -nwk_pana_params_s * pana_client_parameter_allocate(void) -{ - return &pana_params; -} - -int8_t pana_client_key_pull(int8_t interface_id) -{ - return 0; -} - -uint8_t pana_ping_notify_msg_tx(uint16_t pan_id) -{ - return 1; - -} - -int8_t pana_client_nvm_callback_set(pana_client_session_update_cb *nvm_update, pana_client_session_get_cb *nvm_get, uint8_t *nvm_static_buffer) -{ - return 0; -} - - -#else -int8_t pana_client_nvm_callback_set(pana_client_session_update_cb *nvm_update, pana_client_session_get_cb *nvm_get, uint8_t *nvm_static_buffer) -{ - return -1; -} - -#endif - diff --git a/test/nanostack/unittest/stub/pana_eap_stub.c b/test/nanostack/unittest/stub/pana_eap_stub.c deleted file mode 100644 index cc1e1abc9986..000000000000 --- a/test/nanostack/unittest/stub/pana_eap_stub.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "string.h" -#include "common_functions.h" -#include "Security/PANA/pana_eap_header.h" -#ifdef PANA - -bool eap_header_parse(uint8_t *data_ptr, uint16_t length, eap_header_t *header) -{ - return true; -} - -uint8_t eap_header_size(uint8_t eap_code) -{ - return 5; -} - -uint8_t *eap_header_build(uint8_t *ptr, uint16_t data_length, uint8_t eap_code, uint8_t id_seq, uint8_t type) -{ - return ptr; -} - -bool eap_tls_header_parse(uint8_t *eap_data_ptr, uint16_t eap_datalength, eap_tls_header_t *header) -{ - return true; -} - -uint8_t eap_tls_header_size(uint16_t eap_tls_flags) -{ - return 5; -} - -uint8_t *eap_tls_header_build(uint8_t *ptr, uint16_t eap_tls_flags, uint16_t frame_length) -{ - return ptr; -} -#endif diff --git a/test/nanostack/unittest/stub/pana_header_stub.c b/test/nanostack/unittest/stub/pana_header_stub.c deleted file mode 100644 index 81a9bf1f0bca..000000000000 --- a/test/nanostack/unittest/stub/pana_header_stub.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "common_functions.h" -#include "Security/PANA/pana_header.h" - -#ifdef PANA - -bool pana_header_parse(uint8_t *ptr, uint16_t data_length, pana_header_t *header) -{ - return true; -} - -uint8_t *pana_header_write(uint8_t *ptr, const pana_header_t *header) -{ - return ptr + 16; -} -#endif diff --git a/test/nanostack/unittest/stub/pana_relay_table_stub.c b/test/nanostack/unittest/stub/pana_relay_table_stub.c deleted file mode 100644 index 714615e39df0..000000000000 --- a/test/nanostack/unittest/stub/pana_relay_table_stub.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2013-2016, 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 "nsconfig.h" -#include "ns_types.h" -#include "debug.h" -#include "string.h" -#include "Security/PANA/pana_relay_table.h" -#include "nsdynmemLIB.h" - -#ifdef PANA - -void pana_relay_table_init(void) -{ -} - - -relay_table_entry_t *pana_relay_table_update(uint8_t *address) -{ - return NULL; -} - -relay_table_entry_t *pana_relay_detect(uint8_t *address) -{ - return NULL; -} - - -void pana_relay_ttl_update(uint16_t ttl_time) -{ -} -#endif diff --git a/test/nanostack/unittest/stub/pana_server_stub.c b/test/nanostack/unittest/stub/pana_server_stub.c deleted file mode 100644 index e674261d4ef3..000000000000 --- a/test/nanostack/unittest/stub/pana_server_stub.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" - -#include "ns_types.h" -#include "eventOS_event.h" -#include "ns_trace.h" -#include "string.h" -#include "randLIB.h" -#include "nsdynmemLIB.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "ccmLIB.h" -#include "shalib.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "6LoWPAN/ND/nd_router_object.h" -#include "Common_Protocols/udp.h" - -#ifdef ECC -#include "ecc.h" -#endif -#include "common_functions.h" -#include "Security/PANA/pana_nvm.h" -#include "Security/PANA/pana_avp.h" -#include "Security/PANA/pana_eap_header.h" -#include "Security/PANA/pana_header.h" -#include "Security/PANA/eap_protocol.h" -#include "net_pana_parameters_api.h" -#include "Service_Libs/mle_service/mle_service_api.h" - -#ifdef PANA -#ifdef PANA_SERVER_API - -#define TRACE_GROUP "PaSrv" - -void pana_key_update_delivery_ready(void) -{ -} - -void pana_session_nvm_udate(sec_suite_t *suite, pana_nvm_update_process_t update_event) -{ - -} - -int8_t pana_server_interface_init(int8_t interface_id, net_tls_cipher_e cipher_mode, const uint8_t *key_material, uint32_t time_period_before_activate_key) -{ - return -1; -} - -int8_t pana_server_key_update(int8_t interface_id, const uint8_t *network_key_material) -{ - return 0; -} - -void pana_key_update_delay_timer(void) -{ - -} - -int8_t pana_server_nvm_callback_set(pana_server_update_cb *update_cb, pana_server_session_get_cb *nvm_get, pana_server_session_get_by_id_cb *nvm_session_get, uint8_t *nvm_static_buffer) -{ - return -1; -} - -int8_t pana_server_process_ready_cb_set(void (*cb_fptr)(void)) -{ - return -1; -} - -/* Pana Client session load from NVM API */ -int8_t pana_server_nvm_client_session_load(uint8_t *nvm_pointer) -{ - return 0; -} - -int8_t pana_network_key_get(int8_t interface_id, ns_keys_t *key) -{ - return -1; -} - -int8_t pana_server_trig_new_key(int8_t interface_id) -{ - return -1; - -} - -int8_t pana_server_restore_from_nvm(uint8_t *nvm_data, int8_t interface_id) -{ - return 0; -} - -int8_t pana_server_key_material_load(int8_t interface_id) -{ - return 0; -} - -#else -int8_t pana_server_nvm_callback_set(pana_server_update_cb *update_cb, pana_server_session_get_cb *nvm_get, pana_server_session_get_by_id_cb *nvm_session_get, uint8_t *nvm_static_buffer) -{ - return -1; -} - -int8_t pana_server_nvm_client_session_load(uint8_t *nvm_pointer) -{ - return -1; -} - -int8_t pana_server_restore_from_nvm(uint8_t *nvm_data, int8_t interface_id) -{ - return -1; -} -#endif - -#endif diff --git a/test/nanostack/unittest/stub/pana_stub.c b/test/nanostack/unittest/stub/pana_stub.c deleted file mode 100644 index 1a89148eae2a..000000000000 --- a/test/nanostack/unittest/stub/pana_stub.c +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" - -#include "ns_types.h" -#include "eventOS_event.h" -#include "ns_trace.h" -#include "string.h" -#include "randLIB.h" -#include "nsdynmemLIB.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "ccmLIB.h" -#include "shalib.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "6LoWPAN/ND/nd_router_object.h" -#include "Common_Protocols/udp.h" - -#ifdef ECC -#include "ecc.h" -#endif -#include "common_functions.h" -#include "Security/PANA/pana_nvm.h" -#include "net_pana_parameters_api.h" -#include "Service_Libs/mle_service/mle_service_api.h" - -#ifdef PANA - -#define TRACE_GROUP "pana" - -typedef enum { - ARM_PANA_INIT = 0, - ARM_PANA_TLS_CB = 1, -} arm_pana_event_id_e; - -#define PANA_HEADER_START 0x0000 -#define ZIGBEE_VENDOR_ID 0x0000917c -#define PANA_EAP_VENDOR_FLAG 0x8000 - -#define PANA_EAP_KEYWARP_TYPE 0x0001 -#define PANA_EAP_KEYREQ_TYPE 0x0002 -//Pana Relay Constant -const uint8_t PANA_AUTH_STRING[9] = {'I', 'E', 'T', 'F', ' ', 'P', 'A', 'N', 'A'}; -const uint8_t PANA_PAA_ENC_KEY_STRING[18] = {'I', 'E', 'T', 'F', ' ', 'P', 'A', 'N', 'A', ' ', 'P', 'A', 'A', ' ', 'E', 'n', 'c', 'r'}; -const uint8_t PANA_PAC_ENC_KEY_STRING[18] = {'I', 'E', 'T', 'F', ' ', 'P', 'A', 'N', 'A', ' ', 'P', 'a', 'C', ' ', 'E', 'n', 'c', 'r'}; -const uint8_t EAP_ANYMOUS[9] = {'a', 'n', 'o', 'n', 'y', 'm', 'o', 'u', 's'}; - -buffer_t *parse_pana_base(buffer_t *buf); -uint8_t pana_parse_key_data(uint8_t *ptr, uint16_t length); -uint8_t pana_analyze_zigbee_key_data(uint8_t *ptr, uint16_t len); -/** Pana Core functions */ - -buffer_t *pana_relay_parse(buffer_t *buf); - - -pana_session_t * pana_session_allocate(void) -{ - return NULL; -} - -void pana_session_state_init(pana_session_t *p_session) -{ -} - -pana_heap_t * pana_heap_structure_allocate(void) -{ - return NULL; -} - -int8_t pana_get_params(pana_lib_parameters_s *params) -{ - return 0; -} - -int8_t pana_set_params(const pana_lib_parameters_s *params) -{ - return 0; -} - -const pana_lib_parameters_s *pana_get_params_ptr(void) -{ - return NULL; -} - -void pana_timeout_timer_set(sec_suite_t *suite, sec_state_machine_t cur_state) -{ -} - -uint8_t pana_retry_req_max_get(void) -{ - return 0; -} - -uint32_t pana_handshake_timeout(void) -{ - return 0; -} - -int pana_retry_check(uint8_t counter, sec_state_machine_t cur_state) -{ - return 0; -} - -void pana_avp_temp_set(uint32_t avp_value) -{ -} - -uint8_t *pana_key_get(const uint8_t *key) -{ - return NULL; -} - -void pana_session_init_by_session_ptr(sec_suite_t *suite, auth_info_t *auth_ptr) -{ -} - - -void pana_authentication_ready(uint8_t status, protocol_interface_info_entry_t *cur_interface) -{ -} - -void pana_reset_values(uint16_t pan_id) -{ -} - -void pana_event_handler(arm_event_s *event) -{ -} - -bool pana_socket_init(pana_socket_packet_handler_cb * socket_handler, pana_state_machine_step *state_machine_stepper, pana_eap_tls_up_cb *tls_handler_cb) -{ - return true; -} - -buffer_t *parse_pana_base(buffer_t *buf) -{ - return NULL; -} - -buffer_t *pana_relay_avp_build(buffer_t *buf, sec_suite_t *suite) -{ - return NULL; -} - -uint8_t pana_analyze_zigbee_key_data(uint8_t *ptr, uint16_t len) -{ - return 0; -} - -buffer_t *pana_relay_parse(buffer_t *buf) -{ - return NULL; -} - -void pana_session_startms_parse(buffer_t *buf, pana_header_t *header, sec_suite_t *suite) -{ -} - -void pana_complete_msg_parse(buffer_t *buf) -{ -} - -uint8_t *pana_avp_set(uint16_t avp, uint8_t *dptr) -{ - return NULL; -} - -void pana_start_response_build(buffer_t *buf) -{ -} - - -uint8_t pana_parse_key_data(uint8_t *ptr, uint16_t length) -{ - return 0; -} - - -void pana_free_dynamic_ram(sec_suite_t *suite) -{ -} - -void pana_key_calculation(sec_suite_t *suite) -{ - -} - -void pana_start_message_build(buffer_t *buf, sec_suite_t *suite) -{ - -} - -int8_t pana_interface_certificate_chain_set(const arm_certificate_chain_entry_s *chain_info) -{ - return -1; -} - -bool pana_auth_check(uint8_t *ptr, uint16_t length, uint8_t *authency, uint8_t *key) -{ - return true; -} - -buffer_t *pana_auth_message_handler(buffer_t *buf, pana_header_t *header, sec_suite_t *suite) -{ - return buf; -} - -void pana_eap_tls_up(buffer_t *buf, sec_suite_t *suite) -{ - -} - -void pana_eap_down(buffer_t *buf, sec_suite_t *suite) -{ - -} - -void pana_eap_payload_down(buffer_t *buf, const uint8_t *nonce, sec_suite_t *suite) -{ - -} - -void pana_down(buffer_t *buf, sec_suite_t *suite) -{ - -} - -void pana_common_state_machine(sec_suite_t *suite) -{ - -} - -int8_t pana_ccm_data_crypt(uint8_t *ptr, uint16_t len, uint8_t operation_type, uint32_t message_seq, sec_suite_t *suite) -{ - return 0; -} - -void pana_set_agend_address(buffer_t *buf, bool relay, sec_suite_t *suite) -{ - -} - -void pana_session_base_init(pana_session_t * p_session) -{ - -} - -#else - -int8_t pana_server_nvm_callback_set(pana_server_update_cb *update_cb, pana_server_session_get_cb *nvm_get, pana_server_session_get_by_id_cb *nvm_session_get, uint8_t *nvm_static_buffer) -{ - return -1; -} - - -#endif /*PANA*/ - -/* end of file */ diff --git a/test/nanostack/unittest/stub/platform_nvm_stub.c b/test/nanostack/unittest/stub/platform_nvm_stub.c deleted file mode 100644 index c37594ef39c6..000000000000 --- a/test/nanostack/unittest/stub/platform_nvm_stub.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2016, 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 "ns_types.h" -#include "platform/arm_hal_nvm.h" - -typedef struct { - platform_nvm_status status; - nvm_callback *saved_callback; - void *saved_context; -} test_platform_nvm_api_data; - -test_platform_nvm_api_data test_data = {0, NULL, NULL}; - - -void test_platform_nvm_api_set_retval(platform_nvm_status return_value) -{ - test_data.status = return_value; -} - -void test_platform_nvm_api_callback() -{ - test_data.saved_callback(test_data.status, test_data.saved_context); -} - -platform_nvm_status platform_nvm_init(nvm_callback *callback, void *context) -{ - test_data.saved_callback = callback; - test_data.saved_context = context; - return test_data.status; -} - -platform_nvm_status platform_nvm_finalize(nvm_callback *callback, void *context) -{ - (void) callback; - (void) context; - return test_data.status; -} - -platform_nvm_status platform_nvm_key_create(nvm_callback *callback, const char *key_name, uint16_t value_len, uint32_t flags, void *context) -{ - (void) key_name; - (void) value_len; - (void) flags; - test_data.saved_callback = callback; - test_data.saved_context = context; - return test_data.status; -} - -platform_nvm_status platform_nvm_key_delete(nvm_callback *callback, const char *key_name, void *context) -{ - (void) callback; - (void) key_name; - (void) context; - test_data.saved_callback = callback; - test_data.saved_context = context; - return test_data.status; -} - -platform_nvm_status platform_nvm_write(nvm_callback *callback, const char *key_name, const void *data, uint16_t *data_len, void *context) -{ - (void) key_name; - (void) data; - (void) data_len; - test_data.saved_callback = callback; - test_data.saved_context = context; - return test_data.status; -} - -platform_nvm_status platform_nvm_read(nvm_callback *callback, const char *key_name, void *buf, uint16_t *buf_len, void *context) -{ - (void) key_name; - (void) buf; - (void) buf_len; - test_data.saved_callback = callback; - test_data.saved_context = context; - return test_data.status; -} - -platform_nvm_status platform_nvm_flush(nvm_callback *callback, void *context) -{ - (void) callback; - (void) context; - test_data.saved_callback = callback; - test_data.saved_context = context; - return test_data.status; -} - diff --git a/test/nanostack/unittest/stub/platform_stub.c b/test/nanostack/unittest/stub/platform_stub.c deleted file mode 100644 index 92267ac691bf..000000000000 --- a/test/nanostack/unittest/stub/platform_stub.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, 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. - */ -void platform_enter_critical(void) -{ -} - -void platform_exit_critical(void) -{ -} - diff --git a/test/nanostack/unittest/stub/protocol_6lowpan_bootstrap_stub.c b/test/nanostack/unittest/stub/protocol_6lowpan_bootstrap_stub.c deleted file mode 100644 index 78b7b9278787..000000000000 --- a/test/nanostack/unittest/stub/protocol_6lowpan_bootstrap_stub.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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. - */ - -/* - * \file protocol_6lowpan_bootstrap.c - * - */ -#include "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "mac_api.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "Common_Protocols/udp.h" -#include "6LoWPAN/Bootstraps/network_lib.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_interface.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#ifndef NO_MLE -#include "MLE/mle.h" -//#include "MLE/mle_challenge_data.h" -#endif -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#ifndef NO_TCP -#ifndef NO_TLS -#include "ccmLIB.h" -#include "shalib.h" -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#endif -#include "Common_Protocols/tcp.h" -#endif -#include "6LoWPAN/ND/nd_router_object.h" -#include "common_functions.h" - -#define TRACE_GROUP_LOWPAN_BOOT "6Bo" - -#include "protocol_6lowpan_bootstrap_stub.h" - -protocol_6lowpan_bootstrap_def protocol_6lowpan_bootstrap_stub; - -int8_t arm_6lowpan_bootsrap_down(protocol_interface_info_entry_t *cur) -{ - return protocol_6lowpan_bootstrap_stub.int8_value; -} - -int8_t arm_6lowpan_bootstrap_up(protocol_interface_info_entry_t *cur) -{ - return protocol_6lowpan_bootstrap_stub.int8_value; -} - -void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, mle_security_header_t *security_headers) -{ - -} - -int8_t arm_6lowpan_mle_service_ready_for_security_init(protocol_interface_info_entry_t *cur) -{ - return protocol_6lowpan_bootstrap_stub.int8_value; -} - -mle_6lowpan_data_t *protocol_6lowpan_mle_data_get(void) -{ - return NULL; -} - -void protocol_6lowpan_mle_blacklist_clear(void) -{ - -} - -void arm_6lowpan_bootstrap_init(protocol_interface_info_entry_t *cur) -{ -} - -int8_t arm_network_processor_up(protocol_interface_info_entry_t *cur) -{ - return protocol_6lowpan_bootstrap_stub.int8_value; -} - -int8_t arm_6lowpan_bootstarp_bootstrap_set(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode, net_6lowpan_mode_extension_e net_6lowpan_mode_extension) -{ - return protocol_6lowpan_bootstrap_stub.int8_value; -} - -void nwk_6lowpan_router_scan_state(protocol_interface_info_entry_t *cur) -{ -} - -void nwk_6lowpan_bootstrap_ready(protocol_interface_info_entry_t *cur) -{ -} - -void protocol_6lowpan_link_advertise_handle(nd_router_t *cur, protocol_interface_info_entry_t *cur_interface, uint16_t tick) -{ -} - -uint8_t nwk_bootstrap_icmp_rpl_dis_msg_tx(protocol_interface_info_entry_t *cur) -{ - return protocol_6lowpan_bootstrap_stub.uint8_value; -} - -void protocol_6lowpan_bootstrap_nd_ready(protocol_interface_info_entry_t *cur_interface) -{ -} - - -void nwk_6lowpan_rpl_router_result_check(protocol_interface_info_entry_t *cur) -{ -} - - -void nwk_6lowpan_nd_address_registartion_ready(protocol_interface_info_entry_t *cur) -{ -} - -#ifdef PANA -void nwk_6lowpan_pana_key_pull(protocol_interface_info_entry_t *cur) -{ -} -#endif - -#ifndef NO_MLE - -#ifdef PANA -void nwk_6lowpan_bootsrap_pana_authentication_cb(bool processSuccesfully, protocol_interface_info_entry_t *cur) -{ - -} - -#endif - -#endif - -void nwk_6lowpan_network_authentication_fail(protocol_interface_info_entry_t *cur) -{ -} - -uint8_t *protocol_6lowpan_mle_service_security_notify_cb(int8_t interface_id, mle_security_event_t event, uint8_t keyId) -{ - return NULL; -} - -void protocol_6lowpan_mac_scan_confirm(uint8_t *data) -{ -} - -void protocol_6lowpan_bootstrap(protocol_interface_info_entry_t *cur) -{ -} - -void protocol_6lowpan_mac_clean_mac16(protocol_interface_info_entry_t *interface) -{ -} - -void protocol_6lowpan_nd_borderrouter_connection_down(protocol_interface_info_entry_t *interface) -{ -} - -void protocol_6lowpan_bootstrap_re_start(protocol_interface_info_entry_t *interface) -{ -} - -uint8_t *protocol_6lowpan_nd_border_router_address_get(nwk_interface_id nwk_id) -{ - return protocol_6lowpan_bootstrap_stub.uint8_ptr; -} - -uint8_t protocol_6lowpan_rf_link_scalability_from_lqi(uint8_t lqi) -{ - return protocol_6lowpan_bootstrap_stub.uint8_value; -} - -int protocol_6lowpan_del_ll16(protocol_interface_info_entry_t *cur, uint16_t mac_short_address) -{ - return 0; -} - -int protocol_6lowpan_set_ll16(protocol_interface_info_entry_t *cur, uint16_t mac_short_address) -{ - return 0; -} - -int protocol_6lowpan_child_update(protocol_interface_info_entry_t *cur) -{ - return protocol_6lowpan_bootstrap_stub.int_value; -} - -int protocol_6lowpan_parent_link_req(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -int protocol_6lowpan_router_synch_to_new_router(protocol_interface_info_entry_t *cur, uint8_t *ll64, uint8_t incoming_idr, bool retrans) -{ - return 0; -} - -bool lowpan_neighbour_data_clean(int8_t interface_id, const uint8_t *link_local_address) -{ - return false; -} - -void arm_6lowpan_security_init_ifup(protocol_interface_info_entry_t *cur) -{ - -} - -void protocol_6lowpan_mle_timer(uint16_t ticks_update) -{ - -} - -void bootstrap_timer_handle(uint16_t ticks) -{ - -} diff --git a/test/nanostack/unittest/stub/protocol_6lowpan_bootstrap_stub.h b/test/nanostack/unittest/stub/protocol_6lowpan_bootstrap_stub.h deleted file mode 100644 index 7d95e782c026..000000000000 --- a/test/nanostack/unittest/stub/protocol_6lowpan_bootstrap_stub.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 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 __PROTOCOL_6LOWPAN_BOOTSTRAP_STUB_H__ -#define __PROTOCOL_6LOWPAN_BOOTSTRAP_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int int_value; - int8_t int8_value; - uint8_t uint8_value; - uint8_t *uint8_ptr; -} protocol_6lowpan_bootstrap_def; - -extern protocol_6lowpan_bootstrap_def protocol_6lowpan_bootstrap_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __PROTOCOL_6LOWPAN_BOOTSTRAP_STUB_H__ diff --git a/test/nanostack/unittest/stub/protocol_6lowpan_interface_stub.c b/test/nanostack/unittest/stub/protocol_6lowpan_interface_stub.c deleted file mode 100644 index 2dfa2be96a23..000000000000 --- a/test/nanostack/unittest/stub/protocol_6lowpan_interface_stub.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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. - */ - -/* - * \file protocol_6lowpan_interface.c - * \brief Add short description about this file!!! - * - */ -#include "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "mac_api.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/udp.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "6LoWPAN/Bootstraps/network_lib.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#ifndef NO_MLE -#include "MLE/mle.h" -//#include "MLE/mle_challenge_data.h" -#endif -#include "6LoWPAN/Mesh/mesh.h" -#include "6LoWPAN/Thread/thread_common.h" -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#ifndef NO_TCP -#ifndef NO_TLS -#include "ccmLIB.h" -#include "shalib.h" -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#endif -#include "Common_Protocols/tcp.h" -#endif - -#include "6LoWPAN/ND/nd_router_object.h" -#include "platform/arm_hal_interrupt.h" -#include "common_functions.h" - - -int8_t nwk_6lowpan_up(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -int8_t nwk_6lowpan_down(protocol_interface_info_entry_t *cur) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/protocol_6lowpan_stub.c b/test/nanostack/unittest/stub/protocol_6lowpan_stub.c deleted file mode 100644 index bd9e34701166..000000000000 --- a/test/nanostack/unittest/stub/protocol_6lowpan_stub.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "mac_api.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/udp.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "6LoWPAN/IPHC_Decode/cipv6.h" -#ifndef NO_MLE -#include "MLE/mle.h" -//#include "MLE/mle_challenge_data.h" -#endif -#include "6LoWPAN/Mesh/mesh.h" -#include "6LoWPAN/Thread/thread_common.h" -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#ifndef NO_TCP -#ifndef NO_TLS -#include "ccmLIB.h" -#include "shalib.h" -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#endif -#include "Common_Protocols/tcp.h" -#endif -#include "randLIB.h" -#include "6LoWPAN/ND/nd_router_object.h" -#include "common_functions.h" - -#include "protocol_6lowpan_stub.h" - -#define TRACE_GROUP_LOWPAN "6lo" -#ifdef NO_TCP -buffer_t *tcp_up(buffer_t *buf); -buffer_t *tcp_down(buffer_t *buf); - -buffer_t *tcp_up(buffer_t *buf) -{ - return buffer_free(buf); -} -buffer_t *tcp_down(buffer_t *buf) -{ - return buffer_free(buf); -} -#endif - -#ifdef NO_TLS -#define sec_timer_handle() -#endif - -#ifdef HAVE_RPL -#include "RPL/rpl_control.h" -#include "RPL/rpl_data.h" - -rpl_domain_t *protocol_6lowpan_rpl_domain; -/* Having to sidestep old rpl_dodag_t type for the moment */ -struct rpl_dodag *protocol_6lowpan_rpl_root_dodag; -#endif - -protocol_6lowpan_stub_def protocol_6lowpan_stub; - -void protocol_init(void) -{ -} - -void protocol_6lowpan_stack(buffer_t *b) -{ -} - -void protocol_6lowpan_host_init(protocol_interface_info_entry_t *cur, bool sleepy_host) -{ - -} - -void protocol_6lowpan_router_init(protocol_interface_info_entry_t *cur) -{ - -} - -void protocol_6lowpan_configure_core(protocol_interface_info_entry_t *cur) -{ - -} - -void protocol_6lowpan_register_handlers(protocol_interface_info_entry_t *cur) -{ -} - -void protocol_6lowpan_release_short_link_address_from_neighcache(protocol_interface_info_entry_t *cur, uint16_t shortAddress) -{ -} - -void protocol_6lowpan_release_long_link_address_from_neighcache(protocol_interface_info_entry_t *cur, uint8_t *mac64) -{ -} - -void protocol_6lowpan_neighbor_priority_update(protocol_interface_info_entry_t *cur, uint8_t *removed_priority, uint8_t *updated_priority) -{ -} - -int8_t protocol_6lowpan_neighbor_remove(protocol_interface_info_entry_t *cur, uint8_t *address_ptr, addrtype_t type) -{ - return 0; -} - -void protocol_6lowpan_allocate_mac16(protocol_interface_info_entry_t *cur) -{ -} - -void protocol_6lowpan_interface_common_init(protocol_interface_info_entry_t *cur) -{ -} - -int8_t protocol_6lowpan_interface_compare_cordinator_netid(protocol_interface_info_entry_t *cur, uint8_t *adr_ptr) -{ - return 0; -} - -int8_t protocol_6lowpan_interface_get_link_local_cordinator_address(protocol_interface_info_entry_t *cur, uint8_t *adr_ptr) -{ - return 0; -} - -int16_t protocol_6lowpan_rpl_global_priority_get(void) -{ - return protocol_6lowpan_stub.uint8_value; -} - -uint8_t protocol_6lowpan_beacon_join_priority_tx(int8_t interface_id) -{ - return protocol_6lowpan_stub.uint8_value; -} - -uint8_t protocol_6lowpan_beacon_compare_rx(int8_t interface_id, uint8_t join_priority, uint8_t link_quality) -{ - return protocol_6lowpan_stub.uint8_value; -} - -int8_t protocol_6lowpan_neighbor_address_state_synch(protocol_interface_info_entry_t *cur, const uint8_t eui64[8], const uint8_t iid[8]) -{ - return 0; -} - -uint16_t protocol_6lowpan_neighbor_priority_set(int8_t interface_id, addrtype_t addr_type, const uint8_t *addr_ptr) -{ - return 0; -} - -uint16_t protocol_6lowpan_neighbor_second_priority_set(int8_t interface_id, addrtype_t addr_type, const uint8_t *addr_ptr) -{ - return 0; -} - -void protocol_6lowpan_neighbor_priority_clear_all(int8_t interface_id, neighbor_priority priority) -{ - -} - -int8_t protocol_6lowpan_interface_get_mac_coordinator_address(protocol_interface_info_entry_t *cur, sockaddr_t *adr_ptr) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/protocol_6lowpan_stub.h b/test/nanostack/unittest/stub/protocol_6lowpan_stub.h deleted file mode 100644 index 309b60fe6caf..000000000000 --- a/test/nanostack/unittest/stub/protocol_6lowpan_stub.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016, 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 __PROTOCOL_6LOWPAN_STUB_H__ -#define __PROTOCOL_6LOWPAN_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" - -typedef struct { - bool bool_value; - int int_value; - int8_t int8_value; - uint8_t uint8_value; - uint32_t uint32_value; - protocol_interface_info_entry_t *entry_ptr; -} protocol_6lowpan_stub_def; - -extern protocol_6lowpan_stub_def protocol_6lowpan_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __PROTOCOL_6LOWPAN_STUB_H__ diff --git a/test/nanostack/unittest/stub/protocol_core_stub.c b/test/nanostack/unittest/stub/protocol_core_stub.c deleted file mode 100644 index af42ce01f4a4..000000000000 --- a/test/nanostack/unittest/stub/protocol_core_stub.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_scheduler.h" -#include "eventOS_callback_timer.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "Core/include/socket.h" -#include "mac_api.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_timer.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "platform/arm_hal_interrupt.h" -#ifndef NO_MLE -#include "MLE/mle.h" -#endif -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "NWK_INTERFACE/Include/protocol_timer.h" -#include "common_functions.h" -#include "randLIB.h" -#include "platform/arm_hal_phy.h" -#include "platform/arm_hal_interrupt.h" -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#ifndef NO_TLS -#include "shalib.h" -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "net_pana_parameters_api.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#else -#define sec_timer_handle() -#endif -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/ipv6_fragmentation.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "Common_Protocols/udp.h" -#include "6LoWPAN/ND/nd_router_object.h" -#include "libDHCPv6/libDHCPv6.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#ifdef IPV6_STACK -#include "ipv6_stack/protocol_ipv6.h" -#endif -#include "Service_Libs/whiteboard/whiteboard.h" - -#include "sw_mac.h" -#include "MAC/IEEE802_15_4/sw_mac_internal.h" -#include "mac_api.h" -#include "ethernet_mac_api.h" - -#include "protocol_core_stub.h" - -uint32_t protocol_core_monotonic_time; - -protocol_interface_info_entry_t *protocol_core_multicast_upstream; - -protocol_interface_list_t NS_LIST_NAME_INIT(protocol_interface_info_list); - -protocol_core_stub_def protocol_core_stub; - -int protocol_core_buffers_in_event_queue; - -int8_t protocol_read_tasklet_id(void) -{ - return protocol_core_stub.int8_value; -} - -uint8_t check_power_state(uint8_t mode) -{ - return protocol_core_stub.uint8_value; -} - - -void set_power_state(uint8_t mode) -{ -} - -void clear_power_state(uint8_t mode) -{ -} - -void arm_net_protocol_packet_handler(buffer_t *buf, protocol_interface_info_entry_t *cur_interface) -{ - -} - -void protocol_root_tasklet(arm_event_s *event) -{ -} - -void protocol_core_security_tick_update(uint16_t tick_update) -{ -} - -void nwk_bootsrap_timer(protocol_interface_info_entry_t *cur) -{ -} - -void core_timer_event_handle(uint16_t ticksUpdate) -{ -} - -void protocol_core_cb(uint16_t ticksUpdate) -{ -} - - -void protocol_core_init(void) -{ -} - -void protocol_core_interface_info_reset(protocol_interface_info_entry_t *entry) -{ -} - -void bootsrap_next_state_kick(icmp_state_t new_state, protocol_interface_info_entry_t *cur) -{ -} - -uint32_t protocol_stack_interface_set_reachable_time(protocol_interface_info_entry_t *cur, uint32_t base_reachable_time) -{ - return protocol_core_stub.uint32_value; -} - -protocol_interface_info_entry_t *nwk_interface_get_ipv6_ptr(void) -{ - return protocol_core_stub.entry_ptr; -} - -void nwk_interface_print_neigh_cache(route_print_fn_t *print_fn) -{ -} - -void nwk_interface_flush_neigh_cache(void) -{ -} - -protocol_interface_info_entry_t *protocol_stack_interface_info_get(nwk_interface_id nwk_id) -{ - return protocol_core_stub.entry_ptr; -} - -protocol_interface_info_entry_t *protocol_stack_interface_info_get_by_id(int8_t nwk_id) -{ - return protocol_core_stub.entry_ptr; -} - -protocol_interface_info_entry_t *protocol_stack_interface_info_get_by_bootstrap_id(int8_t id) -{ - return protocol_core_stub.entry_ptr; -} - -protocol_interface_info_entry_t *protocol_stack_interface_info_get_by_rpl_domain(const struct rpl_domain *domain, int8_t last_id) -{ - return protocol_core_stub.entry_ptr; -} - -protocol_interface_info_entry_t *protocol_stack_interface_sleep_possibility(void) -{ - return protocol_core_stub.entry_ptr; -} - -uint8_t nwk_bootsrap_ready(protocol_interface_info_entry_t *cur) -{ - return protocol_core_stub.uint8_value; -} - -int8_t nwk_interface_MAC_MTU_allocate(protocol_interface_info_entry_t *cur) -{ - return protocol_core_stub.int8_value; -} - -protocol_interface_info_entry_t *protocol_stack_interface_generate_ethernet(eth_mac_api_t *api) -{ - return protocol_core_stub.entry_ptr; -} - -protocol_interface_info_entry_t *protocol_stack_interface_generate_lowpan(mac_api_t *api) -{ - return protocol_core_stub.entry_ptr; -} - -bool nwk_interface_compare_mac_address(protocol_interface_info_entry_t *cur, uint_fast8_t addrlen, const uint8_t *addr) -{ - return protocol_core_stub.bool_value; -} - -int nwk_lowpan_routing_check(buffer_t *buf) -{ - return protocol_core_stub.int_value; -} - -void protocol_push(buffer_t *buf) -{ -} - -void nwk_bootsrap_state_update(arm_nwk_interface_status_type_e posted_event, protocol_interface_info_entry_t *cur) -{ -} - -void net_bootsrap_cb_run(uint8_t event) -{ -} - -void protocol_core_dhcpv6_allocated_address_remove(protocol_interface_info_entry_t *cur, uint8_t *guaPrefix) -{ -} - -int8_t protcol_interface_address_compare(protocol_interface_info_entry_t *cur, const uint8_t *addr) -{ - return protocol_core_stub.int8_value; -} - diff --git a/test/nanostack/unittest/stub/protocol_core_stub.h b/test/nanostack/unittest/stub/protocol_core_stub.h deleted file mode 100644 index 3b00530e2a5a..000000000000 --- a/test/nanostack/unittest/stub/protocol_core_stub.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016, 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 __PROTOCOL_CORE_STUB_H__ -#define __PROTOCOL_CORE_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" - -typedef struct { - bool bool_value; - int int_value; - int8_t int8_value; - uint8_t uint8_value; - uint32_t uint32_value; - protocol_interface_info_entry_t *entry_ptr; -} protocol_core_stub_def; - -extern protocol_core_stub_def protocol_core_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __PROTOCOL_CORE_STUB_H__ diff --git a/test/nanostack/unittest/stub/protocol_ipv6_stub.c b/test/nanostack/unittest/stub/protocol_ipv6_stub.c deleted file mode 100644 index e33fd6f80f7f..000000000000 --- a/test/nanostack/unittest/stub/protocol_ipv6_stub.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2012-2017, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/ipv6_resolution.h" -#include "Common_Protocols/icmpv6_prefix.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "Common_Protocols/udp.h" -#ifndef NO_TLS -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "shalib.h" -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#endif - -#include "6LoWPAN/ND/nd_router_object.h" // for gp_address_ functions - better place? -#include "ipv6_stack/ipv6_routing_table.h" -#include "ipv6_stack/protocol_ipv6.h" -#ifndef NO_TCP -#include "Common_Protocols/tcp.h" -#endif -#include "Service_Libs/whiteboard/whiteboard.h" -#include "platform/arm_hal_interrupt.h" -#include "common_functions.h" -#include "randLIB.h" - -typedef struct ipv6_interface_prefix_on_link_t { - uint8_t prefix[16]; /*!< destination address */ - uint8_t prefix_len; - uint32_t prefix_valid_ttl; - ns_list_link_t link; -} ipv6_interface_prefix_on_link_t; - -typedef struct ipv6_interface_route_on_link_t { - uint8_t prefix[16]; /*!< destination address */ - uint8_t prefix_len; - uint8_t routePrefer; - uint32_t prefix_valid_ttl; - ns_list_link_t link; -} ipv6_interface_route_on_link_t; - -#define WB_UPDATE_PERIOD_SECONDS 23 - -#define ROUTER_SOL_MAX_COUNTER 4 - -#define TRACE_GROUP_PROTOCOL_IPv6 "ip6s" - -void ipv6_interface_phy_sap_register(protocol_interface_info_entry_t *cur) -{ - -} - -int ipv6_generate_static_gp_setup(protocol_interface_info_entry_t *cur) -{ - return -1; -} - -int ipv6_generate_ula_prefix(protocol_interface_info_entry_t *cur) -{ - return -1; -} - -int ipv6_prefix_router_flag_activate(uint8_t *ipv6_address) -{ - return -1; -} - -buffer_t *ethernet_header_build_push(buffer_t *buf, uint16_t ethernet_type, int8_t *status) -{ - return NULL; -} - -buffer_t *ethernet_down(buffer_t *buf) -{ - return NULL; -} - -void ipv6_stack_prefix_on_link_update(protocol_interface_info_entry_t *cur, uint8_t *address) -{ -} - -void ipv6_stack_route_advert_update(uint8_t *address, uint8_t prefixLength, uint8_t routePrefer) -{ -} - -void ipv6_prefix_on_link_update(uint8_t *address) -{ - -} - -void ipv6_prefix_on_link_remove(uint8_t *address) -{ - -} - -void ipv6_stack_route_advert_remove(uint8_t *address, uint8_t prefixLength) -{ -} - -void ipv6_prefix_online_list_free(void) -{ -} - -void ipv6_rote_advert_list_free(void) -{ -} - -void ipv6_core_slow_timer_event_handle(struct protocol_interface_info_entry *cur) -{ -} - -void ipv6_core_timer_event_handle(protocol_interface_info_entry_t *cur, const uint8_t event) -{ -} - -int ipv6_prefix_register(uint8_t *prefix_64, uint32_t lifetime, uint32_t prefer_lifetime) -{ - return -1; -} - - -int8_t ipv6_interface_up(protocol_interface_info_entry_t *cur) -{ - return -1; -} - -int8_t ipv6_interface_down(protocol_interface_info_entry_t *cur) -{ - return -1; -} - - -#ifdef RADV_TX -void ipv6_nd_ra_advert(protocol_interface_info_entry_t *cur, const uint8_t *dest) -{ -} -#endif - - - -void ipv6_trigger_resolve_query(protocol_interface_info_entry_t *cur_interface, buffer_t *buf, ipv6_neighbour_t *n) -{ -} - -void ipv6_interface_slaac_handler(protocol_interface_info_entry_t *cur, uint8_t *slaacPrefix, uint8_t prefixLen, uint32_t validLifeTime, uint32_t preferredLifeTime) -{ -} - -void ipv6_interface_sitelocal_clone(buffer_t *buf) -{ - -} - -int8_t ipv6_interface_configure_ipv6_bootstrap_set(int8_t interface_id, net_ipv6_mode_e bootstrap_mode, const uint8_t *ipv6_prefix_pointer) -{ - return 0; -} - -int8_t ipv6_interface_accept_ra(int8_t interface_id, net_ipv6_accept_ra_e accept_ra) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/protocol_stats_stub.c b/test/nanostack/unittest/stub/protocol_stats_stub.c deleted file mode 100644 index b117f300bee4..000000000000 --- a/test/nanostack/unittest/stub/protocol_stats_stub.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include -#include "ns_types.h" -#include "nwk_stats_api.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" - -nwk_stats_t *NS_LARGE nwk_stats_ptr = 0; - -void protocol_stats_init(void) -{ -} - -void protocol_stats_start(nwk_stats_t *stats_ptr) -{ -} - -void protocol_stats_stop(void) -{ -} - -void protocol_stats_reset(void) -{ -} - -void protocol_stats_update(nwk_stats_type_t type, uint16_t update_val) -{ -} - - diff --git a/test/nanostack/unittest/stub/protocol_timer_stub.c b/test/nanostack/unittest/stub/protocol_timer_stub.c deleted file mode 100644 index 4b8c65ff87a7..000000000000 --- a/test/nanostack/unittest/stub/protocol_timer_stub.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "eventOS_event.h" -#include "eventOS_callback_timer.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_timer.h" -#include "platform/arm_hal_interrupt.h" - -#define TRACE_GROUP "ctim" - - -int protocol_timer_init(void) -{ - return 0; -} - -void protocol_timer_start(protocol_timer_id_t id, void (*passed_fptr)(uint16_t), uint32_t time) -{ -} - -void protocol_timer_stop(protocol_timer_id_t id) -{ -} - - - -void protocol_timer_sleep_balance(uint32_t time_in_ms) -{ -} - -void protocol_timer_event_lock_free(void) -{ -} - - -void protocol_timer_cb(uint16_t ticks) -{ -} - -void protocol_timer_interrupt(int8_t timer_id, uint16_t slots) -{ -} diff --git a/test/nanostack/unittest/stub/protocol_tun_driver_stub.c b/test/nanostack/unittest/stub/protocol_tun_driver_stub.c deleted file mode 100644 index 78de90b72da9..000000000000 --- a/test/nanostack/unittest/stub/protocol_tun_driver_stub.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2014, 2016, 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 "nsconfig.h" -#ifdef HAVE_LOCAL_SOCKET - -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "Core/include/ns_buffer.h" - -#include "protocol_tun_driver_stub.h" - -protocol_tun_driver_stub_def protocol_tun_driver_stub; - -int8_t arm_tun_driver_tasklet_init(void) -{ - return protocol_tun_driver_stub.int8_value; -} - -int8_t arm_tun_interface_tx_done_handler(arm_device_driver_list_s *driver) -{ - return protocol_tun_driver_stub.int8_value; -} - - -int arm_tun_driver_data_push(buffer_t *b, arm_device_driver_list_s *driver) -{ - return protocol_tun_driver_stub.int8_value; -} -#endif - diff --git a/test/nanostack/unittest/stub/protocol_tun_driver_stub.h b/test/nanostack/unittest/stub/protocol_tun_driver_stub.h deleted file mode 100644 index ff9a58974f32..000000000000 --- a/test/nanostack/unittest/stub/protocol_tun_driver_stub.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 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 __PROTOCOL_TUN_DRIVER_STUB_H__ -#define __PROTOCOL_TUN_DRIVER_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" - -typedef struct { - int8_t int8_value; - int int_value; -} protocol_tun_driver_stub_def; - -extern protocol_tun_driver_stub_def protocol_tun_driver_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __PROTOCOL_TUN_DRIVER_STUB_H__ diff --git a/test/nanostack/unittest/stub/randLIB_stub.c b/test/nanostack/unittest/stub/randLIB_stub.c deleted file mode 100644 index aea779b2e0c2..000000000000 --- a/test/nanostack/unittest/stub/randLIB_stub.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 -#include -#include -#include -#include "randLIB.h" -#include "platform/arm_hal_random.h" - -void randLIB_seed_random(void) -{ -} - -void randLIB_add_seed(uint64_t seed) -{ -} - -uint8_t randLIB_get_8bit(void) -{ - return 0; -} - -uint16_t randLIB_get_16bit(void) -{ - return 0; -} - -uint32_t randLIB_get_32bit(void) -{ - return 0; -} - -uint64_t randLIB_get_64bit(void) -{ - return 0; -} - -void *randLIB_get_n_bytes_random(void *data_ptr, uint8_t eight_bit_boundary) -{ - return data_ptr; -} - -uint16_t randLIB_get_random_in_range(uint16_t min, uint16_t max) -{ - return min; -} - -uint32_t randLIB_randomise_base(uint32_t base, uint16_t min_factor, uint16_t max_factor) -{ - return base; -} diff --git a/test/nanostack/unittest/stub/rf_driver_storage_stub.c b/test/nanostack/unittest/stub/rf_driver_storage_stub.c deleted file mode 100644 index 891619ee1c5d..000000000000 --- a/test/nanostack/unittest/stub/rf_driver_storage_stub.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "common_functions.h" -#include "nsdynmemLIB.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "rf_driver_storage_stub.h" - -//TODO: refactor away (needed by local_socket) -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" - -rf_driver_storage_def rf_driver_storage_stub; - -arm_device_driver_list_s *arm_net_phy_driver_pointer(int8_t id) -{ - return rf_driver_storage_stub.list_value; -} - -int8_t arm_net_phy_register(phy_device_driver_s *phy_driver) -{ - rf_driver_storage_stub.registered_driver = phy_driver; - return rf_driver_storage_stub.int8_value; -} - -int8_t arm_net_phy_init(phy_device_driver_s *phy_driver, arm_net_phy_rx_fn *rx_cb, arm_net_phy_tx_done_fn *done_cb) -{ - rf_driver_storage_stub.rx_cb = rx_cb; - rf_driver_storage_stub.done_cb = done_cb; - return rf_driver_storage_stub.int8_value; -} - -uint32_t dev_get_phy_datarate(phy_device_driver_s *phy_driver, channel_page_e channel_page) -{ - return rf_driver_storage_stub.uint32_value; -} - -int8_t arm_net_phy_mac64_set(uint8_t *MAC, int8_t id) -{ - return rf_driver_storage_stub.int8_value; -} - -uint8_t *arm_net_phy_mac64_get(int8_t id) -{ - return rf_driver_storage_stub.uint8_ptr; -} - -int arm_net_phy_rf_type(int8_t id) -{ - return rf_driver_storage_stub.int_value; -} - -uint16_t arm_net_phy_mtu_size(int8_t id) -{ - return rf_driver_storage_stub.uint16_value; -} - -void arm_net_observer_cb_set(int8_t id, internal_mib_observer *observer_cb) -{ - rf_driver_storage_stub.mlme_observer = observer_cb; -} - -void arm_net_virtual_config_rx_cb_set(phy_device_driver_s *phy_driver, arm_net_virtual_config_rx_fn *virtual_config_rx) -{ - -} - -void arm_net_virtual_confirmation_rx_cb_set(phy_device_driver_s *phy_driver, arm_net_virtual_confirmation_rx_fn *virtual_confirmation_rx) -{ - -} diff --git a/test/nanostack/unittest/stub/rf_driver_storage_stub.h b/test/nanostack/unittest/stub/rf_driver_storage_stub.h deleted file mode 100644 index dc1ff4d379b0..000000000000 --- a/test/nanostack/unittest/stub/rf_driver_storage_stub.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016, 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 __RF_DRIVER_STORAGE_STUB_H__ -#define __SOME_STUB_H__ - -#include "stdint.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "platform/arm_hal_phy.h" - -typedef struct rf_driver_storage { - int8_t int8_value; - int int_value; - uint16_t uint16_value; - uint32_t uint32_value; - bool bool_value; - arm_device_driver_list_s *list_value; - arm_net_phy_rx_fn *rx_cb; - arm_net_phy_tx_done_fn *done_cb; - uint8_t *uint8_ptr; - internal_mib_observer *mlme_observer; - phy_device_driver_s *registered_driver; -}rf_driver_storage_def; - -extern rf_driver_storage_def rf_driver_storage_stub; -#endif //__SOME_STUB_H__ diff --git a/test/nanostack/unittest/stub/routing_table_stub.c b/test/nanostack/unittest/stub/routing_table_stub.c deleted file mode 100644 index ee0ac6449195..000000000000 --- a/test/nanostack/unittest/stub/routing_table_stub.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011-2016, 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 "nsconfig.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "string.h" -#include "Core/include/address.h" -#include "Core/include/ns_buffer.h" -#include "Core/include/socket.h" -#include "nsdynmemLIB.h" -#include "Common_Protocols/ipv6.h" -#include "common_functions.h" - -#define TRACE_GROUP_ROUTING_TABLE "crou" - -#if ADDRESS_SIZE == 8 -#if MAX_HOP_CNT > 30 -#error "DO not set MAX_HOP_CNT over 30 reason by 8-bit size resolution" -#endif -#endif - -uint8_t *gen_source_route_set(uint8_t *ptr) -{ - return NULL; -} - -void gen_routing_table_init(void) -{ -} - -int8_t gen_source_route_allocate(uint8_t alloc) -{ - return -1; -} - -int8_t gen_route_exist_check(const uint8_t ipv6_address_ptr[16]) -{ - return -1; -} - -void gen_routing_ttl_update(uint8_t id) -{ -} - -void gen_routing_ttl_set_low_by_repair(uint8_t id) -{ -} - -void gen_route_remove_by_rpl_instance(uint8_t id) -{ -} - - -void gen_neighbor_ttl_update(uint8_t ttl) -{ -} - -void routing_table_print(void) -{ -} - diff --git a/test/nanostack/unittest/stub/rpl_control_stub.c b/test/nanostack/unittest/stub/rpl_control_stub.c deleted file mode 100644 index 66606f915108..000000000000 --- a/test/nanostack/unittest/stub/rpl_control_stub.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "ns_types.h" - -#define HAVE_RPL -#include -#include "ns_trace.h" -#include "common_functions.h" -#include "nsdynmemLIB.h" - -#include "Core/include/ns_buffer.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "Common_Protocols/ipv6_constants.h" -#include "Common_Protocols/icmpv6.h" - -#include "Service_Libs/etx/etx.h" /* slight ick */ - -#include "net_rpl.h" -#include "RPL/rpl_protocol.h" -#include "RPL/rpl_upward.h" -#include "RPL/rpl_downward.h" -#include "RPL/rpl_policy.h" -#include "RPL/rpl_control.h" - -void rpl_control_set_memory_limits(size_t soft_limit, size_t hard_limit) -{ - -} - -void *rpl_realloc(void *p, uint16_t old_size, uint16_t new_size) -{ - return NULL; -} - -void *rpl_alloc(uint16_t size) -{ - return NULL; -} - -void rpl_free(void *p, uint16_t size) -{ -} - - - -void rpl_control_transmit_multicast_dio(struct rpl_domain *domain, struct rpl_instance *instance, uint8_t instance_id, uint8_t dodag_version, uint16_t rank, uint8_t g_mop_prf, uint8_t dtsn, const uint8_t dodagid[16], const struct rpl_dodag_conf *conf) -{ - -} - -void rpl_control_event(struct rpl_domain *domain, rpl_event_t event) -{ -} - -void rpl_control_publish_host_address(rpl_domain_t *domain, const uint8_t addr[16], uint32_t lifetime) -{ - -} - -void rpl_control_unpublish_address(rpl_domain_t *domain, const uint8_t addr[16]) -{ - -} - -rpl_domain_t *rpl_control_create_domain(void) -{ - return NULL; -} - -void rpl_control_delete_domain(rpl_domain_t *domain) -{ - -} - -void rpl_control_set_domain_on_interface(protocol_interface_info_entry_t *cur, rpl_domain_t *domain, bool downstream) -{ - -} - -void rpl_control_remove_domain_from_interface(protocol_interface_info_entry_t *cur) -{ - -} - -void rpl_control_set_callback(rpl_domain_t *domain, rpl_domain_callback_t callback, void *cb_handle) -{ - -} - -void rpl_control_disable_ra_routes(struct rpl_domain *domain) -{ - -} - -bool rpl_control_have_dodag(rpl_domain_t *domain) -{ - return false; -} - -rpl_dodag_t *rpl_control_create_dodag_root(rpl_domain_t *domain, uint8_t instance_id, const uint8_t *dodagid, const rpl_dodag_conf_t *conf, uint16_t rank, uint8_t g_mop_prf) -{ - return NULL; -} - -void rpl_control_delete_dodag_root(rpl_domain_t *domain, rpl_dodag_t *dodag) -{ - -} - -void rpl_control_update_dodag_route(rpl_dodag_t *dodag, const uint8_t *prefix, uint8_t prefix_len, uint8_t flags, uint32_t lifetime, bool age) -{ - -} - -void rpl_control_update_dodag_prefix(rpl_dodag_t *dodag, const uint8_t *prefix, uint8_t prefix_len, uint8_t flags, uint32_t lifetime, uint32_t preftime, bool age) -{ - -} - -void rpl_control_increment_dtsn(rpl_dodag_t *dodag) -{ - -} - -void rpl_control_increment_dodag_version(rpl_dodag_t *dodag) -{ - -} - -void rpl_control_set_dodag_pref(rpl_dodag_t *dodag, uint8_t pref) -{ - -} - -void rpl_control_poison(rpl_domain_t *domain, uint8_t count) -{ - -} - -void rpl_control_force_leaf(rpl_domain_t *domain, bool leaf) -{ - -} - -void rpl_control_transmit(struct rpl_domain *domain, struct protocol_interface_info_entry *cur, uint8_t code, struct buffer *buf, const uint8_t *dst) -{ - -} - -void rpl_control_transmit_dio(struct rpl_domain *domain, struct protocol_interface_info_entry *cur, uint8_t instance_id, uint8_t dodag_version, uint16_t rank, uint8_t g_mop_prf, uint8_t dtsn, struct rpl_dodag *dodag, const uint8_t dodagid[16], const struct rpl_dodag_conf *conf, const uint8_t *dst) -{ - -} - -void rpl_control_transmit_dis(rpl_domain_t *domain, protocol_interface_info_entry_t *cur, uint8_t pred, uint8_t instance_id, const uint8_t *dodagid, const uint8_t version, const uint8_t *dst) -{ - -} - -bool rpl_control_transmit_dao(struct rpl_domain *domain, struct protocol_interface_info_entry *cur, struct rpl_instance *instance, uint8_t instance_id, uint8_t dao_sequence, const uint8_t dodagid[16], const uint8_t *opts, uint16_t opts_size, const uint8_t *dst) -{ - return false; -} - -buffer_t *rpl_control_handler(buffer_t *buf) -{ - return NULL; -} - -buffer_t *rpl_control_source_route_error_handler(buffer_t *buf, protocol_interface_info_entry_t *cur) -{ - return NULL; -} - -void rpl_control_fast_timer(uint16_t ticks) -{ - -} - -void rpl_control_slow_timer(uint16_t seconds) -{ - -} - -rpl_instance_t *rpl_control_enumerate_instances(rpl_domain_t *domain, rpl_instance_t *instance) -{ - return NULL; -} - -rpl_instance_t *rpl_control_lookup_instance(rpl_domain_t *domain, uint8_t instance_id, const uint8_t *dodagid) -{ - return NULL; -} - -bool rpl_control_read_dodag_info(const rpl_instance_t *instance, rpl_dodag_info_t *dodag_info) -{ - return false; -} - -const uint8_t *rpl_control_preferred_parent_addr(const rpl_instance_t *instance, bool global) -{ - return NULL; -} - -void rpl_control_print(route_print_fn_t *print_fn) -{ - -} diff --git a/test/nanostack/unittest/stub/rpl_data_stub.c b/test/nanostack/unittest/stub/rpl_data_stub.c deleted file mode 100644 index ee7fcb8d498a..000000000000 --- a/test/nanostack/unittest/stub/rpl_data_stub.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#include "common_functions.h" -#include "nsdynmemLIB.h" -#include "ns_trace.h" -#include - -#include "Core/include/ns_buffer.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/ipv6_resolution.h" -#include "Common_Protocols/icmpv6.h" - -#include "RPL/rpl_protocol.h" -#include "RPL/rpl_upward.h" -#include "RPL/rpl_downward.h" -#include "RPL/rpl_structures.h" -#include "RPL/rpl_policy.h" -#include "RPL/rpl_data.h" -#include "rpl_data_stub.h" - -rpl_data_stub_def rpl_data_stub; - -void rpl_data_sr_invalidate(void) -{ - -} - -/* Public API */ -void rpl_data_init(void) -{ - -} -void rpl_data_init_root(void) -{ - -} - -ipv6_route_predicate_fn_t *rpl_data_get_route_predicate(struct rpl_domain *domain, const buffer_t *buf) -{ -return NULL; -} -bool rpl_data_process_hbh(buffer_t *buf, protocol_interface_info_entry_t *cur, uint8_t *opt, const struct ns_sockaddr *ll_src) -{ - return rpl_data_stub.bool_value; -} -bool rpl_data_remember_outer(buffer_t *buf) -{ - return rpl_data_stub.bool_value; -} -bool rpl_data_is_rpl_route(ipv6_route_src_t source) -{ - return rpl_data_stub.bool_value; -} -bool rpl_data_is_rpl_parent_route(ipv6_route_src_t source) -{ - return rpl_data_stub.bool_value; -} -bool rpl_data_forwarding_error(buffer_t *buf) -{ - return rpl_data_stub.bool_value; -} -buffer_t *rpl_data_process_routing_header(buffer_t *buf, protocol_interface_info_entry_t *cur, uint8_t *ptr, uint16_t *hdrlen_out, bool *forward_out) -{ - return NULL; -} -buffer_t *rpl_data_source_route_error_handler(buffer_t *buf, protocol_interface_info_entry_t *cur) -{ - return NULL; -} -bool rpl_data_get_srh_last_address(const uint8_t *srh, uint8_t *addr_out) -{ - return rpl_data_stub.bool_value; -} diff --git a/test/nanostack/unittest/stub/rpl_data_stub.h b/test/nanostack/unittest/stub/rpl_data_stub.h deleted file mode 100644 index 699a57501b7d..000000000000 --- a/test/nanostack/unittest/stub/rpl_data_stub.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016, 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 __RPL_DATA_STUB_H__ -#define __RPL_DATA_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" - -typedef struct { - bool bool_value; -} rpl_data_stub_def; - -extern rpl_data_stub_def rpl_data_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __RPL_DATA_STUB_H__ diff --git a/test/nanostack/unittest/stub/rpl_downward_stub.c b/test/nanostack/unittest/stub/rpl_downward_stub.c deleted file mode 100644 index fb7ed65ec75e..000000000000 --- a/test/nanostack/unittest/stub/rpl_downward_stub.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" - -#ifdef HAVE_RPL - -#include -#include "common_functions.h" -#include "ns_types.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "randLIB.h" - -#include "NWK_INTERFACE/Include/protocol.h" -#include "ipv6_stack/ipv6_routing_table.h" - -#include "net_rpl.h" -#include "RPL/rpl_protocol.h" -#include "RPL/rpl_policy.h" -#include "RPL/rpl_upward.h" -#include "RPL/rpl_downward.h" -#include "RPL/rpl_control.h" -#include "RPL/rpl_data.h" -#include "RPL/rpl_structures.h" - -#define TRACE_GROUP "RPLd" - -void rpl_downward_convert_dodag_preferences_to_dao_path_control(rpl_dodag_t *dodag) -{ -} - -void rpl_downward_neighbour_gone(rpl_instance_t *instance, rpl_neighbour_t *neighbour) -{ -} - -void rpl_downward_process_dao_parent_changes(rpl_instance_t *instance) -{ -} - -rpl_dao_target_t *rpl_create_dao_target(rpl_instance_t *instance, const uint8_t *prefix, uint8_t prefix_len, bool root) -{ - return NULL; -} - -void rpl_delete_dao_target(rpl_instance_t *instance, rpl_dao_target_t *target) -{ -} - -rpl_dao_target_t *rpl_instance_lookup_published_dao_target(rpl_instance_t *instance, const uint8_t *prefix, uint8_t prefix_len) -{ - return NULL; -} - -rpl_dao_target_t *rpl_instance_lookup_dao_target(rpl_instance_t *instance, const uint8_t *prefix, uint8_t prefix_len) -{ - return NULL; -} - -rpl_dao_target_t *rpl_instance_match_dao_target(rpl_instance_t *instance, const uint8_t *prefix, uint8_t prefix_len) -{ - return NULL; -} - -void rpl_instance_delete_published_dao_target(rpl_instance_t *instance, const uint8_t *prefix, uint8_t prefix_len) -{ -} - -void rpl_instance_publish_dao_target(rpl_instance_t *instance, const uint8_t *prefix, uint8_t prefix_len, uint32_t valid_lifetime, bool own, bool want_descriptor, uint32_t descriptor) -{ -} - -void rpl_instance_dao_trigger(rpl_instance_t *instance, uint16_t delay) -{ -} - -void rpl_instance_send_dao_update(rpl_instance_t *instance) -{ -} - -rpl_dao_target_t *rpl_downward_delete_root_transit(rpl_dao_target_t *target, rpl_dao_root_transit_t *transit) -{ - return NULL; -} - -void rpl_downward_transit_error(rpl_instance_t *instance, const uint8_t *target_addr, const uint8_t *transit_addr) -{ -} - -void rpl_downward_compute_paths(rpl_instance_t *instance) -{ -} - -void rpl_downward_paths_invalidate(rpl_instance_t *instance) -{ -} - -bool rpl_instance_dao_received(rpl_instance_t *instance, const uint8_t src[16], int8_t interface_id, bool multicast, const uint8_t *opts, uint16_t opts_len, uint8_t *status) -{ - return false; -} - - -void rpl_instance_dao_acked(rpl_instance_t *instance, const uint8_t src[16], int8_t interface_id, uint8_t dao_sequence, uint8_t status) -{ -} - -void rpl_instance_dao_request(struct rpl_instance *instance, struct rpl_neighbour *neighbour) -{ -} - - -void rpl_downward_dao_slow_timer(rpl_instance_t *instance, uint16_t seconds) -{ -} - -void rpl_downward_dao_timer(rpl_instance_t *instance, uint16_t ticks) -{ -} - -void rpl_downward_print_instance(rpl_instance_t *instance, route_print_fn_t *print_fn) -{ -} - -#endif /* HAVE_RPL */ diff --git a/test/nanostack/unittest/stub/rpl_mrhof_stub.c b/test/nanostack/unittest/stub/rpl_mrhof_stub.c deleted file mode 100644 index 49facf067edf..000000000000 --- a/test/nanostack/unittest/stub/rpl_mrhof_stub.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" - -#ifdef HAVE_RPL - -#include "ns_types.h" -#include "ns_trace.h" -#include "common_functions.h" - -#include "net_rpl.h" - -#include "NWK_INTERFACE/Include/protocol_abstract.h" -#include "Common_Protocols/ipv6_resolution.h" -#include "Service_Libs/etx/etx.h" - -#include "RPL/rpl_protocol.h" -#include "RPL/rpl_objective.h" -#include "RPL/rpl_upward.h" -#include "RPL/rpl_downward.h" -#include "RPL/rpl_policy.h" -#include "RPL/rpl_structures.h" -#include "RPL/rpl_mrhof.h" - -#define TRACE_GROUP "rplm" - -/* Current implementation assumes ETX (and no metric container) - need to - * ensure that we behave appropriately if a metric container is present. - */ - -static void rpl_mrhof_parent_selection(rpl_instance_t *instance); -static uint16_t rpl_mrhof_path_cost_through_neighbour(const rpl_neighbour_t *neighbour); -static bool rpl_mrhof_neighbour_acceptable(const rpl_instance_t *instance, const rpl_neighbour_t *neighbour); - -void rpl_mrhof_init(void) -{ -} - - -#endif /* HAVE_RPL */ diff --git a/test/nanostack/unittest/stub/rpl_objective_stub.c b/test/nanostack/unittest/stub/rpl_objective_stub.c deleted file mode 100644 index 29e5b14f398b..000000000000 --- a/test/nanostack/unittest/stub/rpl_objective_stub.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" - -#ifdef HAVE_RPL - -#include "ns_list.h" -#include "RPL/rpl_objective.h" - -void rpl_objective_register(rpl_objective_t *objective) -{ -} - -rpl_objective_t *rpl_objective_lookup(uint16_t ocp) -{ - return NULL; -} - -#endif /* HAVE_RPL */ diff --git a/test/nanostack/unittest/stub/rpl_of0_stub.c b/test/nanostack/unittest/stub/rpl_of0_stub.c deleted file mode 100644 index 31751854d40b..000000000000 --- a/test/nanostack/unittest/stub/rpl_of0_stub.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" - -#ifdef HAVE_RPL - -#include "ns_types.h" -#include "ns_trace.h" -#include "common_functions.h" - -#include "net_rpl.h" -#include "net_interface.h" - -#include "NWK_INTERFACE/Include/protocol_abstract.h" -#include "Common_Protocols/ipv6_resolution.h" -#include "Service_Libs/etx/etx.h" - -#include "RPL/rpl_protocol.h" -#include "RPL/rpl_objective.h" -#include "RPL/rpl_upward.h" -#include "RPL/rpl_downward.h" -#include "RPL/rpl_policy.h" -#include "RPL/rpl_structures.h" -#include "RPL/rpl_of0.h" - -#define TRACE_GROUP "rpl0" - -void rpl_of0_init(void) -{ -} - -#endif /* HAVE_RPL */ diff --git a/test/nanostack/unittest/stub/rpl_policy_stub.c b/test/nanostack/unittest/stub/rpl_policy_stub.c deleted file mode 100644 index 0b5dd735f89c..000000000000 --- a/test/nanostack/unittest/stub/rpl_policy_stub.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" - -#ifdef HAVE_RPL - -#include "ns_types.h" -#include "ns_trace.h" - -#include "net_interface.h" - -#include "Core/include/address.h" -#include "Service_Libs/etx/etx.h" -#include "Common_Protocols/ipv6_resolution.h" -#include "ipv6_stack/ipv6_routing_table.h" - -#include "RPL/rpl_objective.h" -#include "RPL/rpl_policy.h" - -#define TRACE_GROUP "RPLy" - - -bool rpl_policy_join_instance(rpl_domain_t *domain, uint8_t instance_id, const uint8_t *dodagid) -{ - return false; -} - -bool rpl_policy_join_dodag(rpl_domain_t *domain, uint8_t g_mop_prf, uint8_t instance_id, const uint8_t *addr) -{ - return false; -} - -bool rpl_policy_join_config(rpl_domain_t *domain, const rpl_dodag_conf_t *conf, bool *leaf_only) -{ - return false; -} - -bool rpl_policy_request_dao_acks(const rpl_domain_t *domain, uint8_t mop) -{ - return false; -} - -uint16_t rpl_policy_initial_dao_ack_wait(const rpl_domain_t *domain, uint8_t mop) -{ - return 0; -} - -int8_t rpl_policy_srh_next_hop_interface(rpl_domain_t *domain, int8_t if_id, const uint8_t *next_hop) -{ - return -1; -} - -uint16_t rpl_policy_modify_downward_cost_to_root_neighbour(rpl_domain_t *domain, int8_t if_id, const uint8_t *next_hop, uint16_t cost) -{ - return 0; -} - -uint16_t rpl_policy_parent_selection_period(rpl_domain_t *domain) -{ - return 0; -} - -uint16_t rpl_policy_etx_hysteresis(rpl_domain_t *domain) -{ - return 0; -} - -uint16_t rpl_policy_etx_change_parent_selection_delay(rpl_domain_t *domain) -{ - return 0; -} - -uint16_t rpl_policy_dio_parent_selection_delay(rpl_domain_t *domain) -{ - return 0; -} - -uint16_t rpl_policy_repair_initial_dis_delay(rpl_domain_t *domain) -{ - return 0; -} - -uint16_t rpl_policy_repair_maximum_dis_interval(rpl_domain_t *domain) -{ - return 0; -} - -uint_fast8_t rpl_policy_repair_dis_count(rpl_domain_t *domain) -{ - return 0; -} - -uint_fast8_t rpl_policy_repair_poison_count(rpl_domain_t *domain) -{ - return 0; -} - -bool rpl_policy_dao_trigger_after_srh_error(rpl_domain_t *domain, uint32_t seconds_since_last_dao_trigger, uint16_t errors_since_last_dao_trigger, uint_fast16_t targets) -{ - return false; -} - -bool rpl_policy_target_descriptor_for_own_address(rpl_domain_t *domain, const uint8_t addr[16], if_address_source_t source, void *data, uint32_t *descriptor_out) -{ - return false; -} - -bool rpl_policy_target_descriptor_for_host_address(rpl_domain_t *domain, const uint8_t addr[16], uint32_t *descriptor_out) -{ - return false; -} - -uint16_t rpl_policy_of0_stretch_of_rank(const rpl_domain_t *domain) -{ - return 0; -} - -uint_fast8_t rpl_policy_of0_rank_factor(const rpl_domain_t *domain) -{ - return 0; -} - -bool rpl_policy_of0_dodag_preference_supersedes_grounded(const rpl_domain_t *domain) -{ - return false; -} - -uint_fast8_t rpl_policy_of0_max_backup_successors(const rpl_domain_t *domain) -{ - return 0; -} - -uint_fast8_t rpl_policy_mrhof_parent_set_size(const rpl_domain_t *domain) -{ - return 0; -} - -uint16_t rpl_policy_mrhof_max_rank_stretch_for_extra_parents(const rpl_domain_t *domain) -{ - return 0; -} - -uint16_t rpl_policy_mrhof_max_link_metric(const rpl_domain_t *domain) -{ - return 0; -} - -uint16_t rpl_policy_mrhof_parent_switch_threshold(const rpl_domain_t *domain) -{ - return 0; -} - -#endif /* HAVE_RPL */ diff --git a/test/nanostack/unittest/stub/rpl_upward_stub.c b/test/nanostack/unittest/stub/rpl_upward_stub.c deleted file mode 100644 index c1b2d4e2e310..000000000000 --- a/test/nanostack/unittest/stub/rpl_upward_stub.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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. - */ - -/* rpl_upward.c deals with management of the DODAG and upward routes within an - * instance. - * - * rpl_domain_t is accessible, but not normally manipulated - all routines in - * this file works on a specific instance. - * - * rpl_instance_t, rpl_dodag_t, rpl_dodag_version_t, rpl_neighbour_t are all accessible. - */ - -#include "nsconfig.h" - -#ifdef HAVE_RPL -#include "ns_types.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "common_functions.h" -#include "randLIB.h" -#include "nsdynmemLIB.h" -#include - -#include "net_interface.h" - -#include "Core/include/address.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_prefix.h" -#include "NWK_INTERFACE/Include/protocol_abstract.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "Service_Libs/Trickle/trickle.h" -#include "ipv6_stack/ipv6_routing_table.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "Common_Protocols/ipv6_resolution.h" - -#include "RPL/rpl_protocol.h" -#include "RPL/rpl_policy.h" -#include "RPL/rpl_control.h" -#include "RPL/rpl_objective.h" -#include "RPL/rpl_upward.h" -#include "RPL/rpl_downward.h" -#include "RPL/rpl_structures.h" - -#include "net_rpl.h" - -#define TRACE_GROUP "rplu" - -/* Rank comparison, and DAGRank(rank) */ -uint16_t nrpl_dag_rank(const rpl_dodag_t *dodag, uint16_t rank) -{ - return 0; -} - -/* Silly function needed because RPL HbH option includes dagrank directly */ -rpl_cmp_t rpl_rank_compare_dagrank_rank(const rpl_dodag_t *dodag, uint16_t dag_rank_a, uint16_t b) -{ - return 0; -} - -rpl_cmp_t rpl_rank_compare(const rpl_dodag_t *dodag, uint16_t a, uint16_t b) -{ - return 0; -} - -/* Given a Rank, round up to the next higher integral rank */ -uint16_t rpl_rank_next_level(const rpl_dodag_t *dodag, uint16_t a) -{ - return 0; -} - -/* Given a Rank, return the maximum Rank with equal DAGRank */ -uint16_t rpl_rank_max_at_level(const rpl_dodag_t *dodag, uint16_t a) -{ - return 0; -} - -/* Add two ranks, checking for overflow */ -uint16_t rpl_rank_add(uint16_t a, uint16_t b) -{ - return 0; -} - -/* Subtract two ranks, checking for overflow */ -uint16_t rpl_rank_sub(uint16_t a, uint16_t b) -{ - return 0; -} - -uint8_t rpl_seq_init(void) -{ - return 0; -} - -uint8_t rpl_seq_inc(uint8_t seq) -{ - return 0; -} - -rpl_cmp_t rpl_seq_compare(uint8_t a, uint8_t b) -{ - return RPL_CMP_EQUAL; -} - -void rpl_instance_set_dodag_version(rpl_instance_t *instance, rpl_dodag_version_t *version, uint16_t rank) -{ -} - -rpl_dodag_version_t *rpl_instance_current_dodag_version(const rpl_instance_t *instance) -{ - return NULL; -} - -rpl_dodag_t *rpl_instance_current_dodag(const rpl_instance_t *instance) -{ - return NULL; -} - -bool rpl_instance_am_root(const rpl_instance_t *instance) -{ - return false; -} - -uint8_t rpl_instance_mop(const rpl_instance_t *instance) -{ - return 0; -} - -rpl_neighbour_t *rpl_instance_preferred_parent(const rpl_instance_t *instance) -{ - return NULL; -} - -rpl_dodag_version_t *rpl_instance_predicate_match(rpl_instance_t *instance, uint8_t pred, uint8_t instance_id, const uint8_t *dodagid, uint8_t version_num) -{ - return NULL; -} - -void rpl_instance_inconsistency(rpl_instance_t *instance) -{ -} - -void rpl_instance_consistent_rx(rpl_instance_t *instance) -{ -} - -void rpl_instance_increment_dtsn(rpl_instance_t *instance) -{ -} - -void rpl_instance_poison(rpl_instance_t *instance, uint8_t count) -{ -} - -void rpl_instance_force_leaf(rpl_instance_t *instance) -{ -} - -void rpl_instance_trigger_parent_selection(rpl_instance_t *instance, uint16_t delay) -{ -} - -rpl_dodag_t *rpl_lookup_dodag(const rpl_instance_t *instance, const uint8_t *dodagid) -{ - return NULL; -} - -rpl_dodag_version_t *rpl_lookup_dodag_version(const rpl_dodag_t *dodag, uint8_t version_num) -{ - return NULL; -} - -rpl_dodag_version_t *rpl_lookup_dodag_and_version(const rpl_instance_t *instance, const uint8_t *dodagid, uint8_t version_num) -{ - return NULL; -} - -rpl_neighbour_t *rpl_lookup_neighbour_by_ll_address(const rpl_instance_t *instance, const uint8_t *addr, int8_t if_id) -{ - return NULL; -} - -rpl_neighbour_t *rpl_create_neighbour(rpl_dodag_version_t *version, const uint8_t *addr, int8_t if_id, uint8_t g_mop_prf, uint8_t dtsn) -{ - return NULL; -} - -void rpl_delete_neighbour(rpl_instance_t *instance, rpl_neighbour_t *neighbour) -{ -} - -const uint8_t *rpl_neighbour_ll_address(const rpl_neighbour_t *neighbour) -{ - return NULL; -} - -const uint8_t *rpl_neighbour_global_address(const rpl_neighbour_t *neighbour) -{ - return NULL; -} - -void rpl_neighbour_update_global_address(rpl_neighbour_t *neighbour, const uint8_t *addr) -{ -} - -void rpl_neighbour_update_dodag_version(rpl_neighbour_t *neighbour, rpl_dodag_version_t *version, uint16_t rank, uint8_t g_mop_prf) -{ -} - -bool rpl_neighbour_update_dtsn(rpl_neighbour_t *neighbour, uint8_t dtsn) -{ - return false; -} - -rpl_instance_t *rpl_neighbour_instance(const rpl_neighbour_t *neighbour) -{ - return NULL; -} - -rpl_dodag_version_t *rpl_create_dodag_version(rpl_dodag_t *dodag, uint8_t version_num) -{ - return NULL; -} - -void rpl_delete_dodag_version(rpl_dodag_version_t *version) -{ -} - -bool rpl_dodag_version_is_current(const rpl_dodag_version_t *version) -{ - return false; -} - -bool rpl_dodag_version_rank_indicates_possible_sub_dodag(const rpl_dodag_version_t *version, uint16_t rank) -{ - return false; -} - -rpl_cmp_t rpl_dodag_version_compare(const rpl_dodag_version_t *a, const rpl_dodag_version_t *b) -{ - return RPL_CMP_UNORDERED; -} - -void rpl_dodag_version_limit_greediness(rpl_dodag_version_t *version, uint16_t rank) -{ -} - -void rpl_dodag_version_raise_greediness(rpl_dodag_version_t *version, uint16_t pref_rank) -{ -} - -rpl_dodag_t *rpl_create_dodag(rpl_instance_t *instance, const uint8_t *dodagid, uint8_t g_mop_prf) -{ - return NULL; -} - -void rpl_delete_dodag(rpl_dodag_t *dodag) -{ -} - -uint8_t rpl_dodag_mop(const rpl_dodag_t *dodag) -{ - return 0; -} - -bool rpl_dodag_update_config(rpl_dodag_t *dodag, const rpl_dodag_conf_t *conf, const uint8_t *src, bool *become_leaf) -{ - return false; -} - -/* If we're currently a member of this DODAG, kick the DIO timers */ -void rpl_dodag_inconsistency(rpl_dodag_t *dodag) -{ -} - -void rpl_dodag_increment_dtsn(rpl_dodag_t *dodag) -{ -} - -void rpl_dodag_set_pref(rpl_dodag_t *dodag, uint8_t pref) -{ -} - -rpl_cmp_t rpl_dodag_pref_compare(const rpl_dodag_t *a, const rpl_dodag_t *b) -{ - return RPL_CMP_LESS; -} - -void rpl_dodag_set_root(rpl_dodag_t *dodag, bool root) -{ -} - -bool rpl_dodag_am_root(const rpl_dodag_t *dodag) -{ -} - -void rpl_dodag_set_leaf(rpl_dodag_t *dodag, bool leaf) -{ - -} - -bool rpl_dodag_is_current(const rpl_dodag_t *dodag) -{ - return false; -} - -const rpl_dodag_conf_t *rpl_dodag_get_config(const rpl_dodag_t *dodag) -{ - return NULL; -} - -uint8_t rpl_dodag_get_version_number_as_root(const rpl_dodag_t *dodag) -{ - return 0; -} - -void rpl_dodag_set_version_number_as_root(rpl_dodag_t *dodag, uint8_t number) -{ -} - -const rpl_dio_route_list_t *rpl_dodag_get_route_list(const rpl_dodag_t *dodag) -{ - return NULL; -} - -rpl_dio_route_t *rpl_dodag_update_dio_route(rpl_dodag_t *dodag, const uint8_t *prefix, uint8_t prefix_len, uint8_t flags, uint32_t lifetime, bool age) -{ - return NULL; -} - -void rpl_dodag_delete_dio_route(rpl_dodag_t *dodag, rpl_dio_route_t *route) -{ -} - -const prefix_list_t *rpl_dodag_get_prefix_list(const rpl_dodag_t *dodag) -{ - return NULL; -} - -prefix_entry_t *rpl_dodag_update_dio_prefix(rpl_dodag_t *dodag, const uint8_t *prefix, uint8_t prefix_len, uint8_t flags, uint32_t lifetime, uint32_t preftime, bool publish, bool age) -{ - return NULL; -} - -void rpl_dodag_delete_dio_prefix(rpl_dodag_t *dodag, prefix_entry_t *prefix) -{ -} - -rpl_instance_t *rpl_lookup_instance(const rpl_domain_t *domain, uint8_t instance_id, const uint8_t *addr) -{ - return NULL; -} - -rpl_instance_t *rpl_create_instance(rpl_domain_t *domain, uint8_t instance_id) -{ - return NULL; -} - -void rpl_delete_instance(rpl_instance_t *instance) -{ -} - -/* Purge one item from an instance */ -bool rpl_instance_purge(rpl_instance_t *instance) -{ - return false; -} - -void rpl_instance_neighbours_changed(rpl_instance_t *instance) -{ -} - -/* Called when a DIO has been received */ -void rpl_dodag_update_implicit_system_routes(rpl_dodag_t *dodag, rpl_neighbour_t *parent) -{ -} - -void rpl_instance_run_parent_selection(rpl_instance_t *instance) -{ -} - -void rpl_instance_remove_interface(rpl_instance_t *instance, int8_t if_id) -{ -} - -/* Trigger DIO transmission - all interfaces multicast if addr+cur are NULL, else unicast */ -void rpl_instance_dio_trigger(rpl_instance_t *instance, protocol_interface_info_entry_t *cur, const uint8_t *addr) -{ -} - -void rpl_instance_set_local_repair(rpl_instance_t *instance, bool repair) -{ -} - -bool rpl_instance_local_repair(const rpl_instance_t *instance) -{ - return false; -} - -uint16_t rpl_instance_current_rank(const rpl_instance_t *instance) -{ - return 0; -} - -void rpl_instance_slow_timer(rpl_instance_t *instance, uint16_t seconds) -{ -} - -void rpl_upward_dio_timer(rpl_instance_t *instance, uint16_t ticks) -{ -} - -void rpl_upward_print_neighbour(const rpl_neighbour_t *neighbour, route_print_fn_t *print_fn) -{ -} - -void rpl_upward_print_neighbours_in_version(const rpl_neighbour_list_t *list, const rpl_dodag_version_t *version, route_print_fn_t *print_fn) -{ -} - -void rpl_upward_print_dodag(rpl_instance_t *instance, rpl_dodag_t *dodag, route_print_fn_t *print_fn) -{ -} - -void rpl_upward_print_instance(rpl_instance_t *instance, route_print_fn_t *print_fn) -{ -} - -/* Backwards-compatibility implementation of net_rpl.h API designed for old implementation */ -bool rpl_upward_read_dodag_info(const rpl_instance_t *instance, rpl_dodag_info_t *dodag_info) -{ - return false; -} - -uint16_t rpl_upward_read_dao_target_list_size(const rpl_instance_t *instance) -{ - return 0; -} - -#endif /* HAVE_RPL */ diff --git a/test/nanostack/unittest/stub/security_lib_stub.c b/test/nanostack/unittest/stub/security_lib_stub.c deleted file mode 100644 index c3ab092c62a4..000000000000 --- a/test/nanostack/unittest/stub/security_lib_stub.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "string.h" -#include "eventOS_event.h" -#include "ccmLIB.h" -#include "nsdynmemLIB.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "shalib.h" -#include "randLIB.h" -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana_nvm.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#include "common_functions.h" - -sec_suite_t *NS_LARGE active_ecc_sec_suite = 0; - -sec_suite_t * sec_lib_security_session_allocate(bool tls_allocate) -{ - return NULL; -} - - -void sec_lib_state_machine_lock(sec_suite_t *suite, sec_state_machine_t state) -{ -} - -void sec_lib_state_machine_trig(sec_suite_t *suite, sec_state_machine_t state) -{ -} - -uint8_t tls_server_certi_hash_copy(sec_suite_t *suite) -{ -} - -#ifdef ECC -uint8_t tls_certi_hash_copy(sec_suite_t *suite) -{ -} -#endif - - -#ifdef ECC -void sec_ecc_state_free(sec_suite_t *suite) -{ -} - -void sec_ecc_state_save(sec_suite_t *suite) -{ -} - -#ifdef PANA -void sec_ecc_sceduler() -{ - -} -#endif - -#endif - -void sec_libray_init(void) -{ -} - -int sec_pana_protocol_init(sec_suite_t *suite) -{ - return 0; -} - -void sec_suite_tls_free(sec_suite_t *suite, bool free_session) -{ -} - - - -uint8_t sec_auth_re_check(sec_suite_t *suite) -{ - return 0; -} - -uint8_t sec_check_suite_ptrs(sec_suite_t *suite) -{ - return 0; -} - -#ifdef PANA -void sec_timer_handle() -{ -} -#endif - -sec_suite_t *sec_suite_verify(sec_suite_t *session) -{ - return NULL; -} - -sec_suite_t *sec_suite_selected_pana_session(uint32_t session_id) -{ - return NULL; -} - -sec_suite_t *sec_suite_selected_address(const uint8_t address[static 16]) -{ - return NULL; -} - -uint16_t sec_pana_key_update_trig(uint16_t th_time) -{ - return 0; -} - - -int8_t sec_suite_remove(sec_suite_t *cur) -{ - return 0; -} - -sec_suite_t *sec_suite_selected_py_pan_id(uint16_t pan_id) -{ - return NULL; -} - - -sec_suite_t *sec_suite_create(void) -{ - return NULL; -} - -void sec_prf_state_set(sec_suite_t *suite) -{ -} - -#ifdef ECC -uint8_t tls_ecc_start_premaster_secret(EllipticPoint *ellicpt_ptr, sec_suite_t *suite) -{ - return 0; -} - -void ecc_operation_done_callback(int8_t status, void *result_ptr) -{ -} - -void sec_ecc_client_signature_start(sec_suite_t *suite) -{ -} - -void sec_ecc_gen_public_key_start(sec_suite_t *suite) -{ -} -#endif - -void eap_fragmentation_init(sec_suite_t *suite) -{ -} - -void sec_auth_ready(void) -{ -} - -uint8_t sec_suite_socket_event(uint8_t event_type, sec_suite_t *suite) -{ - return 0; -} - -void sec_set_auth_timeout(sec_suite_t *suite, sec_state_machine_t cur_state) -{ -} -void sec_suite_list_clean(void) -{ -} diff --git a/test/nanostack/unittest/stub/shalib_stub.c b/test/nanostack/unittest/stub/shalib_stub.c deleted file mode 100644 index 70d1cb042537..000000000000 --- a/test/nanostack/unittest/stub/shalib_stub.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 -#include "shalib.h" - -void SHALIB_init_HMAC(const uint8_t *secret, uint8_t sec_len) -{ - -} - -void SHALIB_push_data_HMAC(const void *data, uint16_t len) -{ - -} - -void SHALIB_finish_HMAC(void *buffer, uint8_t len) -{ - -} - -prf_sec_param_t *shalib_prf_param_get(void) -{ - return NULL; -} - -void shalib_prf_calc(void *output, uint_fast16_t nwords) -{ - -} - diff --git a/test/nanostack/unittest/stub/sn_coap_builder_stub.c b/test/nanostack/unittest/stub/sn_coap_builder_stub.c deleted file mode 100644 index 55a5323b8d46..000000000000 --- a/test/nanostack/unittest/stub/sn_coap_builder_stub.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2011-2015, 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. - */ - -/** - * \file sn_coap_builder.c - * - * \brief CoAP Message builder - * - * Functionality: Builds CoAP message - * - */ - -/* * * * * * * * * * * * * * */ -/* * * * INCLUDE FILES * * * */ -/* * * * * * * * * * * * * * */ - -#include "ns_types.h" -#include "sn_coap_header.h" -#include "sn_coap_builder_stub.h" - -sn_coap_builder_stub_def sn_coap_builder_stub; - -sn_coap_hdr_s *sn_coap_build_response(struct coap_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code) -{ - return sn_coap_builder_stub.expectedHeader; -} - -int16_t sn_coap_builder(uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr) -{ - return sn_coap_builder_stub.expectedInt16; -} - -uint16_t sn_coap_builder_calc_needed_packet_data_size(sn_coap_hdr_s *src_coap_msg_ptr) -{ - return sn_coap_builder_stub.expectedUint16; -} - -int16_t sn_coap_builder_options_build_add_zero_length_option(uint8_t **dst_packet_data_pptr, uint8_t option_length, uint8_t option_exist, sn_coap_option_numbers_e option_number) -{ - return sn_coap_builder_stub.expectedInt16; -} - diff --git a/test/nanostack/unittest/stub/sn_coap_builder_stub.h b/test/nanostack/unittest/stub/sn_coap_builder_stub.h deleted file mode 100644 index fabecaf26966..000000000000 --- a/test/nanostack/unittest/stub/sn_coap_builder_stub.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __SN_COAP_BUILDER_STUB_H__ -#define __SN_COAP_BUILDER_STUB_H__ - -typedef struct { - int16_t expectedInt16; - uint16_t expectedUint16; - sn_coap_hdr_s *expectedHeader; -} sn_coap_builder_stub_def; - -extern sn_coap_builder_stub_def sn_coap_builder_stub; - -#endif //__SN_COAP_BUILDER_STUB_H__ diff --git a/test/nanostack/unittest/stub/sn_coap_parser_stub.h b/test/nanostack/unittest/stub/sn_coap_parser_stub.h deleted file mode 100644 index 55dcd24e2eee..000000000000 --- a/test/nanostack/unittest/stub/sn_coap_parser_stub.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __SN_COAP_PARSER_STUB_H__ -#define __SN_COAP_PARSER_STUB_H__ - -#include "sn_coap_header.h" - -typedef struct { - sn_coap_hdr_s *expectedHeader; -} sn_coap_parser_def; - -extern sn_coap_parser_def sn_coap_parser_stub; - -#endif //__SN_COAP_PARSER_STUB_H__ diff --git a/test/nanostack/unittest/stub/sn_coap_protocol_stub.h b/test/nanostack/unittest/stub/sn_coap_protocol_stub.h deleted file mode 100644 index e2376e452637..000000000000 --- a/test/nanostack/unittest/stub/sn_coap_protocol_stub.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __SN_COAP_PROTOCOL_STUB_H__ -#define __SN_COAP_PROTOCOL_STUB_H__ - -#include "sn_coap_header_internal.h" -#include "sn_coap_protocol_internal.h" - -typedef struct { - int8_t expectedInt8; - int16_t expectedInt16; - struct coap_s *expectedCoap; - sn_coap_hdr_s *expectedHeader; - coap_send_msg_s *expectedSendMsg; -} sn_coap_protocol_stub_def; - -extern sn_coap_protocol_stub_def sn_coap_protocol_stub; - -#endif //__SN_COAP_PROTOCOL_STUB_H__ diff --git a/test/nanostack/unittest/stub/sockbuf_stub.c b/test/nanostack/unittest/stub/sockbuf_stub.c deleted file mode 100644 index bb03f94bbd09..000000000000 --- a/test/nanostack/unittest/stub/sockbuf_stub.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2016, 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 "nsconfig.h" -#include "ns_trace.h" -#include -#include "Core/include/sockbuf.h" - -void sockbuf_init(sockbuf_t *sb) -{ - -} -void sockbuf_append(sockbuf_t *sb, buffer_t *buf) -{ - -} -void sockbuf_append_and_compress(sockbuf_t *sb, buffer_t *buf) -{ - -} -void sockbuf_alloc(sockbuf_t *sb, const buffer_t *buf){ - -} -void sockbuf_free(sockbuf_t *sb, const buffer_t *buf) -{ - -} -void sockbuf_drop(sockbuf_t *sb, uint32_t len) -{ - -} -void sockbuf_drop_first(sockbuf_t *sb) -{ - -} -void sockbuf_flush(sockbuf_t *sb) -{ - -} -bool sockbuf_reserve(sockbuf_t *sb, uint32_t space) -{ - return true; -} -int32_t sockbuf_space(const sockbuf_t *sb){ - - return sb->data_bytes; - -} -void sockbuf_check(sockbuf_t *sb) -{ - -} diff --git a/test/nanostack/unittest/stub/socket_api_stub.c b/test/nanostack/unittest/stub/socket_api_stub.c deleted file mode 100644 index 3c067d05f3dd..000000000000 --- a/test/nanostack/unittest/stub/socket_api_stub.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include "socket_api.h" -#include "socket_api_stub.h" -#include "Core/include/sockbuf.h" - -socket_api_stub_data_t socket_api_stub; - -const uint8_t ns_in6addr_any[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - -int8_t socket_open(uint8_t protocol, uint16_t identifier, void (*passed_fptr)(void *)) -{ - socket_api_stub.recv_cb = passed_fptr; - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int8_value; -} - -int8_t socket_close(int8_t socket) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int8_value; -} -int8_t socket_listen(int8_t socket, uint8_t backlog) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int8_value; -} -int8_t socket_connect(int8_t socket, ns_address_t *address, uint8_t randomly_take_src_number) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int8_value; -} -int8_t socket_bind(int8_t socket, const ns_address_t *address) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int8_value; -} -int8_t socket_shutdown(int8_t socket, uint8_t how) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int8_value; -} -int16_t socket_send(int8_t socket, const void *buffer, uint16_t length) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int16_value; -} -int16_t socket_read(int8_t socket, ns_address_t *address, uint8_t *buffer, uint16_t length) -{ - if( address ){ - memset(&address->address, 0, 16); - address->identifier = 0; - } - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int16_value; -} - -int16_t socket_recvmsg(int8_t socket, ns_msghdr_t *msg, int flags) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int16_value; -} - -int16_t socket_sendto(int8_t socket, const ns_address_t *address, const void *buffer, uint16_t length) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int16_value; -} - -int16_t socket_sendmsg(int8_t socket, const ns_msghdr_t *msg, int flags) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int16_value; -} - -int8_t socket_getpeername(int8_t socket, ns_address_t *address) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int8_value; -} - -int8_t socket_setsockopt(int8_t socket, uint8_t level, uint8_t opt_name, const void *opt_value, uint16_t opt_len) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int8_value; -} -int8_t socket_getsockopt(int8_t socket, uint8_t level, uint8_t opt_name, void *opt_value, uint16_t *opt_len) -{ - if( socket_api_stub.counter >= 0){ - return socket_api_stub.values[socket_api_stub.counter--]; - } - - return socket_api_stub.int8_value; -} - -ns_cmsghdr_t *NS_CMSG_NXTHDR(const ns_msghdr_t *msgh, const ns_cmsghdr_t *cmsg) -{ - return NULL; -} diff --git a/test/nanostack/unittest/stub/socket_api_stub.h b/test/nanostack/unittest/stub/socket_api_stub.h deleted file mode 100644 index ae0f65fdd21e..000000000000 --- a/test/nanostack/unittest/stub/socket_api_stub.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __SOCKET_API_STUB_H__ -#define __SOCKET_API_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "stdint.h" - -typedef struct { - void (*recv_cb)(void *); - int8_t int8_value; - int16_t int16_value; - int counter; - int values[10]; -} socket_api_stub_data_t; - -extern socket_api_stub_data_t socket_api_stub; - -#ifdef __cplusplus -} -#endif - -#endif //__SOCKET_API_STUB_H__ - - - - - diff --git a/test/nanostack/unittest/stub/socket_stub.c b/test/nanostack/unittest/stub/socket_stub.c deleted file mode 100644 index 009895bb250f..000000000000 --- a/test/nanostack/unittest/stub/socket_stub.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include -#include -#include "socket.h" -#include "ns_error_types.h" -#include "sec_lib_definitions.h" -#include "socket_api.h" -#include "tcp.h" -#include "socket_stub.h" -#include "ip6string.h" -#include "common_functions.h" - -#define STUB_BUFFER_SIZE 1024 - -socket_stub_def socket_stub; - -inet_pcb_t inet_pcb[SOCKETS_MAX]; -socket_t socket_instance[SOCKETS_MAX]; - -socket_stub_data_t socket_stub_data = { - 0, // socket_id - eOK // err code -}; - -const uint8_t ns_in6addr_any[16]; -socket_list_t socket_list = NS_LIST_INIT(socket_list); - -void socket_stub_setup(void) -{ - socket_stub_data.socket_read_buffer = malloc(sizeof (buffer_t) + STUB_BUFFER_SIZE); - // Cleared by socket_stub_clear_sockets later -} - -void socket_stub_teardown(void) -{ - free(socket_stub_data.socket_read_buffer); -} - -socket_stub_data_t *socket_stub_get_test_data(void) -{ - socket_stub_clear_sockets(); - socket_stub_data.socket_id = 0; - socket_stub_data.err = eOK; - socket_stub_data.socket_ptr = &socket_instance[0]; - socket_stub_data.socket_ptr->inet_pcb = &inet_pcb[0]; - return &socket_stub_data; -} - -void socket_connection_abandoned(socket_t *socket, int8_t interface_id, uint8_t reason) -{ - -} - -socket_t *socket_reference(socket_t *socket_ptr) -{ - return socket_ptr; -} - -socket_t *socket_dereference(socket_t *socket_ptr) -{ - return NULL; -} - -void socket_inet_pcb_set_buffer_hop_limit(const inet_pcb_t *inet_pcb, buffer_t *buf, const int16_t *msg_hoplimit) -{ -} - -void socket_inet_pcb_list_print(route_print_fn_t *print_fn, char sep) -{ -} - -void socket_stub_clear_sockets() -{ - int i; - for (i = 0; i < SOCKETS_MAX; i++) { - memset(&socket_instance[i], 0, sizeof(socket_t)); - } - memset(socket_stub_data.socket_read_buffer, 0, sizeof (buffer_t)); - socket_stub_data.socket_read_buffer->size = 1024; -} - -int8_t socket_event_handler_id_get(void) -{ - return 0; -} - -void socket_init(void) -{ -} - -void socket_release(socket_t *socket) -{ - -} - -error_t socket_port_validate(uint16_t port, uint8_t protocol) -{ - return socket_stub_data.err; -} - -error_t socket_create(socket_family_t family, socket_type_t type, uint8_t protocol, int8_t *sid, uint16_t port, void (*passed_fptr)(void *), bool buffer_type) -{ - if (eOK == socket_stub_data.err) { - *sid = socket_stub_data.socket_id; - socket_instance[socket_stub_data.socket_id].type = type; - socket_instance[socket_stub_data.socket_id].family = family; - socket_instance[socket_stub_data.socket_id].inet_pcb = &inet_pcb[socket_stub_data.socket_id]; - socket_stub_data.socket_ptr = &socket_instance[socket_stub_data.socket_id]; - } - return socket_stub_data.err; -} - -socket_t *socket_lookup_ipv6(uint8_t protocol, const sockaddr_t *local_addr, const sockaddr_t *remote_addr, bool allow_wildcards) -{ - return 0; -} - -socket_t *socket_lookup(socket_family_t family, uint8_t protocol, const sockaddr_t *local_addr, const sockaddr_t *remote_addr) -{ - return 0; -} - -error_t socket_up(buffer_t *buf) -{ - return eOK; -} - -void socket_event_push(uint8_t sock_event, socket_t *socket, int8_t interface_id, void *session_ptr, uint16_t length) -{ - -} - -int16_t socket_buffer_sendmsg(int8_t sid, buffer_t *buf, const struct ns_msghdr *msg, int flags) -{ - return 0; -} - -inet_pcb_t *socket_inet_pcb_free(inet_pcb_t *inet_pcb) -{ - return socket_stub.inet_pcb; -} - - -inet_pcb_t *socket_inet_pcb_allocate(void) -{ - return socket_stub.inet_pcb; -} - -bool socket_validate_listen_backlog(const socket_t *socket_ptr) { - return true; -} - -int8_t socket_inet_pcb_join_group(inet_pcb_t *inet_pcb, int8_t interface_id, const uint8_t group[static 16]) -{ - return 0; -} - -int8_t socket_inet_pcb_leave_group(inet_pcb_t *inet_pcb, int8_t interface_id, const uint8_t group[static 16]) -{ - return 0; -} - -struct protocol_interface_info_entry *socket_interface_determine(const socket_t *socket, buffer_t *buf) { - return socket_stub.entry_ptr; -} - -socket_t *socket_pointer_get(int8_t socket) -{ - return socket_stub.socket_structure; -} - -void socket_tx_buffer_event_and_free(buffer_t *buf, uint8_t status) -{ - -} - -buffer_t *socket_tx_buffer_event(buffer_t *buf, uint8_t status) -{ - return socket_stub.buffer_ptr; -} - -uint16_t socket_generate_random_port(uint8_t protocol) -{ - return 99; -} - -void socket_connection_complete(socket_t *socket, int8_t interface_id) -{ - -} - -socket_t *socket_new_incoming_connection(socket_t *listen_socket) -{ - return socket_stub.socket_structure; -} - -bool socket_data_queued_event_push(socket_t *socket) -{ - return true; -} - -void socket_cant_recv_more(socket_t *socket, int8_t interface_id) -{ - -} - -void socket_list_print(route_print_fn_t *print_fn, char sep) -{ - -} - -void socket_id_detach(int8_t sid) -{ - -} - -void socket_leave_pending_state(socket_t *socket, void (*fptr)(void *)) -{ - -} - -int8_t socket_id_assign_and_attach(socket_t *socket) -{ - return 0; -} - -bool socket_message_validate_iov(const ns_msghdr_t *msg, uint16_t *length_out) -{ - return true; -} diff --git a/test/nanostack/unittest/stub/socket_stub.h b/test/nanostack/unittest/stub/socket_stub.h deleted file mode 100644 index e1f45e3ae90e..000000000000 --- a/test/nanostack/unittest/stub/socket_stub.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 __SOCKET_STUB_H__ -#define __SOCKET_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include "Core/include/ns_buffer.h" -#include "Core/include/socket.h" - -typedef struct { - uint8_t socket_id; // socket id returned when socket created - error_t err; // socket error returned by the socket call - socket_t *socket_ptr; - buffer_t *socket_read_buffer; -} socket_stub_data_t; - -typedef struct { - buffer_t *buffer_ptr; - void *void_ptr; - protocol_interface_info_entry_t *entry_ptr; - socket_t *socket_structure; - int8_t socket_read_cnt; - inet_pcb_t *inet_pcb; -} socket_stub_def; - -extern socket_stub_def socket_stub; - -socket_stub_data_t *socket_stub_get_test_data(void); -void socket_stub_clear_sockets(); -void socket_stub_setup(void); -void socket_stub_teardown(void); - -#ifdef __cplusplus -} -#endif - -#endif //__SOCKET_STUB_H__ diff --git a/test/nanostack/unittest/stub/sw_mac_stub.c b/test/nanostack/unittest/stub/sw_mac_stub.c deleted file mode 100644 index 74ac36b17850..000000000000 --- a/test/nanostack/unittest/stub/sw_mac_stub.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include "nsdynmemLIB.h" -#include "fhss_api.h" -#include "mac_api.h" -#include "sw_mac.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" -#include "MAC/IEEE802_15_4/mac_mcps_sap.h" -#include "MAC/IEEE802_15_4/mac_pd_sap.h" -#include "MAC/rf_driver_storage.h" -#include "MAC/IEEE802_15_4/sw_mac_internal.h" -#include "sw_mac_stub.h" - -sw_mac_stub_def sw_mac_stub; - -mac_api_t *ns_sw_mac_create(int8_t rf_driver_id, mac_description_storage_size_t *storage_sizes) -{ - return sw_mac_stub.mac_api_ptr; -} - -mac_api_t *get_sw_mac_api(protocol_interface_rf_mac_setup_s *setup) -{ - return sw_mac_stub.mac_api_ptr; -} - -protocol_interface_rf_mac_setup_s *get_sw_mac_ptr_by_mac_api(mac_api_t *api) -{ - return sw_mac_stub.rf_mac_ptr; -} - -protocol_interface_rf_mac_setup_s *get_sw_mac_ptr_by_fhss_api(const fhss_api_t *api) -{ - return sw_mac_stub.rf_mac_ptr; -} - -protocol_interface_rf_mac_setup_s *get_sw_mac_ptr_by_driver_id(int8_t id) -{ - return sw_mac_stub.rf_mac_ptr; -} - -void mlme_req(const mac_api_t* api, mlme_primitive id, const void *data) -{ -} - -void mcps_req(const mac_api_t* api, const mcps_data_req_t *data) -{ -} - - -protocol_interface_rf_mac_setup_s *get_sw_mac_ptr_by_timer(int8_t id, arm_nwk_timer_id_e type) -{ - return sw_mac_stub.rf_mac_ptr; -} - -void sw_mac_stats_update(protocol_interface_rf_mac_setup_s *setup, mac_stats_type_t type, uint32_t update_val) -{ - -} diff --git a/test/nanostack/unittest/stub/sw_mac_stub.h b/test/nanostack/unittest/stub/sw_mac_stub.h deleted file mode 100644 index aec9f774a335..000000000000 --- a/test/nanostack/unittest/stub/sw_mac_stub.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __SW_MAC_STUB_H__ -#define __SW_MAC_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "mac_api.h" -#include "MAC/IEEE802_15_4/mac_defines.h" -#include "MAC/rf_driver_storage.h" - -typedef struct { - mac_api_t *mac_api_ptr; - protocol_interface_rf_mac_setup_s* rf_mac_ptr; -} sw_mac_stub_def; - -extern sw_mac_stub_def sw_mac_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __SW_MAC_STUB_H__ diff --git a/test/nanostack/unittest/stub/system_timer_stub.c b/test/nanostack/unittest/stub/system_timer_stub.c deleted file mode 100644 index a921898eb5da..000000000000 --- a/test/nanostack/unittest/stub/system_timer_stub.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "ns_types.h" -#include "timer_sys.h" -#include "platform/arm_hal_interrupt.h" -#include "ns_timer.h" -#include "nsdynmemLIB.h" -#include "eventOS_event.h" -#include "eventOS_callback_timer.h" - -#include "system_timer_stub.h" - -system_timer_stub_def system_timer_stub; - -void timer_sys_init(void) -{ -} - -void timer_sys_disable(void) -{ - -} - -int8_t timer_sys_wakeup(void) -{ - return system_timer_stub.int8_value; -} - -uint32_t timer_get_runtime_ticks(void) // only used in dev_stats_internal.c -{ - return system_timer_stub.uint32_value; -} - - - -int8_t eventOS_event_timer_request(uint8_t snmessage, uint8_t event_type, int8_t tasklet_id, uint32_t time) -{ - return system_timer_stub.int8_value; -} - -int8_t eventOS_event_timer_cancel(uint8_t snmessage, int8_t tasklet_id) -{ - return system_timer_stub.int8_value; -} - - -uint32_t eventOS_event_timer_shortest_active_timer(void) -{ - return system_timer_stub.uint32_value; -} - -void system_timer_tick_update(uint32_t ticks) -{ -} - diff --git a/test/nanostack/unittest/stub/system_timer_stub.h b/test/nanostack/unittest/stub/system_timer_stub.h deleted file mode 100644 index ded5a91ecb36..000000000000 --- a/test/nanostack/unittest/stub/system_timer_stub.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2016, 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 __SYSTEM_TIMER_STUB_H__ -#define __SYSTEM_TIMER_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int8_t int8_value; - uint32_t uint32_value; -} system_timer_stub_def; - -extern system_timer_stub_def system_timer_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __SYSTEM_TIMER_STUB_H__ diff --git a/test/nanostack/unittest/stub/tcp_stub.c b/test/nanostack/unittest/stub/tcp_stub.c deleted file mode 100644 index 8738feb9eff6..000000000000 --- a/test/nanostack/unittest/stub/tcp_stub.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include "string.h" -#include "ns_types.h" -#include "ns_trace.h" -#include "eventOS_event.h" -#include "Core/include/socket.h" -#include "nsdynmemLIB.h" -#include "ip_fsc.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_timer.h" -#include "randLIB.h" -#include "Common_Protocols/ipv6_constants.h" -#include "Common_Protocols/tcp.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "common_functions.h" -#include "tcp_stub.h" -#include "socket_api.h" -#include "socket.h" -#include "sockbuf.h" - -void tcp_timer_handle(uint16_t ticksUpdate); -void tcp_segment_start(tcp_session_t *tcp_info); - -buffer_t *tcp_up(buffer_t *buf); -void tcp_uack_segment(buffer_t *buf, tcp_session_t *tcp_info, uint16_t header_length); - - -tcp_stub_data_t tcp_stub; - -tcp_error tcp_session_close(tcp_session_t *tcp_info) -{ - return tcp_stub.tcp_error_value; -} - -tcp_session_t *tcp_session_delete_with_error(tcp_session_t *tcp_info, uint8_t error) -{ - return tcp_stub.tcp_session_ptr; -} - -tcp_error tcp_session_open(tcp_session_t *tcp_session) -{ - return tcp_stub.tcp_error_value; -} - -void tcp_segment_start(tcp_session_t *tcp_info) -{ -} - -buffer_t *tcp_build_reset_packet(const sockaddr_t *dst_addr, const sockaddr_t *src_addr, uint32_t seq, uint32_t ack, uint8_t flag) -{ - return tcp_stub.buffer_ptr; -} - -tcp_session_t *tcp_resend_segment(tcp_session_t *tcp_info) -{ - return tcp_stub.tcp_session_ptr; -} - -buffer_t *tcp_ack_buffer(tcp_session_t *tcp_info, uint16_t new_ack) -{ - return tcp_stub.buffer_ptr; -} - -void tcp_uack_segment(buffer_t *buf, tcp_session_t *tcp_info, uint16_t header_length) -{ -} - -buffer_t *tcp_buf_save(buffer_t *buf) -{ - return tcp_stub.buffer_ptr; -} - -tcp_session_t *tcp_ack_segment(uint32_t ack, tcp_session_t *tcp_info) -{ - return tcp_stub.tcp_session_ptr; -} - -tcp_error tcp_session_accept(tcp_session_t *tcp_info) -{ - return tcp_stub.tcp_error_value; -} - -tcp_session_t *tcp_session_ptr_free(tcp_session_t *tcp_info) -{ - return tcp_stub.tcp_session_ptr; -} - -void tcp_timer_handle(uint16_t ticksUpdate) -{ -} - -void tcp_handle_time_event(uint16_t tickUpdate) -{ -} - -tcp_error tcp_session_shutdown_read(tcp_session_t *tcp_session) -{ - return tcp_stub.tcp_error_value; -} -tcp_error tcp_session_send(tcp_session_t *tcp_info, buffer_t *buf) -{ - return tcp_stub.tcp_error_value; -} - -void tcp_socket_released(tcp_session_t *cur) -{ -} - -const char *tcp_state_name(const tcp_session_t *tcp_info) -{ - return tcp_stub.state; -} - -buffer_t *tcp_up(buffer_t *buf) -{ - return tcp_stub.buffer_ptr; -} - -tcp_session_t *tcp_session_ptr_allocate(struct inet_pcb_s *inet_pcb, tcp_session_t *from_time_wait) -{ - return tcp_stub.tcp_session_ptr; -} - -void tcp_session_data_received(tcp_session_t *tcp_info) -{ - -} - -/* end of file tcp.c */ diff --git a/test/nanostack/unittest/stub/tcp_stub.h b/test/nanostack/unittest/stub/tcp_stub.h deleted file mode 100644 index 275e774bd04c..000000000000 --- a/test/nanostack/unittest/stub/tcp_stub.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __TCP_STUB_H__ -#define __TCP_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "stdint.h" -#include "Core/include/ns_buffer.h" -#include "socket.h" -#include "tcp.h" - -typedef struct { - int8_t int8_value; - uint16_t uint16_value; - tcp_error tcp_error_value; - tcp_session_t *tcp_session_ptr; - char *state; - buffer_t *buffer_ptr; -} tcp_stub_data_t; - -extern tcp_stub_data_t tcp_stub; - - -#ifdef __cplusplus -} -#endif - -#endif //__SOCKET_STUB_H__ diff --git a/test/nanostack/unittest/stub/thread_address_registration_client_stub.c b/test/nanostack/unittest/stub/thread_address_registration_client_stub.c deleted file mode 100644 index 42abd842355a..000000000000 --- a/test/nanostack/unittest/stub/thread_address_registration_client_stub.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "common_functions.h" -#include "randLIB.h" - -#include "thread_common.h" -#include "thread_config.h" -#include "thread_management_if.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_management_client.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/ipv6.h" -#include "Core/include/address.h" - -void thread_address_registration_init() -{ -} - -void thread_address_registration_deinit() -{ -} - -void thread_address_registration_send_proactive_an(struct protocol_interface_info_entry *interface, const uint8_t *addr, const uint8_t *child_mac64) -{ - (void)interface; - (void)addr; - (void)child_mac64; -} - -void thread_address_registration_mcast_change(protocol_interface_info_entry_t *interface, if_group_entry_t *group, bool added) -{ - (void)interface; - (void)group; - (void)added; -} -void thread_address_registration_timer_set(protocol_interface_info_entry_t *interface, uint16_t seconds) -{ - (void)interface; - (void)seconds; -} - -void thread_address_registration_timer(protocol_interface_info_entry_t *interface, uint16_t seconds) -{ - (void)interface; - (void)seconds; -} diff --git a/test/nanostack/unittest/stub/thread_bbr_api_stub.c b/test/nanostack/unittest/stub/thread_bbr_api_stub.c deleted file mode 100644 index ad47f899ebf5..000000000000 --- a/test/nanostack/unittest/stub/thread_bbr_api_stub.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" - - -#include -#include "ns_types.h" -#include -#include -#include "ns_trace.h" -#include "eventOS_event_timer.h" -#include "randLIB.h" -#include "common_functions.h" -#include "thread_border_router_api.h" -#include "thread_bbr_api.h" -#include "Common_Protocols/ipv6_constants.h" -#include "DHCPv6_Server/DHCPv6_server_service.h" -#include "thread_management_if.h" -#include "6LoWPAN/Thread/thread_config.h" -#include "6LoWPAN/Thread/thread_constants.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "6LoWPAN/Thread/thread_extension.h" -#include "6LoWPAN/Thread/thread_tmfcop_lib.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "6LoWPAN/Thread/thread_router_bootstrap.h" -#include "6LoWPAN/Thread/thread_border_router_api_internal.h" -#include "6LoWPAN/Thread/thread_mdns.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "coap_service_api.h" -#include "thread_management_server.h" -#include "socket_api.h" -#include "coap_service_api.h" - -bool thread_bbr_routing_enabled(protocol_interface_info_entry_t *cur) -{ - return true; -} - -void thread_bbr_network_data_update_notify(protocol_interface_info_entry_t *cur) -{ -} - - -int thread_bbr_commissioner_proxy_service_update(int8_t interface_id) -{ - return -1; -} -int8_t thread_bbr_init(int8_t interface_id, uint16_t external_commisssioner_port) -{ - return -1; -} - -void thread_bbr_delete(int8_t interface_id) -{ -} - -void thread_bbr_seconds_timer(int8_t interface_id, uint32_t seconds) -{ -} - -int thread_bbr_proxy_state_update(int8_t caller_interface_id , int8_t handler_interface_id, bool status) -{ - return -1; -} diff --git a/test/nanostack/unittest/stub/thread_beacon_stub.c b/test/nanostack/unittest/stub/thread_beacon_stub.c deleted file mode 100644 index df14200221e7..000000000000 --- a/test/nanostack/unittest/stub/thread_beacon_stub.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include "mac_api.h" -#include "thread_beacon.h" -#include "thread_config.h" -#include "common_functions.h" -#include "thread_meshcop_lib.h" -#include -#include "ns_trace.h" -/*service lib includes */ -#include "Service_Libs/utils/ns_crc.h" -#define TRACE_GROUP "Tbcn" - -#define THREAD_BEACON_VERSION_SHIFT 4 -#define THREAD_BEACON_JOINING_PERMITTED_BIT 0x01 - -uint8_t *thread_beacon_calculate_bloom_filter(uint8_t *bloom_filter_ptr,uint8_t bloom_filter_length, uint8_t *joiner_id_ptr, int joiner_id_length) -{ - return NULL; -} - diff --git a/test/nanostack/unittest/stub/thread_bootstrap_stub.c b/test/nanostack/unittest/stub/thread_bootstrap_stub.c deleted file mode 100644 index 714c2f278ab1..000000000000 --- a/test/nanostack/unittest/stub/thread_bootstrap_stub.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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. - */ - -/* - * \file thread_bootstrap.c - * \brief Add short description about this file!!! - * - */ -#include "nsconfig.h" -#include -#include -#include -#include "eventOS_event.h" -#include "eventOS_event_timer.h" -#include "randLIB.h" -#include "common_functions.h" -#include "mac_api.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "net_thread_test.h" -#include "libDHCPv6/libDHCPv6.h" -#include "libDHCPv6/libDHCPv6_server.h" -#include "ns_trace.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "6LoWPAN/Thread/thread_nd.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "thread_management_if.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "MLE/mle.h" -#include "dhcp_service_api.h" -#include "thread_dhcpv6_client.h" - - -#define TRACE_GROUP "thbs" - -void threa_ula_address_generate_and_push_to_stack(protocol_interface_info_entry_t *cur); -int thread_bootstrap_reset(protocol_interface_info_entry_t *cur); -static void thread_mle_challenge_trig(int8_t interface_id, uint8_t *LinkId); - -void thread_bootstrap_attached_finish(protocol_interface_info_entry_t *cur); - -int8_t nwk_thread_host_control(protocol_interface_info_entry_t *cur, net_host_mode_t mode, uint32_t delay) -{ - return 0; -} - -int thread_link_configuration_activate(protocol_interface_info_entry_t *cur, link_configuration_s *linkConfiguration) -{ - return 0; -} - -void thread_interface_init(protocol_interface_info_entry_t *cur) -{ -} - -void thread_tasklet(arm_event_s *event) -{ -} - -int thread_bootstrap_tasklet_init(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -void thread_clean_old_16_bit_address_based_addresses(protocol_interface_info_entry_t *cur) -{ -} - - -void thread_bootstrap_ready(protocol_interface_info_entry_t *cur) -{ -} - -int thread_leader_configure_init(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -void thread_bootstrap_generate_leader_and_link(int8_t interface_id) -{ -} - -void thread_bootstrap_connection_error(int8_t interface_id, nwk_connect_error_types errorType, uint8_t *LinkId) -{ -} - -void thread_bootsrap_router_id_cb(int8_t interface_id, uint8_t *ml16_address, uint8_t router_id, const uint8_t *router_mask_ptr) -{ -} - -void thread_interface_up(protocol_interface_info_entry_t *cur) -{ -} - -int thread_bootstrap_reset(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -void thread_network_attach_start(protocol_interface_info_entry_t *cur) -{ -} - -void threa_ula_address_generate_and_push_to_stack(protocol_interface_info_entry_t *cur) -{ -} - -void thread_generate_domain_address(protocol_interface_info_entry_t *cur) -{ -} -void thread_bootstrap_attached_ready(protocol_interface_info_entry_t *cur) -{ -} - -void thread_bootstrap_attached_downgrade_router(protocol_interface_info_entry_t *cur) -{ -} - -void thread_bootstrap_attched_upgrade_reed(protocol_interface_info_entry_t *cur) -{ -} - -void thread_bootstrap_attched_active_router(protocol_interface_info_entry_t *cur) -{ -} - -void thread_bootstrap_router_id_release_ready(protocol_interface_info_entry_t *cur) -{ -} - -void thread_bootstrap_router_id_get_fail(protocol_interface_info_entry_t *cur) -{ -} - -int8_t thread_bootstrap_child_id_request(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -void thread_bootstrap_attached_finish(protocol_interface_info_entry_t *cur) -{ -} - -void thread_parent_scan(protocol_interface_info_entry_t *cur) -{ -} - -int thread_set_link_for_commission(protocol_interface_info_entry_t *interface, nwk_pan_descriptor_t *best) -{ - return 0; -} - -void thread_mac_active_scan_response(uint8_t *data) -{ -} - -void thread_bootstrap_state_machine(protocol_interface_info_entry_t *cur) -{ -} - -void thread_bootstrap_stop(protocol_interface_info_entry_t *cur) -{ -} - -void thread_bootstrap_address_register(protocol_interface_info_entry_t *cur) -{ -} - -void thread_bootstrap_child_update_trig(protocol_interface_info_entry_t *cur) -{ -} - -void thread_bootstrap_global_leader_data(thread_info_t *thread_info) -{ - -} - -bool thread_tlv_request(int8_t interface_id, uint8_t *address, bool delayed_message, uint8_t *req_tlv, uint8_t req_len) -{ - return false; -} - -void thread_bootstrap_reset_restart(int8_t interface) -{ -} - -int thread_bootstrap_announce_send(protocol_interface_info_entry_t *cur, uint8_t channel_page, uint16_t channel, uint16_t panid, uint64_t timestamp, uint16_t selected_channel) -{ - return 0; -} -void thread_bootstrap_announcement_start(protocol_interface_info_entry_t *cur, uint8_t channel_page, uint16_t channel, uint8_t count, uint16_t period) -{ - return; -} -void thread_bootstrap_temporary_attach(protocol_interface_info_entry_t *cur, uint8_t channel_page, uint16_t channel, uint16_t panid, uint64_t timestamp) -{ - return; -} -int8_t thread_active_configuration_dataset_query_clean(protocol_interface_info_entry_t *cur) -{ - - return 0; -} -int8_t thread_active_configuration_dataset_query_done(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -void thread_bootstrap_network_data_changed(protocol_interface_info_entry_t *cur, bool force_stable_update, bool force_unstable_update) -{ - return; -} -void thread_bootstrap_network_data_update(protocol_interface_info_entry_t *cur) -{ - return; -} -void thread_bootstrap_dynamic_configuration_save(protocol_interface_info_entry_t *cur) -{ - return; -} -void thread_bootstrap_update_ml16_address(protocol_interface_info_entry_t *cur, uint16_t mac16) -{ - return; -} -void thread_bootstrap_clear_neighbor_entries(protocol_interface_info_entry_t *cur) -{ - return; -} -bool thread_bootstrap_link_create_check(protocol_interface_info_entry_t *interface, uint16_t short_address) -{ - return false; -} - -int8_t thread_mle_class_init(int8_t interface_id) -{ - return 0; -} - -void thread_clean_all_routers_from_neighbor_list(int8_t interface_id) -{ - -} - -void thread_set_link_local_address(protocol_interface_info_entry_t *cur) -{ - -} - -void thread_bootstrap_attached_active_router(protocol_interface_info_entry_t *cur) -{ - -} - -void thread_bootstrap_pending_configuration_save(protocol_interface_info_entry_t *cur) -{ - -} - -bool thread_check_is_this_my_parent(protocol_interface_info_entry_t *cur, mle_neigh_table_entry_t *entry_temp) -{ - return false; -} - -int thread_bootstrap_reset_child_info(protocol_interface_info_entry_t *cur, mle_neigh_table_entry_t *child) -{ - return 0; -} - -bool thread_device_register_address(protocol_interface_info_entry_t *cur) -{ - return false; -} - -void thread_bootstrap_all_nodes_address_generate(uint8_t multicast_address[16],uint8_t prefix[8], uint8_t scope) -{ -} - -int thread_configuration_thread_activate(protocol_interface_info_entry_t *cur, link_configuration_s *linkConfiguration) -{ - return 0; -} - -bool thread_bootstrap_should_register_address(protocol_interface_info_entry_t *cur) -{ - return false; -} - -int thread_bootstrap_network_data_process(protocol_interface_info_entry_t *cur, uint8_t *network_data_ptr, uint16_t network_data_length) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/thread_border_router_api_internal_stub.c b/test/nanostack/unittest/stub/thread_border_router_api_internal_stub.c deleted file mode 100644 index 13510aed45cb..000000000000 --- a/test/nanostack/unittest/stub/thread_border_router_api_internal_stub.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" - -#include -#include "ns_types.h" -#include -#include "eventOS_event.h" -#include -#include "ns_trace.h" -#include "Core/include/ns_buffer.h" -#include "common_functions.h" -#include "thread_border_router_api.h" -#include "thread_management_if.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_config.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "6LoWPAN/Thread/thread_network_data_storage.h" -#include "6LoWPAN/Thread/thread_management_client.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "MLE/mle.h" - -#define TRACE_GROUP "tBRa" - -void thread_border_router_network_data_update_notify(protocol_interface_info_entry_t *cur) -{ - (void) cur; -} -void thread_border_router_seconds_timer(int8_t interface_id, uint32_t seconds) -{ - (void) interface_id; - (void) seconds; -} - -void thread_border_router_resubmit_timer_set(int8_t interface_id, int16_t seconds) -{ - (void)interface_id; - (void)seconds; -} -int thread_border_router_udp_proxy_service_start(int8_t interface_id) -{ - (void)interface_id; - return 0; -} -void thread_border_router_network_data_appl_callback(protocol_interface_info_entry_t *cur) -{ - (void) cur; -} diff --git a/test/nanostack/unittest/stub/thread_border_router_api_stub.c b/test/nanostack/unittest/stub/thread_border_router_api_stub.c deleted file mode 100644 index 8622564a8016..000000000000 --- a/test/nanostack/unittest/stub/thread_border_router_api_stub.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" - -#include -#include "ns_types.h" -#include -#include "eventOS_event.h" -#include -#include "ns_trace.h" -#include "Core/include/ns_buffer.h" -#include "common_functions.h" -#include "thread_border_router_api.h" -#include "thread_management_if.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_config.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "6LoWPAN/Thread/thread_network_data_storage.h" -#include "6LoWPAN/Thread/thread_management_client.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "MLE/mle.h" - -#define TRACE_GROUP "tBRa" - -int thread_border_router_publish(int8_t interface_id) -{ - return 0; -} - -int thread_border_router_proxy_state_update(int8_t caller_interface_id , int8_t handler_interface_id, bool status) -{ - return 0; -} - -int8_t thread_border_router_init(int8_t interface_id) -{ - return 0; -} - -void thread_border_router_delete(int8_t interface_id) -{ -} - -int thread_border_router_recursive_dns_server_option_set(int8_t interface_id, uint8_t *recursive_dns_server_option, uint16_t recursive_dns_server_option_len) -{ - return 0; -} - -int thread_border_router_dns_search_list_option_set(int8_t interface_id, uint8_t *dns_search_list_option, uint16_t search_list_option_len) -{ - return 0; -} - -int thread_border_router_prefix_context_id(uint8_t *prefix_tlv, uint16_t prefix_tlv_length) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/thread_commissioning_if_stub.c b/test/nanostack/unittest/stub/thread_commissioning_if_stub.c deleted file mode 100644 index f77677cea271..000000000000 --- a/test/nanostack/unittest/stub/thread_commissioning_if_stub.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include -#include -#include -#include -#include "ns_trace.h" -#include "Core/include/ns_buffer.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "6LoWPAN/MAC/mac_pairwise_key.h" - -#include "net_interface.h" // TODO remove when fixing properly -#include "thread_commissioning_if.h" -#include "randLIB.h" - -#define TRACE_GROUP "thrC" - -int thread_commissioning_if_steering_data_set(int8_t interface_id, uint8_t *buf_ptr, uint16_t length) -{ - return 0; -} - -int thread_commissioning_if_register(int8_t interface_id, uint8_t border_router_address[static 16], uint8_t *commissioner_id_ptr, uint16_t commissioner_id_len, uint16_t *session_id) -{ - return 0; -} - -bool thread_commissioning_if_session_refresh(int8_t interface_id, uint16_t session_id) -{ - return true; -} - -int thread_commissioning_if_pairwise_key_add(int8_t interface_id, uint32_t valid_life_time, uint8_t eui64[8], uint8_t key[16]) -{ - return 0; -} - -bool thread_commissioning_if_joiner_port_set(int8_t interface_id, uint16_t joiner_udp_port) -{ - return true; -} - -int thread_commissioning_if_pairwise_key_del(int8_t interface_id, uint8_t eui64[static 8]) -{ - return 0; -} - -int thread_commissioning_if_pairwise_key_delete_all(int8_t interface_id) -{ - return 0; -} - -int thread_commissioning_if_border_router_locator_get(int8_t interface_id, uint8_t *address_ptr) -{ - return 0; -} - -int thread_commissioning_if_enable_security(int8_t interface_id) -{ - return 0; -} - -char* thread_commissioning_if_commissioner_id_get(int8_t interface_id) -{ - return NULL; -} -bool thread_commissioning_if_unregister(int8_t interface_id, uint16_t session_id) -{ - return true; -} -bool thread_commissioning_if_address_changed(int8_t interface_id, uint8_t border_router_address[static 16]) -{ - return true; -} - diff --git a/test/nanostack/unittest/stub/thread_common_stub.c b/test/nanostack/unittest/stub/thread_common_stub.c deleted file mode 100644 index e7ecde291088..000000000000 --- a/test/nanostack/unittest/stub/thread_common_stub.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Copyright (c) 2014-2015, 2017, 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 "nsconfig.h" -#include -#include -#include -#include "eventOS_event.h" -#include "randLIB.h" -#include "common_functions.h" - -#include "NWK_INTERFACE/Include/protocol.h" -#include "net_thread_test.h" -#include "libDHCPv6/libDHCPv6.h" -#include "libDHCPv6/libDHCPv6_server.h" -#include "ns_trace.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan_interface.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_nd.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "MLE/mle.h" -#include "MLE/mle_tlv.h" -#include "thread_common_stub.h" - -thread_stub_def thread_stub; -uint32_t thread_router_selection_jitter; - -uint16_t thread_log2_aprx(uint32_t n) -{ - return 0; -} - -int thread_proxy_state_update(int8_t caller_interface_id , int8_t handler_interface_id, bool status) -{ - return thread_stub.int_value; -} - -void thread_anycast_address_policy_update(const thread_info_t *thread_info, bool addPolicy) -{ -} -int8_t thread_bootstrap_up(protocol_interface_info_entry_t *cur) -{ - return thread_stub.int8_value; -} - -int8_t thread_bootstrap_down(protocol_interface_info_entry_t *cur) -{ - return thread_stub.int8_value; -} - -int thread_leader_data_base_allocate(protocol_interface_info_entry_t *cur) -{ - return thread_stub.int_value; -} - -bool thread_addr_is_mesh_local(const uint8_t *addr, const protocol_interface_info_entry_t *cur) -{ - return thread_stub.bool_value; -} - -bool thread_addr_is_mesh_local_16(const uint8_t *addr, const protocol_interface_info_entry_t *cur) -{ - return thread_stub.bool_value; -} - -uint8_t *thread_addr_write_mesh_local_16(uint8_t ip_addr_out[16], uint16_t addr16, const thread_info_t *info) -{ - return NULL; -} -uint8_t *thread_route_option_write(protocol_interface_info_entry_t *cur, uint8_t *ptr) -{ - return 0; -} - -uint16_t thread_active_operational_dataset_size(protocol_interface_info_entry_t *cur) -{ - return 0; -} -uint8_t *thread_active_timestamp_write(protocol_interface_info_entry_t *cur, uint8_t *ptr) -{ - return 0; -} -uint8_t *thread_network_data_tlv_write(protocol_interface_info_entry_t *cur, uint8_t *ptr, bool fulllist) -{ - return ptr; -} - -uint8_t *thread_active_operational_dataset_write(protocol_interface_info_entry_t *cur, uint8_t *ptr) -{ - return 0; -} -uint8_t *thread_address_registration_tlv_write(uint8_t *ptr, protocol_interface_info_entry_t *cur) -{ - return ptr; -} - -bool thread_active_operational_dataset_process(protocol_interface_info_entry_t *cur, uint8_t *ptr, uint16_t len, uint64_t dataset_timestamp) -{ - return false; -} -uint8_t *thread_pending_timestamp_write(protocol_interface_info_entry_t *cur, uint8_t *ptr) -{ - return 0; -} -uint16_t thread_pending_operational_dataset_size(protocol_interface_info_entry_t *cur) -{ - return 0; -} -uint8_t *thread_pending_operational_dataset_write(protocol_interface_info_entry_t *cur, uint8_t *ptr) -{ - return 0; -} -bool thread_pending_operational_dataset_process(protocol_interface_info_entry_t *cur, uint64_t mle_pending_timestamp, uint8_t *ptr, uint16_t len) -{ - return 0; -} - -bool thread_leader_data_parse(uint8_t *ptr, uint16_t dataLength, thread_leader_data_t *leaderDataBuf) -{ - return thread_stub.bool_value; -} - -bool thread_connectivity_tlv_parse(uint8_t *ptr, uint16_t dataLength, thread_connectivity_t *connectivityTlv) -{ - return thread_stub.bool_value; -} - -int thread_leader_ul16_address_get(thread_info_t *thread_info, uint8_t *address_ptr) -{ - return thread_stub.int_value; -} - -bool thread_leader_commissioner_create(thread_info_t *thread_info) -{ - return thread_stub.bool_value; -} - -void thread_leader_commissioner_free(thread_info_t *thread_info) -{ -} - -void thread_data_base_init(thread_info_t *thread_info, int8_t interfaceId) -{ -} - - -int thread_info_allocate_and_init(protocol_interface_info_entry_t *cur) -{ - return thread_stub.int_value; -} - -thread_link_quality_e thread_link_margin_to_quality(thread_link_margin_t margin) -{ - return QUALITY_BAD; -} - -uint_fast8_t thread_sum_rx_path_cost_and_link_cost(uint8_t inMargim, uint8_t outMargin, uint8_t pathCost) -{ - return 0; -} - -void thread_info_deallocate(protocol_interface_info_entry_t *cur) -{ -} - -int thread_leader_route_mask_update(thread_leader_info_t *info, uint8_t router_id, bool setActive) -{ - return thread_stub.int_value; -} - -/* Called by thread_routing.c as a result of updates to routing table - allows - * leader to monitor a router being available (having a finite route cost). - */ -void thread_leader_router_state_changed(thread_leader_info_t *info, uint8_t router_id, bool available, int8_t interface_id) -{ -} - -void thread_leader_allocate_router_id_by_allocated_id(thread_leader_info_t *info, uint8_t router_id, const uint8_t *eui64) -{ -} - -int thread_generate_leasequery(int8_t interfaceID, uint8_t *addressRequested) -{ - return thread_stub.bool_value; -} - - -void thread_child_id_request_info_init(thread_pending_child_id_req_t *child_info) -{ -} - -thread_pending_child_id_req_t *thread_child_id_request_allocate(void) -{ - return thread_stub.req_ptr; -} - -void thread_child_id_request_entry_clean(protocol_interface_info_entry_t *cur) -{ -} - -thread_pending_child_id_req_t *thread_child_id_request_entry_get(protocol_interface_info_entry_t *cur, uint8_t *euid64) -{ - return thread_stub.req_ptr; -} - -thread_pending_child_id_req_t *thread_child_id_request_entry_get_from_the_list(protocol_interface_info_entry_t *cur) -{ - return thread_stub.req_ptr; -} - -void thread_child_id_request_entry_remove(protocol_interface_info_entry_t *cur, thread_pending_child_id_req_t *entry) -{ -} - -int thread_init(protocol_interface_info_entry_t *cur) -{ - return thread_stub.int_value; -} - -int thread_attach_ready(protocol_interface_info_entry_t *cur) -{ - return thread_stub.int_value; -} - -bool thread_attach_active_router(protocol_interface_info_entry_t *cur) -{ - return thread_stub.bool_value; -} - -bool thread_scan_mask_validation(protocol_interface_info_entry_t *cur, uint8_t mask) -{ - return thread_stub.bool_value; -} - -int thread_route_ready_to_leader(protocol_interface_info_entry_t *cur) -{ - return thread_stub.int_value; -} - -thread_parent_info_t *thread_parent_data_allocate(thread_info_t *info) -{ - return thread_stub.info_ptr; -} - -void thread_dhcp_client_gua_error_cb(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], bool register_status) -{ -} - - -void thread_network_data_service_learn(protocol_interface_info_entry_t *cur) -{ -} - -void thread_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t ticks) -{ -} - -void thread_timer(protocol_interface_info_entry_t *cur, uint8_t ticks) -{ -} - -void thread_network_data_changed(protocol_interface_info_entry_t *cur, bool force_stable_update, bool force_unstable_update) -{ -} - -void thread_network_data_update(protocol_interface_info_entry_t *cur, bool force_stable_update, bool force_unstable_update) -{ -} - -bool thread_insist_that_mesh_isnt_a_link(const protocol_interface_info_entry_t *cur) -{ - return thread_stub.bool_value; -} - -/* If it's a 16-bit src address, only pass it if it's on the list */ -bool thread_test_addr_filter(const buffer_t *buf, const protocol_interface_info_entry_t *cur) -{ - return thread_stub.bool_value; -} - -int8_t thread_beacon_create_payload(protocol_interface_info_entry_t *cur) -{ - return thread_stub.int8_value; -} - -uint8_t thread_beacon_indication(uint8_t *ptr, uint8_t len, protocol_interface_info_entry_t *cur) -{ - return thread_stub.uint8_value; -} - -void thread_network_data_request_send(protocol_interface_info_entry_t *cur, uint8_t *requestDstAddress, bool delaydTrig) -{ - -} - -void thread_calculate_key_guard_timer(protocol_interface_info_entry_t *cur, link_configuration_s *linkConfiguration, bool is_init) -{ - return; -} - -void thread_network_data_request_disable_trig(protocol_interface_info_entry_t *cur) -{ - -} - -uint8_t *thread_leader_data_tlv_write(uint8_t *ptr, protocol_interface_info_entry_t *cur) -{ - return thread_stub.uint8_ptr; -} - -int8_t thread_network_data_sender_verify(uint8_t source_address[16], thread_commissioner_t *registered_commissioner, link_configuration_s *link_configuration, uint8_t *data_ptr, uint16_t data_len) -{ - return thread_stub.int8_value; -} - -void thread_network_data_request_trig(protocol_interface_info_entry_t *cur, uint8_t *requestDstAddress, bool delaydTrig) -{ - -} - -int thread_network_data_propagation(protocol_interface_info_entry_t *cur, uint8_t *childUnicastAddress, bool fullList) -{ - return thread_stub.int_value; -} - -bool thread_on_mesh_route_possible_add(thread_attach_device_mode_e threadMode) -{ - return thread_stub.bool_value; -} - -uint8_t thread_leader_data_tlv_size(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -int thread_link_reject_send(protocol_interface_info_entry_t *interface, const uint8_t *ll64) -{ - return 0; -} - -uint8_t thread_get_router_count_from_route_tlv(mle_tlv_info_t *routeTlv) -{ - return 0; -} - -uint8_t *thread_management_key_request_with_sequence(int8_t interface_id, uint8_t keyId, uint32_t keySequnce) -{ - return NULL; -} - -void thread_mcast_address_change(struct protocol_interface_info_entry *interface, struct addr_multicast_t *addr, bool addr_added) -{ -} - -void thread_child_mcast_entries_remove(protocol_interface_info_entry_t *cur, const uint8_t *mac64) -{ -} - -void thread_registered_mcast_addr_entry_clean(protocol_interface_info_entry_t *cur) -{ -} -void thread_address_registration_primary_bbr_process(struct protocol_interface_info_entry *cur) -{ -} -void thread_address_registration_primary_bbr_update_done(struct protocol_interface_info_entry *cur) -{ -} -int thread_address_registration_primary_bbr_update_needed(struct protocol_interface_info_entry *cur, uint16_t rloc, uint8_t seq) -{ - return 0; -} -int thread_address_registration_primary_bbr_get(struct protocol_interface_info_entry *cur, uint8_t *addr_ptr, uint8_t *seq_ptr, uint32_t *mlr_timer_ptr, uint32_t *delay_timer_ptr) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/thread_common_stub.h b/test/nanostack/unittest/stub/thread_common_stub.h deleted file mode 100644 index 76a8d59123b0..000000000000 --- a/test/nanostack/unittest/stub/thread_common_stub.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 __THREAD_COMMON_STUB_H__ -#define __THREAD_COMMON_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "inttypes.h" -#include "thread_common.h" - -typedef struct { - bool bool_value; - int int_value; - int8_t int8_value; - uint8_t uint8_value; - uint8_t *uint8_ptr; - uint16_t uint16_value; - thread_parent_info_t *info_ptr; - thread_leader_data_t *data_ptr; - thread_pending_child_id_req_t *req_ptr; -} thread_stub_def; - -extern thread_stub_def thread_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __THREAD_COMMON_STUB_H__ diff --git a/test/nanostack/unittest/stub/thread_dhcpv6_client_stub.c b/test/nanostack/unittest/stub/thread_dhcpv6_client_stub.c deleted file mode 100644 index b5999a0b5a7a..000000000000 --- a/test/nanostack/unittest/stub/thread_dhcpv6_client_stub.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include -#include -#include -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "common_functions.h" - - -#include "dhcp_service_api.h" -#include "thread_dhcpv6_client.h" -#include "libDHCPv6/libDHCPv6.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" - - -typedef struct { - thread_dhcp_client_global_adress_cb *global_address_cb; - uint16_t service_instance; - uint8_t libDhcp_instance; - int8_t interface; -} thread_dhcp_client_class_t; - -thread_dhcp_client_class_t dhcp_client; - -extern uint8_t *dhcpv6_vendor_code_parse_thread_router_id(uint8_t *ptr, uint16_t data_length); -void thread_dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr); - - -void thread_dhcp_client_init(int8_t interface) -{ -} - -void thread_dhcp_client_delete(int8_t interface) -{ -} - -void thread_dhcpv6_client_send_error_cb(dhcpv6_client_server_data_t *srv_data_ptr) -{ -} - - -/* solication responce received for either global address or routter id assignment */ -int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uint8_t *msg_ptr, uint16_t msg_len) -{ - return 0; -} - -int thread_dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[__static 16], uint8_t prefix[__static 16], uint8_t mac64[__static 8], thread_dhcp_client_global_adress_cb *error_cb) -{ - return 0; -} - -void thread_dhcp_client_global_address_renew(int8_t interface) -{ -} - -void thread_dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]) -{ -} - -void thread_dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_entry_t *addr, if_address_callback_t reason) -{ -} - -void thread_dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr) -{ -} - -uint8_t *dhcpv6_vendor_code_parse_thread_router_id(uint8_t *ptr, uint16_t data_length) -{ - return NULL; -} diff --git a/test/nanostack/unittest/stub/thread_discovery_stub.c b/test/nanostack/unittest/stub/thread_discovery_stub.c deleted file mode 100644 index aee06eee6d56..000000000000 --- a/test/nanostack/unittest/stub/thread_discovery_stub.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#ifdef HAVE_THREAD -#include "ns_types.h" -#include "eventOS_event.h" -#include "eventOS_event_timer.h" -#include "thread_config.h" -#include "common_functions.h" -#include -#include "ns_trace.h" -#include "ns_list.h" -#include "randLIB.h" -#include -#include "6LoWPAN/Thread/thread_discovery.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_management_server.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "Service_Libs/mle_service/mle_service_api.h" -#include "MLE/mle.h" -#include "MLE/mle_tlv.h" -#include "thread_tmfcop_lib.h" -#include "thread_meshcop_lib.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "mac_api.h" -#include "6LoWPAN/MAC/mac_data_poll.h" - -typedef enum { - THREAD_DISCOVER_INIT = 0, - THREAD_DISCOVER_TIMER -} thread_discover_event_id_e; - -#define TRACE_GROUP "tdis" - -//Discovery request class -typedef struct { - uint16_t active_timer; - uint32_t channel_mask; - uint16_t random_panid; - uint8_t temporary_mac64[8]; - thread_nwk_discovery_response_list_t network_list; - thread_discovery_ready_cb *response_cb; - uint8_t active_channel; - uint8_t channel_page; - bool waiting_response:1; - bool joiner_flag:1; - bool native_commisioner_scan; - uint8_t filter_tlv_length; //Optional Filter data length - uint8_t filter_tlv_data[]; //Do not anything after this definition -} thread_discovery_request_info_t; - -typedef struct { - uint8_t extentedAddress[8]; - uint8_t timer; - bool randomJitter; - ns_list_link_t link; -} thread_discovery_response_msg_t; - -typedef NS_LIST_HEAD(thread_discovery_response_msg_t, link) thread_discovery_response_msg_list; - -typedef struct { - struct protocol_interface_info_entry *interface; - thread_discovery_request_info_t *discovery_request; - thread_discovery_response_msg_list srv_respose_msg_list; - thread_discovery_response_msg_list srv_respose_msg_buffers; - thread_discovery_response_msg_t *msg_buffers; - thread_nwk_discovery_response_list_t discovered_network; - int8_t interface_id; - uint8_t version; - bool discovery_server_active; - ns_list_link_t link; -} thread_discovery_class_t; - -#define THREAD_DISCOVER_TIMER_PERIOD 50 - -int thread_discovery_init(int8_t interface_id, struct protocol_interface_info_entry *cur_interface, uint8_t version, bool reedDevice) -{ - return 0; -} - -/** - * Free all allocated memory and free class - */ -int thread_discovery_free(int8_t interface_id) -{ - return 0; -} - -/** - * Reset discovery class state to idle - */ -int thread_discovery_reset(int8_t interface_id) -{ - return 0; -} - -/** - * Enable thread discovery request response support - */ -int thread_discovery_responser_enable(int8_t interface_id, bool enable_service) -{ - return 0; -} - -/** - * Start Thread network discovery - */ -int thread_discovery_network_scan(int8_t interface_id, thread_discover_reques_t *scan_request, thread_discovery_ready_cb *ready_cb) -{ - return 0; -} - -discovery_response_list_t *thread_discovery_network_description_get(int8_t interface_id) -{ - return NULL; -} - -int thread_discovery_announce_network_scan(int8_t interface_id, thread_announce_discover_reques_t *scan_request, thread_announce_scan_ready_cb *ready_cb) -{ - return 0; -} - -#endif diff --git a/test/nanostack/unittest/stub/thread_host_bootstrap_stub.c b/test/nanostack/unittest/stub/thread_host_bootstrap_stub.c deleted file mode 100644 index 4b1ce56b948b..000000000000 --- a/test/nanostack/unittest/stub/thread_host_bootstrap_stub.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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. - */ - -/* - * \file thread_host_bootstrap.c - * \brief Add short description about this file!!! - * - */ - -#include "nsconfig.h" -#include -#include -#include -#include "eventOS_event.h" -#include "eventOS_event_timer.h" -#include "randLIB.h" -#include "shalib.h" -#include "common_functions.h" -#include "mac_api.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "net_thread_test.h" -#include "ns_trace.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "6LoWPAN/Thread/thread_nd.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_host_bootstrap.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/Thread/thread_network_synch.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/Thread/thread_management_client.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "MAC/IEEE802_15_4/mac_mlme.h" -#include "thread_management_if.h" -#include "Common_Protocols/ipv6.h" -#include "MLE/mle.h" -#include "MLE/mle_tlv.h" -#include "thread_config.h" -#include "Service_Libs/mle_service/mle_service_api.h" - -#define TRACE_GROUP "tebs" - - - -void thread_child_set_default_route(protocol_interface_info_entry_t *cur) -{ - -} - -void thread_set_meshlocal_route(protocol_interface_info_entry_t *cur) -{ - -} - -void thread_network_attach_start(protocol_interface_info_entry_t *cur) -{ - -} - -void thread_mle_parent_discover_receive_cb(int8_t interface_id, mle_message_t *mle_msg, mle_security_header_t *security_headers) -{ - -} - -void thread_endevice_synch_start(protocol_interface_info_entry_t *cur) -{ -} - -int8_t thread_bootstrap_child_update(protocol_interface_info_entry_t *cur) -{ - return 0; -} - diff --git a/test/nanostack/unittest/stub/thread_joiner_application_stub.c b/test/nanostack/unittest/stub/thread_joiner_application_stub.c deleted file mode 100644 index 4c392ab6362c..000000000000 --- a/test/nanostack/unittest/stub/thread_joiner_application_stub.c +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "common_functions.h" -#include "thread_tmfcop_lib.h" -#include "shalib.h" -#include "thread_management_if.h" -#include "thread_config.h" -#include "thread_meshcop_lib.h" -#include "thread_commissioning_if.h" -#include "thread_joiner_application.h" - -#define TRACE_GROUP TRACE_GROUP_THREAD_JOINER_APPLICATION -const uint8_t mle_pending_configuration_dataset_tlvs[] = { - MESHCOP_TLV_ACTIVE_TIME_STAMP, - MESHCOP_TLV_NETWORK_NAME, - MESHCOP_TLV_PANID, - MESHCOP_TLV_CHANNEL, - MESHCOP_TLV_CHANNEL_MASK, - MESHCOP_TLV_XPANID, - MESHCOP_TLV_NETWORK_MESH_LOCAL_ULA, - MESHCOP_TLV_NETWORK_MASTER_KEY, - MESHCOP_TLV_PSKC, - MESHCOP_TLV_SECURITY_POLICY}; - -const uint8_t mle_active_configuration_dataset_tlvs[] = { - MESHCOP_TLV_NETWORK_NAME, - MESHCOP_TLV_PANID, - MESHCOP_TLV_CHANNEL, - MESHCOP_TLV_CHANNEL_MASK, - MESHCOP_TLV_XPANID, - MESHCOP_TLV_NETWORK_MESH_LOCAL_ULA, - MESHCOP_TLV_NETWORK_MASTER_KEY, - MESHCOP_TLV_PSKC, - MESHCOP_TLV_SECURITY_POLICY}; - -const uint8_t entrust_dataset_tlvs[] = { - MESHCOP_TLV_ACTIVE_TIME_STAMP, - MESHCOP_TLV_NETWORK_NAME, - MESHCOP_TLV_CHANNEL_MASK,// Missing specification - MESHCOP_TLV_XPANID, - MESHCOP_TLV_NETWORK_MESH_LOCAL_ULA, - MESHCOP_TLV_NETWORK_MASTER_KEY, - MESHCOP_TLV_PSKC, - MESHCOP_TLV_SECURITY_POLICY, - MESHCOP_TLV_NETWORK_KEY_SEQUENCE}; - -const uint8_t pending_configuration_dataset_tlvs[] = { - MESHCOP_TLV_PENDING_TIMESTAMP, - MESHCOP_TLV_ACTIVE_TIME_STAMP, - MESHCOP_TLV_NETWORK_NAME, - MESHCOP_TLV_PANID, - MESHCOP_TLV_CHANNEL, - MESHCOP_TLV_CHANNEL_MASK, - MESHCOP_TLV_XPANID, - MESHCOP_TLV_NETWORK_MESH_LOCAL_ULA, - MESHCOP_TLV_NETWORK_MASTER_KEY, - MESHCOP_TLV_PSKC, - MESHCOP_TLV_SECURITY_POLICY}; - -const uint8_t active_configuration_dataset_tlvs[] = { - MESHCOP_TLV_ACTIVE_TIME_STAMP, - MESHCOP_TLV_NETWORK_NAME, - MESHCOP_TLV_PANID, - MESHCOP_TLV_CHANNEL, - MESHCOP_TLV_CHANNEL_MASK, - MESHCOP_TLV_XPANID, - MESHCOP_TLV_NETWORK_MESH_LOCAL_ULA, - MESHCOP_TLV_NETWORK_MASTER_KEY, - MESHCOP_TLV_PSKC, - MESHCOP_TLV_SECURITY_POLICY}; - -const uint8_t mle_active_configuration_dataset_ignore_tlvs[] = { - MESHCOP_TLV_ACTIVE_TIME_STAMP -}; - -const uint8_t mle_pending_configuration_dataset_ignore_tlvs[] = { - MESHCOP_TLV_PENDING_TIMESTAMP -}; - -uint8_t mle_active_configuration_dataset_ignore_tlvs_size(void) -{ - return sizeof(mle_active_configuration_dataset_ignore_tlvs); -} - -uint8_t mle_pending_configuration_dataset_ignore_tlvs_size(void) -{ - return sizeof(mle_pending_configuration_dataset_ignore_tlvs); -} - -uint8_t active_configuration_dataset_tlvs_size(void) -{ - return sizeof(active_configuration_dataset_tlvs); -} - -uint8_t pending_configuration_dataset_tlvs_size(void) -{ - return sizeof(pending_configuration_dataset_tlvs); -} - -uint8_t mle_active_configuration_dataset_tlvs_size(void) -{ - return sizeof(mle_active_configuration_dataset_tlvs); -} - -uint16_t thread_joiner_application_active_config_length(uint8_t interface_id, const uint8_t *req_tlv_ptr, uint8_t req_tlv_len, const uint8_t *ignore_tlv_ptr, uint8_t ignore_tlv_len) -{ - return 0; -} -uint8_t *thread_joiner_application_active_config_write(uint8_t interface_id, uint8_t *ptr, const uint8_t *req_tlv_ptr, uint8_t req_tlv_len, const uint8_t *ignore_tlv_ptr, uint8_t ignore_tlv_len) -{ - return NULL; -} -uint64_t thread_joiner_application_active_timestamp_get(int8_t interface_id) -{ - return 0; -} -int thread_joiner_application_domain_prefix_get(int8_t interface_id, uint8_t *options_ptr, uint8_t *domain_prefix_ptr, uint8_t *domain_prefix_len) -{ - return 0; -} -void thread_joiner_application_active_timestamp_set(int8_t interface_id, uint64_t timestamp) -{ - return; -} -uint8_t *thread_joiner_application_active_config_tlv_list_get(uint8_t interface_id, uint16_t *length) -{ - return NULL; -} - -uint8_t mle_pending_configuration_dataset_tlvs_size(void) -{ - return sizeof(mle_pending_configuration_dataset_tlvs); -} -uint8_t entrust_dataset_tlvs_size(void) -{ - return sizeof(entrust_dataset_tlvs); -} - -link_configuration_s *link_configuration_create(void) -{ - return NULL; -} - -void link_configuration_delete(link_configuration_s *this) -{ -} - -void link_configuration_copy(link_configuration_s *this, link_configuration_s *configuration_ptr) -{ -} - -int thread_joiner_application_init(int8_t interface_id, device_configuration_s *device_configuration_ptr, struct link_configuration *static_configuration_ptr) -{ - return 0; -} - -void thread_joiner_application_deinit(int8_t interface_id) -{ -} - -link_configuration_s *thread_joiner_application_get_config(int8_t interface_id) -{ - return NULL; -} - -bool thread_joiner_application_nvm_operation_in_progress(int8_t interface_id) -{ - return false; -} - -bool thread_joiner_application_nvm_link_configuration_load(int8_t interface_id) -{ - return false; -} - -int joiner_application_security_done_cb(int8_t service_id, uint8_t IID[8], uint8_t keyblock[40]) -{ - return 0; -} - -int thread_joiner_application_pskd_commission_start(int8_t interface_id, uint8_t parent_address[16], uint16_t port, uint16_t panid, uint8_t xpanid[8], uint8_t channel, thread_joiner_application_commission_done_cb *done_cb) -{ - return 0; -} - -int thread_joiner_application_pending_config_create(int8_t interface_id, uint8_t *data_ptr, uint16_t data_len) -{ - return 0; -} -void thread_joiner_application_pending_config_delete(int8_t interface_id) -{ - return; -} - -uint32_t thread_joiner_application_pending_timeout_get(int8_t interface_id) -{ - return 0; -} - -bool thread_joiner_application_old_config_exists(int8_t interface_id) -{ - return false; -} -int thread_joiner_application_old_config_activate(int8_t interface_id) -{ - return 0; -} - -int thread_joiner_application_pending_config_enable(int8_t interface_id, uint32_t timeout_in_ms) -{ - return 0; -} - -void thread_joiner_application_seconds_timer(int8_t interface_id, uint32_t seconds) -{ - -} -void thread_joiner_application_pending_config_add_missing_fields(uint8_t interface_id) -{ -} - -device_configuration_s *thread_joiner_application_get_device_config(int8_t interface_id) -{ - return NULL; -} -uint64_t thread_joiner_application_pending_config_timestamp_get(int8_t interface_id) -{ - return 0; -} -int thread_joiner_application_pending_config_timestamp_set(int8_t interface_id, uint64_t timestamp) -{ - return 0; -} -uint64_t thread_joiner_application_get_pending_timestamp(int8_t interface_id) -{ - return 0; -} -bool thread_joiner_application_pending_config_exists(int8_t interface_id) -{ - return true; -} -uint32_t thread_joiner_application_pending_config_timeout_get(int8_t interface_id) -{ - return 0; -} - -uint16_t thread_joiner_application_pending_config_length(uint8_t interface_id, uint8_t *req_tlv_ptr, uint8_t req_tlv_len, const uint8_t *ignore_tlv_ptr, uint8_t ignore_tlv_len) -{ - return 0; -} - -uint8_t *thread_joiner_application_pending_config_build(uint8_t interface_id, uint8_t *ptr, uint8_t *req_tlv_ptr, uint8_t req_tlv_len, const uint8_t *ignore_tlv_ptr, uint8_t ignore_tlv_len) -{ - return ptr; -} -uint8_t *thread_joiner_application_pending_config_tlv_list_get(uint8_t interface_id, uint16_t *length) -{ - return NULL; -} - -int thread_joiner_application_set_pending_timestamp(int8_t interface_id, uint64_t timestamp) -{ - return 0; -} -bool thread_joiner_application_next_pending_config_exists(int8_t interface_id) -{ - return true; -} -void thread_joiner_application_next_pending_config_save(int8_t interface_id) -{ - return; -} -uint16_t thread_joiner_application_next_pending_config_length(int8_t interface_id) -{ - return 0; -} -uint8_t *thread_joiner_application_next_pending_config_build(int8_t interface_id, uint8_t *ptr) -{ - return ptr; -} -uint64_t thread_joiner_application_next_pending_config_timestamp_get(int8_t interface_id) -{ - return 0; -} -uint32_t thread_joiner_application_next_pending_config_timeout_get(int8_t interface_id) -{ - return 0; -} -void thread_joiner_application_next_pending_config_delete(int8_t interface_id) -{ - return; -} - -bool thread_joiner_application_next_active_config_exists(int8_t interface_id) -{ - return false; -} -uint16_t thread_joiner_application_next_active_config_length(int8_t interface_id) -{ - return 0; -} - -uint8_t *thread_joiner_application_next_active_config_write(int8_t interface_id, uint8_t *ptr) -{ - return NULL; -} - - -void thread_joiner_application_next_active_config_save(int8_t interface_id) -{ - return; -} - -link_configuration_s *thread_joiner_application_next_active_config_get(int8_t interface_id) -{ - return NULL; -} - -void thread_joiner_application_next_active_config_delete(int8_t interface_id) -{ - return; -} - -int thread_joiner_application_configuration_nvm_save(int8_t interface_id) -{ - return 0; -} - -int thread_joiner_application_update_configuration(uint8_t interface_id, uint8_t *msg_ptr, uint16_t msg_len, bool include_missing_tlvs) -{ - return 0; -} -int thread_joiner_application_configuration_length(link_configuration_s *link_configuration, const uint8_t *tlv_list, uint16_t list_len) -{ - return 0; -} - -uint8_t *thread_joiner_application_configuration_build(link_configuration_s *link_configuration, uint8_t *response_ptr, const uint8_t *tlv_list, uint16_t list_len) -{ - return NULL; -} - -link_configuration_s *thread_joiner_application_old_config_get(int8_t interface_id) -{ - return NULL; -} - -void thread_joiner_application_old_config_delete(int8_t interface_id) -{ - return; -} - -link_configuration_s *thread_joiner_application_old_config_create(int8_t interface_id) -{ - return NULL; -} -int thread_joiner_application_provisioning_set(int8_t interface_id, thread_provisioning_status_e status) -{ - return 0; -} - -thread_provisioning_status_e thread_joiner_application_provisioning_get(int8_t interface_id) -{ - return PROVISIONING_STATUS_REJECTED; -} -uint8_t *thread_joiner_application_device_configuration_build(uint8_t *ptr, device_configuration_s *device_configuration) -{ - return NULL; -} -int thread_joiner_application_device_configuration_length(device_configuration_s *device_configuration) -{ - return 0; -} -void thread_joiner_pending_config_activate(int8_t interface_id) -{ - return; -} - -int thread_joiner_application_link_configuration_store(int8_t interface_id, link_configuration_s *link_config) -{ - return 0; -} - -int thread_joiner_application_link_configuration_delete(int8_t interface_id) -{ - return 0; -} - diff --git a/test/nanostack/unittest/stub/thread_leader_service_stub.c b/test/nanostack/unittest/stub/thread_leader_service_stub.c deleted file mode 100644 index 0bb91244553b..000000000000 --- a/test/nanostack/unittest/stub/thread_leader_service_stub.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "nsconfig.h" -#include -#include -#include -#include -#include "nsdynmemLIB.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" - -#define TRACE_GROUP "TMFs" - -#include "net_interface.h" -#include "socket_api.h" -#include "thread_config.h" -#include "thread_common.h" -#include "thread_tmfcop_lib.h" -#include "thread_meshcop_lib.h" -#include "thread_management_if.h" -#include "thread_commissioning_if.h" -#include "thread_leader_service.h" - - -int thread_leader_service_init(int8_t interface_id, uint8_t coap_service_id) -{ - return 0; -} - -void thread_leader_service_delete(int8_t interface_id) -{ -} -int thread_leader_service_start(int8_t interface_id) -{ - return 0; -} - -void thread_leader_service_stop(int8_t interface_id) -{ - -} - -void thread_leader_service_leader_data_free(thread_info_t *thread_info) -{ -} -void thread_leader_service_generate_thread_partitition(int8_t interface_id, bool newPartition) -{ - (void)interface_id; - (void)newPartition; -} -void thread_leader_service_update_id_set(protocol_interface_info_entry_t *cur) -{ -} -void thread_leader_service_router_id_valid_lifetime_update(protocol_interface_info_entry_t *cur, uint32_t tickUpdate) -{ -} -void thread_leader_service_generate_network_data(protocol_interface_info_entry_t *cur) -{ -} -uint16_t thread_leader_service_child_id_from_networkdata_get(struct thread_info_s *thread_info, uint16_t router_short_addr) -{ - return 0; -} -void thread_leader_service_thread_partitition_generate(int8_t interface_id, bool newPartition) -{ -} diff --git a/test/nanostack/unittest/stub/thread_management_api_stub.c b/test/nanostack/unittest/stub/thread_management_api_stub.c deleted file mode 100644 index a5a745038ce9..000000000000 --- a/test/nanostack/unittest/stub/thread_management_api_stub.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#include -#include "thread_management_api.h" -#include "ns_types.h" -#include "sn_coap_header.h" - -int thread_management_recv_set_response_cb(int8_t service_id, uint16_t msg_id, sn_coap_hdr_s *response_ptr) -{ - return 0; -} - -int thread_management_recv_get_response_cb(int8_t service_id, uint16_t msg_id, sn_coap_hdr_s *response_ptr) -{ - return 0; -} - -int thread_management_register(int8_t interface_id) -{ - return 0; -} - -int thread_management_unregister(int8_t interface_id) -{ - return 0; -} - -int thread_management_set_security_policy(int8_t interface_id, uint8_t options, uint16_t rotation_time, management_set_response_cb *cb_ptr) -{ - return 0; -} - -int thread_management_set_steering_data(int8_t interface_id,uint16_t session_id, uint8_t *steering_data_ptr, uint8_t steering_data_len, management_set_response_cb *cb_ptr) -{ - return 0; -} - -int thread_management_set_commissioning_data_timestamp(int8_t interface_id, uint64_t time, management_set_response_cb *cb_ptr) -{ - return 0; -} - -int thread_management_get(int8_t instance_id, uint8_t dst_addr[static 16], char *uri_ptr, uint8_t *fields_ptr, uint8_t fields_count, management_get_response_cb *cb_ptr) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/thread_management_client_stub.c b/test/nanostack/unittest/stub/thread_management_client_stub.c deleted file mode 100644 index 82c88212bb1f..000000000000 --- a/test/nanostack/unittest/stub/thread_management_client_stub.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "thread_tmfcop_lib.h" - -#include "thread_config.h" -#include "thread_management_if.h" -#include "6LoWPAN/Thread/thread_management_client.h" - -#define TRACE_GROUP TRACE_GROUP_THREAD_MANAGEMENT_CLIENT - -typedef struct thread_management { - thread_management_client_router_id_cb *router_id_cb_ptr; - thread_management_client_network_data_set_cb *network_data_set_cb_ptr; - int8_t interface_id; - int8_t coap_service_id; - ns_list_link_t link; -} thread_management_t; - - -void thread_management_client_init(int8_t interface_id) -{ -} - -void thread_management_client_delete(int8_t interface_id) -{ -} - -int thread_management_client_router_id_get(int8_t interface_id, uint8_t mac[8], uint16_t router_id, thread_management_client_router_id_cb *id_cb, uint8_t cause) -{ - return 0; -} - -int thread_management_client_router_id_release(int8_t interface_id, uint8_t mac[8], uint16_t router_id, thread_management_client_router_id_cb *id_cb) -{ - return 0; -} - -int thread_management_client_network_data_register(int8_t interface_id, uint8_t *data_ptr, uint16_t data_len, thread_management_client_network_data_set_cb *set_cb) -{ - return 0; -} - -int8_t thread_management_query_network_parameters(int8_t interface_id, uint8_t *dst_address) -{ - return 0; -} - -int8_t thread_management_send_set_network_parameters(int8_t interface_id) -{ - return 0; -} - -int8_t thread_management_client_pending_get(int8_t interface_id, uint8_t *dst_address) -{ - return 0; -} - -int8_t thread_management_client_active_get(int8_t interface_id, uint8_t *dst_address) -{ - return 0; -} - -int8_t thread_management_client_active_set(int8_t interface_id, uint8_t *dst_address) -{ - return 0; -} -int8_t thread_management_client_pending_set(int8_t interface_id, uint8_t *dst_address) -{ - return 0; -} -int thread_management_client_network_data_unregister(int8_t interface_id, uint16_t rloc16) -{ - return 0; -} -int thread_management_client_neighbor_discovery_data_request(int8_t interface_id, const uint8_t destination[16], const uint8_t *options, uint8_t options_len, thread_management_client_network_data_set_cb *set_cb) -{ - return 0; -} -int thread_management_client_provision_request(int8_t interface_id, uint8_t *dst_address, uint16_t port) -{ - return 0; -} -void thread_management_client_pending_coap_request_kill(int8_t interface_id) -{ -} - -void thread_management_client_proactive_an(int8_t interface_id, const uint8_t address[16], const uint16_t rloc, const uint8_t ml_eid[8], const uint8_t dst_addr[16]) -{ -} diff --git a/test/nanostack/unittest/stub/thread_management_if_stub.c b/test/nanostack/unittest/stub/thread_management_if_stub.c deleted file mode 100644 index 3e1e0bfa77cc..000000000000 --- a/test/nanostack/unittest/stub/thread_management_if_stub.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include -#include -#include "ns_types.h" -#include -//#include "eventOS_event.h" -#include -#include -#include "ns_trace.h" -#include "Core/include/ns_buffer.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "6LoWPAN/Thread/thread_network_data_storage.h" -#include "6LoWPAN/Thread/thread_nd.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "MLE/mle.h" -#include "thread_management_if.h" -#include "6LoWPAN/Thread/thread_constants.h" -//#include "thread_tmf_data_if.h" -#include "thread_commissioning_if.h" -#include "shalib.h" -#include "Common_Protocols/icmpv6.h" -#include "libDHCPv6/libDHCPv6.h" -#include "libDHCPv6/libDHCPv6_server.h" -#include "DHCPv6_Server/DHCPv6_server_service.h" - -uint16_t thread_joiner_port = THREAD_DEFAULT_JOINER_PORT; - -int8_t thread_node_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode) -{ - return 0; -} - -void arm_thread_private_ula_prefix_set(protocol_interface_info_entry_t *cur, const uint8_t *ula_prefix) -{ -} - -int thread_tmf_service_commision_request(int8_t commissioning_handler_id, int8_t interfaceId, uint8_t *parentLLAddressPtr) -{ - return 0; -} - -int thread_tmf_service_commision_relay_control(int8_t interfaceId, int8_t commissioning_handler_id, uint8_t *borderRouterLocator, bool enableService) -{ - return 0; -} - -int thread_management_router_select_threshold_values_set( - int8_t interface_id, - uint8_t upGradeThreshold, - uint8_t downGradeThreshold) -{ - return 0; -} - -int thread_management_node_init( - int8_t interface_id, - channel_list_s *channel_list, - device_configuration_s *device_configuration, - link_configuration_s *static_configuration) -{ - return 0; -} - -int thread_management_get_ml16_address(int8_t interface_id, uint8_t *address_ptr) -{ - return 0; -} - -int thread_management_get_ml_prefix(int8_t interface_id, uint8_t *prefix_ptr) -{ - return 0; -} - -int thread_management_get_ml_prefix_112(int8_t interface_id, uint8_t *prefix_ptr) -{ - return 0; -} - -int thread_management_get_leader_address(int8_t interface_id, uint8_t *address_ptr) -{ - return 0; -} -int thread_management_get_leader_aloc(int8_t interface_id, uint8_t *address_buffer) -{ - return 0; -} - -link_configuration_s *thread_management_configuration_get(int8_t interface_id) -{ - return NULL; -} - -int thread_management_security_material_set(int8_t interface_id, bool enableSecurity, uint8_t *thrMasterKey, uint32_t thrKeySequenceCounter, uint32_t thrKeyRotation) -{ - return 0; -} - -int thread_commision_data_handler(uint8_t *thrMasterKey, uint32_t thrKeySequenceCounter, uint32_t thrKeyRotation, uint8_t *meshLocalPrefix) -{ - return 0; -} - -int thread_management_commission_data_set(int8_t interface_id) -{ - return 0; -} - -int thread_management_joiner_attach_start(int8_t interface_id) -{ - return 0; -} - -uint8_t *thread_management_key_request(int8_t nwk_interface_id, uint8_t keyId) -{ - return NULL; -} - -void thread_management_key_synch_req(int8_t interface_id, uint32_t keySequnce) -{ -} - -void thread_history_key_material_push(thread_info_t *thread_info, uint8_t *mleKeyPtr, uint8_t keyId) -{ -} - -void thread_security_trig_pending_key(protocol_interface_info_entry_t *cur) -{ -} - -void thread_security_next_key_generate(protocol_interface_info_entry_t *cur, uint8_t *masterKey, uint32_t keySequence) -{ -} - -int thread_management_increment_key_sequence_counter(int8_t interface_id) -{ - return 0; -} - -int thread_management_key_sequence_counter_update(int8_t interface_id, uint32_t thrKeySequenceCounter) -{ - return 0; -} - -int thread_management_add_route(int8_t interface_id, uint8_t *route_prefix_ptr, uint8_t prefix_length, bool stable_service) -{ - return 0; -} - -int thread_management_del_route(int8_t interface_id, uint8_t *route_prefix_ptr, uint8_t prefix_length) -{ - return 0; - -} - -int thread_management_add_dhcpv6_server(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_length, bool stable_service) -{ - return 0; -} - -int thread_management_del_dhcpv6_server(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_length) -{ - return 0; -} - -int thread_management_add_contexts(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_length, uint8_t cid, bool compress_supported) -{ - return 0; -} - -int thread_management_read_leader_ula(int8_t interface_id, uint8_t *address_buffer) -{ - return 0; -} - -int thread_management_network_data_tlv_push(protocol_interface_info_entry_t *cur, uint8_t *data_pointer, uint16_t length) -{ - return 0; -} - -int thread_management_network_data_analyze_trig(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -int thread_management_network_data_register(int8_t interface_id, uint8_t *network_data_ptr, uint16_t network_data_length, uint16_t routerId) -{ - return 0; -} - -int thread_management_remove_router_by_id(int8_t interface_id, uint8_t routerId) -{ - return 0; -} - -int thread_management_print_network_data(int8_t interface_id) -{ - return 0; -} - -int thread_on_mesh_slaac_server_add(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_length, bool stableData) -{ - return 0; -} - -int thread_on_mesh_slaac_delete(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_length) -{ - return 0; -} - -int thread_dhcpv6_server_add(int8_t interface_id, uint8_t *prefix_ptr, uint32_t max_client_cnt, bool stableData) -{ - return 0; -} - -int thread_dhcpv6_server_set_lifetime(int8_t interface_id, uint8_t *prefix_ptr, uint32_t valid_lifetime) -{ - return 0; -} - -int thread_dhcpv6_server_set_max_client(int8_t interface_id, uint8_t *prefix_ptr, uint32_t max_client_count) -{ - return 0; -} - -int thread_dhcpv6_server_set_anonymous_addressing(int8_t interface_id, uint8_t *prefix_ptr, bool anonymous) -{ - return 0; -} - -int thread_dhcpv6_server_delete(int8_t interface_id, uint8_t *prefix_ptr) -{ - return 0; -} - -uint16_t thread_management_get_my_sht_addr(int8_t interface_id) -{ - return 0; -} - -int thread_management_get_my_iid16(int8_t interface_id, uint8_t *iidPtr) -{ - return 0; -} - -int thread_management_get_my_ml_prefix(int8_t interface_id, uint8_t *prefix) -{ - return 0; -} - -/* Get my mesh local prefix /112 */ -int thread_management_get_my_ml_prefix_112(int8_t interface_id, uint8_t *prefix) -{ - return 0; -} - -int thread_management_get_my_ml16(int8_t interface_id, uint8_t *addressPtr) -{ - return 0; -} - - -int thread_management_get_current_keysequence(int8_t interface_id, uint32_t *sequencePtr) -{ - return 0; -} - -int thread_management_native_commissioner_get_connection_info(int8_t interface_id, uint8_t *address_ptr, uint16_t *port, uint8_t *PSKc_ptr) -{ - return 0; -} - -int thread_management_get_commissioner_address(int8_t interface_id, uint8_t *address_ptr, uint16_t *port_ptr) -{ - return 0; -} - -void thread_key_get(uint8_t *key, uint8_t *key_material_buf, uint32_t key_sequence_counter) -{ - -} - -int thread_management_key_sets_calc(protocol_interface_info_entry_t *cur, link_configuration_s *linkConfiguration, uint32_t thrKeySequenceCounter) -{ - return 0; -} - -void thread_security_update_from_mac(protocol_interface_info_entry_t *cur) -{ - -} -int thread_management_get_parent_address(int8_t interface_id, uint8_t *address_ptr) -{ - return 0; -} -int thread_management_device_type_set(int8_t interface_id, thread_device_type_e device_type) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/thread_management_server_stub.c b/test/nanostack/unittest/stub/thread_management_server_stub.c deleted file mode 100644 index e0b23305de22..000000000000 --- a/test/nanostack/unittest/stub/thread_management_server_stub.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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 "nsconfig.h" -#include -#include -#include -#include -#include "nsdynmemLIB.h" -#include "common_functions.h" -#include "6LoWPAN/Thread/thread_management_server.h" - -#define TRACE_GROUP "TMFs" - -#include "net_interface.h" -#include "socket_api.h" -#include "thread_config.h" -#include "thread_tmfcop_lib.h" -#include "thread_meshcop_lib.h" -#include "thread_management_if.h" -#include "thread_commissioning_if.h" -//#include "thread_tmf_data_if.h" - -int thread_management_server_init(int8_t interface_id) -{ - return 0; -} - -void thread_management_server_delete(int8_t interface_id) -{ -} - -void joiner_router_recv_commission_msg(void *cb_res) -{ -} - -int thread_management_server_joiner_router_init(int8_t interface_id) -{ - return 0; -} - -void thread_management_server_joiner_router_deinit(int8_t interface_id) -{ -} - -int thread_management_server_commisoner_data_get(int8_t interface_id, thread_management_server_data_t *server_data) -{ - return 0; -} - -bool thread_management_server_source_address_check(int8_t interface_id, uint8_t source_address[16]) -{ - return false; -} diff --git a/test/nanostack/unittest/stub/thread_meshcop_lib_stub.c b/test/nanostack/unittest/stub/thread_meshcop_lib_stub.c deleted file mode 100644 index 612b9343173a..000000000000 --- a/test/nanostack/unittest/stub/thread_meshcop_lib_stub.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include "common_functions.h" -#include -#include "thread_meshcop_lib_stub.h" -thread_meshcop_lib_stub_def thread_meshcop_lib_stub; - -uint8_t *thread_meshcop_tlv_data_write(uint8_t *ptr, uint8_t type, uint16_t length, const uint8_t *data) -{ - return NULL; -} - -uint8_t *thread_meshcop_tlv_data_write_header(uint8_t *ptr, uint8_t type, uint16_t length) -{ - return NULL; -} - -uint8_t *thread_meshcop_tlv_data_write_uint8(uint8_t *ptr, uint8_t type, uint8_t data) -{ - return NULL; -} - -uint8_t *thread_meshcop_tlv_data_write_uint16(uint8_t *ptr, uint8_t type, uint16_t data) -{ - return NULL; -} -uint8_t *thread_meshcop_tlv_data_write_uint32(uint8_t *ptr, uint8_t type, uint32_t data) -{ - return NULL; -} -uint8_t *thread_meshcop_tlv_data_write_uint64(uint8_t *ptr, uint8_t type, uint64_t data) -{ - return NULL; -} - -bool thread_meshcop_tlv_exist(const uint8_t *ptr, const uint16_t length, const uint8_t type) -{ - return thread_meshcop_lib_stub.expectedBool; -} -uint16_t thread_meshcop_tlv_list_generate(const uint8_t *ptr, uint16_t length,uint8_t *result_ptr, uint16_t *result_len) -{ - return 0; -} -uint16_t thread_meshcop_tlv_list_remove(uint8_t *tlv_ptr, uint16_t tlv_len, uint8_t tlv_type) -{ - return 0; -} - -bool thread_meshcop_tlv_list_type_available(const uint8_t *list_ptr, uint16_t list_len, uint8_t tlv_type) -{ - return thread_meshcop_lib_stub.expectedBool; -} - -uint16_t thread_meshcop_tlv_find(const uint8_t *ptr, uint16_t length, uint8_t type, uint8_t **result_ptr) -{ - uint8_t *data_ptr; - *data_ptr = thread_meshcop_lib_stub.expectedUnit8ResultValue; - *result_ptr = (uint8_t *) data_ptr; - return thread_meshcop_lib_stub.expectedUint16; - -} - -uint8_t thread_meshcop_tlv_data_get_uint8(const uint8_t *ptr, uint16_t length, uint8_t type, uint8_t *data_ptr) -{ - return thread_meshcop_lib_stub.expectedInt8; -} - -uint8_t thread_meshcop_tlv_data_get_uint16(const uint8_t *ptr, uint16_t length, uint8_t type, uint16_t *data_ptr) -{ - return thread_meshcop_lib_stub.expectedInt8; -} - -uint8_t thread_meshcop_tlv_data_get_uint32(const uint8_t *ptr, uint16_t length, uint8_t type, uint32_t *data_ptr) -{ - return thread_meshcop_lib_stub.expectedInt8; -} -uint8_t thread_meshcop_tlv_data_get_uint64(const uint8_t *ptr, uint16_t length, uint8_t type, uint64_t *data_ptr) -{ - return thread_meshcop_lib_stub.expectedInt8; -} -uint16_t thread_meshcop_tlv_find_next(uint8_t* tlv_ba, uint16_t tlv_ba_length, uint8_t tlv_id, uint8_t** found_tlv) -{ - return 0; -} - diff --git a/test/nanostack/unittest/stub/thread_meshcop_lib_stub.h b/test/nanostack/unittest/stub/thread_meshcop_lib_stub.h deleted file mode 100644 index 2587e8d702ce..000000000000 --- a/test/nanostack/unittest/stub/thread_meshcop_lib_stub.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 __THREAD_MESHCOP_LIB_STUB_H__ -#define __THREAD_MESHCOP_LIB_STUB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "thread_meshcop_lib.h" - -typedef struct { - char* expectedCharPtr; - void* cb; - int8_t expectedInt8; - int16_t expectedInt16; - uint16_t expectedUint16; - bool expectedBool; - uint8_t expectedUnit8ResultValue; -} thread_meshcop_lib_stub_def; - -extern thread_meshcop_lib_stub_def thread_meshcop_lib_stub; - -#ifdef __cplusplus -} -#endif - -#endif // __THREAD_MESHCOP_LIB_STUB_H__ diff --git a/test/nanostack/unittest/stub/thread_mle_message_handler_stub.c b/test/nanostack/unittest/stub/thread_mle_message_handler_stub.c deleted file mode 100644 index c08a5e16e491..000000000000 --- a/test/nanostack/unittest/stub/thread_mle_message_handler_stub.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, 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 "Service_Libs/mle_service/mle_service_api.h" - - -void thread_general_mle_receive_cb(int8_t interface_id, mle_message_t *mle_msg, mle_security_header_t *security_headers) -{ - (void) interface_id; - (void) mle_msg; - (void) security_headers; -} diff --git a/test/nanostack/unittest/stub/thread_nd_stub.c b/test/nanostack/unittest/stub/thread_nd_stub.c deleted file mode 100644 index 8c322d1c9b74..000000000000 --- a/test/nanostack/unittest/stub/thread_nd_stub.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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. - */ - -/* - * \file thread_nd.c - * \brief Add short description about this file!!! - * - */ - -#include "nsconfig.h" -#include -#include -#include -#include "eventOS_event.h" -#include "common_functions.h" -#include "socket_api.h" -#include "Core/include/socket.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "Common_Protocols/ipv6.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "net_thread_test.h" -#include "libDHCPv6/libDHCPv6.h" -#include "randLIB.h" -#include "ns_trace.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "6LoWPAN/Thread/thread_nd.h" -#include "6LoWPAN/Thread/thread_resolution_client.h" -#include "6LoWPAN/Thread/thread_resolution_server.h" -#include "Common_Protocols/icmpv6.h" -#include "MLE/mle.h" -#include "dhcp_service_api.h" - -#define TRACE_GROUP "thdn" - -static thread_resolution_server_addr_query_cb thread_nd_address_query_lookup; - -void thread_nd_service_delete(int8_t interfaceId) -{ -} - -int thread_nd_service_activate(int8_t interfaceId) -{ - return 0; -} - -int thread_nd_client_service_activate(int8_t interfaceId) -{ - return 0; -} - -int thread_nd_service_disable(int8_t interfaceId) -{ - return 0; -} - -bool thread_nd_ns_transmit(protocol_interface_info_entry_t *cur, ipv6_neighbour_t *entry, bool unicast, uint8_t seq) -{ - return false; -} - -void thread_nd_flush_neighbour_cache_for_short_addr(protocol_interface_info_entry_t *cur, uint16_t flushee, bool children) -{ -} - -buffer_t *thread_nd_snoop(protocol_interface_info_entry_t *cur, buffer_t *buf, const sockaddr_t *ll_dst, const sockaddr_t *ll_src, bool *bounce) -{ - return NULL; -} - -buffer_t *thread_nd_special_forwarding(protocol_interface_info_entry_t *cur, buffer_t *buf, const sockaddr_t *ll_src, bool *bounce) -{ - return NULL; -} - -buffer_t *thread_nd_icmp_handler(protocol_interface_info_entry_t *cur, buffer_t *buf, bool *bounce) -{ - return NULL; -} - -int thread_nd_address_registration(protocol_interface_info_entry_t *cur, const uint8_t *ipv6Address, uint16_t mac16, uint16_t panId, const uint8_t *mac64) -{ - return 0; -} - -int thread_nd_map_anycast_address(protocol_interface_info_entry_t *cur, uint16_t *addr16) -{ - return -1; -} - -void thread_nd_address_remove(protocol_interface_info_entry_t *cur_interface, addrtype_t ll_type, const uint8_t *ll_address) -{ - -} diff --git a/test/nanostack/unittest/stub/thread_network_data_lib_stub.c b/test/nanostack/unittest/stub/thread_network_data_lib_stub.c deleted file mode 100644 index d4a8bc2b21c2..000000000000 --- a/test/nanostack/unittest/stub/thread_network_data_lib_stub.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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. - */ -/* - * \file thread_network_data_lib.c - * \brief Add short description about this file!!! - * - */ -#include "nsconfig.h" -#include -#include -#include -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "common_functions.h" -#include "ns_trace.h" - -#define TRACE_GROUP "tndl" - -uint8_t prefixBits_to_bytes(uint8_t prefixLenInBits) -{ - return 0; -} - -int thread_network_data_malformed_check(uint8_t *network_data_ptr, uint16_t network_data_length) -{ - return 0; -} - -int thread_network_data_sub_tlv_malformed_check(uint8_t *network_data_ptr, uint8_t network_data_length) -{ - return 0; -} - - -uint8_t *thread_nd_commission_data_write_steering_data(uint8_t *ptr, const uint8_t *steeringData, uint8_t length) -{ - return NULL; -} - -uint8_t *thread_nd_commission_data_write_commissioning_credentials(uint8_t *ptr, char *crendentials, uint8_t length) -{ - return NULL; -} - -uint8_t *thread_nd_network_data_border_router_tlv_write(uint8_t *ptr, uint16_t routerId, uint16_t flags) -{ - return NULL; -} - -uint8_t *thread_nd_network_data_has_route_tlv_write(uint8_t *ptr, uint16_t routerId, uint8_t prf) -{ - return NULL; -} diff --git a/test/nanostack/unittest/stub/thread_network_data_storage_stub.c b/test/nanostack/unittest/stub/thread_network_data_storage_stub.c deleted file mode 100644 index 30e878ce2aba..000000000000 --- a/test/nanostack/unittest/stub/thread_network_data_storage_stub.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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. - */ - -/* - * \file thread_network_data_storage.c - * \brief Add short description about this file!!! - * - */ -#include "nsconfig.h" -#include -#include -#include -#include "NWK_INTERFACE/Include/protocol.h" -#include "common_functions.h" -#include "ns_trace.h" -#include "ip6string.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "6LoWPAN/Thread/thread_network_data_storage.h" -#include "6LoWPAN/Thread/thread_dhcpv6_client.h" -#include "libDHCPv6/libDHCPv6_server.h" -#include "DHCPv6_Server/DHCPv6_server_service.h" - -#define TRACE_GROUP "thrd" - -void thread_nd_network_data_print(thread_network_data_cache_entry_t *networkData, uint16_t routerId) -{ -} - -uint8_t thread_nd_server_external_route_list_size(thread_network_server_data_list_t *list, bool stable) -{ - return 0; -} - -uint8_t thread_nd_border_routerserver_list_size(thread_network_server_data_list_t *list, bool stable) -{ - return 0; -} - -uint8_t thread_nd_context_list_size(thread_data_context_list_t *list, bool stable) -{ - return 0; -} - -uint8_t *thread_nd_context_list_write(thread_data_context_list_t *list, uint8_t *dataPtr, bool stableData) -{ - return NULL; -} - -uint8_t *thread_nd_server_list_write(thread_network_server_data_list_t *list, uint8_t *dataPtr, uint8_t type, bool stable) -{ - return NULL; -} - -uint8_t thread_nd_prefix_based_on_list_entry_size(thread_network_data_prefix_cache_entry_t *entry, bool fullList) -{ - return 0; -} - -int thread_nd_local_data_length_updated(thread_network_data_cache_entry_t *networkDataList) -{ - return 0; -} - - -thread_network_local_data_entry_t *thread_local_service_list_allocate(thread_prefix_tlv_t *prefixTlv) -{ - return NULL; -} - -thread_network_data_prefix_cache_entry_t *thread_prefix_service_list_allocate(thread_prefix_tlv_t *prefixTlv) -{ - return NULL; -} - -thread_network_server_data_entry_t *thread_server_list_allocate(thread_border_router_tlv_entry_t *service) -{ - return NULL; -} - -thread_network_data_context_entry_t *thread_context_service_list_allocate(uint8_t contextLength, uint8_t cid, bool compersioEnabled) -{ - return NULL; -} - -int thread_nd_verify_contex_id_is_free(thread_network_data_cache_entry_t *list, uint8_t *prefixPtr, thread_network_local_data_context_entry_t *context) -{ - return 0; -} - -thread_network_local_data_entry_t *thread_get_local_prefix_entry(thread_network_data_prefix_list_t *list, thread_prefix_tlv_t *prefixTlv) -{ - return NULL; -} - -thread_network_local_data_entry_t *thread_get_local_prefix_list(thread_network_data_prefix_list_t *list, thread_prefix_tlv_t *prefixTlv) -{ - return NULL; -} - -thread_network_data_prefix_cache_entry_t *thread_get_main_prefix_entry(thread_network_prefix_list_t *list, thread_prefix_tlv_t *prefixTlv) -{ - return NULL; -} - -thread_network_data_prefix_cache_entry_t *thread_get_main_prefix_list(thread_network_prefix_list_t *list, thread_prefix_tlv_t *prefixTlv) -{ - return NULL; -} - -thread_network_server_data_entry_t *thread_search_server_list(thread_network_server_data_list_t *list, uint8_t routerId) -{ - return NULL; -} - -thread_network_server_data_entry_t *thread_get_server_list(thread_network_server_data_list_t *list, thread_border_router_tlv_entry_t *service) -{ - return NULL; -} - - -uint8_t thread_get_context_id_by_length(thread_data_context_list_t *list, uint8_t contextLength) -{ - return 0; -} - -thread_network_data_context_entry_t *thread_get_context_by_id(thread_data_context_list_t *list, uint8_t cid) -{ - return NULL; -} - -thread_network_data_context_entry_t *thread_get_main_context_list(thread_data_context_list_t *list, thread_network_local_data_context_entry_t *context) -{ - return NULL; -} - -void thread_server_list_free(thread_network_server_data_list_t *listPtr) -{ -} - -int thread_server_context_delete_mark(thread_data_context_list_t *listPtr) -{ - return 0; -} - -int thread_server_data_delete_mark_by_router_id(thread_network_server_data_list_t *listPtr, uint16_t routerID, bool subSet) -{ - return 0; -} - -int thread_server_context_clean(thread_network_data_cache_entry_t *cachePtr, thread_data_context_list_t *listPtr, thread_network_data_prefix_cache_entry_t *prefixEntry) -{ - return 0; -} - - -bool thread_server_data_clean_by_router_id(thread_network_data_cache_entry_t *cachePtr, thread_network_server_data_list_t *listPtr, thread_network_data_prefix_cache_entry_t *prefixEntry, bool routeInfo, protocol_interface_info_entry_t *curInterface) -{ - return false; -} - -void thread_context_service_list_free(thread_data_context_list_t *listPtr) -{ -} -void thread_network_data_base_init(thread_network_data_cache_entry_t *cachePtr) -{ -} - -void thread_network_local_server_data_base_init(thread_network_local_data_cache_entry_t *cachePtr) -{ -} - -void thread_network_data_router_id_mark_delete(thread_network_data_cache_entry_t *cachePtr, uint16_t routerID, bool subSet) -{ -} - -bool thread_network_data_router_id_free(thread_network_data_cache_entry_t *cachePtr, bool subSet, protocol_interface_info_entry_t *curInterface) -{ - return false; -} - -void thread_network_data_context_re_use_timer_update(thread_network_data_cache_entry_t *cachePtr, uint32_t ticks, lowpan_context_list_t *context_list) -{ - -} - -void thread_network_data_free_and_clean(thread_network_data_cache_entry_t *cachePtr) -{ -} - -void thread_network_local_data_free_and_clean(thread_network_local_data_cache_entry_t *cachePtr, int8_t interface_id) -{ -} - -int thread_nd_local_list_add_route(thread_network_data_cache_entry_t *networkDataList, thread_prefix_tlv_t *prefixTlv, thread_border_router_tlv_entry_t *route) -{ - return 0; -} - -int thread_nd_local_list_add_on_mesh_prefix(thread_network_data_cache_entry_t *networkDataList, thread_prefix_tlv_t *prefixTlv, thread_border_router_tlv_entry_t *service) -{ - return 0; -} - -int thread_nd_local_list_del_on_mesh_server(thread_network_data_cache_entry_t *networkDataList, thread_prefix_tlv_t *prefixTlv, thread_border_router_tlv_entry_t *service) -{ - return 0; -} - -int thread_local_server_list_add_on_mesh_server(thread_network_local_data_cache_entry_t *networkDataList, thread_prefix_tlv_t *prefixTlv, thread_border_router_tlv_entry_t *service) -{ - return 0; -} - -int thread_local_server_list_del_on_mesh_server(thread_network_local_data_cache_entry_t *networkDataList, thread_prefix_tlv_t *prefixTlv) -{ - return 0; -} - -int thread_local_server_add_route(thread_network_local_data_cache_entry_t *networkDataList, thread_prefix_tlv_t *prefixTlv, thread_border_router_tlv_entry_t *route) -{ - return 0; -} - -int thread_local_server_del_route(thread_network_local_data_cache_entry_t *networkDataList, thread_prefix_tlv_t *prefixTlv) -{ - return 0; -} - -uint8_t thread_nd_context_id_allocate(thread_network_data_cache_entry_t *networkDataList, thread_network_local_data_cache_entry_t *localDataList, uint8_t *prefixPtr, uint8_t prefixLength) -{ - return 0; -} - -int thread_nd_local_list_add_contexts(thread_network_data_cache_entry_t *networkDataList, thread_prefix_tlv_t *prefixTlv, thread_network_local_data_context_entry_t *context) -{ - return 0; -} - -uint8_t thread_server_prefix_length(thread_network_local_data_entry_t *cur) -{ - return 0; -} - -uint16_t thread_nd_own_service_list_data_size(thread_network_local_data_cache_entry_t *serverDataList) -{ - return 0; -} - -uint8_t * thread_nd_own_service_list_data_write(thread_network_local_data_cache_entry_t *serverDataList, uint8_t *ptr, uint16_t routerID) -{ - return NULL; -} - -uint16_t thread_nd_data_size(thread_network_data_cache_entry_t *networkDataList, bool fullList) -{ - return 0; -} - -int thread_nd_commission_data_len_update(thread_network_data_cache_entry_t *networkDataList, link_configuration_s *linkConfiguration, thread_commissioner_t *registered_commissioner) -{ - return 0; -} - -uint8_t thread_nd_commission_data_length_size(link_configuration_s *linkConfiguration, thread_commissioner_t *registered_commissioner) -{ - return 0; -} - -uint8_t *thread_nd_commission_data_write(uint8_t *ptr, link_configuration_s *linkConfiguration, thread_commissioner_t *registered_commissioner) -{ - return NULL; -} - -bool thread_check_network_data_prefix_stable_boolean(thread_network_data_prefix_cache_entry_t *dataList) -{ - return false; -} - -uint8_t *thread_nd_generate_from_local_data_list(thread_network_data_cache_entry_t *networkDataList, link_configuration_s *linkConfiguration, thread_commissioner_t *registered_commissioner, uint8_t *ptr, bool fullList) -{ - return NULL; -} - -uint8_t *thread_nd_generate_from_local_data_list_to_sleepy_child(thread_network_data_cache_entry_t *networkDataList, struct link_configuration *linkConfiguration, struct thread_commissioner *registered_commissioner, uint8_t *ptr, bool fullList) -{ - return NULL; -} - -uint16_t thread_network_data_prefix_set_size(thread_network_data_cache_entry_t *networkDataList, bool fullList) -{ - return 0; -} -thread_network_data_service_cache_entry_t *thread_network_data_service_entry_find(thread_network_data_service_cache_list_t *list, thread_network_data_service_entry_t *service) -{ - return NULL; -} -uint16_t thread_network_data_service_set_size(thread_network_data_cache_entry_t *networkDataList, bool fullList) -{ - return 0; -} -uint8_t *thread_network_data_prefix_set_write(thread_network_data_cache_entry_t *networkDataList, uint8_t *ptr) -{ - return NULL; -} -uint8_t *thread_network_data_service_set_write(thread_network_data_cache_entry_t *networkDataList, uint8_t *ptr) -{ - return NULL; -} -bool thread_network_data_service_hosted_by_this_router_id(thread_network_data_service_cache_entry_t *dataList, uint16_t router_id) -{ - return false; -} -bool thread_nd_on_mesh_address_valid(thread_network_server_data_entry_t *curRoute) -{ - return true; -} - -thread_network_server_data_entry_t *thread_nd_hosted_by_this_routerid(uint16_t routerId, thread_network_server_data_list_t *list) -{ - return NULL; -} -bool thread_network_data_services_registered(thread_network_data_cache_entry_t *cachePtr, uint16_t routerID) -{ - return true; -} - -uint16_t thread_network_data_service_child_id_from_networkdata_get(thread_network_data_cache_entry_t *networkDataList, uint16_t router_short_addr) -{ - return 0; -} -int thread_nd_local_list_add_service(thread_network_data_cache_entry_t *networkDataList, thread_network_data_service_entry_t *service, thread_network_data_service_server_entry_t *server) -{ - return 0; -} - diff --git a/test/nanostack/unittest/stub/thread_network_synch_stub.c b/test/nanostack/unittest/stub/thread_network_synch_stub.c deleted file mode 100644 index c6b82cadc734..000000000000 --- a/test/nanostack/unittest/stub/thread_network_synch_stub.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include "thread_management_if.h" -#include "mle.h" -#include -#include "NWK_INTERFACE/Include/protocol.h" - -int thread_network_synch_start(int8_t interface_id) -{ - return 0; -} - -int thread_network_synch_data_free(int8_t interface_id) -{ - return 0; -} - -uint16_t thread_network_synch_get_strored_mac16(int8_t interface_id) -{ - return 0; -} - -uint32_t thread_dynamic_storage_mle_frame_counter_get(int8_t interfaceId) -{ - return 0; -} -void thread_dynamic_storage_frame_counter_store(int8_t interface_id, uint32_t mle_frame_counter, uint32_t mac_frame_counter) -{ -} -uint32_t thread_dynamic_storage_mac_frame_counter_get(int8_t interfaceId) -{ - return 0; -} - -void thread_dynamic_storage_pending_configuration_store(int8_t interface_id, link_configuration_s *pendingConfiguration, uint64_t pending_timestamp) -{ - return; -} -link_configuration_s *thread_network_synch_get_stored_pending_set(int8_t interface_id, uint64_t *pending_timestamp) -{ - return NULL; -} - -void thread_dynamic_storage_child_info_store(int8_t interface_id, mle_neigh_table_entry_t *child) -{ -} - -void thread_dynamic_storage_child_info_clear(int8_t interface_id, mle_neigh_table_entry_t *child) -{ -} - -void thread_dynamic_storage_build_mle_table(int8_t interface_id) -{ -} - -void thread_dynamic_storage_network_seq_counter_store(int8_t interface_id, uint32_t network_seq_counter) -{ - return; -} - -uint32_t thread_dynamic_storage_network_seq_counter_get(int8_t interfaceId) -{ - return 0; -} -void thread_nvm_store_link_info_file_read() -{ -} -bool thread_nvm_store_link_info_get(uint8_t *parent_mac64, uint16_t *my_short_address) -{ -} - -void thread_nvm_store_link_info_clear() -{ -} - -void thread_nvm_store_link_info_file_write(protocol_interface_info_entry_t *cur) -{ -} diff --git a/test/nanostack/unittest/stub/thread_nvm_store_stub.c b/test/nanostack/unittest/stub/thread_nvm_store_stub.c deleted file mode 100644 index a8c3bdc98284..000000000000 --- a/test/nanostack/unittest/stub/thread_nvm_store_stub.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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. - */ -/* - * \file thread_nvm_store.c - * - */ - -#include "thread_nvm_store.h" -#include "ns_trace.h" -#include -#include -#include "ns_file_system.h" -#include "thread_config.h" - -static const char* thread_nvm_store_get_root_path(void) -{ - return ""; -} - -int thread_nvm_store_init(void) -{ - - return 0; -} - - -int thread_nvm_store_fast_data_read(thread_nvm_fast_data_t* fast_data) -{ - return THREAD_NVM_FILE_SUCCESS; -} - -int thread_nvm_store_fast_data_store(thread_nvm_fast_data_t* fast_data) -{ - return THREAD_NVM_FILE_SUCCESS; -} - -int thread_nvm_store_seq_counter_store(uint32_t network_seq_counter) -{ - return THREAD_NVM_FILE_SUCCESS; -} - -int thread_nvm_store_frame_counters_store(uint32_t mac_frame_counter, uint32_t mle_frame_counter) -{ - return THREAD_NVM_FILE_SUCCESS; -} - -int thread_nvm_store_fast_data_check_and_store(uint32_t mac_frame_counter, uint32_t mle_frame_counter, uint32_t network_seq_counter) -{ - return THREAD_NVM_FILE_SUCCESS; -} diff --git a/test/nanostack/unittest/stub/thread_resolution_client_stub.c b/test/nanostack/unittest/stub/thread_resolution_client_stub.c deleted file mode 100644 index e7797a6da44d..000000000000 --- a/test/nanostack/unittest/stub/thread_resolution_client_stub.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" -#include "thread_tmfcop_lib.h" - -#include "coap_service_api.h" - -#include "thread_config.h" -#include "thread_resolution_client.h" - -/** - * Public Api functions - */ -void thread_resolution_client_init(int8_t interface_id) -{ -} - -void thread_resolution_client_delete(int8_t interface_id) -{ -} - -void thread_resolution_client_set_notification_cb(int8_t interface_id, thread_resolution_client_notification_cb notification_cb) -{ -} - -void thread_resolution_client_set_error_cb(int8_t interface_id, thread_resolution_client_error_cb error_cb) -{ -} - -int thread_resolution_client_address_error(int8_t interface_id, const uint8_t dest_ip_addr[16], const uint8_t target_ip_addr[16], const uint8_t ml_eid[8]) -{ - return 0; -} - -int thread_resolution_client_resolve(int8_t interface_id, uint8_t ip_addr[16], thread_resolution_client_response_cb *resp_cb) -{ - return 0; -} - -void thread_resolution_client_timer(int8_t interface_id, uint16_t seconds) -{ -} - diff --git a/test/nanostack/unittest/stub/thread_router_bootstrap_stub.c b/test/nanostack/unittest/stub/thread_router_bootstrap_stub.c deleted file mode 100644 index 04239cf5d44e..000000000000 --- a/test/nanostack/unittest/stub/thread_router_bootstrap_stub.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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. - */ - -/* - * \file thread_router_bootstrap.c - * \brief Add short description about this file!!! - * - */ -#include "nsconfig.h" -#include -#include -#include -#include -#include "eventOS_event.h" -#include "eventOS_event_timer.h" -#include "randLIB.h" -#include "shalib.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "net_thread_test.h" -#include "ns_trace.h" -#include "6LoWPAN/Bootstraps/protocol_6lowpan.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_routing.h" -#include "6LoWPAN/Thread/thread_nd.h" -#include "6LoWPAN/Thread/thread_bootstrap.h" -#include "6LoWPAN/Thread/thread_router_bootstrap.h" -#include "6LoWPAN/Thread/thread_host_bootstrap.h" -#include "6LoWPAN/Thread/thread_management_internal.h" -#include "6LoWPAN/Thread/thread_network_synch.h" -#include "6LoWPAN/Thread/thread_discovery.h" -#include "6LoWPAN/Thread/thread_joiner_application.h" -#include "6LoWPAN/Thread/thread_address_registration_client.h" -#include "6LoWPAN/Thread/thread_management_client.h" -#include "6LoWPAN/Thread/thread_management_server.h" -#include "6LoWPAN/Thread/thread_extension.h" -#include "6LoWPAN/Thread/thread_leader_service.h" -#include "6LoWPAN/Thread/thread_beacon.h" -#include "6LoWPAN/Thread/thread_network_data_lib.h" -#include "6LoWPAN/Thread/thread_lowpower_private_api.h" -#include "6LoWPAN/Thread/thread_tmfcop_lib.h" -#include "thread_management_if.h" -#include "Common_Protocols/ipv6.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/icmpv6_radv.h" -#include "MLE/mle.h" -#include "MLE/mle_tlv.h" -#include "thread_config.h" -#include "multicast_api.h" -#include "Service_Libs/nd_proxy/nd_proxy.h" -#include "Service_Libs/mle_service/mle_service_api.h" -#include "Service_Libs/blacklist/blacklist.h" -#include "thread_dhcpv6_client.h" -#include "6LoWPAN/MAC/mac_helper.h" -#include "mac_api.h" -#include "6LoWPAN/MAC/mac_data_poll.h" -#include "thread_border_router_api.h" -#include "Core/include/address.h" - -int thread_router_bootstrap_mle_advertise(protocol_interface_info_entry_t *cur) -{ -} - -void thread_router_bootstrap_multicast_forwarder_enable(protocol_interface_info_entry_t *cur, buffer_t *buf) -{ -} - -void thread_router_bootstrap_child_information_clear(protocol_interface_info_entry_t *cur) -{ -} -void thread_router_bootstrap_router_id_request(protocol_interface_info_entry_t *cur, uint8_t status) -{ -} -uint16_t thread_router_bootstrap_child_count_get(protocol_interface_info_entry_t *cur) -{ -} -void thread_router_bootstrap_child_id_handler(protocol_interface_info_entry_t *cur) -{ -} - -void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *mle_msg, mle_security_header_t *security_headers) -{ -} - -int thread_router_bootstrap_link_synch_start(protocol_interface_info_entry_t *cur) -{ -} - -bool thread_router_bootstrap_router_downgrade(protocol_interface_info_entry_t *cur) -{ - return true; -} - -bool thread_router_bootstrap_reed_upgrade(protocol_interface_info_entry_t *cur) -{ - return true; -} - -void thread_router_bootstrap_child_id_reject(protocol_interface_info_entry_t *cur) -{ -} - -void thread_router_bootstrap_active_router_attach(protocol_interface_info_entry_t *cur) -{ -} - -void thread_router_bootstrap_routing_activate(protocol_interface_info_entry_t *cur) -{ -} -int thread_router_bootstrap_route_tlv_push(protocol_interface_info_entry_t *cur, uint8_t *route_tlv, uint8_t route_len, uint8_t linkMargin, mle_neigh_table_entry_t *entry) -{ -} - -void thread_router_bootstrap_reed_advertisements_start(protocol_interface_info_entry_t *cur) -{ -} - -void thread_router_bootstrap_router_id_release(protocol_interface_info_entry_t *cur) -{ -} - -void thread_router_bootstrap_timer(protocol_interface_info_entry_t *cur, uint32_t ticks) -{ -} - -void thread_router_bootstrap_advertiment_analyze(protocol_interface_info_entry_t *cur, uint8_t *src_address, mle_neigh_table_entry_t *entry_temp, uint16_t shortAddress) -{ -} -void thread_router_bootstrap_anycast_address_register(protocol_interface_info_entry_t *cur) -{ -} - -bool thread_router_bootstrap_routing_allowed(struct protocol_interface_info_entry *cur) -{ - return true; -} -void thread_router_bootstrap_network_data_distribute(protocol_interface_info_entry_t *cur) -{ -} -void thread_router_bootstrap_address_change_notify_send(protocol_interface_info_entry_t *cur) -{ -} - diff --git a/test/nanostack/unittest/stub/thread_routing_stub.c b/test/nanostack/unittest/stub/thread_routing_stub.c deleted file mode 100644 index 854de9c79b1a..000000000000 --- a/test/nanostack/unittest/stub/thread_routing_stub.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include -#include -#include -#include - -#ifndef UINT_FAST4_MAX -typedef uint_fast8_t uint_fast4_t; -#define UINT_FAST4_MAX UINT_FAST8_MAX -#endif - -#define THREAD_ROUTING_FN extern - -#include -#include "ns_trace.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "MLE/mle.h" -#include "6LoWPAN/Mesh/mesh.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_nd.h" -#include "6LoWPAN/Thread/thread_routing.h" - -#define TRACE_GROUP "trou" - -/* MLE Route Data bit assignments (draft-kelsey-thread-routing-00) */ -#define ROUTE_DATA_OUT_MASK 0xC0 -#define ROUTE_DATA_OUT_SHIFT 6 -#define ROUTE_DATA_IN_MASK 0x30 -#define ROUTE_DATA_IN_SHIFT 4 -#define ROUTE_DATA_COST_MASK 0x0F - -#define MAX_ROUTE_COST 0x0F - -typedef uint_fast4_t thread_route_cost_t; -#define THREAD_COST_INFINITE 0 - -#define MAX_LINK_AGE 100*10 /* 100 seconds */ - -#define LINK_AGE_STATIC 0xFFFF /* Magic number to indicate "never expire" */ - - -bool router_id_sequence_is_greater(const thread_routing_info_t *routing, uint8_t seq) -{ - return false; -} - -#define LINK_QUALITY_HYSTERESIS (1 << THREAD_LINK_MARGIN_SCALING) /* 1dB */ - -bool thread_i_am_router(const protocol_interface_info_entry_t *cur) -{ - return false; -} - -void thread_routing_update_id_set(protocol_interface_info_entry_t *cur, uint8_t seq, const uint8_t *id_mask) -{ -} - -int_fast8_t thread_routing_update_link_margin(protocol_interface_info_entry_t *cur, - uint16_t sender, - uint8_t link_margin_db, - uint8_t outgoing_link_margin_db) -{ - return 0; -} - -int_fast8_t thread_routing_force_link_margin(protocol_interface_info_entry_t *cur, - uint16_t addr, - uint8_t link_margin_db) -{ - return 0; -} - -int_fast8_t thread_routing_add_link(protocol_interface_info_entry_t *cur, - uint16_t sender, uint8_t link_margin_db, - uint8_t id_seq, - const uint8_t *id_mask, - const uint8_t *route_data, - bool is_static) -{ - return 0; -} - -int_fast8_t thread_routing_remove_link(protocol_interface_info_entry_t *cur, - uint16_t sender) -{ - return 0; -} - -uint8_t thread_routing_get_route_data_size(protocol_interface_info_entry_t *cur) -{ - return 0; -} - -uint_fast8_t thread_routing_cost_get_by_router_id(thread_routing_info_t *routing , uint8_t routerId) -{ - return 0; -} - -int_fast8_t thread_routing_get_route_data(protocol_interface_info_entry_t *cur, - uint8_t *id_seq, - uint8_t *id_mask, - uint8_t *data, - uint8_t *len_out) -{ - return 0; -} - -void thread_routing_init(thread_routing_info_t *routing) -{ -} - -void thread_routing_free(thread_routing_info_t *routing) -{ -} - -void thread_routing_activate(thread_routing_info_t *routing) -{ -} - -void thread_routing_deactivate(thread_routing_info_t *routing) -{ -} - -/* ticks is in 100ms units, I think */ -/* Return true if we want to send an MLE advertisement */ -bool thread_routing_timer(thread_info_t *thread, uint8_t ticks) -{ - return false; -} - -void thread_routing_leader_connection_validate(struct thread_info_s *thread, uint16_t disconnect_period) -{ -} - -void thread_routing_set_mesh_callbacks(protocol_interface_info_entry_t *cur) -{ -} - -uint_fast8_t thread_routing_count_neighbours_with_quality_or_better(thread_routing_info_t *routing, thread_link_quality_e quality) -{ - return 0; -} - -uint_fast8_t thread_routing_count_active_routers(thread_routing_info_t *routing) -{ - return 0; -} - -uint_fast8_t thread_routing_count_active_routers_from_mask(const uint8_t *id_mask) -{ - return 0; -} - -void thread_routing_reset(thread_routing_info_t *routing) -{ - -} diff --git a/test/nanostack/unittest/stub/thread_test_api_stub.c b/test/nanostack/unittest/stub/thread_test_api_stub.c deleted file mode 100644 index ddc90822d0a3..000000000000 --- a/test/nanostack/unittest/stub/thread_test_api_stub.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2014-2017, 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 "nsconfig.h" -#include -#include -#include -#include - -#include "ns_trace.h" -#include "common_functions.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "6LoWPAN/Thread/thread_routing.h" - -#define TRACE_GROUP "tapi" - -int_fast8_t arm_nwk_6lowpan_thread_test_router_id_push( - int8_t interface_id, - const uint8_t *euid64, - uint8_t router_id) -{ - return 0; -} - -int_fast8_t arm_nwk_6lowpan_thread_test_add_neighbour( - int8_t interface_id, - uint16_t neighbour_short_addr, - uint_fast8_t link_margin_db, - uint8_t id_sequence, - const uint8_t *id_mask, - const uint8_t *route_data) -{ - return 0; -} - -int_fast8_t arm_nwk_6lowpan_thread_test_remove_neighbour( - int8_t interface_id, - uint16_t neighbour_short_addr) -{ - return 0; - -} - -int_fast8_t arm_nwk_6lowpan_thread_test_set_addr_filter( - int8_t interface_id, - uint8_t num_short_addrs, - const uint16_t valid_short_addrs[num_short_addrs], - uint8_t num_long_addrs, - const uint8_t valid_long_addrs[num_long_addrs][8]) -{ - return 0; -} - -int_fast8_t arm_nwk_6lowpan_thread_adjust_link_margins( - int8_t interface_id, - int8_t adjustment) -{ - return 0; -} - -void arm_nwk_6lowpan_thread_test_print_routing_database(int8_t interface_id) -{ -} - -int8_t arm_nwk_key_update_trig(int8_t interface_id) -{ - return 0; -} diff --git a/test/nanostack/unittest/stub/timeout_stub.c b/test/nanostack/unittest/stub/timeout_stub.c deleted file mode 100644 index 8cc701683e03..000000000000 --- a/test/nanostack/unittest/stub/timeout_stub.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#include "ns_types.h" -#include "eventOS_event_timer.h" - -timeout_t *eventOS_timeout_ms(void (*callback)(void *), uint32_t ms, void *arg) -{ - return NULL; -} - -void eventOS_timeout_cancel(timeout_t *t) -{ - -} diff --git a/test/nanostack/unittest/stub/tls_ccm_crypt_stub.c b/test/nanostack/unittest/stub/tls_ccm_crypt_stub.c deleted file mode 100644 index 428387fd0d4b..000000000000 --- a/test/nanostack/unittest/stub/tls_ccm_crypt_stub.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017, 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 "nsconfig.h" -#include "ns_types.h" -#ifdef PANA -#include "string.h" -#include "ccmLIB.h" -#include "ns_trace.h" -#include "common_functions.h" - -#define CLIENT_WRITE_KEY 0 -#define SERVER_WRITE_KEY 16 -#define CLIENT_IV 32 -#define SERVER_IV 36 - -#define TLS_1_2_VER 0x0303 - -int8_t tls_ccm_data_encrypt(uint8_t *data_ptr, uint16_t data_length,const uint8_t *key_expansion, const uint8_t *nonce, uint8_t type, bool server) -{ - return 0; -} - -int8_t tls_ccm_data_decrypt(uint8_t *data_ptr, uint16_t data_length, const uint8_t *key_expansion, uint8_t type, bool server) -{ - return 0; -} -#endif diff --git a/test/nanostack/unittest/stub/tls_lib_stub.c b/test/nanostack/unittest/stub/tls_lib_stub.c deleted file mode 100644 index 5c39b5ffb0c9..000000000000 --- a/test/nanostack/unittest/stub/tls_lib_stub.c +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include "ns_types.h" -#ifdef PANA -#include "string.h" -#include "ccmLIB.h" -#include "Core/include/address.h" -#include "Core/include/ns_buffer.h" -#ifdef ECC -#include "libX509_V3.h" -#include "ecc.h" -#endif -#include "randLIB.h" -#include "Core/include/socket.h" -//#include "6LoWPAN/Bootstraps/network_lib.h" -#include "shalib.h" -#include "Security/TLS/tls_lib.h" -#include "Security/Common/sec_lib.h" -#include "nsdynmemLIB.h" -#include "net_nvm_api.h" -#include "Security/PANA/pana.h" -#include "Security/PANA/pana_internal_api.h" -#include "ns_trace.h" -#include "common_functions.h" -#include "net_interface.h" - -#define TLS_1_2_VERSION 0x0303 -#define ECC_CHIPHERSUITE 0xc0c6 -#define PSK_CHIPHERSUITE 0xc0a8 - -const uint8_t SERVER_FIN_STRING[15] = {'s', 'e', 'r', 'v', 'e', 'r', ' ', 'f', 'i', 'n', 'i', 's', 'h', 'e', 'd'}; -const uint8_t CLIENT_FIN_STRING[15] = {'c', 'l', 'i', 'e', 'n', 't', ' ', 'f', 'i', 'n', 'i', 's', 'h', 'e', 'd'}; -const uint8_t KEY_EXT_STRING[13] = {'k', 'e', 'y', ' ', 'e', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n'}; -const uint8_t MASTER_SEC_STRING[13] = {'m', 'a', 's', 't', 'e', 'r', ' ', 's', 'e', 'c', 'r', 'e', 't'}; - -typedef struct tls_psk_key_ { - uint16_t key_id; - uint8_t psk_key[16]; - ns_list_link_t link; -} tls_psk_key_t; - -static NS_LIST_DEFINE(tls_psk_list, tls_psk_key_t, link); - -NS_LARGE tls_header_t tls_header; -NS_LARGE tls_msg_t tls_msg; -NS_LARGE uint8_t tls_auth_data_general[13]; - -#ifdef ECC - -tls_ecc_heap_t *ecc_allocate_ram(void); -void tls_ecc_reverse_hash(uint8_t *ptr); -uint8_t tls_write_signature_parameters(uint8_t *ptr, uint8_t *signature_parameter, uint8_t leadin_zeros); -uint8_t tls_parse_certificate_request(uint8_t *ptr, uint16_t len); -uint8_t tls_parse_client_key_exchange(uint8_t *ptr, uint16_t len); - -#endif - -tls_session_t *amr_tls_session_allocate(void) -{ - return NULL; -} - -void arm_tls_session_clear(tls_session_t *t_session) -{ -} - -int8_t arm_tls_add_psk_key(const uint8_t *key_ptr, uint16_t key_id) -{ - return 0; -} - -int8_t arm_tls_check_key(uint16_t key_id) -{ - return 0; -} - -int8_t arm_tls_remove_psk_key(uint16_t key_id) -{ - return 0; -} - -void tls_finnish_copy(uint8_t *ptr, tls_heap_t *heap_ptr) -{ -} - - -void tls_alert_build(buffer_t *buf, uint8_t alert) -{ -} - -#ifdef PANA_SERVER_API -void tls_server_hello_build(buffer_t *buf, sec_suite_t *tls_suite) -{ -} -#endif - -void tls_prepare_change_chipher_spec(sec_suite_t *tls_suite) -{ -} - -#ifdef ECC - -void tls_parse_subject_get_pub_key_from_chain(tls_heap_t *theap, uint8_t rd_ptr) -{ - -} - -uint8_t tls_parse_client_key_exchange(uint8_t *ptr, uint16_t len) -{ - return 0; -} - -void tls_read_certi_signature(tls_heap_t *theap, uint8_t certificate) -{ -} - -tls_ecc_heap_t *ecc_allocate_ram(void) -{ - return NULL; -} - -uint8_t *tls_client_key_exchange_msg_set(uint8_t *ptr , tls_heap_t *heap_ptr) -{ - return NULL; -} -#endif - -uint8_t *tls_build_change_chipher_suite_finnish_msg(uint8_t *ptr, tls_session_t *tls_session) -{ - return NULL; -} - -void tls_build_client_change_chipher_suite_finnish(buffer_t *buf, sec_suite_t *tls_suite) -{ -} - -#ifdef ECC -void tls_ecc_verfify_start(sec_suite_t *tls_suite) -{ -} - - -void tls_certificate_signature_verify(sec_suite_t *tls_suite) -{ -} - -void tls_server_finnish_handle_start(sec_suite_t *tls_suite) -{ -} -#endif - -#ifdef ECC -extern void sec_ecc_state_free(sec_suite_t *suite); -#endif - -buffer_t *tls_client_up(buffer_t *buf, sec_suite_t *tls_suite) -{ - return NULL; -} - -buffer_t *tls_server_up(buffer_t *buf, sec_suite_t *tls_suite) -{ - return NULL; -} - -buffer_t * tls_client_hello_build(buffer_t *buf, sec_suite_t *tls_suite) -{ - return buf; -} -#ifdef ECC - -uint8_t *tls_server_key_excahnge_msg_build(uint8_t *ptr , tls_heap_t *heap_ptr) -{ - return NULL; -} - - -uint8_t *tls_certificate_verify_msg_set(uint8_t *ptr, tls_heap_t *heap_ptr) -{ - return NULL; -} - -uint16_t tls_certificate_len(certificate_chain_internal_t *temp) -{ - return 0; -} - -uint8_t *tls_certificate_msg_set(uint8_t *ptr, certificate_chain_internal_t *temp) -{ - return NULL; -} - -uint8_t tls_write_signature_parameters(uint8_t *ptr, uint8_t *signature_parameter, uint8_t leadin_zeros) -{ - return 0; -} - -void tls_ecc_point_reverse_order(uint8_t *dst, uint8_t *src) -{ -} -#endif - -uint8_t *tls_build_server_hello_msg(uint8_t *ptr, tls_session_t *tls_session) -{ - return NULL; -} - -void tls_header_set(buffer_t *buf) -{ -} - -void tls_session_id_genrate(uint8_t *suite, uint8_t length) -{ -} - -tls_heap_t *tls_heap_allocate(void) -{ - return NULL; -} - -void tls_heap_free(tls_heap_t *heap_ptr) -{ -} -#ifdef ECC -void tls_ecc_heap_free(tls_heap_t *heap_ptr) -{ -} -#endif - -#ifdef ECC -uint8_t tls_get_leading_zeros(void *data) -{ - return 0; -} -#endif - - -void tls_key_expansion_cal(tls_heap_t *heap_ptr, uint8_t *key_save_ptr, uint8_t *master_secret) -{ -} - -void tls_master_key_cal(tls_heap_t *heap_ptr, sec_suite_t *tls_suite) -{ -} - -void tls_verify_calc(uint8_t output[12], uint8_t server, tls_heap_t *heap_ptr, uint8_t *master_secret) -{ -} - -void tls_handshake_copy(tls_msg_t *tls_msg_ptr, tls_heap_t *heap_ptr) -{ -} - -void tls_hanshake_hash_cal(tls_heap_t *heap_ptr) -{ -} - -uint8_t tls_msg_analyzy(uint8_t *ptr, uint16_t data_len) -{ - return 0; -} - -tls_msg_t *tls_msg_get(uint8_t *dptr) -{ - return NULL; -} - -tls_msg_t *tls_msg_ptr_get(void) -{ - return NULL; -} - -void tls_build_client_verify_payload(tls_heap_t *tls_heap) -{ -} - -void tls_nonce_update(uint8_t *ptr) -{ -} -#ifdef ECC -uint8_t tls_parse_certificate_request(uint8_t *ptr, uint16_t len) -{ - return 0; -} - - -void tls_ecc_reverse_hash(uint8_t *ptr) -{ -} - -void tls_ecc_server_key_signature_hash(tls_heap_t *heap_ptr) -{ -} - -#endif - - -#else -int8_t arm_tls_add_psk_key(const uint8_t *key_ptr, uint16_t key_id) { - return -1; -} -#endif - - - diff --git a/test/nanostack/unittest/stub/trickle_stub.c b/test/nanostack/unittest/stub/trickle_stub.c deleted file mode 100644 index c794447ef75c..000000000000 --- a/test/nanostack/unittest/stub/trickle_stub.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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. - */ -/* - * trickle.c - * - * Implement a generic RFC 6206 Trickle Algorithm - */ -#include "nsconfig.h" -#include -#include - -#include "ns_trace.h" - -#include "Service_Libs/Trickle/trickle.h" - -void trickle_begin_interval(trickle_t *t) -{ -} - -void trickle_start(trickle_t *t, const trickle_params_t *params) -{ -} - -void trickle_consistent_heard(trickle_t *t) -{ -} - -void trickle_inconsistent_heard(trickle_t *t, const trickle_params_t *params) -{ -} - -bool trickle_timer(trickle_t *t, const trickle_params_t *params, uint16_t ticks) -{ - return false; -} diff --git a/test/nanostack/unittest/stub/udp_stub.c b/test/nanostack/unittest/stub/udp_stub.c deleted file mode 100644 index 4820548d8454..000000000000 --- a/test/nanostack/unittest/stub/udp_stub.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include "ns_types.h" -#include "string.h" -#include "ns_trace.h" -#include "ip_fsc.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "NWK_INTERFACE/Include/protocol_stats.h" -#include "6LoWPAN/Bootstraps/network_lib.h" // for nwk_udp_rx_security_check -#include "Common_Protocols/ipv6_constants.h" -#include "Common_Protocols/icmpv6.h" -#include "Common_Protocols/udp.h" -#include "Core/include/socket.h" -#include "common_functions.h" - -#define TRACE_GROUP "udp" - -void udp_checksum_write(buffer_t *buf) -{ -} - - -buffer_t *udp_down(buffer_t *buf) -{ - return NULL; -} - -buffer_t *udp_up(buffer_t *buf) -{ - return NULL; -} diff --git a/test/nanostack/unittest/stub/whiteboard_stub.c b/test/nanostack/unittest/stub/whiteboard_stub.c deleted file mode 100644 index c9edcf940a9d..000000000000 --- a/test/nanostack/unittest/stub/whiteboard_stub.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-2017, 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 "nsconfig.h" -#include -#include "string.h" -#include "nsdynmemLIB.h" -#include "ns_list.h" -#include "Common_Protocols/icmpv6.h" -#include "Service_Libs/whiteboard/whiteboard.h" -#include "platform/os_whiteboard.h" - -#ifdef WHITEBOARD - -void whiteboard_init(int8_t id) -{ -} - -void whiteboard_init_by_prefix(int8_t id, const uint8_t address[static 8]) -{ -} - -void whiteboard_rm_entry(int8_t id, const uint8_t address[static 16]) -{ -} - -whiteboard_entry_t *whiteboard_table_check_address(const uint8_t address[static 16]) -{ - return NULL; -} - -whiteboard_entry_t *whiteboard_get(whiteboard_entry_t *cur) -{ - return NULL; -} - -#ifndef EVOLUTION_VERSION -void whiteboard_ttl_max_size(uint16_t new_size_limit) -{ -} -#endif - -uint16_t whiteboard_size_get(void) -{ - return 0; -} - -int8_t whiteboard_interface_register(const uint8_t address[static 16], int8_t nwk_id) -{ - return 0; -} - -int8_t whiteboard_interface_unregister_all_address(int8_t nwk_id) -{ - return 0; -} - -bool whiteboard_interface_address_cmp(const uint8_t address[static 16]) -{ - return false; -} - -whiteboard_entry_t *whiteboard_table_update(const uint8_t address[static 16], const uint8_t eui64[static 8], uint8_t *status) -{ - return NULL; -} - -void whiteboard_ttl_update(uint16_t ttl_time) -{ -} -#endif diff --git a/test/nanostack/unittest/stub/x509_stub.c b/test/nanostack/unittest/stub/x509_stub.c deleted file mode 100644 index 21577e404199..000000000000 --- a/test/nanostack/unittest/stub/x509_stub.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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 "ns_types.h" -#include "libX509_V3.h" - -int8_t asn1_parse(uint8_t *data_ptr, uint16_t *len_ptr, uint8_t *type_ptr) -{ - return 0; -} -uint8_t x509_v3_certi_chain_analyze(uint8_t *ptr, uint16_t len, certificate_chain_t *chain_ptr) -{ - return 0; -} -uint8_t x509_v3_certificate_analyze(uint8_t *ptr, uint16_t cer_len, certificate_info_t *cer_info) -{ - return 0; -} -uint8_t x509_v3_parse_subject_public_key(uint8_t *ptr, uint16_t length, certificate_info_t *cer_info) -{ - return 0; -} -uint8_t x509_v3_parse_signature_alg(uint8_t *ptr, uint16_t length) -{ - return 0; -} -uint8_t x509_v3_parse_signature_parameter(uint8_t *src, uint8_t *dst) -{ - return 0; -} -uint8_t x509_v3_certi_pk_get(uint8_t *ptr, certificate_chain_t *chain_ptr) -{ - return 0; -} -uint8_t *x509_v3_certi_subj_get(uint8_t *ptr, uint16_t *len) -{ - return 0; -} -uint8_t *x509_get_key_from_pki(uint8_t *ptr, uint8_t key_type) -{ - return 0; -} -certificate_chain_internal_t *sec_cetificate_chain_get(certficate_get_types type) -{ - return 0; -} -int8_t x509_cetificate_chain_push(certficate_get_types type, certificate_chain_internal_t *chain) -{ - return 0; -} -int8_t sec_cetificate_chain_remove(certficate_get_types type) -{ - return 0; -} diff --git a/test/nanostack/unittest/thread/nvm/Makefile b/test/nanostack/unittest/thread/nvm/Makefile deleted file mode 100644 index 841a4dda9b37..000000000000 --- a/test/nanostack/unittest/thread/nvm/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = thread_nvm_store_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Thread/thread_nvm_store.c \ - ../../../../../source/Service_Libs/utils/ns_file_system.c \ - ../../stub/nsdynmemLIB_stub.c \ - -TEST_SRC_FILES = \ - ../../stub/mbed_trace_stub.c \ - main.cpp \ - thread_nvm_storetest.cpp \ - test_thread_nvm_store.c \ - -include ../../MakefileWorker.mk - -CLEAN-DIRS := $(foreach dir,$(DIRS),clean-$(dir)) -clean: $(CLEAN-DIRS) - rm -rf stub/*gcov stub/*gcda stubs/*o - rm -rf results/* - rm -rf coverages/* - rm -rf results - rm -rf coverages - rm -rf lib/* - rm -rf objs/* - rm -f /tmp/fd.txt - -.PHONY: $(CLEAN-DIRS) -$(CLEAN-DIRS): - make -C $(subst clean-,,$@) clean - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD=1 diff --git a/test/nanostack/unittest/thread/nvm/main.cpp b/test/nanostack/unittest/thread/nvm/main.cpp deleted file mode 100644 index 289f5972d3f1..000000000000 --- a/test/nanostack/unittest/thread/nvm/main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" - -#include - -int main(int ac, char** av) -{ - //rmdir("/tmp/thr"); - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(thread_nvm_store); - diff --git a/test/nanostack/unittest/thread/nvm/test_thread_nvm_store.c b/test/nanostack/unittest/thread/nvm/test_thread_nvm_store.c deleted file mode 100644 index e55581646887..000000000000 --- a/test/nanostack/unittest/thread/nvm/test_thread_nvm_store.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "test_thread_nvm_store.h" -#include -#include -#include "6LoWPAN/Thread/thread_nvm_store.h" -#include "ns_file_system.h" -#include "thread_config.h" - - -const char *ROOT_FILE_PATH = "/tmp/"; - -bool test_thread_nvm_store_init() -{ - int ret = ns_file_system_set_root_path(ROOT_FILE_PATH); - if(ret) - return 0; - - ret = thread_nvm_store_init(); - // this is for clearing memory - ns_file_system_set_root_path(NULL); - - if(!ret) - return 1; - else - return 0; -} - -bool test_thread_nvm_store_init_failed() -{ - ns_file_system_set_root_path(NULL); - int ret = thread_nvm_store_init(); - if (ret<0) - return 1; - - return 0; -} - -/** first stores data successfully and then read fails, but it should - * return (write) cached values. - * - */ -bool test_thread_nvm_store_init_failed_read() -{ - ns_file_system_set_root_path(ROOT_FILE_PATH); - if(thread_nvm_store_init()<0) - return 0; - - thread_nvm_fast_data_t f_data; - f_data.mac_frame_counter=2; - f_data.mle_frame_counter=3; - f_data.seq_counter=5; - // data goes to write cache - thread_nvm_store_fast_data_store(&f_data); - ns_file_system_set_root_path(NULL); - - thread_nvm_fast_data_t f_data2; - if(thread_nvm_store_fast_data_read(&f_data2)<0) - return 0; - if(f_data2.mac_frame_counter!=2) - return 0; - if(f_data2.seq_counter!=5) - return 0; - if(f_data2.mle_frame_counter!=3) - return 0; - - return 1; -} - -/** Storing fails, but read should - * return (write) cached values. - * - */ -bool test_thread_nvm_store_init_failed_write() -{ - ns_file_system_set_root_path(NULL); - if(thread_nvm_store_init()>-1) - return 0; - - if(thread_nvm_store_frame_counters_check_and_store(MAC_FRAME_COUNTER_LIMIT+7,MLE_FRAME_COUNTER_LIMIT+7)>-1) - return 0; - - // using here different value, as the nvm data was not cleaned. - if(thread_nvm_store_seq_counter_store(87)>-1) - return 0; - - thread_nvm_fast_data_t f_data; - thread_nvm_store_fast_data_read(&f_data); - if(f_data.mac_frame_counter!=MAC_FRAME_COUNTER_LIMIT+7) - return 0; - if(f_data.seq_counter!=87) - return 0; - if(f_data.mle_frame_counter!=MLE_FRAME_COUNTER_LIMIT+7) - return 0; - - return 1; -} - -// tests seq counter. First stores to file and reads checks all values -// then stores only seq counter and reads it back and checks the value. -// After it stores all values and reads back and checks all values. -bool test_thread_nvm_store_seq_counter() -{ - ns_file_system_set_root_path(ROOT_FILE_PATH); - if(thread_nvm_store_init()<0) - return 0; - - thread_nvm_fast_data_t f_data; - f_data.mac_frame_counter=2; - f_data.mle_frame_counter=3; - f_data.seq_counter=5; - thread_nvm_store_fast_data_store(&f_data); - - thread_nvm_fast_data_t f_data2; - thread_nvm_store_fast_data_read(&f_data2); - if(f_data2.mac_frame_counter!=2) - return 0; - if(f_data2.seq_counter!=5) - return 0; - if(f_data2.mle_frame_counter!=3) - return 0; - - if(thread_nvm_store_seq_counter_store(7)<0) - return 0; - - thread_nvm_store_fast_data_read(&f_data); - - if (f_data.seq_counter!=7) - return 0; - - if(thread_nvm_store_fast_data_check_and_store(2,3,8)<0) - return 0; - - thread_nvm_store_fast_data_read(&f_data); - - if(f_data.mac_frame_counter!=2) - return 0; - if(f_data.seq_counter!=8) - return 0; - if(f_data.mle_frame_counter!=3) - return 0; - // this is for clearing memory - ns_file_system_set_root_path(NULL); - - return 1; -} - -bool test_thread_nvm_store_mac_frame_counter() -{ - ns_file_system_set_root_path(ROOT_FILE_PATH); - if(thread_nvm_store_init()<0) - return 0; - - thread_nvm_fast_data_t f_data; - f_data.mac_frame_counter=2; - f_data.mle_frame_counter=3; - f_data.seq_counter=5; - thread_nvm_store_fast_data_store(&f_data); - - thread_nvm_fast_data_t f_data2; - thread_nvm_store_fast_data_read(&f_data2); - if(f_data2.mac_frame_counter!=2) - return 0; - if(f_data2.seq_counter!=5) - return 0; - if(f_data2.mle_frame_counter!=3) - return 0; - - thread_nvm_store_frame_counters_check_and_store(MAC_FRAME_COUNTER_LIMIT+17, 0); - thread_nvm_store_fast_data_read(&f_data); - // this is for clearing memory - ns_file_system_set_root_path(NULL); - if (f_data.mac_frame_counter==17+MAC_FRAME_COUNTER_LIMIT) - return 1; - - return 0; -} - -bool test_thread_nvm_store_mle_frame_counter() -{ - ns_file_system_set_root_path(ROOT_FILE_PATH); - if(thread_nvm_store_init()<0) - return 0; - - thread_nvm_fast_data_t f_data; - f_data.mac_frame_counter=2; - f_data.mle_frame_counter=3; - f_data.seq_counter=5; - thread_nvm_store_fast_data_store(&f_data); - - thread_nvm_fast_data_t f_data2; - thread_nvm_store_fast_data_read(&f_data2); - if(f_data2.mac_frame_counter!=2) - return 0; - if(f_data2.seq_counter!=5) - return 0; - if(f_data2.mle_frame_counter!=3) - return 0; - - thread_nvm_store_frame_counters_check_and_store(0, 77+MLE_FRAME_COUNTER_LIMIT); - - thread_nvm_store_fast_data_read(&f_data); - // this is for clearing memory - ns_file_system_set_root_path(NULL); - if (f_data.mle_frame_counter==77+MLE_FRAME_COUNTER_LIMIT) - return 1; - - return 0; -} - -bool test_thread_nvm_store_read_cache() -{ - ns_file_system_set_root_path(ROOT_FILE_PATH); - if(thread_nvm_store_init()<0) - return 0; - - thread_nvm_fast_data_t f_data; - f_data.mac_frame_counter=2; - f_data.mle_frame_counter=3; - f_data.seq_counter=5; - thread_nvm_store_fast_data_store(&f_data); - - thread_nvm_fast_data_t f_data2; - thread_nvm_store_fast_data_read(&f_data2); - if(f_data2.mac_frame_counter!=2) - return 0; - if(f_data2.seq_counter!=5) - return 0; - if(f_data2.mle_frame_counter!=3) - return 0; - - thread_nvm_store_frame_counters_check_and_store(10, 10); - thread_nvm_store_fast_data_read(&f_data); - // this is for clearing memory - ns_file_system_set_root_path(NULL); - - if (f_data.mac_frame_counter!=2) - return 0; - if (f_data.mle_frame_counter!=3) - return 0; - if (f_data.seq_counter!=5) - return 0; - - return 1; -} diff --git a/test/nanostack/unittest/thread/nvm/test_thread_nvm_store.h b/test/nanostack/unittest/thread/nvm/test_thread_nvm_store.h deleted file mode 100644 index 60a66ee1803b..000000000000 --- a/test/nanostack/unittest/thread/nvm/test_thread_nvm_store.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 TEST_THREAD_COMMISSIONING_API_H -#define TEST_THREAD_COMMISSIONING_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_thread_nvm_store_init(); -bool test_thread_nvm_store_init_failed(); -bool test_thread_nvm_store_init_failed_read(); -bool test_thread_nvm_store_init_failed_write(); -bool test_thread_nvm_store_seq_counter(); -bool test_thread_nvm_store_mac_frame_counter(); -bool test_thread_nvm_store_mle_frame_counter(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_THREAD_COMMISSIONING_API_H - diff --git a/test/nanostack/unittest/thread/nvm/thread_nvm_storetest.cpp b/test/nanostack/unittest/thread/nvm/thread_nvm_storetest.cpp deleted file mode 100644 index 0c43be027a32..000000000000 --- a/test/nanostack/unittest/thread/nvm/thread_nvm_storetest.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "CppUTest/TestHarness.h" -#include "test_thread_nvm_store.h" -#include "6LoWPAN/Thread/thread_nvm_store.h" -#include "ns_file_system.h" -#include "nsdynmemLIB_stub.h" - -TEST_GROUP(thread_nvm_store) -{ - void setup() - { - } - - void teardown() - { - } -}; - - - -TEST(thread_nvm_store, test_thread_nvm_store_init) -{ - nsdynmemlib_stub.returnCounter = 2; - CHECK(test_thread_nvm_store_init()); -} - -TEST(thread_nvm_store, test_thread_nvm_store_init_failed) -{ - CHECK(test_thread_nvm_store_init_failed()); -} - -TEST(thread_nvm_store, test_thread_nvm_store_init_failed_read) -{ - nsdynmemlib_stub.returnCounter = 2; - CHECK(test_thread_nvm_store_init_failed_read()); -} - -TEST(thread_nvm_store, test_thread_nvm_store_init_failed_write) -{ - CHECK(test_thread_nvm_store_init_failed_write()); -} - -TEST(thread_nvm_store, test_thread_nvm_store_seq_counter) -{ - nsdynmemlib_stub.returnCounter = 2; - CHECK(test_thread_nvm_store_seq_counter()); -} - -TEST(thread_nvm_store, test_thread_nvm_store_mle_frame_counter) -{ - nsdynmemlib_stub.returnCounter = 2; - CHECK(test_thread_nvm_store_mle_frame_counter()); - free(nsdynmemlib_stub.expectedPointer); -} - -TEST(thread_nvm_store, test_thread_nvm_store_mac_frame_counter) -{ - nsdynmemlib_stub.returnCounter = 2; - CHECK(test_thread_nvm_store_mac_frame_counter()); -} - - - - - - diff --git a/test/nanostack/unittest/thread/thread/Makefile b/test/nanostack/unittest/thread/thread/Makefile deleted file mode 100644 index 1bfe4a536131..000000000000 --- a/test/nanostack/unittest/thread/thread/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = thread_unit - -SRC_FILES = ../../../../../source/6LoWPAN/Thread/thread_common.c - -TEST_SRC_FILES = main.cpp \ - threadtest.cpp \ - test_thread.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/thread_nvm_store_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/thread_joiner_application_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/mle_tlv_stub.c \ - ../../stub/address_stub.c \ - ../../stub/thread_routing_stub.c \ - ../../stub/thread_nd_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/protocol_6lowpan_interface_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/lowpan_context_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/thread_bootstrap_stub.c \ - ../../stub/thread_border_router_api_internal_stub.c \ - ../../stub/thread_network_data_storage_stub.c \ - ../../stub/thread_test_api_stub.c \ - ../../stub/thread_network_data_lib_stub.c \ - ../../stub/thread_border_router_api_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/ipv6_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/blacklist_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - ../../stub/thread_dhcpv6_client_stub.c \ - ../../stub/thread_management_client_stub.c \ - ../../stub/thread_discovery_stub.c \ - ../../stub/thread_management_server_stub.c \ - ../../stub/thread_management_if_stub.c \ - ../../stub/thread_network_synch_stub.c \ - ../../stub/thread_resolution_client_stub.c \ - ../../stub/thread_address_registration_client_stub.c \ - ../../stub/thread_router_bootstrap_stub.c \ - ../../stub/thread_leader_service_stub.c \ - ../../stub/thread_beacon_stub.c \ - ../../stub/thread_bbr_api_stub.c \ - ../../stub/nd_proxy_stub.c \ - ../../stub/thread_meshcop_lib_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mac_pairwise_key_stub.c \ - ../../stub/sw_mac_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/etx_stub.c \ - ../../stub/timeout_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD -DHAVE_ND_PROXY - diff --git a/test/nanostack/unittest/thread/thread/main.cpp b/test/nanostack/unittest/thread/thread/main.cpp deleted file mode 100644 index 862b096f20e6..000000000000 --- a/test/nanostack/unittest/thread/thread/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(thread); - diff --git a/test/nanostack/unittest/thread/thread/test_thread.c b/test/nanostack/unittest/thread/thread/test_thread.c deleted file mode 100644 index 8a1d5624eec0..000000000000 --- a/test/nanostack/unittest/thread/thread/test_thread.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "nsconfig.h" -#include "test_thread.h" -#include "thread_common.h" -#include - -bool test_thread_bootstrap_up() -{ - int8_t ret = thread_bootstrap_up(NULL); - return -1 == ret; -} - diff --git a/test/nanostack/unittest/thread/thread/test_thread.h b/test/nanostack/unittest/thread/thread/test_thread.h deleted file mode 100644 index f893f9a38faf..000000000000 --- a/test/nanostack/unittest/thread/thread/test_thread.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2015, 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 TEST_THREAD_H -#define TEST_THREAD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_thread_bootstrap_up(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_THREAD_H - diff --git a/test/nanostack/unittest/thread/thread/threadtest.cpp b/test/nanostack/unittest/thread/thread/threadtest.cpp deleted file mode 100644 index 3bf255c1b6e9..000000000000 --- a/test/nanostack/unittest/thread/thread/threadtest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/TestHarness.h" -#include "test_thread.h" - -TEST_GROUP(thread) -{ - void setup() { - - } - - void teardown() { - - } -}; - -TEST(thread, test_thread_bootstrap_up) -{ - CHECK(test_thread_bootstrap_up() == true); -} - diff --git a/test/nanostack/unittest/thread/thread_bootstrap/Makefile b/test/nanostack/unittest/thread/thread_bootstrap/Makefile deleted file mode 100644 index 21aa9da2c7e1..000000000000 --- a/test/nanostack/unittest/thread/thread_bootstrap/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = thread_bootstrap_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Thread/thread_bootstrap.c - -TEST_SRC_FILES = \ - main.cpp \ - thread_bootstraptest.cpp \ - test_thread_bootstrap.c \ - ../../stub/ns_list_stub.c \ - ../../stub/socket_api_stub.c \ - ../../stub/thread_nvm_store.c \ - ../../stub/ns_file_system_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/ns_sha256_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/mac_security_interface_stub.c \ - ../../stub/mac_mlme_stub.c \ - ../../stub/thread_network_data_lib_stub.c \ - ../../stub/thread_management_if_stub.c \ - ../../stub/thread_router_bootstrap_stub.c \ - ../../stub/thread_commissioning_if_stub.c \ - ../../stub/thread_meshcop_lib_stub.c \ - ../../stub/thread_management_api_stub.c \ - ../../stub/event_stub.c \ - ../../stub/thread_dhcpv6_client_stub.c \ - ../../stub/thread_border_router_api_stub.c \ - ../../stub/thread_border_router_api_internal_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/thread_joiner_application_stub.c \ - ../../stub/thread_leader_service_stub.c \ - ../../stub/thread_management_client_stub.c \ - ../../stub/thread_management_server_stub.c \ - ../../stub/thread_discovery_stub.c \ - ../../stub/thread_nd_stub.c \ - ../../stub/thread_routing_stub.c \ - ../../stub/thread_bbr_api_stub.c \ - ../../stub/address_stub.c \ - ../../stub/mpl_stub.c \ - ../../stub/blacklist_stub.c \ - ../../stub/routing_table_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/libDHCPv6_server_stub.c \ - ../../stub/lowpan_context_stub.c \ - ../../stub/system_timer_stub.c \ - ../../stub/timeout_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/mle_tlv_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/neighbor_cache_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/thread_test_api_stub.c \ - ../../stub/thread_beacon_stub.c \ - ../../stub/thread_network_synch_stub.c \ - ../../stub/thread_network_data_storage_stub.c \ - ../../stub/thread_address_registration_client_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/net_stub.c \ - ../../stub/nd_proxy_stub.c \ - ../../stub/thread_router_bootstrap_stub.c \ - ../../stub/thread_host_bootstrap_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/thread_mle_message_handler_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD -DHAVE_DHCPV6_SERVER - diff --git a/test/nanostack/unittest/thread/thread_bootstrap/main.cpp b/test/nanostack/unittest/thread/thread_bootstrap/main.cpp deleted file mode 100644 index 844ecb25156e..000000000000 --- a/test/nanostack/unittest/thread/thread_bootstrap/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(thread_bootstrap); - diff --git a/test/nanostack/unittest/thread/thread_bootstrap/test_thread_bootstrap.c b/test/nanostack/unittest/thread/thread_bootstrap/test_thread_bootstrap.c deleted file mode 100644 index 0adfef2c1f6a..000000000000 --- a/test/nanostack/unittest/thread/thread_bootstrap/test_thread_bootstrap.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "nsconfig.h" -#include "test_thread_bootstrap.h" -#include -#include "ns_types.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "event_stub.h" - -bool test_thread_bootstrap_tasklet_init() -{ - protocol_interface_info_entry_t et; - et.bootStrapId = 0; - if (0 != thread_bootstrap_tasklet_init(&et)) { - return false; - } - - et.bootStrapId = -3; - event_stub.int8_value = -3; - if (-1 != thread_bootstrap_tasklet_init(&et)) { - return false; - } - - return true; -} - diff --git a/test/nanostack/unittest/thread/thread_bootstrap/test_thread_bootstrap.h b/test/nanostack/unittest/thread/thread_bootstrap/test_thread_bootstrap.h deleted file mode 100644 index e2fc3acfa588..000000000000 --- a/test/nanostack/unittest/thread/thread_bootstrap/test_thread_bootstrap.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2015, 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 TEST_THREAD_BOOTSTRAP_H -#define TEST_THREAD_BOOTSTRAP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_thread_bootstrap_tasklet_init(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_THREAD_BOOTSTRAP_H - diff --git a/test/nanostack/unittest/thread/thread_bootstrap/thread_bootstraptest.cpp b/test/nanostack/unittest/thread/thread_bootstrap/thread_bootstraptest.cpp deleted file mode 100644 index 97dbe5d0b9bc..000000000000 --- a/test/nanostack/unittest/thread/thread_bootstrap/thread_bootstraptest.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/TestHarness.h" -#include "test_thread_bootstrap.h" - -TEST_GROUP(thread_bootstrap) -{ - - void setup() { - } - - void teardown() { - } -}; - -TEST(thread_bootstrap, test_thread_bootstrap_tasklet_init) -{ - CHECK(test_thread_bootstrap_tasklet_init()); -} - diff --git a/test/nanostack/unittest/thread/thread_commissioning_api/Makefile b/test/nanostack/unittest/thread/thread_commissioning_api/Makefile deleted file mode 100644 index d1355c3955f5..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_api/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = thread_commissioning_api_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Thread/thread_commissioning_api.c - -TEST_SRC_FILES = \ - main.cpp \ - thread_commissioning_apitest.cpp \ - test_thread_commissioning_api.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/thread_meshcop_lib_stub.c \ - ../../stub/coap_service_api_stub.c \ - ../../stub/thread_management_if_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/thread_management_api_stub.c \ - ../../stub/ns_sha256_stub.c \ - ../../stub/thread_beacon_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/thread_common_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD=1 - diff --git a/test/nanostack/unittest/thread/thread_commissioning_api/main.cpp b/test/nanostack/unittest/thread/thread_commissioning_api/main.cpp deleted file mode 100644 index a185a1d4b949..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_api/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char** av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(thread_commissioning_api); - diff --git a/test/nanostack/unittest/thread/thread_commissioning_api/test_thread_commissioning_api.c b/test/nanostack/unittest/thread/thread_commissioning_api/test_thread_commissioning_api.c deleted file mode 100644 index 5da9c719bd53..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_api/test_thread_commissioning_api.c +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Copyright (c) 2015-2017, 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 "test_thread_commissioning_api.h" -#include -#include "thread_commissioning_api.h" -#include "nsdynmemLIB_stub.h" -#include "coap_service_api_stub.h" -#include "thread_meshcop_lib_stub.h" -#include "nsconfig.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "sn_coap_header.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "protocol_core_stub.h" - - -int commissioner_joiner_finalisation_handler_cb(int8_t interface_id, uint8_t EUI64[8], uint8_t *message_ptr, uint16_t message_len){ - return 0; -} -void thread_commissioning_native_select(int8_t interface_id, uint8_t count, thread_commissioning_link_configuration_s *link_ptr ){ - return; -} -/*This test case does the covers the commissioner register and device add methods*/ -bool test_commissioning_device_add_and_remove() -{ - uint8_t pskd[32] = {0x00}; - int joining_device_cb = 1; - uint8_t interface_id = 5; - uint8_t EUI64[] = {0x12,0x13,0x14,0x15,0x12,0x13,0x14,0x15}; - nsdynmemlib_stub.returnCounter = 1; - uint8_t pw[16]; - if( 0 != thread_commissioning_register(interface_id, pw) ) - return false; - nsdynmemlib_stub.returnCounter = 0; - if( -2 != thread_commissioning_device_add(interface_id, true, EUI64, pskd, 32, &joining_device_cb) ) - return false; - nsdynmemlib_stub.returnCounter = 1; - if( 0 != thread_commissioning_device_add(interface_id, true, EUI64, pskd, 32, &joining_device_cb) ) - return false; - if ( 0 != thread_commissioning_device_delete(interface_id, EUI64)) - return false; - if ( 0 != thread_commissioning_unregister(interface_id)) - return false; - /*setting up test case for covering bloom fliter which can add all devices*/ - for (int i = 0; i < 8; i++) - EUI64[i] = 0xff; - nsdynmemlib_stub.returnCounter = 1; - if( 0 != thread_commissioning_register(interface_id, pw) ) - return false; - nsdynmemlib_stub.returnCounter = 1; - if( 0 != thread_commissioning_device_add(interface_id, true, EUI64, pskd, 32, &joining_device_cb) ) - return false; - if ( 0 != thread_commissioning_device_delete(interface_id, EUI64)) - return false; - if ( 0 != thread_commissioning_unregister(interface_id)) - return false; - return true; -} - -/*test case to add commissioning device without a commissioner */ - -bool test_commissioning_device_add() -{ - uint8_t pskd[32] = {0x00}; - //int joining_device_cb = commissioner_joiner_finalisation_handler_cb; - uint8_t interface_id = 5; - uint8_t EUI64[] = {0x12,0x13,0x14,0x15,0x12,0x13,0x14,0x15}; - /*commissioner is not created before device is added */ - nsdynmemlib_stub.returnCounter = 1; - if( -1 != thread_commissioning_device_add(interface_id, true, EUI64, pskd, 32, commissioner_joiner_finalisation_handler_cb) ) - return false; - /*now register a commissioner */ - uint8_t pw[16]; - if( 0 != thread_commissioning_register(interface_id, pw) ) - return false; - /* PSKd_len is less than 1 */ - nsdynmemlib_stub.returnCounter = 1; - if( -1 != thread_commissioning_device_add(interface_id, true, EUI64, pskd, 0, commissioner_joiner_finalisation_handler_cb) ) - return false; - /* PSKd_len is greater than 32 */ - nsdynmemlib_stub.returnCounter = 1; - if( -1 != thread_commissioning_device_add(interface_id, true, EUI64, pskd, 33, commissioner_joiner_finalisation_handler_cb) ) - return false; - /*unregister the commissioner */ - if (0 != thread_commissioning_unregister(interface_id)) - return false; - return true; -} - -/*test case to cover a deletion of a device with incorrect interface id */ - -bool test_commissioning_device_delete() -{ - uint8_t interface_id = 5; - uint8_t EUI64[] = {0x12,0x13,0x14,0x15,0x12,0x13,0x14,0x15}; - if (-1 != thread_commissioning_device_delete(interface_id,EUI64)) - return false; - return true; -} - -/* test case to cover registering of a commissioner that already exists & -unregistering of a non existent commissioner*/ - -bool test_commissioning_register_twice() -{ - uint8_t interface_id = 5; - nsdynmemlib_stub.returnCounter = 1; - uint8_t pw[16]; - if ( 0 != thread_commissioning_register(interface_id, pw) ) - return false; - nsdynmemlib_stub.returnCounter = 1; - if ( -1 != thread_commissioning_register(interface_id, pw) ) - return false; - nsdynmemlib_stub.returnCounter = 1; - if ( 0 != thread_commissioning_unregister(interface_id)) - return false; - nsdynmemlib_stub.returnCounter = 1; - if ( -1 != thread_commissioning_unregister(interface_id)) - return false; - return true; -} - -bool test_thread_commissioning_petition_start() -{ - int8_t interface_id = 6; - int status_cb_ptr = 1; - char commissioner_id_ptr[1]; - commissioner_id_ptr[0] = 'a'; - char commissioner_id_ptr_long[65]; - - if ( -1 != thread_commissioning_petition_start(interface_id,commissioner_id_ptr, &status_cb_ptr)) - return false; - nsdynmemlib_stub.returnCounter = 1; - /*now register a commissioner */ - uint8_t pw[16]; - if( 0 != thread_commissioning_register(interface_id, pw) ) - return false; - if ( -2 != thread_commissioning_petition_start(interface_id,NULL,&status_cb_ptr)) - return false; - - for (int i = 0; i<65; i++){ - commissioner_id_ptr_long[i] = 'a'; - } - if ( -3 != thread_commissioning_petition_start(interface_id,commissioner_id_ptr_long, &status_cb_ptr)) - return false; - if ( 0 != thread_commissioning_petition_start(interface_id,commissioner_id_ptr, &status_cb_ptr)) - return false; - - if ( 0 != thread_commissioning_unregister(interface_id)) - return false; - - return true; -} - -bool test_thread_commissioning_rx_receive_cb() -{ - uint8_t pskd[32] = {0x00}; - int8_t interface_id = 1; - thread_commissioning_joiner_finalisation_cb joining_device_cb; - uint8_t EUI64[] = {0xfe,0x80,0xff,0xff,0xff,0xff,0xff,0xff}; - //set coap service stub values - coap_service_api_stub.response_resp_cb = NULL; - coap_service_api_stub.socket_send_cb = NULL; - coap_service_api_stub.register_uri_send_cb = NULL; - coap_service_api_stub.expectedInt8 = interface_id; - - //set meshcop stub values - thread_meshcop_lib_stub.expectedInt8 = 2; - thread_meshcop_lib_stub.expectedUint16 = 8; - thread_meshcop_lib_stub.expectedUnit8ResultValue = 1; - - - int status_cb_ptr = 1; - char commissioner_id_ptr[1]; - commissioner_id_ptr[0] = 'a'; - uint8_t data_ptr[3]; - int8_t service_id = 0; - uint8_t source_address[] = {0xfe,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0xff}; - uint16_t source_port = 1; - uint8_t payload[] = {0x11,0x12,0x13,0x16,0x01}; - sn_coap_hdr_s response_ptr; - response_ptr.payload_ptr = payload; - response_ptr.payload_len = 5; - sn_coap_hdr_s request_ptr; - request_ptr.payload_ptr = payload; - request_ptr.payload_len = 5; - nsdynmemlib_stub.returnCounter = 4; - uint8_t pw[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; - reset_callback(); - coap_service_api_stub.callBackAccepted = 2; - /*now register a commissioner */ - if( 0 != thread_commissioning_register(interface_id, pw) ) { - return false; - } - if( 0 != thread_commissioning_device_add(interface_id, true, EUI64, pskd, 32, commissioner_joiner_finalisation_handler_cb) ) { - return false; - } - if (!coap_service_api_stub.socket_send_cb) { - return false; - } - coap_service_api_stub.socket_send_cb(interface_id, source_address, source_port, data_ptr, 3); - - if (!coap_service_api_stub.register_uri_send_cb) { - return false; - } - coap_service_api_stub.register_uri_send_cb(interface_id, source_address, source_port, &request_ptr); - - if ( 0 != thread_commissioning_petition_start(interface_id,commissioner_id_ptr, NULL)){ - return false; - } - //test here --> - if (!coap_service_api_stub.response_resp_cb) { - return false; - } - - coap_service_api_stub.response_resp_cb(interface_id, source_address, source_port, &response_ptr); - response_ptr.payload_ptr = NULL; - coap_service_api_stub.response_resp_cb(interface_id, source_address, source_port, &response_ptr); - //<-- test here - - if ( 0 != thread_commissioning_device_delete(interface_id, EUI64)) { - return false; - } - if ( 0 != thread_commissioning_unregister(interface_id)){ - return false; - } - return true; -} - -bool test_thread_commissioning_application_provision_cb() -{ - uint8_t pskd[32] = {0x00}; - int8_t interface_id = 1; - thread_commissioning_joiner_finalisation_cb joining_device_cb; - uint8_t EUI64[] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; - //set coap service stub values - coap_service_api_stub.response_resp_cb = NULL; - coap_service_api_stub.socket_send_cb = NULL; - coap_service_api_stub.register_uri_send_cb = NULL; - coap_service_api_stub.expectedInt8 = interface_id; - coap_service_api_stub.callBackAccepted = 3; - //set meshcop stub values - thread_meshcop_lib_stub.expectedInt8 = 2; - thread_meshcop_lib_stub.expectedUint16 = 1; - thread_meshcop_lib_stub.expectedUnit8ResultValue = 1; - - - int status_cb_ptr = 1; - char commissioner_id_ptr[1]; - commissioner_id_ptr[0] = 'a'; - uint8_t data_ptr[3]; - int8_t service_id = 0; - uint8_t source_address[] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; - uint16_t source_port = 1; - uint8_t payload[] = {0x11,0x12,0x13,0x16,0x01}; - sn_coap_hdr_s response_ptr; - response_ptr.payload_ptr = payload; - response_ptr.payload_len = 5; - sn_coap_hdr_s request_ptr; - request_ptr.payload_ptr = payload; - request_ptr.payload_len = 5; - nsdynmemlib_stub.returnCounter = 4; - uint8_t pw[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; - reset_callback(); - - /*now register a commissioner */ - if( 0 != thread_commissioning_register(interface_id, pw) ) { - return false; - } - if( 0 != thread_commissioning_device_add(interface_id, true, EUI64, pskd, 32, commissioner_joiner_finalisation_handler_cb) ) { - return false; - } - if (!coap_service_api_stub.socket_send_cb) { - return false; - } - coap_service_api_stub.socket_send_cb(interface_id, source_address, source_port, data_ptr, 3); - - if (!coap_service_api_stub.register_uri_send_cb) { - return false; - } - coap_service_api_stub.register_uri_send_cb(interface_id, source_address, source_port, &request_ptr); - - if ( 0 != thread_commissioning_petition_start(interface_id,commissioner_id_ptr, NULL)){ - return false; - } - //test here --> - if (!coap_service_api_stub.response_resp_cb) { - return false; - } - - coap_service_api_stub.response_resp_cb(interface_id, source_address, source_port, &response_ptr); - response_ptr.payload_ptr = NULL; - coap_service_api_stub.response_resp_cb(interface_id, source_address, source_port, &response_ptr); - //<-- test here - - if ( 0 != thread_commissioning_device_delete(interface_id, EUI64)) { - return false; - } - if ( 0 != thread_commissioning_unregister(interface_id)){ - return false; - } - return true; -} - -bool test_thread_commissioning_finalisation_req_recv_cb() -{ - uint8_t pskd[32] = {0x00}; - int8_t interface_id = 1; - thread_commissioning_joiner_finalisation_cb joining_device_cb; - uint8_t EUI64[] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; - //set coap service stub values - reset_callback(); - coap_service_api_stub.response_resp_cb = NULL; - coap_service_api_stub.socket_send_cb = NULL; - coap_service_api_stub.register_uri_send_cb = NULL; - coap_service_api_stub.expectedInt8 = interface_id; - coap_service_api_stub.callBackAccepted = 5; - //set meshcop stub values - thread_meshcop_lib_stub.expectedInt8 = 2; - thread_meshcop_lib_stub.expectedUint16 = 1; - thread_meshcop_lib_stub.expectedUnit8ResultValue = 1; - - - int status_cb_ptr = 1; - char commissioner_id_ptr[1]; - commissioner_id_ptr[0] = 'a'; - uint8_t data_ptr[3]; - int8_t service_id = 0; - uint8_t source_address[] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; - uint16_t source_port = 1; - uint8_t payload[] = {0x11,0x12,0x13,0x16,0x01}; - sn_coap_hdr_s response_ptr; - response_ptr.payload_ptr = payload; - response_ptr.payload_len = 5; - sn_coap_hdr_s request_ptr; - request_ptr.payload_ptr = payload; - request_ptr.payload_len = 5; - nsdynmemlib_stub.returnCounter = 4; - uint8_t pw[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; - - /*now register a commissioner */ - if( 0 != thread_commissioning_register(interface_id, pw) ) { - return false; - } - if( 0 != thread_commissioning_device_add(interface_id, true, EUI64, pskd, 32, commissioner_joiner_finalisation_handler_cb) ) { - return false; - } - if (!coap_service_api_stub.socket_send_cb) { - return false; - } - coap_service_api_stub.socket_send_cb(interface_id, source_address, source_port, data_ptr, 3); - - if (!coap_service_api_stub.register_uri_send_cb) { - return false; - } - coap_service_api_stub.register_uri_send_cb(interface_id, source_address, source_port, &request_ptr); - - if ( 0 != thread_commissioning_petition_start(interface_id,commissioner_id_ptr, NULL)){ - return false; - } - //test here --> - if (!coap_service_api_stub.response_resp_cb) { - return false; - } - - coap_service_api_stub.response_resp_cb(interface_id, source_address, source_port, &response_ptr); - response_ptr.payload_ptr = NULL; - coap_service_api_stub.response_resp_cb(interface_id, source_address, source_port, &response_ptr); - //<-- test here - - if ( 0 != thread_commissioning_device_delete(interface_id, EUI64)) { - return false; - } - if ( 0 != thread_commissioning_unregister(interface_id)){ - return false; - } - - return true; -} - -bool test_thread_commissioning_petition_keep_alive() -{ - - int8_t interface_id = 7; - commissioning_state_e state = COMMISSIONING_STATE_ACCEPT; - char commissioner_id_ptr[1]; - int status_cb_ptr = 1; - commissioner_id_ptr[0] = 'a'; - if (-1 != thread_commissioning_petition_keep_alive(interface_id, state)) - return false; - nsdynmemlib_stub.returnCounter = 1; - uint8_t pw[16]; - /*now register a commissioner */ - if( 0 != thread_commissioning_register(interface_id, pw) ) - return false; - - if ( 0 != thread_commissioning_petition_start(interface_id,commissioner_id_ptr, &status_cb_ptr)) - return false; - if (0 != thread_commissioning_petition_keep_alive(interface_id, state)) - return false; - - if ( 0 != thread_commissioning_unregister(interface_id)) - return false; - - return true; - -} - -bool test_thread_commissioning_get_management_id() -{ - int8_t interface_id = 8; - if (-1 != thread_commissioning_get_management_id(interface_id)) - return false; - - nsdynmemlib_stub.returnCounter = 1; - uint8_t pw[16]; - /*now register a commissioner */ - if( 0 != thread_commissioning_register(interface_id, pw) ) - return false; - - if (0 != thread_commissioning_get_management_id(interface_id)) - return false; - - if ( 0 != thread_commissioning_unregister(interface_id)) - return false; - - return true; -} - -bool test_thread_commissioning_native_commissioner_start() -{ - int8_t interface_id = 1; - protocol_interface_info_entry_t cur; - thread_info_t thread_info; - thread_info.version = 1; - cur.id = interface_id; - cur.thread_info = NULL; - protocol_core_stub.entry_ptr = &cur; - - if (-1 != thread_commissioning_native_commissioner_start(interface_id, NULL)) { - return false; - } - cur.thread_info = &thread_info; - protocol_core_stub.entry_ptr = &cur; - if (0 != thread_commissioning_native_commissioner_start(interface_id, thread_commissioning_native_select)) { - return false; - } - - return true; -} -bool test_thread_commissioning_native_commissioner_connect() -{ - thread_commissioning_link_configuration_s link_configuration; - int8_t interface_id = 1; - protocol_interface_info_entry_t cur; - thread_info_t thread_info; - thread_info.version = 1; - thread_info.thread_attached_state = THREAD_STATE_CONNECTED; - thread_info.native_commissioner_port = 10; - uint8_t address_ptr; - uint16_t port; - cur.id = interface_id; - cur.thread_info = NULL; - protocol_core_stub.entry_ptr = NULL; - if (-1 != thread_commissioning_native_commissioner_connect(interface_id, &link_configuration)) { - return false; - } - nsdynmemlib_stub.returnCounter = 1; - cur.thread_info = &thread_info; - protocol_core_stub.entry_ptr = &cur; - if (0 != thread_commissioning_native_commissioner_connect(interface_id, &link_configuration)) { - return false; - } - if (0 != thread_commissioning_native_commissioner_stop(interface_id)) { - return false; - } - if (0 != thread_commissioning_native_commissioner_get_connection_info(interface_id,&address_ptr,&port)){ - return false; - } - - return true; -} diff --git a/test/nanostack/unittest/thread/thread_commissioning_api/test_thread_commissioning_api.h b/test/nanostack/unittest/thread/thread_commissioning_api/test_thread_commissioning_api.h deleted file mode 100644 index 179b07239cc2..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_api/test_thread_commissioning_api.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 TEST_THREAD_COMMISSIONING_API_H -#define TEST_THREAD_COMMISSIONING_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_commissioning_device_add_and_remove(); -bool test_commissioning_device_add(); -bool test_commissioning_device_delete(); -bool test_commissioning_register_twice(); -bool test_thread_commissioning_petition_start(); -bool test_thread_commissioning_petition_keep_alive(); -bool test_thread_commissioning_get_management_id(); -bool test_thread_commissioning_application_provision_cb(); -bool test_thread_commissioning_finalisation_req_recv_cb(); -bool test_thread_commissioning_rx_receive_cb(); -bool test_thread_commissioning_native_commissioner_start(); -bool test_thread_commissioning_native_commissioner_connect(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_THREAD_COMMISSIONING_API_H - diff --git a/test/nanostack/unittest/thread/thread_commissioning_api/thread_commissioning_apitest.cpp b/test/nanostack/unittest/thread/thread_commissioning_api/thread_commissioning_apitest.cpp deleted file mode 100644 index dcc7cad62b2a..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_api/thread_commissioning_apitest.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "CppUTest/TestHarness.h" -#include "test_thread_commissioning_api.h" - -TEST_GROUP(thread_commissioning_api) -{ - void setup() - { - } - - void teardown() - { - } -}; - - - -TEST(thread_commissioning_api, test_commissioning_device_add_and_remove) -{ - CHECK(test_commissioning_device_add_and_remove()); -} - -TEST(thread_commissioning_api, test_commissioning_device_add) -{ - CHECK(test_commissioning_device_add()); -} - -TEST(thread_commissioning_api, test_commissioning_device_delete) -{ - CHECK(test_commissioning_device_delete()); -} - -TEST(thread_commissioning_api, test_commissioning_register_twice) - { - CHECK(test_commissioning_register_twice()); -} - -TEST(thread_commissioning_api, test_thread_commissioning_petition_start) -{ - CHECK(test_thread_commissioning_petition_start()); -} -TEST(thread_commissioning_api, test_thread_commissioning_petition_keep_alive) -{ - CHECK(test_thread_commissioning_petition_keep_alive()); -} - -TEST(thread_commissioning_api, test_thread_commissioning_get_management_id) -{ - CHECK(test_thread_commissioning_get_management_id()); -} - -TEST(thread_commissioning_api, test_thread_commissioning_application_provision_cb) -{ - CHECK(test_thread_commissioning_application_provision_cb()); -} - -TEST(thread_commissioning_api, test_thread_commissioning_finalisation_req_recv_cb) -{ - CHECK(test_thread_commissioning_finalisation_req_recv_cb()); -} - -TEST(thread_commissioning_api, test_thread_commissioning_rx_receive_cb) -{ - CHECK(test_thread_commissioning_rx_receive_cb()); -} -TEST(thread_commissioning_api, test_thread_commissioning_native_commissioner_start) -{ - CHECK(test_thread_commissioning_native_commissioner_start()); -} -TEST(thread_commissioning_api, test_thread_commissioning_native_commissioner_connect) -{ - CHECK(test_thread_commissioning_native_commissioner_connect()); -} - - - - - diff --git a/test/nanostack/unittest/thread/thread_commissioning_if/Makefile b/test/nanostack/unittest/thread/thread_commissioning_if/Makefile deleted file mode 100644 index cc112f40f1b0..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_if/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = thread_thread_commissioning_if_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Thread/thread_commissioning_if.c \ - -TEST_SRC_FILES = \ - main.cpp \ - thread_commissioning_iftest.cpp \ - test_thread_commissioning_if.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/thread_joiner_application_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/thread_management_if_stub.c \ - ../../stub/thread_bootstrap_stub.c \ - ../../stub/thread_network_data_storage_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/mac_pairwise_key_stub.c \ - ../../stub/mac_security_interface_stub.c \ - ../../stub/thread_management_server_stub.c \ - ../../stub/timeout_stub.c \ - ../../stub/mac_helper_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD - diff --git a/test/nanostack/unittest/thread/thread_commissioning_if/main.cpp b/test/nanostack/unittest/thread/thread_commissioning_if/main.cpp deleted file mode 100644 index 5d9acc126e1d..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_if/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(thread_commissioning_if); - diff --git a/test/nanostack/unittest/thread/thread_commissioning_if/test_thread_commissioning_if.c b/test/nanostack/unittest/thread/thread_commissioning_if/test_thread_commissioning_if.c deleted file mode 100644 index c26ab974ee55..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_if/test_thread_commissioning_if.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "test_thread_commissioning_if.h" -#include -#include "thread_commissioning_if.h" - -bool test_thread_commissioning_if_pairwise_key_add() -{ - int res = thread_commissioning_if_pairwise_key_add(0, 0, NULL, NULL); - if (res != -1) { - return false; - } - return true; -} - -bool test_thread_commissioning_if_pairwise_key_del() -{ - int res = thread_commissioning_if_pairwise_key_del(0, NULL); - if (res != -1) { - return false; - } - return true; -} diff --git a/test/nanostack/unittest/thread/thread_commissioning_if/test_thread_commissioning_if.h b/test/nanostack/unittest/thread/thread_commissioning_if/test_thread_commissioning_if.h deleted file mode 100644 index ef69cf484904..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_if/test_thread_commissioning_if.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 TEST_THREAD_COMMISSIONING_IF_H -#define TEST_THREAD_COMMISSIONING_IF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_thread_commissioning_if_pairwise_key_add(); -bool test_thread_commissioning_if_pairwise_key_del(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_THREAD_COMMISSIONING_IF_H - diff --git a/test/nanostack/unittest/thread/thread_commissioning_if/thread_commissioning_iftest.cpp b/test/nanostack/unittest/thread/thread_commissioning_if/thread_commissioning_iftest.cpp deleted file mode 100644 index d7bdabeeee03..000000000000 --- a/test/nanostack/unittest/thread/thread_commissioning_if/thread_commissioning_iftest.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "CppUTest/TestHarness.h" -#include "test_thread_commissioning_if.h" - -TEST_GROUP(thread_commissioning_if) -{ - void setup() { - - } - - void teardown() { - } -}; - -TEST(thread_commissioning_if, test_thread_commissioning_if_pairwise_key_add) -{ - CHECK(test_thread_commissioning_if_pairwise_key_add()); -} - -TEST(thread_commissioning_if, test_thread_commissioning_if_pairwise_key_del) -{ - CHECK(test_thread_commissioning_if_pairwise_key_del()); -} - diff --git a/test/nanostack/unittest/thread/thread_lowpower_api/Makefile b/test/nanostack/unittest/thread/thread_lowpower_api/Makefile deleted file mode 100644 index 2a984696c8b0..000000000000 --- a/test/nanostack/unittest/thread/thread_lowpower_api/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = thread_lowpower_api_unit - -#This must be changed manually -SRC_FILES = \ - ../../../../../source/6LoWPAN/Thread/thread_lowpower_private_api.c - -TEST_SRC_FILES = \ - main.cpp \ - thread_lowpower_apitest.cpp \ - test_thread_lowpower_api.c \ - ../../stub/ns_list_stub.c \ - ../../stub/socket_api_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/ns_sha256_stub.c \ - ../../stub/mac_data_poll_stub.c \ - ../../stub/mac_security_interface_stub.c \ - ../../stub/mac_mlme_stub.c \ - ../../stub/thread_management_if_stub.c \ - ../../stub/thread_router_bootstrap_stub.c \ - ../../stub/thread_commissioning_if_stub.c \ - ../../stub/thread_meshcop_lib_stub.c \ - ../../stub/thread_management_api_stub.c \ - ../../stub/event_stub.c \ - ../../stub/thread_dhcpv6_client_stub.c \ - ../../stub/thread_border_router_api_stub.c \ - ../../stub/thread_border_router_api_internal_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/thread_joiner_application_stub.c \ - ../../stub/thread_leader_service_stub.c \ - ../../stub/thread_management_client_stub.c \ - ../../stub/thread_management_server_stub.c \ - ../../stub/thread_discovery_stub.c \ - ../../stub/thread_nd_stub.c \ - ../../stub/thread_routing_stub.c \ - ../../stub/address_stub.c \ - ../../stub/mpl_stub.c \ - ../../stub/blacklist_stub.c \ - ../../stub/routing_table_stub.c \ - ../../stub/protocol_ipv6_stub.c \ - ../../stub/ipv6_routing_table_stub.c \ - ../../stub/libDHCPv6_server_stub.c \ - ../../stub/lowpan_context_stub.c \ - ../../stub/system_timer_stub.c \ - ../../stub/timeout_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/mle_service_stub.c \ - ../../stub/mle_tlv_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/randLIB_stub.c \ - ../../stub/neighbor_cache_stub.c \ - ../../stub/protocol_6lowpan_stub.c \ - ../../stub/thread_test_api_stub.c \ - ../../stub/thread_beacon_stub.c \ - ../../stub/thread_network_synch_stub.c \ - ../../stub/thread_network_data_storage_stub.c \ - ../../stub/thread_address_registration_client_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/net_stub.c \ - ../../stub/nd_proxy_stub.c \ - ../../stub/thread_router_bootstrap_stub.c \ - ../../stub/thread_host_bootstrap_stub.c \ - ../../stub/rpl_control_stub.c \ - ../../stub/mle_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/icmpv6_stub.c \ - ../../stub/thread_mle_message_handler_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD -DHAVE_DHCPV6_SERVER - diff --git a/test/nanostack/unittest/thread/thread_lowpower_api/main.cpp b/test/nanostack/unittest/thread/thread_lowpower_api/main.cpp deleted file mode 100644 index 099abc9c4f07..000000000000 --- a/test/nanostack/unittest/thread/thread_lowpower_api/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(thread_lowpower_api); - diff --git a/test/nanostack/unittest/thread/thread_lowpower_api/test_thread_lowpower_api.c b/test/nanostack/unittest/thread/thread_lowpower_api/test_thread_lowpower_api.c deleted file mode 100644 index afe37e38ff58..000000000000 --- a/test/nanostack/unittest/thread/thread_lowpower_api/test_thread_lowpower_api.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "nsconfig.h" -#include "test_thread_lowpower_api.h" -#include "thread_lowpower_api.h" -#include -#include "ns_types.h" -#include "NWK_INTERFACE/Include/protocol.h" -#include "event_stub.h" -#include "6LoWPAN/Thread/thread_common.h" -#include "protocol_core_stub.h" -#include "mle_service_stub.h" - -bool test_thread_lowpower_test_probe_send() -{ - int8_t interface_id = 1; - uint8_t address[16]; - uint8_t *metrics; - uint8_t metrics_length; - int data_response_cb; - thread_info_t thread_info; - thread_info.version = 1; - thread_info.thread_attached_state = THREAD_STATE_CONNECTED; - thread_info.native_commissioner_port = 10; - mle_service_msg_buf_def mle_service_msg_buf; - mle_service_msg_buf.msg_id = 0; - - if (-1 != thread_lowpower_test_probe_send(interface_id, address, metrics, metrics_length, data_response_cb)) { - return false; - } - return true; -} - diff --git a/test/nanostack/unittest/thread/thread_lowpower_api/test_thread_lowpower_api.h b/test/nanostack/unittest/thread/thread_lowpower_api/test_thread_lowpower_api.h deleted file mode 100644 index 892c574fab0b..000000000000 --- a/test/nanostack/unittest/thread/thread_lowpower_api/test_thread_lowpower_api.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2017, 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 TEST_THREAD_LOWPOWER_API_H -#define TEST_THREAD_LOWPOWER_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_thread_lowpower_test_probe_send(); - -#ifdef __cplusplus -} -#endif - -#endif // TEST_THREAD_LOWPOWER_API_H - diff --git a/test/nanostack/unittest/thread/thread_lowpower_api/thread_lowpower_apitest.cpp b/test/nanostack/unittest/thread/thread_lowpower_api/thread_lowpower_apitest.cpp deleted file mode 100644 index 771e1065feca..000000000000 --- a/test/nanostack/unittest/thread/thread_lowpower_api/thread_lowpower_apitest.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 "CppUTest/TestHarness.h" -#include "test_thread_lowpower_api.h" - -TEST_GROUP(thread_lowpower_api) -{ - - void setup() { - } - - void teardown() { - } -}; - -TEST(thread_lowpower_api, test_thread_lowpower_test_probe_send) -{ - CHECK(test_thread_lowpower_test_probe_send()); -} - diff --git a/test/nanostack/unittest/thread/thread_management_client/Makefile b/test/nanostack/unittest/thread/thread_management_client/Makefile deleted file mode 100644 index f1ee29752c58..000000000000 --- a/test/nanostack/unittest/thread/thread_management_client/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = thread_management_client_unit - -#This must be changed manually -SRC_FILES = ../../../../../source/6LoWPAN/Thread/thread_management_client.c - -TEST_SRC_FILES = \ - main.cpp \ - thread_management_clienttest.cpp \ - test_thread_management_client.c \ - ../../stub/coap_service_api_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/socket_api_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/thread_meshcop_lib_stub.c \ - ../../stub/thread_bootstrap_stub.c \ - ../../stub/thread_management_if_stub.c \ - ../../stub/thread_joiner_application_stub.c \ - ../../stub/thread_network_data_lib_stub.c \ - - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD=1 - diff --git a/test/nanostack/unittest/thread/thread_management_client/main.cpp b/test/nanostack/unittest/thread/thread_management_client/main.cpp deleted file mode 100644 index ab56f25b42f9..000000000000 --- a/test/nanostack/unittest/thread/thread_management_client/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(thread_management_client); - diff --git a/test/nanostack/unittest/thread/thread_management_client/test_thread_management_client.c b/test/nanostack/unittest/thread/thread_management_client/test_thread_management_client.c deleted file mode 100644 index c3b62c713f43..000000000000 --- a/test/nanostack/unittest/thread/thread_management_client/test_thread_management_client.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "test_thread_management_client.h" -#include -/*typedef struct thread_management { - thread_management_client_router_id_cb *router_id_cb_ptr; - thread_management_client_network_data_set_cb *network_data_set_cb_ptr; - int8_t interface_id; - int8_t coap_service_id; - ns_list_link_t link; -} thread_management_t;*/ -bool test_thread_management_client_init() -{ - thread_management_client_init(0); - - thread_management_client_delete(0); - - return true; -} - -/*bool test_thread_management_client_router_id_get(){ - int8_t interface_id = 0; - uint8_t mac[8] = {0x00}; - uint16_t router_id = 0x1234; - thread_management_client_router_id_cb *id_cb; - thread_management_client_router_id_get(interface_id, &mac[0], router_id, &id_cb); -}*/ \ No newline at end of file diff --git a/test/nanostack/unittest/thread/thread_management_client/test_thread_management_client.h b/test/nanostack/unittest/thread/thread_management_client/test_thread_management_client.h deleted file mode 100644 index 0ce6f0545191..000000000000 --- a/test/nanostack/unittest/thread/thread_management_client/test_thread_management_client.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 TEST_THREAD_MANAGEMENT_CLIENT_H -#define TEST_THREAD_MANAGEMENT_CLIENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -bool test_thread_management_client_init(); -//bool test_thread_management_client_router_id_get(); - -#ifdef __cplusplus -} -#endif - - -#endif // TEST_THREAD_MANAGEMENT_CLIENT_H - diff --git a/test/nanostack/unittest/thread/thread_management_client/thread_management_clienttest.cpp b/test/nanostack/unittest/thread/thread_management_client/thread_management_clienttest.cpp deleted file mode 100644 index 257c5849a02c..000000000000 --- a/test/nanostack/unittest/thread/thread_management_client/thread_management_clienttest.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2015-2016, 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 "CppUTest/TestHarness.h" -#include "test_thread_management_client.h" - -TEST_GROUP(thread_management_client) -{ - void setup() { - } - - void teardown() { - } -}; - -TEST(thread_management_client, test_thread_management_client_init) -{ - CHECK(test_thread_management_client_init()); -} - -// TEST(thread_management_client, test_thread_management_client_router_id_get) -// { -// CHECK(test_thread_management_client_router_id_get()); -// } diff --git a/test/nanostack/unittest/thread/thread_management_server/Makefile b/test/nanostack/unittest/thread/thread_management_server/Makefile deleted file mode 100644 index 4f5b916d0fad..000000000000 --- a/test/nanostack/unittest/thread/thread_management_server/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -include ../../makefile_defines.txt - -COMPONENT_NAME = thread_management_server_unit -SRC_FILES = \ - ../../../../../source/6LoWPAN/Thread/thread_management_server.c - - -TEST_SRC_FILES = main.cpp \ - thread_management_server_test.cpp \ - test_thread_management_server.cpp \ - ../../stub/timeout_stub.c \ - ../../stub/coap_service_api_stub.c \ - ../../stub/ns_list_stub.c \ - ../../stub/socket_api_stub.c \ - ../../stub/mbed_trace_stub.c \ - ../../stub/mac_mlme_stub.c \ - ../../stub/common_functions_stub.c \ - ../../stub/address_stub.c \ - ../../stub/thread_border_router_api_stub.c \ - ../../stub/thread_joiner_application_stub.c \ - ../../stub/thread_leader_service_stub.c \ - ../../stub/thread_management_if_stub.c \ - ../../stub/thread_bootstrap_stub.c \ - ../../stub/thread_commissioning_if_stub.c \ - ../../stub/thread_bbr_api_stub.c \ - ../../stub/nsdynmemLIB_stub.c \ - ../../stub/thread_meshcop_lib_stub.c \ - ../../stub/thread_beacon_stub.c \ - ../../stub/thread_common_stub.c \ - ../../stub/thread_routing_stub.c \ - ../../stub/thread_network_data_lib_stub.c \ - ../../stub/thread_discovery_stub.c \ - ../../stub/protocol_core_stub.c \ - ../../stub/mac_helper_stub.c \ - ../../stub/mac_data_poll_stub.c \ - -include ../../MakefileWorker.mk - -CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DHAVE_THREAD - diff --git a/test/nanostack/unittest/thread/thread_management_server/main.cpp b/test/nanostack/unittest/thread/thread_management_server/main.cpp deleted file mode 100644 index f9475515b8bd..000000000000 --- a/test/nanostack/unittest/thread/thread_management_server/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/CommandLineTestRunner.h" -#include "CppUTest/TestPlugin.h" -#include "CppUTest/TestRegistry.h" -#include "CppUTestExt/MockSupportPlugin.h" -int main(int ac, char **av) -{ - return CommandLineTestRunner::RunAllTests(ac, av); -} - -IMPORT_TEST_GROUP(thread_management_server); diff --git a/test/nanostack/unittest/thread/thread_management_server/test_thread_management_server.cpp b/test/nanostack/unittest/thread/thread_management_server/test_thread_management_server.cpp deleted file mode 100644 index 0dc0bb1a89e9..000000000000 --- a/test/nanostack/unittest/thread/thread_management_server/test_thread_management_server.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/TestHarness.h" -#include "test_thread_management_server.h" -#include "thread_management_server.h" -#include - -//#include "some_stub.h" - -test_thread_management_server::test_thread_management_server() -{ - -} - -test_thread_management_server::~test_thread_management_server() -{ -} - -void test_thread_management_server::test_thread_management_server_init() -{ - CHECK(-2 == thread_management_server_init(0)); - thread_management_server_delete(0); -} diff --git a/test/nanostack/unittest/thread/thread_management_server/test_thread_management_server.h b/test/nanostack/unittest/thread/thread_management_server/test_thread_management_server.h deleted file mode 100644 index 159e71200147..000000000000 --- a/test/nanostack/unittest/thread/thread_management_server/test_thread_management_server.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2015, 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 TEST_ANY_MODULE_H -#define TEST_ANY_MODULE_H - -#include "thread_management_server.h" - -class test_thread_management_server -{ -public: - test_thread_management_server(); - - virtual ~test_thread_management_server(); - - void test_thread_management_server_init(); -}; - -#endif // TEST_ANY_TRACE_H diff --git a/test/nanostack/unittest/thread/thread_management_server/thread_management_server_test.cpp b/test/nanostack/unittest/thread/thread_management_server/thread_management_server_test.cpp deleted file mode 100644 index 24ddc34c4884..000000000000 --- a/test/nanostack/unittest/thread/thread_management_server/thread_management_server_test.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015, 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 "CppUTest/TestHarness.h" -#include "test_thread_management_server.h" - -TEST_GROUP(thread_management_server) -{ - test_thread_management_server *unit; - - void setup() { - unit = new test_thread_management_server(); - } - - void teardown() { - delete unit; - } -}; - -TEST(thread_management_server, Create) -{ - CHECK(unit != NULL); -} - -TEST(thread_management_server, test_thread_management_server_init) -{ - unit->test_thread_management_server_init(); -} diff --git a/unittest/header_test/Makefile b/unittest/header_test/Makefile deleted file mode 100644 index 54708cbf8c0d..000000000000 --- a/unittest/header_test/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Test that all of our public headers include all of their requisities. -# - -HEADER_DIR := ../../nanostack/ -HEADERS:= $(shell find $(HEADER_DIR) -type f -name '*.h' | sed 's/$(subst /,\/,$(HEADER_DIR))//' ) - -CFLAGS += -I$(HEADER_DIR) -SERVLIB_DIR := ../../../libService -EVENTLOOP_DIR := ../../../event-loop -CFLAGS += -I$(SERVLIB_DIR)/libService -CFLAGS += -I$(EVENTLOOP_DIR)/nanostack-event-loop - -.PHONY: run -run: $(HEADERS) - -# Dummy compile to see if header includes all its requisities -%.h: - @echo "#include \"$@\"" | gcc -c -o /dev/null $(CFLAGS) -xc - diff --git a/unittest/simulations/sim_address.c b/unittest/simulations/sim_address.c deleted file mode 100644 index d2c98daafbb3..000000000000 --- a/unittest/simulations/sim_address.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2014-2015, 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. - */ - -/** -* \file \test_libTrace\Test.c -* -* \brief Unit tests for libTrace -*/ -#include -#include -#include -#include -#include - -#include "unity.h" -#include "ns_address.h" -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" - -#include "unity.h" -#include "unity_improved.h" - -typedef enum { - IF_6LoWPAN, - IF_IPV6, - IF_LOCAL_SOCKET, -} nwk_interface_id; - -typedef struct protocol_interface_info_entry { - nwk_interface_id nwk_id; - int8_t id; - int8_t net_start_tasklet; - char *interface_name; -} protocol_interface_info_entry_t; - -typedef enum if_address_source_e { - ADDR_SOURCE_UNKNOWN, - ADDR_SOURCE_SLAAC, - ADDR_SOURCE_DHCP, - ADDR_SOURCE_STATIC, -} if_address_source_t; - -typedef enum if_address_callback_e { - ADDR_CALLBACK_DAD_COMPLETE, // Duplicate Address Detection complete - address now valid - ADDR_CALLBACK_DAD_FAILED, // Duplicate Address Detection failed - address is a duplicate, about to be deleted - ADDR_CALLBACK_TIMER, // state_timer reached 0 - ADDR_CALLBACK_DEPRECATED, // preferred lifetime reached 0 - ADDR_CALLBACK_INVALIDATED, // valid lifetime reached 0 - about to be deleted -} if_address_callback_t; - -struct if_address_entry; -typedef void if_address_callback_fn(struct protocol_interface_info_entry *interface, struct if_address_entry *addr, if_address_callback_t reason); - -typedef struct if_address_entry { - uint8_t address[16]; // IPv6 (or IPv4-mapped IPv6 in future) - uint8_t prefix_len; // length of prefix part - uint32_t valid_lifetime; // seconds remaining; 0xffffffff = infinite - uint32_t preferred_lifetime; // seconds remaining; 0 if deprecated, 0xffffffff = infinite - uint32_t state_timer; // ticks to state change - used by DAD, then can be used by protocol - uint8_t count; // general count field - used by DAD, then can be used by protocol - bool temporary; // RFC 4941 temporary address - bool tentative; // Tentative address (Duplicate Address Detection running) - if_address_source_t source; // - if_address_callback_fn *cb; // Address protocol callback function - void *data; // Address protocol data - ns_list_link_t link; -} if_address_entry_t; -protocol_interface_info_entry_t piie; - -typedef NS_LIST_HEAD(if_address_entry_t, link) if_address_list_t; - -if_address_list_t addr_list; - -int_fast8_t addr_delete(protocol_interface_info_entry_t *cur, const uint8_t address[static 16]) -{ - uint8_t *address_ptr = malloc(16); - if_address_entry_t *addr_ptr = NULL; - TEST_METHOD_CALLED("addr_delete", address_ptr); - memcpy(address_ptr, address, 16); - print_buf(address, 16); - ns_list_foreach(if_address_entry_t, cur_ptr, &addr_list) { - if (memcmp(cur_ptr->address, address, 16) == 0) { - addr_ptr = cur_ptr; - } - } - if (addr_ptr != NULL) { - printf(" Address found and deleted.\n"); - ns_list_remove(&addr_list, addr_ptr); - free(addr_ptr); - } else { - printf(" Address NOT found.\n"); - } - return 0; -} -void lt_test_addr_delete(const uint8_t address[static 16]) -{ - uint8_t *address_ptr; - address_ptr = TEST_METHOD_CHECK("addr_delete"); - TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(address, address_ptr, 16, "Incorrect address deleted"); - free(address_ptr); -} - -if_address_entry_t *addr_add(protocol_interface_info_entry_t *cur, const uint8_t address[static 16], uint_fast8_t prefix_len, if_address_source_t source, uint32_t valid_lifetime, uint32_t preferred_lifetime, bool skip_dad) -{ - if_address_entry_t *addr_ptr = malloc(sizeof(if_address_entry_t)); - - memcpy(addr_ptr->address, address, 16); - ns_list_add_to_start(&addr_list, addr_ptr); - - TEST_METHOD_CALLED("addr_add", addr_ptr); - printf(" addr = "); - print_buf(addr_ptr->address, 16); - return addr_ptr; -} -void lt_test_addr_add(const uint8_t address[static 16]) -{ - if_address_entry_t *addr_ptr; - addr_ptr = TEST_METHOD_CHECK("addr_add"); - TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(address, addr_ptr->address, 16, "Incorrect address"); -} - -if_address_entry_t *addr_get_entry(const protocol_interface_info_entry_t *interface, const uint8_t addr[static 16]) -{ - if_address_entry_t *addr_ptr = NULL; - - printf("SIM Address addr_get_entry()\n addr = "); - print_buf(addr, 16); - ns_list_foreach(if_address_entry_t, cur_ptr, &addr_list) { - if (memcmp(cur_ptr->address, addr, 16) == 0) { - addr_ptr = cur_ptr; - } - } - if (addr_ptr != NULL) { - printf(" Address found.\n"); - } else { - printf(" Address NOT found.\n"); - } - return addr_ptr; -} - -void lt_timeout_address(int8_t interface_id, const uint8_t address[static 16]) -{ - if_address_entry_t *addr_ptr; - ns_list_foreach(if_address_entry_t, cur_ptr, &addr_list) { - if (memcmp(cur_ptr->address, address, 16) == 0) { - addr_ptr = cur_ptr; - } - } - printf("lt_timeout_address()\n"); - if (addr_ptr != NULL) { - printf(" Address found calling_timeout.\n"); - piie.id = interface_id; - addr_ptr->cb(&piie, addr_ptr, ADDR_CALLBACK_TIMER); - } else { - printf(" Address NOT found.\n"); - } -} - -protocol_interface_info_entry_t *protocol_stack_interface_info_get_by_id(int8_t nwk_id) -{ - printf("SIM Protocol protocol_stack_interface_info_get_by_id()\n"); - return &piie; -} - diff --git a/unittest/simulations/sim_address.h b/unittest/simulations/sim_address.h deleted file mode 100644 index 7e44023cac6a..000000000000 --- a/unittest/simulations/sim_address.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014-2015, 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. - */ - -/** -* \file \test_libTrace\Test.c -* -* \brief Unit tests for libTrace -*/ -#include -#include -#include -#include -#include - -#include "unity.h" - -void lt_test_addr_delete(const uint8_t address[static 16]); - -void lt_test_addr_add(const uint8_t address[static 16]); - -/* - call timeout callback for address. -*/ -void lt_timeout_address(int8_t interface_id, const uint8_t address[static 16]); diff --git a/unittest/simulations/sim_nanostack.c b/unittest/simulations/sim_nanostack.c deleted file mode 100644 index 4ac7d798a0f3..000000000000 --- a/unittest/simulations/sim_nanostack.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2014-2015, 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. - */ - -/** -* \file \test_libTrace\Test.c -* -* \brief Unit tests for libTrace -*/ -#include -#include -#include -#include -#include - -#include "unity.h" - - -#ifdef DEBUG_MALLOC -void *ns_dyn_mem_temporary_alloc(int16_t alloc_size) -{ - mem_t *str_ptr; - str_ptr = malloc(sizeof(mem_t)); - str_ptr->size = alloc_size; - str_ptr->ptr = malloc(alloc_size + 8); - str_ptr->end_ptr = str_ptr->ptr + alloc_size + 4; - ns_list_add_to_start(&mem_list, str_ptr); - put_uint32(str_ptr->ptr, 0xdeadbeef); - put_uint32(str_ptr->end_ptr, 0xdeadbeef); - printf("Mem alloc ptr = %x\n", str_ptr->ptr + 4); - return str_ptr->ptr + 4; -} -void ns_dyn_mem_free(void *heap_ptr) -{ - mem_t *str_ptr; - printf("Mem Free ptr = %p\n", heap_ptr); - ns_list_foreach(mem_t, cur_ptr, &mem_list) { - if (cur_ptr->ptr + 4 == heap_ptr) { - str_ptr = cur_ptr; - } - } - if (str_ptr == NULL) { - printf("Unknown block deallocated\n"); - } - if (get_uint32(str_ptr->ptr) != 0xdeadbeef) { - printf("MEM HEAD override\n"); - return; - } - if (get_uint32(str_ptr->end_ptr) != 0xdeadbeef) { - printf("MEM TAIL override\n"); - return; - } - ns_list_remove(&mem_list, str_ptr); - free(str_ptr->ptr); - free(str_ptr); - return; -} -#else -void *ns_dyn_mem_temporary_alloc(int16_t alloc_size) -{ - return malloc(alloc_size); -} -void ns_dyn_mem_free(void *heap_ptr) -{ - free(heap_ptr); - return; -} -#endif -void *ns_dyn_mem_alloc(int16_t alloc_size) -{ - return ns_dyn_mem_temporary_alloc(alloc_size); -} - -#include "eventOS_event.h" - -int8_t eventOS_event_handler_create(void (*handler_func_ptr)(arm_event_s *), uint8_t init_event_type) -{ - return 1; -} -#include "eventOS_event_timer.h" -int8_t eventOS_event_timer_request(uint8_t snmessage, uint8_t event_type, int8_t tasklet_id, uint32_t time) -{ - return 1; -} - -/* Random library*/ -static uint32_t randoms = 1; -uint32_t randLIB_get_32bit(void) -{ - return randoms; -} -uint32_t randLIB_randomise_base(uint32_t base, uint16_t min_factor, uint16_t max_factor) -{ - return base; -} diff --git a/unittest/simulations/sim_socket_api.c b/unittest/simulations/sim_socket_api.c deleted file mode 100644 index d05b26d8c722..000000000000 --- a/unittest/simulations/sim_socket_api.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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. - */ - -/** -* \file \test_libTrace\Test.c -* -* \brief Unit tests for libTrace -*/ -#include -#include -#include -#include -#include - -#include "ns_list.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" - -#include "unity.h" -#include "unity_improved.h" - -/* Socket API*/ - -#include "socket_api.h" - -typedef struct { - int8_t id; - void (*cb_ptr)(void *); - uint8_t address[16]; - uint8_t *buffer_ptr; - uint16_t length; - ns_list_link_t link; -} socket_t; -typedef NS_LIST_HEAD(socket_t, link) socket_list_t; - -socket_list_t sckt_list; -// Test function -int lt_test_sockets_open() -{ - return ns_list_count(&sckt_list); -} - -socket_t *sim_get_socket(int8_t socket) -{ - ns_list_foreach(socket_t, cur_ptr, &sckt_list) { - if (cur_ptr->id == socket) { - return cur_ptr; - } - } - return NULL; -} -int8_t socket_open(uint8_t protocol, uint16_t identifier, void (*passed_fptr)(void *)) -{ - socket_t *sckt_ptr; - int8_t id = 1; - - ns_list_foreach(socket_t, cur_ptr, &sckt_list) { - if (cur_ptr->id == id) { - id++; - cur_ptr = ns_list_get_first(&sckt_list); - } - } - sckt_ptr = ns_dyn_mem_alloc(sizeof(socket_t)); - ns_list_add_to_start(&sckt_list, sckt_ptr); - sckt_ptr->id = id; - sckt_ptr->cb_ptr = passed_fptr; - printf("SIM Socket socket_open() id = %d\n", id); - return sckt_ptr->id; -} -int8_t socket_close(int8_t socket) -{ - socket_t *sckt_ptr; - printf("SIM Socket socket_close() id = %d\n", socket); - - sckt_ptr = sim_get_socket(socket); - if (sckt_ptr != NULL) { - ns_list_remove(&sckt_list, sckt_ptr); - ns_dyn_mem_free(sckt_ptr); - } - return 0; -} -typedef struct { - uint16_t socket_send_len; - uint8_t *socket_send_ptr; - uint8_t socket_send_address[16]; - int8_t socket_send_socket; -} socket_send_to_t; - -int8_t socket_sendto(int8_t socket, ns_address_t *address, uint8_t *buffer, uint16_t length) -{ - socket_send_to_t *data_ptr = malloc(sizeof(socket_send_to_t)); - printf("SIM Socket socket_sendto() socket = %d length = %d\n", socket, length); - data_ptr->socket_send_ptr = malloc(length); - memcpy(data_ptr->socket_send_ptr, buffer, length); - data_ptr->socket_send_len = length; - data_ptr->socket_send_socket = socket; - memcpy(data_ptr->socket_send_address, address->address, 16); - TEST_METHOD_CALLED("socket_sendto", data_ptr); - return 1; -} -void lt_test_socket_sendto(int8_t socket, uint8_t *address, uint8_t *buffer, uint16_t length) -{ - socket_send_to_t *data_ptr; - data_ptr = TEST_METHOD_CHECK("socket_sendto"); - printf("lt_test_socket_sendto() parameters\n"); - printf("Address :\n"); - print_buf(data_ptr->socket_send_address, 16); - printf("Data :\n"); - test_buf(buffer, length, data_ptr->socket_send_ptr, data_ptr->socket_send_len); - TEST_ASSERT_EQUAL_INT_MESSAGE(socket, data_ptr->socket_send_socket, "Wrong Socket ID"); - TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(address, data_ptr->socket_send_address, 16, "Incorrect destination address"); - TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(buffer, data_ptr->socket_send_ptr, data_ptr->socket_send_len, "MESSAGE_DATA_FAILED"); - TEST_ASSERT_EQUAL_INT_MESSAGE(length, data_ptr->socket_send_len, "Message length wrong"); - free(data_ptr->socket_send_ptr); - free(data_ptr); -} - -void lt_test_socket_recv_data(uint8_t interface, int8_t socket, uint8_t *address, uint8_t *buffer, uint16_t length) -{ - socket_callback_t sckt_data; - socket_t *sckt_ptr; - sckt_ptr = sim_get_socket(socket); - if (sckt_ptr == NULL) { - printf("Invalid socket"); - TEST_FAIL(); - - return ; - } - - sckt_data.event_type = 0 /*SOCKET_DATA*/; - sckt_data.socket_id = sckt_ptr->id; - sckt_data.interface_id = interface; - sckt_data.d_len = length; - sckt_ptr->buffer_ptr = buffer; - sckt_ptr->length = length; - memcpy(sckt_ptr->address, address, 16); - - sckt_ptr->cb_ptr(&sckt_data); -} - -int16_t socket_read(int8_t socket, ns_address_t *address, uint8_t *buffer, uint16_t length) -{ - printf("SIM Socket socket_read()\n"); - socket_t *sckt_ptr; - sckt_ptr = sim_get_socket(socket); - if (sckt_ptr == NULL) { - printf("Socket not found\n"); - return -1; - } - memcpy(buffer, sckt_ptr->buffer_ptr, length); - memcpy(address->address, sckt_ptr->address, 16); - return length; -} -int8_t socket_setsockopt(int8_t socket, uint8_t level, uint8_t opt_name, const void *opt_value, uint16_t opt_len) -{ - printf("SIM Socket socket_setsockopt() socket = %d name = %d ", socket, opt_name); - if (opt_name == 0xfe) { - printf("SOCKET_INTERFACE_SELECT"); - } - if (opt_name == 0xff) { - printf("SOCKET_IPV6_ADDRESS_SELECT"); - } - printf("\n"); - return 1; -} diff --git a/unittest/simulations/sim_socket_api.h b/unittest/simulations/sim_socket_api.h deleted file mode 100644 index a3b5e5a0aeb0..000000000000 --- a/unittest/simulations/sim_socket_api.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ -/* - -Socket api test functions call these from testcases to check data in messages - -*/ - - -/* - Check How many sockets are open -*/ -int lt_test_sockets_open(); - -/* - Check received message from socket -*/ -void lt_test_socket_sendto(int8_t socket, uint8_t *address, uint8_t *buffer, uint16_t length); - -/* - Send data to socket -*/ -void lt_test_socket_recv_data(uint8_t interface, int8_t socket, uint8_t *address, uint8_t *buffer, uint16_t length); diff --git a/unittest/thread_dhcp/.cproject b/unittest/thread_dhcp/.cproject deleted file mode 100644 index 3389dc297048..000000000000 --- a/unittest/thread_dhcp/.cproject +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/unittest/thread_dhcp/.project b/unittest/thread_dhcp/.project deleted file mode 100644 index 72da1e802bcf..000000000000 --- a/unittest/thread_dhcp/.project +++ /dev/null @@ -1,26 +0,0 @@ - - - thread_dhcp_unittest - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/unittest/thread_dhcp/Test.c b/unittest/thread_dhcp/Test.c deleted file mode 100644 index 6b848f64ca30..000000000000 --- a/unittest/thread_dhcp/Test.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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. - */ - -/** -* \file \test_libTrace\Test.c -* -* \brief Unit tests for libTrace -*/ -#include -#include -#include -#include -#include - -#include "unity.h" -#include "thread_dhcpv6_client.h" -#include "dhcp_service_api.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" - -#include "unity_improved.h" - -#include "sim_socket_api.h" -#include "sim_address.h" - -/* - * Unity test code starts - * - */ -void setUp(void) -{ - trace_init(); - set_trace_config(TRACE_ACTIVE_LEVEL_ALL); - - printf("\nUNITY testcase Begin\n"); -} - -void tearDown(void) -{ - unity_impr_teststep_clean(); - printf("UNITY testcase End\n"); - trace_free(); -} - -typedef struct { - int8_t interface; - uint8_t dhcp_addr[16]; - uint8_t mesh_link_prefix[16]; - uint8_t mac64[8]; -} test_ctx_t; - -test_ctx_t ctx; - -uint8_t test_router_id; -uint8_t test_router_mask_ptr[8]; -void dhcp_router_id_cb(int8_t interface_id, uint8_t *ml16_address, uint8_t router_id, const uint8_t router_mask_ptr[static 8]) -{ - TEST_METHOD_CALLED("dhcp_router_id_cb", NULL); - printf(" id = %x\n", router_id); - test_router_id = router_id; - if (router_mask_ptr != NULL) { - memcpy(test_router_mask_ptr, router_mask_ptr, 8); - } else { - memset(test_router_mask_ptr, 0, 8); - } -} -void lt_test_dhcp_router_id_cb(uint8_t router_id, const uint8_t router_mask_ptr[static 8]) -{ - TEST_METHOD_CHECK("dhcp_router_id_cb"); - TEST_ASSERT_EQUAL_INT_MESSAGE(router_id, test_router_id, "Wrong router id given"); - if (router_mask_ptr != NULL) { - TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(test_router_mask_ptr, router_mask_ptr, 8, "Incorrect router mask"); - } -} - -/* - * Testcases start here - * - * - * - * */ - - - -#define EID_SILICON_LABS 0x00 ,0x00 ,0x9b ,0xc1 - -#define MAC_ADDR 0x14 ,0x6e ,0x0a ,0x00 ,0x00 ,0x00 ,0x00 ,0x03 -#define SERVER_MAC_ADDR 0x14 ,0x6e ,0x0a ,0x02 ,0x00 ,0x01 ,0x04 ,0x00 - -#define MESH_PREFIX 0xfd ,0x00 ,0xdb ,0x08 ,0x00 ,0x00 ,0x00 ,0x00 -#define GLOBAL_PREFIX 0x20 ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 - -#define EMPTY_SHORT_ADDR 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 -#define ASSIGNED_ROUTER_ADDR 0x00 ,0x00 ,0x00 ,0xff ,0xfe ,0x00 ,0x04 ,0x00 - -#define IAID 0x00 ,0x00 ,0x00 ,0x01 -#define T1 0x00 ,0x00 ,0x00 ,0x00 -#define T2 0x00 ,0x00 ,0x00 ,0x00 -#define PREF_TIME 0x00 ,0x00 ,0x00 ,0x00 -#define REQ_TIME 0x00 ,0x00 ,0x00 ,0x00 -#define EMPTY_ROUTER_IA_ADDRESS 0x00 ,0x05 ,0x00 ,0x18, MESH_PREFIX, EMPTY_SHORT_ADDR, PREF_TIME, REQ_TIME -#define ASSIGNER_ROUTER_IA_ADDRESS 0x00 ,0x05 ,0x00 ,0x18, MESH_PREFIX, ASSIGNED_ROUTER_ADDR, PREF_TIME, REQ_TIME - - -#define ROUTER_ID 0x09 -#define ROUTER_MASK 0xC0 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 -#define VENDOR_OPTION 0x00 ,0x00 ,0x00 ,0x09 ,ROUTER_ID, ROUTER_MASK -#define VENDOR_SPECIFIC 0x00 ,0x11 ,0x00 ,0x11 ,EID_SILICON_LABS, VENDOR_OPTION - -#define CLIENT_IDENTIFIER 0x00 ,0x01 ,0x00 ,0x0c ,0x00 ,0x03 ,0x00 ,0x1b ,MAC_ADDR -#define SERVER_IDENTIFIER 0x00 ,0x02 ,0x00 ,0x0c ,0x00 ,0x03 ,0x00 ,0x1b ,SERVER_MAC_ADDR -#define RAPID_COMMIT 0x00 ,0x0e ,0x00 ,0x00 -#define ELAPSED_TIME 0x00 ,0x08 ,0x00 ,0x02 ,0x00 ,0x00 -#define OPTION_REQUEST_VENDOR 0x00 ,0x06 ,0x00 ,0x02 ,0x00 ,0x11 -#define OPTION_REQUEST_EMPTY 0x00 ,0x06 ,0x00 ,0x00 -#define EMPTY_ROUTER_IAFNTA 0x00 ,0x03 ,0x00 ,0x28 ,IAID ,T1 ,T2 ,EMPTY_ROUTER_IA_ADDRESS -#define ASSIGNED_ROUTER_IAFNTA 0x00 ,0x03 ,0x00 ,0x28 ,IAID ,T1 ,T2 ,ASSIGNER_ROUTER_IA_ADDRESS - -/*Global address defines*/ -#define EMPTY_GUA_IA_ADDRESS 0x00 ,0x05 ,0x00 ,0x18, GLOBAL_PREFIX, EMPTY_SHORT_ADDR, PREF_TIME, REQ_TIME -#define EMPTY_GUA_IAFNTA 0x00 ,0x03 ,0x00 ,0x28 ,IAID ,T1 ,T2 ,EMPTY_GUA_IA_ADDRESS -#define GUA_ASSIGNED_ADDR 0x00 ,0x00 ,0x00 ,0x00 ,0x04 ,0x03 ,0x02 ,0x01 -#define ASSIGNED_GUA_IA_ADDRESS 0x00 ,0x05 ,0x00 ,0x18, GLOBAL_PREFIX, GUA_ASSIGNED_ADDR, PREF_TIME, REQ_TIME -#define ASSIGNED_GUA_IAFNTA 0x00 ,0x03 ,0x00 ,0x28 ,IAID ,T1 ,T2 ,ASSIGNED_GUA_IA_ADDRESS - - -uint8_t router_solicit_req[] = { - 0x01 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , CLIENT_IDENTIFIER - , RAPID_COMMIT - , OPTION_REQUEST_VENDOR - , EMPTY_ROUTER_IAFNTA -}; -uint8_t router_solicit_resp[] = { - 0x07 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , SERVER_IDENTIFIER - , CLIENT_IDENTIFIER - , VENDOR_SPECIFIC - , RAPID_COMMIT - , ASSIGNED_ROUTER_IAFNTA -}; - -uint8_t gua_dhcp_addr[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}; -uint8_t gua_prefix[16] = {GLOBAL_PREFIX}; -uint8_t gua_assigned_addr[16] = {GLOBAL_PREFIX, GUA_ASSIGNED_ADDR}; - -uint8_t leader_addr[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; -uint8_t router_addr[16] = {MESH_PREFIX, ASSIGNED_ROUTER_ADDR}; -uint8_t mesh_link_prefix[16] = {MESH_PREFIX}; -uint8_t mac[8] = {MAC_ADDR}; -uint8_t server_mac[8] = {SERVER_MAC_ADDR}; -uint8_t router_mask[8] = {ROUTER_MASK}; - -void test_client_init(void) -{ - TEST_DESCRIPTION("1 test service create and delete\n"); - TEST_ASSERT_EQUAL_INT(0, lt_test_sockets_open()); - thread_dhcp_client_init(1); - TEST_ASSERT_EQUAL_INT(2, lt_test_sockets_open()); - thread_dhcp_client_delete(1); - TEST_ASSERT_EQUAL_INT(0, lt_test_sockets_open()); - thread_dhcp_client_init(2); - TEST_ASSERT_EQUAL_INT(2, lt_test_sockets_open()); - thread_dhcp_client_delete(2); - TEST_ASSERT_EQUAL_INT(0, lt_test_sockets_open()); -} - - - -uint8_t gua_solicit_req[] = { - 0x01 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , CLIENT_IDENTIFIER - , RAPID_COMMIT - , OPTION_REQUEST_EMPTY - , EMPTY_GUA_IAFNTA -}; -uint8_t gua_solicit_resp[] = { - 0x07 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , SERVER_IDENTIFIER - , CLIENT_IDENTIFIER - , VENDOR_SPECIFIC - , RAPID_COMMIT - , ASSIGNED_GUA_IAFNTA -}; - -void test_client_get_global_address(void) -{ - TEST_DESCRIPTION("1 get Global address\n" - "2 delete Global address manually\n" - "3 delete service\n"); - thread_dhcp_client_init(1); - thread_dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - lt_test_socket_recv_data(1, 2, gua_dhcp_addr, gua_solicit_resp, sizeof(gua_solicit_resp)); - lt_test_addr_add(gua_assigned_addr); - - thread_dhcp_client_global_address_delete(1, gua_dhcp_addr, gua_prefix); // Delete GUA by hand - lt_test_addr_delete(gua_assigned_addr); - thread_dhcp_client_delete(1); -} - -void test_client_get_global_address_retry(void) -{ - TEST_DESCRIPTION("1 get Global address\n" - "2 no response, make retransmission\n" - "3 receive reply \n" - "4 delete service\n" - "5 service deletes allocated address\n"); - thread_dhcp_client_init(1); - thread_dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - - dhcp_service_timer_tick(10); - dhcp_service_timer_tick(10); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - - lt_test_socket_recv_data(1, 2, gua_dhcp_addr, gua_solicit_resp, sizeof(gua_solicit_resp)); - lt_test_addr_add(gua_assigned_addr); - - thread_dhcp_client_delete(1); - lt_test_addr_delete(gua_assigned_addr); -} - -uint8_t non_assigned_gua[16] = {GLOBAL_PREFIX, 0}; -void test_client_get_global_address_retry_no_response(void) -{ - TEST_DESCRIPTION("1 get Global address\n" - "2 no response, make retransmissions\n" - "3 delete service\n"); - thread_dhcp_client_init(1); - thread_dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - - dhcp_service_timer_tick(11); // Allow for max 1.1 initial randomisation - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - dhcp_service_timer_tick(24); // Allow for max 2.1 randomisation each retry - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - dhcp_service_timer_tick(49); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - dhcp_service_timer_tick(102); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - dhcp_service_timer_tick(214); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - dhcp_service_timer_tick(450); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - dhcp_service_timer_tick(944); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - dhcp_service_timer_tick(1982); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - - thread_dhcp_client_delete(1); - lt_test_addr_delete(non_assigned_gua);// TODO This is bug should fix add boolean when got address. -} - -#undef T1 -#undef T2 -#define T1 0x00 ,0x00 ,0x00 ,0x32 -#define T2 0x00 ,0x00 ,0x00 ,0x4b -#define ASSIGNED_GUA_IAFNTA 0x00 ,0x03 ,0x00 ,0x28 ,IAID ,T1 ,T2 ,ASSIGNED_GUA_IA_ADDRESS -uint8_t gua_renew_req[] = { - 0x05 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , CLIENT_IDENTIFIER - , SERVER_IDENTIFIER - , RAPID_COMMIT - , OPTION_REQUEST_EMPTY - , ASSIGNED_GUA_IAFNTA -}; -uint8_t gua_renew_resp[] = { - 0x07 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , SERVER_IDENTIFIER - , CLIENT_IDENTIFIER - , VENDOR_SPECIFIC - , RAPID_COMMIT - , ASSIGNED_GUA_IAFNTA -}; - -void test_client_global_address_renew(void) -{ - TEST_DESCRIPTION("1 get Global address\n" - "2 receive reply \n" - "3 receive timeout for global address\n" - "4 send renew\n" - "5 recv renew\n" - "6 delete address\n" - "7 service delete\n"); - thread_dhcp_client_init(1); - thread_dhcp_client_get_global_address(1, gua_dhcp_addr, gua_prefix, mac, NULL); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_solicit_req, sizeof(gua_solicit_req)); - lt_test_socket_recv_data(1, 2, gua_dhcp_addr, gua_solicit_resp, sizeof(gua_solicit_resp)); - lt_test_addr_add(gua_assigned_addr); - lt_timeout_address(1, gua_assigned_addr); - lt_test_socket_sendto(2, gua_dhcp_addr, gua_renew_req, sizeof(gua_renew_req)); - lt_test_socket_recv_data(1, 2, gua_dhcp_addr, gua_renew_resp, sizeof(gua_renew_resp)); - thread_dhcp_client_global_address_delete(1, gua_dhcp_addr, gua_prefix); // Delete GUA by hand - lt_test_addr_delete(gua_assigned_addr); - thread_dhcp_client_delete(1); -} - -#undef T1 -#undef T2 -#define T1 0x00 ,0x00 ,0x00 ,0x32 -#define T2 0x00 ,0x00 ,0x00 ,0x4b -#define ASSIGNED_ROUTER_IAFNTA 0x00 ,0x03 ,0x00 ,0x28 ,IAID ,T1 ,T2 ,ASSIGNER_ROUTER_IA_ADDRESS - -uint8_t router_renew_req[] = { - 0x05 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , CLIENT_IDENTIFIER - , SERVER_IDENTIFIER - , RAPID_COMMIT - , OPTION_REQUEST_VENDOR - , ASSIGNED_ROUTER_IAFNTA -}; -uint8_t router_renew_resp[] = { - 0x07 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , SERVER_IDENTIFIER - , CLIENT_IDENTIFIER - , VENDOR_SPECIFIC - , RAPID_COMMIT - , ASSIGNED_ROUTER_IAFNTA -}; - diff --git a/unittest/thread_dhcp/makefile b/unittest/thread_dhcp/makefile deleted file mode 100644 index aae131e99948..000000000000 --- a/unittest/thread_dhcp/makefile +++ /dev/null @@ -1,45 +0,0 @@ -C_COMPILER=gcc -TARGET_BASE=test_thread_dhcp -TARGET_EXTENSION=.exe -TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) -UNIT_TEST_BASE = ../../../unittest/src - -SRC_FILES = $(UNIT_TEST_BASE)/unity.c Test_Runner.c ../unity_improvement/unity_improved.c -## Test files and simulated interfaces -SRC_FILES += Test.c -SRC_FILES += ../simulations/sim_nanostack.c ../simulations/sim_address.c ../simulations/sim_socket_api.c -## libservice dependencies -SRC_FILES += ../../../libService/source/libList/ns_list.c -SRC_FILES += ../../../libService/source/libTrace/ns_trace.c -SRC_FILES += ../../../libService/source/libip6string/ip6tos.c -SRC_FILES += ../../../libService/source/libBits/common_functions.c -## nanostack files -TEST_SRC_FILES += ../../source/6LoWPAN/Thread/thread_dhcpv6_client.c -TEST_SRC_FILES += ../../source/libDHCPv6/dhcp_service_api.c -TEST_SRC_FILES += ../../source/libDHCPv6/libDHCPv6.c - -SRC_FILES += $(TEST_SRC_FILES) -INC_DIRS = -I$(UNIT_TEST_BASE) -I../../source/6LoWPAN/Thread/ -I../../nanostack -I../../source -I../../../event-loop/nanostack-event-loop -I../../../libService/libService -I../simulations -I../unity_improvement - -SYMBOLS=-DTEST -std=gnu99 -pedantic -D'MEM_ALLOC=malloc' -D'MEM_FREE=free' -fprofile-arcs -ftest-coverage -O0 - -CLEANUP=rm -f Test_Runner.c&&rm -f *.gcno&&rm -f *.gcda&&rm -f *.gcov&&rm -f $(TARGET) - -all: clean default - -run: clean default execute -cov: clean default execute coverage - -default: - ruby $(UNIT_TEST_BASE)/../auto/generate_test_runner.rb Test.c Test_Runner.c - $(C_COMPILER) -g -O0 -DFEA_TRACE_SUPPORT $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(TARGET) - -execute: - ./$(TARGET) - -TEST_FILES := $(notdir $(TEST_SRC_FILES)) -coverage: - gcov -r $(TEST_FILES)&&rm -f *.gcno&&rm -f *.gcda - -clean: - $(CLEANUP) diff --git a/unittest/thread_dhcp_servers/.cproject b/unittest/thread_dhcp_servers/.cproject deleted file mode 100644 index b4d1b76cce64..000000000000 --- a/unittest/thread_dhcp_servers/.cproject +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/unittest/thread_dhcp_servers/.project b/unittest/thread_dhcp_servers/.project deleted file mode 100644 index 7560b1e0a99d..000000000000 --- a/unittest/thread_dhcp_servers/.project +++ /dev/null @@ -1,27 +0,0 @@ - - - thread_dhcp_servers - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/unittest/thread_dhcp_servers/Test.c b/unittest/thread_dhcp_servers/Test.c deleted file mode 100644 index d6770483c3e7..000000000000 --- a/unittest/thread_dhcp_servers/Test.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Copyright (c) 2014-2016, 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. - */ - -/** -* \file \test_libTrace\Test.c -* -* \brief Unit tests for libTrace -*/ -#include -#include -#include -#include -#include - -#include "unity.h" -#include "thread_dhcpv6_client.h" -#include "dhcp_service_api.h" -#include "ns_trace.h" -#include "nsdynmemLIB.h" - -#include "unity_improved.h" - -#include "sim_socket_api.h" -#include "sim_address.h" - -/* - * Unity test code starts - * - */ -void setUp(void) -{ - trace_init(); - set_trace_config(TRACE_ACTIVE_LEVEL_ALL); - - printf("\nUNITY testcase Begin\n"); -} - -void tearDown(void) -{ - unity_impr_teststep_clean(); - printf("UNITY testcase End\n"); - trace_free(); -} - - -uint8_t test_router_id; -uint8_t test_router_mask_ptr[8]; -void dhcp_router_id_cb(int32_t tr_id, uint8_t router_id, const uint8_t router_mask_ptr[static 8]) -{ - TEST_METHOD_CALLED("dhcp_router_id_cb", NULL); - printf(" id = %x\n", router_id); - test_router_id = router_id; - if (router_mask_ptr != NULL) { - memcpy(test_router_mask_ptr, router_mask_ptr, 8); - } else { - memset(test_router_mask_ptr, 0, 8); - } -} -void lt_test_dhcp_router_id_cb(uint8_t router_id, const uint8_t router_mask_ptr[static 8]) -{ - TEST_METHOD_CHECK("dhcp_router_id_cb"); - TEST_ASSERT_EQUAL_INT_MESSAGE(router_id, test_router_id, "Wrong router id given"); - if (router_mask_ptr != NULL) { - TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(test_router_mask_ptr, router_mask_ptr, 8, "Incorrect router mask"); - } -} -typedef struct { - uint16_t instance_id; - void *ptr; - uint8_t msg_name; - uint8_t *msg_ptr; - uint16_t msg_len; -} test_service_recv_resp_t; - -int test_dhcp_service_receive_resp_cb_a(uint16_t instance_id, void *ptr, uint8_t msg_name, uint8_t *msg_ptr, uint16_t msg_len) -{ - test_service_recv_resp_t *msg_data_ptr = malloc(sizeof(test_service_recv_resp_t)); - msg_data_ptr->instance_id = instance_id; - msg_data_ptr->ptr = ptr; - msg_data_ptr->msg_name = msg_name; - msg_data_ptr->msg_ptr = malloc(msg_len); - memcpy(msg_data_ptr->msg_ptr, msg_ptr, msg_len); - msg_data_ptr->msg_len = msg_len; - TEST_METHOD_CALLED("dhcp_service_receive_resp_cb", msg_data_ptr); - return RET_MSG_ACCEPTED; -} -int test_dhcp_service_receive_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uint8_t *msg_ptr, uint16_t msg_len) -{ - test_service_recv_resp_t *msg_data_ptr; - msg_data_ptr = TEST_METHOD_CHECK("dhcp_service_receive_resp_cb"); - printf("Data :\n"); - test_buf(msg_ptr, msg_len, msg_data_ptr->msg_ptr, msg_data_ptr->msg_len); - TEST_ASSERT_EQUAL_INT_MESSAGE(instance_id, msg_data_ptr->instance_id, "Wrong instance ID"); - TEST_ASSERT_EQUAL_INT_MESSAGE(ptr, msg_data_ptr->ptr, "Wrong pointer received"); - TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(msg_ptr, msg_data_ptr->msg_ptr, msg_data_ptr->msg_len, "MESSAGE_DATA_FAILED"); - TEST_ASSERT_EQUAL_INT_MESSAGE(msg_len, msg_data_ptr->msg_len, "Message length wrong"); - free(msg_data_ptr->msg_ptr); - free(msg_data_ptr); -} - -/* - * Testcases start here - * - * - * - * */ -#define EID_SILICON_LABS 0x00 ,0x00 ,0x9b ,0xc1 - -#define MESH_PREFIX 0xfd ,0x00 ,0xdb ,0x08 ,0x00 ,0x00 ,0x00 ,0x00 -#define GLOBAL_PREFIX 0x20 ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 - - - -#define MAC_ADDR 0x14 ,0x6e ,0x0a ,0x00 ,0x00 ,0x00 ,0x00 ,0x03 -#define SERVER_MAC_ADDR 0x14 ,0x6e ,0x0a ,0x02 ,0x00 ,0x01 ,0x04 ,0x00 - -#define SHORT_ADDR 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 -#define ASSIGNEDSHORT_ADDR 0x00 ,0x00 ,0x00 ,0xff ,0xfe ,0x00 ,0x04 ,0x00 - -#define IAID 0x00 ,0x00 ,0x00 ,0x01 -#define T1 0x00 ,0x00 ,0x00 ,0x00 -#define T2 0x00 ,0x00 ,0x00 ,0x00 -#define PREF_TIME 0x00 ,0x00 ,0x00 ,0x00 -#define REQ_TIME 0x00 ,0x00 ,0x00 ,0x00 -#define IA_ADDRESS 0x00 ,0x05 ,0x00 ,0x18, MESH_PREFIX, SHORT_ADDR, PREF_TIME, REQ_TIME -#define ASSIGNER_ROUTER_IA_ADDRESS 0x00 ,0x05 ,0x00 ,0x18, MESH_PREFIX, ASSIGNEDSHORT_ADDR, PREF_TIME, REQ_TIME - - -#define ROUTER_ID 0x01 -#define ROUTER_MASK 0xC0 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 - -#define CLIENT_IDENTIFIER 0x00 ,0x01 ,0x00 ,0x0c ,0x00 ,0x03 ,0x00 ,0x1b ,MAC_ADDR -#define SERVER_IDENTIFIER 0x00 ,0x02 ,0x00 ,0x0c ,0x00 ,0x03 ,0x00 ,0x1b ,SERVER_MAC_ADDR -#define RAPID_COMMIT 0x00 ,0x0e ,0x00 ,0x00 -#define ELAPSED_TIME 0x00 ,0x08 ,0x00 ,0x02 ,0x00 ,0x00 -#define OPTION_REQUEST 0x00 ,0x06 ,0x00 ,0x02 ,0x00 ,0x11 -#define IAFNTA 0x00 ,0x03 ,0x00 ,0x28 ,IAID ,T1 ,T2 ,IA_ADDRESS -#define ASSIGNED_IAFNTA 0x00 ,0x03 ,0x00 ,0x28 ,IAID ,T1 ,T2 ,ASSIGNER_ROUTER_IA_ADDRESS -#define VENDOR_OPTION 0x00 ,0x00 ,0x00 ,0x09 ,ROUTER_ID, ROUTER_MASK -#define VENDOR_SPECIFIC 0x00 ,0x11 ,0x00 ,0x11 ,EID_SILICON_LABS, VENDOR_OPTION - -uint8_t router_solicit_req[] = { - 0x01 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , CLIENT_IDENTIFIER - , RAPID_COMMIT - , OPTION_REQUEST - , IAFNTA -}; -uint8_t router_solicit_resp[] = { - 0x07 , 0x00 , 0x00 , 0x01 - , ELAPSED_TIME - , SERVER_IDENTIFIER - , CLIENT_IDENTIFIER - , VENDOR_SPECIFIC - , RAPID_COMMIT - , ASSIGNED_IAFNTA -}; - -#undef PREF_TIME -#undef REQ_TIME - -#define PREF_TIME 0x00 ,0x00 ,0x0e ,0x10 -#define REQ_TIME 0x00 ,0x00 ,0x1c ,0x20 - -uint8_t gua_dhcp_addr[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}; -uint8_t gua_prefix[16] = {GLOBAL_PREFIX}; -uint8_t gua_assigned_addr[16] = {GLOBAL_PREFIX, ASSIGNEDSHORT_ADDR}; - -uint8_t leader_addr[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; -uint8_t router_addr[16] = {MESH_PREFIX, ASSIGNEDSHORT_ADDR}; -uint8_t mesh_link_prefix[16] = {MESH_PREFIX}; -uint8_t mac[8] = {MAC_ADDR}; -uint8_t server_mac[8] = {SERVER_MAC_ADDR}; -uint8_t router_mask[8] = {ROUTER_MASK}; - - -uint8_t arm_router_solicit_resp[] = { - 0x07 , 0x00 , 0x00 , 0x01 - , SERVER_IDENTIFIER - , CLIENT_IDENTIFIER - , ASSIGNED_IAFNTA - , VENDOR_SPECIFIC - , RAPID_COMMIT -}; - -/* - -Simulated test functions -*/ - -typedef struct { - uint16_t instance_id; - uint32_t msg_tr_id; - uint8_t msg_name; - uint8_t *msg_ptr; - uint16_t msg_len; -} test_recv_req_cb_t; - -int sim_dhcp_service_receive_req_cb(uint16_t instance_id, uint32_t msg_tr_id, uint8_t msg_name, uint8_t *msg_ptr, uint16_t msg_len) -{ - test_recv_req_cb_t *msg_data_ptr; - msg_data_ptr = malloc(sizeof(test_recv_req_cb_t)); - msg_data_ptr->instance_id = instance_id; - msg_data_ptr->msg_name = msg_name; - msg_data_ptr->msg_tr_id = msg_tr_id; - TEST_METHOD_CALLED("dhcp_service_receive_req_cb", msg_data_ptr); - printf(" instance id = %d\n", instance_id); - printf(" tr id = %d\n", msg_tr_id); - - return RET_MSG_ACCEPTED; -} -void lt_dhcp_service_receive_req_cb(uint16_t instance_id, uint32_t msg_tr_id, uint8_t msg_name, uint8_t *msg_ptr, uint16_t msg_len) -{ - test_recv_req_cb_t *msg_data_ptr = TEST_METHOD_CHECK("dhcp_service_receive_req_cb"); - TEST_ASSERT_EQUAL_INT_MESSAGE(instance_id, msg_data_ptr->instance_id, "Wrong Instance ID"); - TEST_ASSERT_EQUAL_INT_MESSAGE(msg_name, msg_data_ptr->msg_name, "Wrong msg name ID"); - TEST_ASSERT_EQUAL_INT_MESSAGE(msg_tr_id, msg_data_ptr->msg_tr_id, "Wrong transaction ID"); - free(msg_data_ptr); -} -int ut_dhcp_service_send_resp(uint32_t msg_tr_id, uint8_t options, uint8_t *msg_ptr, uint16_t msg_len) -{ - uint8_t *ptr; - dhcp_service_send_resp(msg_tr_id, options, msg_ptr, msg_len); -} - -uint8_t routerMask[8] = {ROUTER_MASK}; -uint8_t routerID = ROUTER_ID; - -/* - - Testcase definitions - -*/ - - -void test_service_server_init(void) -{ - uint16_t instance1, instance2; - TEST_DESCRIPTION("1 Init multible service\n" - "2 receive message for service \n" - "3 answer message\n" - "6 service delete\n"); - instance1 = dhcp_service_init(1, sim_dhcp_service_receive_req_cb); - instance2 = dhcp_service_init(1, sim_dhcp_service_receive_req_cb); - lt_test_socket_recv_data(1, 1, gua_dhcp_addr, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 1/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - dhcp_service_timer_tick(49); - dhcp_service_timer_tick(49); - ut_dhcp_service_send_resp(1/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, gua_dhcp_addr, router_solicit_resp, sizeof(router_solicit_resp)); - - dhcp_service_delete(instance1); - dhcp_service_delete(instance2); -} -void test_service_server_init_wrong_interface(void) -{ - uint16_t instance1, instance2; - TEST_DESCRIPTION("1 Init multible service\n" - "2 receive message for client socket \n" - "6 service delete\n"); - instance1 = dhcp_service_init(1, sim_dhcp_service_receive_req_cb); - instance2 = dhcp_service_init(1, sim_dhcp_service_receive_req_cb); - lt_test_socket_recv_data(2, 1, gua_dhcp_addr, router_solicit_resp, sizeof(router_solicit_resp)); - dhcp_service_delete(instance1); - dhcp_service_delete(instance2); -} - -void test_router_id_server_init(void) -{ - TEST_DESCRIPTION("1 init router id server\n" - "2 receive message for service \n" - "3 answer message\n" - "6 service delete\n"); - thread_routerid_server_init(1, mesh_link_prefix, server_mac); - lt_test_socket_recv_data(1, 1, gua_dhcp_addr, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_sendto(1, gua_dhcp_addr, arm_router_solicit_resp, sizeof(arm_router_solicit_resp)); - thread_routerid_server_delete(1); -} -uint8_t clt_addr1[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; -uint8_t clt_addr2[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2}; -uint8_t clt_addr3[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}; -uint8_t clt_addr4[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}; -uint8_t clt_addr5[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}; -uint8_t clt_addr6[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6}; -uint8_t clt_addr7[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7}; -uint8_t clt_addr8[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}; - -void test_service_server_multi_client(void) -{ - uint16_t instance1, instance2; - TEST_DESCRIPTION("1 Init multible service\n" - "2 receive Multiple messages for service from different clients all use same message tr id\n" - "3 answer messages\n" - "6 service delete\n"); - instance1 = dhcp_service_init(1, sim_dhcp_service_receive_req_cb); - instance2 = dhcp_service_init(1, sim_dhcp_service_receive_req_cb); - lt_test_socket_recv_data(1, 1, clt_addr1, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 1/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_recv_data(1, 1, clt_addr2, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 2/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_recv_data(1, 1, clt_addr3, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 3/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_recv_data(1, 1, clt_addr4, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 4/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_recv_data(1, 1, clt_addr5, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 5/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_recv_data(1, 1, clt_addr6, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 6/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_recv_data(1, 1, clt_addr7, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 7/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_recv_data(1, 1, clt_addr8, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 8/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - - ut_dhcp_service_send_resp(1/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr1, router_solicit_resp, sizeof(router_solicit_resp)); - ut_dhcp_service_send_resp(1/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); // tests so that no duplicates - - ut_dhcp_service_send_resp(8/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr8, router_solicit_resp, sizeof(router_solicit_resp)); - ut_dhcp_service_send_resp(2/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr2, router_solicit_resp, sizeof(router_solicit_resp)); - ut_dhcp_service_send_resp(7/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr7, router_solicit_resp, sizeof(router_solicit_resp)); - ut_dhcp_service_send_resp(6/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr6, router_solicit_resp, sizeof(router_solicit_resp)); - ut_dhcp_service_send_resp(3/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr3, router_solicit_resp, sizeof(router_solicit_resp)); - ut_dhcp_service_send_resp(4/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr4, router_solicit_resp, sizeof(router_solicit_resp)); -// transaction 5 not answered check that no leaks left - dhcp_service_delete(instance1); - dhcp_service_delete(instance2); -} -void test_service_server_multi_client_test_2(void) -{ - uint16_t instance1, instance2; - TEST_DESCRIPTION("1 Init multible service\n" - "2 send one client transaction\n" - "3 receive Multiple messages for service from different clients all use same message tr id\n" - "4 receive response to client transaction\n" - "5 answer messages\n" - "6 service delete\n"); - instance1 = dhcp_service_init(1, sim_dhcp_service_receive_req_cb); - instance2 = dhcp_service_init(1, sim_dhcp_service_receive_req_cb); - - dhcp_service_send_req(1, 0, (void *)3333, gua_dhcp_addr, router_solicit_req, sizeof(router_solicit_req), test_dhcp_service_receive_resp_cb_a); - lt_test_socket_sendto(2, gua_dhcp_addr, router_solicit_req, sizeof(router_solicit_req)); - - lt_test_socket_recv_data(1, 1, clt_addr1, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 2/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_recv_data(1, 1, clt_addr2, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 3/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - lt_test_socket_recv_data(1, 1, clt_addr3, router_solicit_req, sizeof(router_solicit_req)); - lt_dhcp_service_receive_req_cb(2, 4/*msg_tr_id*/, 0x01, router_solicit_req, sizeof(router_solicit_req)); - - lt_test_socket_recv_data(1, 2, gua_dhcp_addr, router_solicit_resp, sizeof(router_solicit_resp)); - test_dhcp_service_receive_resp_cb(1, (void *)3333, 0x07, &router_solicit_resp[4], sizeof(router_solicit_resp) - 4); - - ut_dhcp_service_send_resp(2/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr1, router_solicit_resp, sizeof(router_solicit_resp)); - ut_dhcp_service_send_resp(3/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr2, router_solicit_resp, sizeof(router_solicit_resp)); - ut_dhcp_service_send_resp(4/*msg_tr_id*/, 0, router_solicit_resp, sizeof(router_solicit_resp)); - lt_test_socket_sendto(1, clt_addr3, router_solicit_resp, sizeof(router_solicit_resp)); - dhcp_service_delete(instance1); - dhcp_service_delete(instance2); -} - - diff --git a/unittest/thread_dhcp_servers/makefile b/unittest/thread_dhcp_servers/makefile deleted file mode 100644 index 1440f01b6c47..000000000000 --- a/unittest/thread_dhcp_servers/makefile +++ /dev/null @@ -1,46 +0,0 @@ -C_COMPILER=gcc -TARGET_BASE=test_thread_dhcp_servers -TARGET_EXTENSION=.exe -TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) -UNIT_TEST_BASE = ../../../unittest/src - -SRC_FILES = $(UNIT_TEST_BASE)/unity.c Test_Runner.c ../unity_improvement/unity_improved.c -## Test files and simulated interfaces -SRC_FILES += Test.c -SRC_FILES += ../simulations/sim_nanostack.c ../simulations/sim_address.c ../simulations/sim_socket_api.c -## libservice dependencies -SRC_FILES += ../../../libService/source/libList/ns_list.c -SRC_FILES += ../../../libService/source/libTrace/ns_trace.c -SRC_FILES += ../../../libService/source/libip6string/ip6tos.c -SRC_FILES += ../../../libService/source/libBits/common_functions.c -## nanostack files -TEST_SRC_FILES += ../../source/6LoWPAN/Thread/thread_routerid_server.c -TEST_SRC_FILES += ../../source/libDHCPv6/dhcp_service_api.c -TEST_SRC_FILES += ../../source/libDHCPv6/libDHCPv6.c - -SRC_FILES += $(TEST_SRC_FILES) -INC_DIRS = -I$(UNIT_TEST_BASE) -I../../source/6LoWPAN/Thread/ -I../../nanostack -I../../source -I../../../event-loop/nanostack-event-loop -I../../../libService/libService -I../simulations -I../unity_improvement - -SYMBOLS=-DTEST -std=gnu99 -pedantic -D'MEM_ALLOC=malloc' -D'MEM_FREE=free' -fprofile-arcs -ftest-coverage -O0 - -CLEANUP=rm -f Test_Runner.c&&rm -f *.gcno&&rm -f *.gcda&&rm -f *.gcov&&rm -f $(TARGET) - -all: clean default - -run: clean default execute - -cov: clean default execute coverage - -default: - ruby $(UNIT_TEST_BASE)/../auto/generate_test_runner.rb Test.c Test_Runner.c - $(C_COMPILER) -g -O0 -DFEA_TRACE_SUPPORT $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) -o $(TARGET) - -execute: - ./$(TARGET) - -TEST_FILES := $(notdir $(TEST_SRC_FILES)) -coverage: - gcov -r $(TEST_FILES)&&rm -f *.gcno&&rm -f *.gcda - -clean: - $(CLEANUP) diff --git a/unittest/unity_improvement/unity_improved.c b/unittest/unity_improvement/unity_improved.c deleted file mode 100644 index b625c7aa8583..000000000000 --- a/unittest/unity_improvement/unity_improved.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2014-2015, 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. - */ - -/** -* \file \test_libTrace\Test.c -* -* \brief Unit tests for libTrace -*/ -#include -#include -#include -#include -#include - -#include "unity.h" -#include "ns_list.h" -#include "ns_trace.h" - -void print_buf(const uint8_t *buf, uint16_t len) -{ - for (int n = 1; n <= len; n++) { - printf(",%02xh", buf[n - 1]); - if (n % 16 == 0) { - printf("\n"); - } - } -} -void test_buf(const uint8_t *buf, uint16_t len, const uint8_t *buf1, uint16_t len1) -{ - int c, n; - c = len < len1 ? len : len1; - - for (n = 0; n < c; n++) { - if (buf[n] == buf1[n]) { - printf(",%02xh", buf[n]); - } else { - break; - } - } - if (n < c) { - // not equal outputted - printf("\nRemaining expected:\n"); - print_buf(&buf[n], len - n); - printf("\nRemaining received:\n"); - print_buf(&buf1[n], len1 - n); - } - printf("\n"); -} - -typedef struct { - char *function_name_ptr; - void *params_ptr; - ns_list_link_t link; -} teststep_t; -typedef NS_LIST_HEAD(teststep_t, link) teststep_list_t; - -teststep_list_t teststep_list; - -void unity_impr_teststep_set(char *function_name_ptr, void *params_ptr) -{ - teststep_t *ts_ptr; - printf("UNITY Called: %s\n", function_name_ptr); - ts_ptr = malloc(sizeof(teststep_t)); - ns_list_add_to_start(&teststep_list, ts_ptr); - ts_ptr->function_name_ptr = function_name_ptr; - ts_ptr->params_ptr = params_ptr; -} - -void *unity_impr_teststep_get(char *function_name_ptr) -{ - teststep_t *ts_ptr; - void *ptr; - printf("UNITY Checkking data for method: %s\n", function_name_ptr); - ts_ptr = ns_list_get_last(&teststep_list); - if (ts_ptr == NULL) { - printf("UNITY Expecting function %s, but nothing has been called\n", function_name_ptr); - goto failure; - } - if (strcmp(function_name_ptr, ts_ptr->function_name_ptr) != 0) { - printf("UNITY Expecting function %s, but %s was called\n", function_name_ptr, ts_ptr->function_name_ptr); - goto failure; - } - ptr = ts_ptr->params_ptr; - ns_list_remove(&teststep_list, ts_ptr); - free(ts_ptr); - return ptr; -failure: - TEST_FAIL(); - return NULL; -} -void unity_impr_teststep_clean(void) -{ - bool failure = false; - teststep_t *ts_ptr; - do { - ts_ptr = ns_list_get_last(&teststep_list); - if (ts_ptr != NULL) { - printf("UNITY Unhandled method %s\n", ts_ptr->function_name_ptr); - ns_list_remove(&teststep_list, ts_ptr); - failure = true; - free(ts_ptr); - } - } while (ts_ptr != NULL); - if (failure) { - TEST_FAIL(); - } - return; -} diff --git a/unittest/unity_improvement/unity_improved.h b/unittest/unity_improvement/unity_improved.h deleted file mode 100644 index 9ec5cedb0c6a..000000000000 --- a/unittest/unity_improvement/unity_improved.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ - -/* -This file improves the unity to allow module tests be more flexible. - -When you make simulated function add - void my_test_method(char *data_ptr) - { - UNITY_METHOD_CALLED("my_test_method",data_ptr); - } - -When testing the method values - void test_my_test_method(char *data_ptr) - { - params_ptr = UNITY_METHOD_CHECK("my_test_method"); - TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(data_ptr, params_ptr,3,"invalid string"); - } -In testcase - do_stuff("foo","bar"); - test_my_test_method("foo"); - test_my_test_method("bar"); - -that will allow correct order of methods to be check in testcase and multiple -different parameter values to be checkked if two methods are called - -*/ - -#define TEST_METHOD_CALLED(name,ptr) unity_impr_teststep_set(name,ptr) -#define TEST_METHOD_CHECK(name) unity_impr_teststep_get(name) - -#define TEST_DESCRIPTION(...) printf(__VA_ARGS__) - -void unity_impr_teststep_set(char *function_name_ptr, void *params_ptr); -void *unity_impr_teststep_get(char *function_name_ptr); -void unity_impr_teststep_clean(void); - -void print_buf(const uint8_t *buf, uint16_t len); -void test_buf(const uint8_t *buf, uint16_t len, const uint8_t *buf1, uint16_t len1); - - -#define put_uint32(x, z) do {\ - (x)[0] = (uint8_t) ((z) >> 24);\ - (x)[1] = (uint8_t) ((z) >> 16);\ - (x)[2] = (uint8_t) ((z) >> 8);\ - (x)[3] = (uint8_t) ((z));\ - } while(0) - -#define get_uint32(x) \ - (((uint32_t)(x)[0] << 24 ) |\ - ((uint32_t)(x)[1] << 16 ) |\ - ((uint32_t)(x)[2] << 8 ) |\ - (uint32_t)(x)[3]) diff --git a/xsl_script.sh b/xsl_script.sh deleted file mode 100755 index 5dae1cddee44..000000000000 --- a/xsl_script.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2015-2017, 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. - -echo -echo "Creating report" -echo - -echo ' - -' > results/index.xml - -for f in $(find ./test -name *.xml); -do - cp $f results - name=$(basename $f) - echo "">> results/index.xml -done - -echo '' >> results/index.xml - -echo -echo "Report created to results/index.xml (outputs html)" -echo