This commit is contained in:
jebrando 2019-04-12 16:40:59 -07:00
Родитель 06bbd48bde
Коммит daa9f0a2f6
12 изменённых файлов: 357 добавлений и 222 удалений

Просмотреть файл

@ -13,19 +13,8 @@ set(run_e2e_tests OFF)
set(run_unittests OFF)
set(skip_samples ON)
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/deps/parson)
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/umock-c)
#include_directories(${UMOCK_C_INC_FOLDER})
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/c-utility)
#include_directories(${SHARED_UTIL_INC_FOLDER})
#set_platform_files(${CMAKE_CURRENT_LIST_DIR}/deps/c-utility)
enable_testing()
#include("${CMAKE_CURRENT_LIST_DIR}/configs/iot_test_functions.cmake")
set(CLONE_OPTIONS "-q")
#Clone the test submodules if needed
@ -35,24 +24,13 @@ endif()
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/ctest/CMakeLists.txt")
execute_process(COMMAND git clone https://github.com/Azure/azure-ctest.git ${CLONE_OPTIONS} ${CMAKE_CURRENT_SOURCE_DIR}/deps/ctest)
endif()
#if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/umock-c/CMakeLists.txt")
# execute_process(COMMAND git clone https://github.com/Azure/umock-c.git ${CLONE_OPTIONS} ${CMAKE_CURRENT_SOURCE_DIR}/deps/umock-c)
#endif()
if (${refresh_sdk} OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/c-sdk/CMakeLists.txt")
execute_process(COMMAND git clone https://github.com/Azure/azure-iot-sdk-c.git ${CLONE_OPTIONS} -b ${sdk_branch} --recursive ${CMAKE_CURRENT_SOURCE_DIR}/deps/c-sdk)
endif()
# Submodules
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/testrunnerswitcher)
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/umock-c)
#include_directories(${UMOCK_C_INC_FOLDER})
#include_directories(${TESTRUNNERSWITCHER_INC_FOLDER})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/ctest)
#include_directories(${CTEST_INC_FOLDER})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/c-sdk)
set(IOTHUB_REPO_FOLDER ${CMAKE_CURRENT_LIST_DIR}/deps/c-sdk CACHE INTERNAL "Location of the azure c sdk" FORCE)
@ -64,7 +42,6 @@ include_directories(${TESTRUNNERSWITCHER_INC_FOLDER})
include_directories(${CTEST_INC_FOLDER})
include_directories(${UMOCK_C_INC_FOLDER})
#????
include_directories(${SHARED_UTIL_INC_FOLDER})
include_directories(./inc)

Просмотреть файл

@ -1,183 +0,0 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
function(back_compat_add_dll whatIsBuilding folder)
link_directories(${whatIsBuilding}_dll $ENV{VCInstallDir}UnitTest/lib)
add_library(${whatIsBuilding}_testsonly_lib STATIC
${${whatIsBuilding}_test_files}
)
SET(VAR 1)
foreach(file ${${whatIsBuilding}_test_files})
set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS -DCPPUNITTEST_SYMBOL=some_symbol_for_cppunittest_${VAR})
MATH(EXPR VAR "${VAR}+1")
endforeach()
set_target_properties(${whatIsBuilding}_testsonly_lib
PROPERTIES
FOLDER ${folder} )
target_include_directories(${whatIsBuilding}_testsonly_lib PUBLIC ${sharedutil_include_directories} $ENV{VCInstallDir}UnitTest/include)
target_compile_definitions(${whatIsBuilding}_testsonly_lib PUBLIC -DCPP_UNITTEST)
target_compile_options(${whatIsBuilding}_testsonly_lib PUBLIC /TP /EHsc)
add_library(${whatIsBuilding}_dll SHARED
${${whatIsBuilding}_cpp_files}
${${whatIsBuilding}_h_files}
${${whatIsBuilding}_c_files}
${logging_files}
)
set_target_properties(${whatIsBuilding}_dll
PROPERTIES
FOLDER ${folder})
set_source_files_properties(${${whatIsBuilding}_c_files} ${logging_files}
PROPERTIES
COMPILE_FLAGS /TC)
set_source_files_properties(${${whatIsBuilding}_cpp_files}
PROPERTIES
COMPILE_FLAGS /TP)
target_link_libraries(${whatIsBuilding}_dll umock_c ctest testrunnerswitcher ${whatIsBuilding}_testsonly_lib )
# set(PARSING_ADDITIONAL_LIBS OFF)
# set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
# set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
# set(ARG_PREFIX "none")
# foreach(f ${ARGN})
# set(skip_to_next FALSE)
# if(${f} STREQUAL "ADDITIONAL_LIBS")
# SET(PARSING_ADDITIONAL_LIBS ON)
# SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
# set(ARG_PREFIX "none")
# #also unset all the other states
# set(skip_to_next TRUE)
# elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
# SET(PARSING_ADDITIONAL_LIBS OFF)
# SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
# set(skip_to_next TRUE)
# endif()
# if(NOT skip_to_next)
# if(PARSING_ADDITIONAL_LIBS)
# if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
# SET(ARG_PREFIX ${f})
# else()
# target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_dll ${f})
# target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_testsonly_lib ${f})
# set(ARG_PREFIX "none")
# endif()
# endif()
# endif()
# endforeach()
SET(SPACES " ")
SET(VAR 1)
foreach(file ${${whatIsBuilding}_test_files})
# for x64 the underscore is not needed
if (ARCHITECTURE STREQUAL "x86_64" OR ARCHITECTURE STREQUAL "ARM")
set_property(TARGET ${whatIsBuilding}_dll APPEND_STRING PROPERTY LINK_FLAGS ${SPACES}/INCLUDE:"some_symbol_for_cppunittest_${VAR}")
else()
set_property(TARGET ${whatIsBuilding}_dll APPEND_STRING PROPERTY LINK_FLAGS ${SPACES}/INCLUDE:"_some_symbol_for_cppunittest_${VAR}")
endif()
MATH(EXPR VAR "${VAR}+1")
endforeach()
endfunction()
function(back_compat_add_exe whatIsBuilding folder)
add_executable(${whatIsBuilding}_exe
${${whatIsBuilding}_test_files}
${${whatIsBuilding}_cpp_files}
${${whatIsBuilding}_h_files}
${${whatIsBuilding}_c_files}
${CMAKE_CURRENT_LIST_DIR}/main.c
${logging_files}
)
set_target_properties(${whatIsBuilding}_exe
PROPERTIES
FOLDER ${folder})
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
#this part detects
# - the additional libraries that might be needed.
# additional libraries are started by ADDITIONAL_LIBS parameter and ended by any other known parameter (or end of variable arguments)
# - a valgrind suppression file (VALGRIND_SUPPRESSIONS_FILE) for memcheck
# the file name follows immediately after
# set(PARSING_ADDITIONAL_LIBS OFF)
# set(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
# set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER)
# set(ARG_PREFIX "none")
# foreach(f ${ARGN})
# set(skip_to_next FALSE)
# if(${f} STREQUAL "ADDITIONAL_LIBS")
# SET(PARSING_ADDITIONAL_LIBS ON)
# SET(PARSING_VALGRIND_SUPPRESSIONS_FILE OFF)
# set(ARG_PREFIX "none")
# #also unset all the other states
# set(skip_to_next TRUE)
# elseif(${f} STREQUAL "VALGRIND_SUPPRESSIONS_FILE")
# SET(PARSING_ADDITIONAL_LIBS OFF)
# SET(PARSING_VALGRIND_SUPPRESSIONS_FILE ON)
# set(skip_to_next TRUE)
# endif()
# if(NOT skip_to_next)
# if(PARSING_ADDITIONAL_LIBS)
# if((${f} STREQUAL "debug") OR (${f} STREQUAL "optimized") OR (${f} STREQUAL "general"))
# SET(ARG_PREFIX ${f})
# else()
# target_link_libraries_with_arg_prefix(${ARG_PREFIX} ${whatIsBuilding}_exe ${f})
# set(ARG_PREFIX "none")
# endif()
# elseif(PARSING_VALGRIND_SUPPRESSIONS_FILE)
# set(VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER "--suppressions=${f}")
# endif()
# endif()
# endforeach()
if (WIN32)
target_compile_definitions(${whatIsBuilding}_exe PUBLIC -DUSE_CTEST)
target_include_directories(${whatIsBuilding}_exe PUBLIC ${sharedutil_include_directories})
target_link_libraries(${whatIsBuilding}_exe umock_c ctest testrunnerswitcher)
else ()
target_link_libraries(${whatIsBuilding}_exe umock_c ctest m)
endif ()
add_test(NAME ${whatIsBuilding} COMMAND $<TARGET_FILE:${whatIsBuilding}_exe>)
# if(${run_valgrind})
# find_program(VALGRIND_FOUND NAMES valgrind)
# if(${VALGRIND_FOUND} STREQUAL VALGRIND_FOUND-NOTFOUND)
# message(WARNING "run_valgrind was TRUE, but valgrind was not found - there will be no tests run under valgrind")
# else()
# add_test(NAME ${whatIsBuilding}_valgrind COMMAND valgrind --gen-suppressions=all --num-callers=100 --error-exitcode=1 --leak-check=full --track-origins=yes ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
# add_test(NAME ${whatIsBuilding}_helgrind COMMAND valgrind --tool=helgrind --gen-suppressions=all --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
# add_test(NAME ${whatIsBuilding}_drd COMMAND valgrind --tool=drd --gen-suppressions=all --num-callers=100 --error-exitcode=1 ${VALGRIND_SUPPRESSIONS_FILE_EXTRA_PARAMETER} $<TARGET_FILE:${whatIsBuilding}_exe>)
# endif()
# endif()
endfunction()
function(build_back_compat_test_artifacts whatIsBuilding folder)
#the first argument is what is building
#the second argument is whether the tests should be build with gballoc #defines or not
#the following arguments are a list of libraries to link with
set(logging_files ${XLOGGING_C_FILE} ${LOGGING_C_FILE})
#setting #defines
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
back_compat_add_dll(${whatIsBuilding} ${folder} ${ARGN})
endif()
back_compat_add_exe(${whatIsBuilding} ${folder} ${ARGN})
endfunction()

Просмотреть файл

@ -2,3 +2,5 @@
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
add_subdirectory(iothub_mqtt_back_compat)
add_subdirectory(iothub_amqp_back_compat)
add_subdirectory(iothub_http_back_compat)

Просмотреть файл

@ -568,7 +568,7 @@ BACK_COMPAT_HANDLE back_compat_init(TEST_PROTOCOL_TYPE protocol_type)
}
else if ((result = (BACK_COMPAT_INFO*)malloc(sizeof(BACK_COMPAT_INFO))) == NULL)
{
LogError("Could not initialize IoTHubAccount");
LogError("Failure allocating back compat info");
result = NULL;
}
else
@ -576,7 +576,7 @@ BACK_COMPAT_HANDLE back_compat_init(TEST_PROTOCOL_TYPE protocol_type)
memset(result, 0, sizeof(BACK_COMPAT_INFO));
if ((result->tick_cntr_handle = tickcounter_create()) == NULL)
{
LogError("Could not initialize IoTHubAccount");
LogError("Failure creating tickcounter object");
free(result);
result = NULL;
}

Просмотреть файл

@ -0,0 +1,78 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
cmake_minimum_required(VERSION 2.8.11)
if(NOT (${use_amqp} AND ${use_mqtt}))
message(FATAL_ERROR "iothub_amqp_back_compat being generated without AMQP and MQTT support")
endif()
compileAsC11()
set(theseTestsName iothub_amqp_back_compat)
set(${theseTestsName}_test_files
${theseTestsName}.c
)
set(${theseTestsName}_c_files
${IOTHUB_REPO_FOLDER}/certs/certs.c
../common_test_files/back_compat_test_common.c
)
set(${theseTestsName}_h_files
../common_test_files/back_compat_test_common.h
)
if (${use_sample_trusted_cert})
add_definitions(-DSET_TRUSTED_CERT_IN_SAMPLES)
include_directories(${IOTHUB_REPO_FOLDER}/certs)
endif()
build_back_compat_test_artifacts(${theseTestsName} "back-compat_tests/iothub_client")
include_directories(../common_test_files)
include_directories(${IOTHUB_TEST_INC_FOLDER})
include_directories(${IOTHUB_SERVICE_CLIENT_INC_FOLDER})
if (TARGET ${theseTestsName}_exe)
target_link_libraries(${theseTestsName}_exe
iothub_test
iothub_client
iothub_client_amqp_transport
iothub_service_client
uamqp
aziotsharedutil
)
endif()
if (WIN32)
if(TARGET ${theseTestsName}_dll)
target_link_libraries(${theseTestsName}_dll
iothub_test
iothub_client
iothub_client_amqp_transport
iothub_service_client
uamqp
aziotsharedutil
rpcrt4
)
target_link_libraries(${theseTestsName}_dll rpcrt4)
endif()
if(TARGET ${theseTestsName}_exe)
target_link_libraries(${theseTestsName}_exe rpcrt4)
endif()
else ()
if (UNIX) #LINUX OR APPLE
find_package(PkgConfig REQUIRED)
pkg_search_module(UUID REQUIRED uuid)
link_directories(${UUID_LIBRARY_DIRS})
endif ()
if (APPLE)
target_link_libraries(${theseTestsName}_exe -L${UUID_LIBRARY_DIRS} pthread ${UUID_LIBRARIES})
elseif (LINUX)
target_link_libraries(${theseTestsName}_exe pthread ${UUID_LIBRARIES})
endif()
endif()

Просмотреть файл

@ -0,0 +1,92 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include <stdio.h>
#include <stdlib.h>
#include "testrunnerswitcher.h"
#include "back_compat_test_common.h"
#include "iothubtransportamqp.h"
static BACK_COMPAT_HANDLE g_back_compat_handle;
BEGIN_TEST_SUITE(iothub_amqp_back_compat)
TEST_SUITE_INITIALIZE(suite_init)
{
g_back_compat_handle = back_compat_init(TEST_AMQP);
ASSERT_IS_NOT_NULL(g_back_compat_handle, "Failure creating iothub device in hub");
}
TEST_SUITE_CLEANUP(suite_cleanup)
{
back_compat_deinit(g_back_compat_handle);
}
TEST_FUNCTION_INITIALIZE(method_init)
{
}
TEST_FUNCTION_CLEANUP(method_cleanup)
{
}
// COMPAT_TEST_07_IoTHubDeviceClient_LL_CreateFromConnectionString
// COMPAT_TEST_07_IoTHubDeviceClient_LL_Destroy
// COMPAT_TEST_07_IoTHubDeviceClient_LL_SetConnectionStatusCallback
// COMPAT_TEST_07_IoTHubMessage_CreateFromString
// COMPAT_TEST_07_IoTHubMessage_GetContentType
// COMPAT_TEST_07_IoTHubMessage_GetString
// COMPAT_TEST_07_IoTHubMessage_SetMessageId
// COMPAT_TEST_07_IoTHubMessage_GetMessageId
// COMPAT_TEST_07_IoTHubMessage_SetCorrelationId
// COMPAT_TEST_07_IoTHubMessage_GetCorrelationId
// COMPAT_TEST_07_IoTHubMessage_SetContentTypeSystemProperty
// COMPAT_TEST_07_IoTHubMessage_GetContentTypeSystemProperty
// COMPAT_TEST_07_IoTHubMessage_SetContentEncodingSystemProperty
// COMPAT_TEST_07_IoTHubMessage_GetContentEncodingSystemProperty
// COMPAT_TEST_07_IoTHubMessage_SetOutputName
// COMPAT_TEST_07_IoTHubMessage_GetOutputName
// COMPAT_TEST_07_IoTHubMessage_SetInputName
// COMPAT_TEST_07_IoTHubMessage_GetInputName
// COMPAT_TEST_07_IoTHubMessage_SetProperty
// COMPAT_TEST_07_IoTHubDeviceClient_LL_SendEventAsync
// COMPAT_TEST_07_IoTHubDeviceClient_LL_DoWork
// COMPAT_TEST_07_IoTHubDeviceClient_LL_Destroy
// COMPAT_TEST_07_AMQP_Protocol
// COMPAT_TEST_07_IOTHUB_MESSAGE_HANDLE
// COMPAT_TEST_07_IOTHUB_DEVICE_CLIENT_LL_HANDLE
// COMPAT_TEST_07_IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK
// COMPAT_TEST_07_TRANSPORT_PROVIDER
TEST_FUNCTION(MQTT_test_telemetry_string_with_connection_string)
{
int result = send_telemetry_with_device_client(g_back_compat_handle, DEVICE_CREATION_CONN_STRING, TEST_MESSAGE_CREATE_STRING, AMQP_Protocol);
ASSERT_ARE_EQUAL(int, 0, result);
}
TEST_FUNCTION(MQTT_test_telemetry_byte_array_with_create)
{
int result = send_telemetry_with_device_client(g_back_compat_handle, DEVICE_CREATION_CREATE, TEST_MESSAGE_CREATE_BYTE_ARRAY, AMQP_Protocol);
ASSERT_ARE_EQUAL(int, 0, result);
}
TEST_FUNCTION(MQTT_test_c2d_with_create)
{
int result = test_c2d_with_device_client(g_back_compat_handle, DEVICE_CREATION_CREATE, AMQP_Protocol);
ASSERT_ARE_EQUAL(int, 0, result);
}
TEST_FUNCTION(MQTT_test_methods_with_create)
{
int result = test_method_with_device_client(g_back_compat_handle, DEVICE_CREATION_CREATE, AMQP_Protocol);
ASSERT_ARE_EQUAL(int, 0, result);
}
TEST_FUNCTION(MQTT_test_methods_with_connection_string)
{
int result = test_twin_with_device_client(g_back_compat_handle, DEVICE_CREATION_CONN_STRING, AMQP_Protocol);
ASSERT_ARE_EQUAL(int, 0, result);
}
END_TEST_SUITE(iothub_amqp_back_compat)

Просмотреть файл

@ -0,0 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "testrunnerswitcher.h"
int main(void)
{
size_t failedTestCount = 0;
RUN_TEST_SUITE(iothub_amqp_back_compat, failedTestCount);
return failedTestCount;
}

Просмотреть файл

@ -0,0 +1,74 @@
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
cmake_minimum_required(VERSION 2.8.11)
if(NOT (${use_amqp} AND ${use_mqtt}))
message(FATAL_ERROR "iothub_http_back_compat being generated without AMQP and MQTT support")
endif()
compileAsC11()
set(theseTestsName iothub_http_back_compat)
set(${theseTestsName}_test_files
${theseTestsName}.c
)
set(${theseTestsName}_c_files
${IOTHUB_REPO_FOLDER}/certs/certs.c
../common_test_files/back_compat_test_common.c
)
set(${theseTestsName}_h_files
../common_test_files/back_compat_test_common.h
)
if (${use_sample_trusted_cert})
add_definitions(-DSET_TRUSTED_CERT_IN_SAMPLES)
include_directories(${IOTHUB_REPO_FOLDER}/certs)
endif()
build_back_compat_test_artifacts(${theseTestsName} "back-compat_tests/iothub_client")
include_directories(../common_test_files)
include_directories(${IOTHUB_TEST_INC_FOLDER})
include_directories(${IOTHUB_SERVICE_CLIENT_INC_FOLDER})
if (TARGET ${theseTestsName}_exe)
target_link_libraries(${theseTestsName}_exe
iothub_test
iothub_client
iothub_client_http_transport
iothub_service_client
aziotsharedutil
)
endif()
if (WIN32)
if(TARGET ${theseTestsName}_dll)
target_link_libraries(${theseTestsName}_dll
iothub_test
iothub_client
iothub_client_http_transport
iothub_service_client
aziotsharedutil
rpcrt4
)
endif()
if(TARGET ${theseTestsName}_exe)
target_link_libraries(${theseTestsName}_exe rpcrt4)
endif()
else ()
if (UNIX) #LINUX OR APPLE
find_package(PkgConfig REQUIRED)
pkg_search_module(UUID REQUIRED uuid)
link_directories(${UUID_LIBRARY_DIRS})
endif ()
if (APPLE)
target_link_libraries(${theseTestsName}_exe -L${UUID_LIBRARY_DIRS} pthread ${UUID_LIBRARIES})
elseif (LINUX)
target_link_libraries(${theseTestsName}_exe pthread ${UUID_LIBRARIES})
endif()
endif()

Просмотреть файл

@ -0,0 +1,80 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include <stdio.h>
#include <stdlib.h>
#include "testrunnerswitcher.h"
#include "back_compat_test_common.h"
#include "iothubtransporthttp.h"
static BACK_COMPAT_HANDLE g_back_compat_handle;
BEGIN_TEST_SUITE(iothub_http_back_compat)
TEST_SUITE_INITIALIZE(suite_init)
{
g_back_compat_handle = back_compat_init(TEST_HTTP);
ASSERT_IS_NOT_NULL(g_back_compat_handle, "Failure creating iothub device in hub");
}
TEST_SUITE_CLEANUP(suite_cleanup)
{
back_compat_deinit(g_back_compat_handle);
}
TEST_FUNCTION_INITIALIZE(method_init)
{
}
TEST_FUNCTION_CLEANUP(method_cleanup)
{
}
// COMPAT_TEST_07_IoTHubDeviceClient_LL_CreateFromConnectionString
// COMPAT_TEST_07_IoTHubDeviceClient_LL_Destroy
// COMPAT_TEST_07_IoTHubDeviceClient_LL_SetConnectionStatusCallback
// COMPAT_TEST_07_IoTHubMessage_CreateFromString
// COMPAT_TEST_07_IoTHubMessage_GetContentType
// COMPAT_TEST_07_IoTHubMessage_GetString
// COMPAT_TEST_07_IoTHubMessage_SetMessageId
// COMPAT_TEST_07_IoTHubMessage_GetMessageId
// COMPAT_TEST_07_IoTHubMessage_SetCorrelationId
// COMPAT_TEST_07_IoTHubMessage_GetCorrelationId
// COMPAT_TEST_07_IoTHubMessage_SetContentTypeSystemProperty
// COMPAT_TEST_07_IoTHubMessage_GetContentTypeSystemProperty
// COMPAT_TEST_07_IoTHubMessage_SetContentEncodingSystemProperty
// COMPAT_TEST_07_IoTHubMessage_GetContentEncodingSystemProperty
// COMPAT_TEST_07_IoTHubMessage_SetOutputName
// COMPAT_TEST_07_IoTHubMessage_GetOutputName
// COMPAT_TEST_07_IoTHubMessage_SetInputName
// COMPAT_TEST_07_IoTHubMessage_GetInputName
// COMPAT_TEST_07_IoTHubMessage_SetProperty
// COMPAT_TEST_07_IoTHubDeviceClient_LL_SendEventAsync
// COMPAT_TEST_07_IoTHubDeviceClient_LL_DoWork
// COMPAT_TEST_07_IoTHubDeviceClient_LL_Destroy
// COMPAT_TEST_07_HTTP_Protocol
// COMPAT_TEST_07_IOTHUB_MESSAGE_HANDLE
// COMPAT_TEST_07_IOTHUB_DEVICE_CLIENT_LL_HANDLE
// COMPAT_TEST_07_IOTHUB_CLIENT_EVENT_CONFIRMATION_CALLBACK
// COMPAT_TEST_07_TRANSPORT_PROVIDER
TEST_FUNCTION(MQTT_test_telemetry_string_with_connection_string)
{
int result = send_telemetry_with_device_client(g_back_compat_handle, DEVICE_CREATION_CONN_STRING, TEST_MESSAGE_CREATE_STRING, HTTP_Protocol);
ASSERT_ARE_EQUAL(int, 0, result);
}
TEST_FUNCTION(MQTT_test_telemetry_byte_array_with_create)
{
int result = send_telemetry_with_device_client(g_back_compat_handle, DEVICE_CREATION_CREATE, TEST_MESSAGE_CREATE_BYTE_ARRAY, HTTP_Protocol);
ASSERT_ARE_EQUAL(int, 0, result);
}
TEST_FUNCTION(MQTT_test_c2d_with_create)
{
int result = test_c2d_with_device_client(g_back_compat_handle, DEVICE_CREATION_CREATE, HTTP_Protocol);
ASSERT_ARE_EQUAL(int, 0, result);
}
END_TEST_SUITE(iothub_http_back_compat)

Просмотреть файл

@ -0,0 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "testrunnerswitcher.h"
int main(void)
{
size_t failedTestCount = 0;
RUN_TEST_SUITE(iothub_http_back_compat, failedTestCount);
return failedTestCount;
}

Просмотреть файл

@ -40,10 +40,9 @@ if (TARGET ${theseTestsName}_exe)
iothub_client
iothub_client_mqtt_transport
iothub_service_client
umqtt
aziotsharedutil
iothub_client_mqtt_transport
)
linkMqttLibrary(${theseTestsName}_exe)
endif()
if (WIN32)
@ -51,23 +50,16 @@ if (WIN32)
target_link_libraries(${theseTestsName}_dll
iothub_test
iothub_client
iothub_client_amqp_transport
iothub_client_mqtt_transport
iothub_service_client
umqtt
aziotsharedutil
rpcrt4
)
linkSharedUtil(${theseTestsName}_dll)
linkMqttLibrary(${theseTestsName}_dll)
target_link_libraries(${theseTestsName}_dll
rpcrt4
)
endif()
if(TARGET ${theseTestsName}_exe)
target_link_libraries(${theseTestsName}_exe
rpcrt4
)
target_link_libraries(${theseTestsName}_exe rpcrt4)
endif()
else ()
if (UNIX) #LINUX OR APPLE

Просмотреть файл

@ -167,14 +167,14 @@ static int retrieveConnStringInfo(IOTHUB_ACCOUNT_INFO* accountInfo)
}
else if ((accountInfo->keyName = (char*)malloc(endName - beginName + 1)) == NULL)
{
LogError("Failure allocating hostName.\r\n");
LogError("Failure allocating keyname.\r\n");
free(accountInfo->iothubName);
free(accountInfo->hostname);
result = MU_FAILURE;
}
else if ((accountInfo->sharedAccessKey = (char*)malloc(totalLen + 1 - beginKey + 1)) == NULL)
{
LogError("Failure allocating hostName.\r\n");
LogError("Failure allocating shared access key.\r\n");
free(accountInfo->iothubName);
free(accountInfo->keyName);
free(accountInfo->hostname);
@ -642,6 +642,7 @@ static char* convert_base64_to_string(const char* base64_cert)
IOTHUB_ACCOUNT_INFO_HANDLE IoTHubAccount_Init_With_Config(IOTHUB_ACCOUNT_CONFIG* config, bool testingModules)
{
(void)testingModules;
IOTHUB_ACCOUNT_INFO* iothub_account_info;
if (config == NULL)