├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── PortingGuide.md ├── README.md ├── build_all ├── arduino │ ├── CMakeList.append │ ├── Makefile.iot │ ├── build.sh │ ├── setup.sh │ └── setup_sdk.sh ├── esp32 │ ├── Makefile │ ├── README.md │ ├── components │ │ └── sdk │ │ │ └── component.mk │ └── main │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ └── main.c └── linux │ ├── build.sh │ ├── print_failed_tests.sed │ ├── setup.sh │ └── setup_opensuse.sh ├── c-utility ├── CMakeLists.txt ├── LICENSE ├── README.md ├── adapters │ ├── README.md │ ├── agenttime.c │ ├── agenttime_esp8266.c │ ├── agenttime_mbed.c │ ├── condition_pthreads.c │ ├── condition_rtx_mbed.cpp │ ├── condition_win32.c │ ├── esp8266_mock.h │ ├── httpapi_compact.c │ ├── httpapi_curl.c │ ├── httpapi_tirtos.c │ ├── httpapi_wince.c │ ├── httpapi_winhttp.c │ ├── linux_time.c │ ├── linux_time.h │ ├── lock_pthreads.c │ ├── lock_rtx_mbed.cpp │ ├── lock_win32.c │ ├── platform_esp8266.c │ ├── platform_freertos.c │ ├── platform_linux.c │ ├── platform_mbed.cpp │ ├── platform_stub.c │ ├── platform_tizenrt.c │ ├── platform_win32.c │ ├── socketio_berkeley.c │ ├── socketio_mbed.c │ ├── socketio_win32.c │ ├── tcpsocketconnection_c.cpp │ ├── threadapi_esp8266.c │ ├── threadapi_pthreads.c │ ├── threadapi_rtx_mbed.cpp │ ├── threadapi_win32.c │ ├── tickcounter_esp8266.c │ ├── tickcounter_linux.c │ ├── tickcounter_mbed.cpp │ ├── tickcounter_tirtos.c │ ├── tickcounter_win32.c │ ├── tlsio_mbedtls.c │ ├── tlsio_ssl_esp8266.c │ ├── uniqueid_linux.c │ ├── uniqueid_stub.c │ └── uniqueid_win32.c ├── build_all │ ├── linux │ │ └── build.sh │ ├── mbed │ │ ├── CMakeLists.txt │ │ ├── azure_c_shared_utility_filelist.txt │ │ └── build.cmd │ ├── mbed3 │ │ ├── .yotta.json │ │ ├── build.cmd │ │ ├── module.json │ │ └── shared-util_filelist.txt │ ├── packaging │ │ ├── linux │ │ │ └── debian │ │ │ │ ├── azure-c-shared-util-dev.dirs │ │ │ │ ├── azure-c-shared-util-dev.install │ │ │ │ ├── azure-c-shared-util-lib.dirs │ │ │ │ ├── azure-c-shared-util-lib.install │ │ │ │ ├── changelog-trusty │ │ │ │ ├── changelog-vivid │ │ │ │ ├── changelog-wily │ │ │ │ ├── changelog-xenial │ │ │ │ ├── compat │ │ │ │ ├── control │ │ │ │ ├── copyright │ │ │ │ ├── docs │ │ │ │ ├── rules │ │ │ │ └── source │ │ │ │ └── format │ │ └── windows │ │ │ ├── Microsoft.Azure.C.SharedUtility.nuspec │ │ │ ├── Microsoft.Azure.C.SharedUtility.targets │ │ │ ├── Microsoft.Azure.C.SharedUtility_thirdpartynotice.txt │ │ │ └── rebuild_nugets.cmd │ ├── tirtos │ │ ├── package.bld │ │ └── package.xdc │ ├── windows │ │ └── build.cmd │ └── windowsce │ │ └── build.cmd ├── configs │ ├── azure_c_shared_utilityConfig.cmake │ ├── azure_c_shared_utilityFunctions.cmake │ ├── azure_iot_build_rules.cmake │ └── azure_iot_external_pal_unit_test_setup.cmake ├── dependencies-test.cmake ├── dependencies.cmake ├── devdoc │ ├── agenttime_requirements.md │ ├── base32_requirements.md │ ├── base64_requirements.md │ ├── buffer_requirements.md │ ├── condition_requirements.md │ ├── connectionstringparser_requirements.md │ ├── constbuffer_requirements.md │ ├── constmap_requirements.md │ ├── crt_abstraction_requirements.md │ ├── dns_async.md │ ├── doublylinkedlist_requirements.md │ ├── gballoc_requirements.md │ ├── http_proxy_io_requirements.md │ ├── httpapi_compact_requirements.md │ ├── httpapiex_requirements.md │ ├── httpapiex_retry_mechanism.vsdx │ ├── httpapiexsas_requirements.md │ ├── httpheaders_requirements.md │ ├── img │ │ ├── porting_guide_overview.png │ │ ├── readme.txt │ │ ├── tlsio_state_diagram.png │ │ └── xio_chain.png │ ├── img_src │ │ ├── porting_guide_overview.vsdx │ │ ├── readme.txt │ │ ├── tlsio_state_diagram.pptx │ │ └── xio_chain.pptx │ ├── lock_requirements.md │ ├── map_requirements.md │ ├── optionhandler_requirements.md │ ├── platform_requirements.md │ ├── sastoken_requirements.md │ ├── singlylinkedlist_requirements.md │ ├── sntp_lwip_requirements.md │ ├── socket_async.md │ ├── ssl_socket_compact.md │ ├── string_tokenizer_requirements.md │ ├── strings_requirements.md │ ├── template_requirements.md │ ├── threadapi_and_sleep_requirements.md │ ├── threadapi_freertos_requirements.md │ ├── tickcounter_freertos_requirement.md │ ├── tlsio_cyclonessl_requirements.md │ ├── tlsio_cyclonessl_socket_bsd_requirements.md │ ├── tlsio_cyclonessl_socket_requirements.md │ ├── tlsio_requirements.md │ ├── tlsio_ssl_esp8266.md │ ├── uniqueid_requirements.md │ ├── url_encode_requirements.md │ ├── utf8_checker_requirements.md │ ├── uuid_requirements.md │ ├── uws_client_requirements.md │ ├── uws_frame_encoder_requirements.md │ ├── vector_requirements.md │ ├── wsio_requirements.md │ ├── x509_openssl.md │ ├── x509_schannel.md │ └── xio_requirements.md ├── inc │ └── azure_c_shared_utility │ │ ├── agenttime.h │ │ ├── base32.h │ │ ├── base64.h │ │ ├── buffer_.h │ │ ├── condition.h │ │ ├── connection_string_parser.h │ │ ├── consolelogger.h │ │ ├── const_defines.h │ │ ├── constbuffer.h │ │ ├── constmap.h │ │ ├── crt_abstractions.h │ │ ├── doublylinkedlist.h │ │ ├── etwlogger.h │ │ ├── etwlogger_driver.h │ │ ├── gb_rand.h │ │ ├── gb_stdio.h │ │ ├── gb_time.h │ │ ├── gballoc.h │ │ ├── gbnetwork.h │ │ ├── hmac.h │ │ ├── hmacsha256.h │ │ ├── http_proxy_io.h │ │ ├── httpapi.h │ │ ├── httpapiex.h │ │ ├── httpapiexsas.h │ │ ├── httpheaders.h │ │ ├── lock.h │ │ ├── macro_utils.h │ │ ├── map.h │ │ ├── optimize_size.h │ │ ├── optionhandler.h │ │ ├── platform.h │ │ ├── refcount.h │ │ ├── sastoken.h │ │ ├── sha-private.h │ │ ├── sha.h │ │ ├── shared_util_options.h │ │ ├── singlylinkedlist.h │ │ ├── socketio.h │ │ ├── stdint_ce6.h │ │ ├── string_tokenizer.h │ │ ├── string_tokenizer_types.h │ │ ├── strings.h │ │ ├── strings_types.h │ │ ├── tcpsocketconnection_c.h │ │ ├── threadapi.h │ │ ├── tickcounter.h │ │ ├── tls_config.h │ │ ├── tlsio.h │ │ ├── tlsio_cyclonessl.h │ │ ├── tlsio_cyclonessl_socket.h │ │ ├── tlsio_mbedtls.h │ │ ├── tlsio_openssl.h │ │ ├── tlsio_options.h │ │ ├── tlsio_schannel.h │ │ ├── tlsio_wolfssl.h │ │ ├── umock_c_prod.h │ │ ├── uniqueid.h │ │ ├── urlencode.h │ │ ├── utf8_checker.h │ │ ├── uuid.h │ │ ├── uws_client.h │ │ ├── uws_frame_encoder.h │ │ ├── vector.h │ │ ├── vector_types.h │ │ ├── vector_types_internal.h │ │ ├── windowsce │ │ ├── cstdbool │ │ ├── cstdint │ │ ├── inttypes.h │ │ ├── stdbool.h │ │ └── stdint.h │ │ ├── wsio.h │ │ ├── x509_openssl.h │ │ ├── x509_schannel.h │ │ ├── xio.h │ │ └── xlogging.h ├── jenkins │ ├── debian_c.sh │ ├── inteledison_c.sh │ ├── linux_c.sh │ ├── linux_c_gcc44.sh │ ├── linux_wolfssl.sh │ ├── mbed_c.cmd │ ├── osx_gcc_openssl.sh │ ├── osx_xcode_native.sh │ ├── raspberrypi_c.sh │ ├── ubuntu1510_c.sh │ ├── ubuntu1604_c.sh │ ├── ubuntu_clang.sh │ ├── windows_c.cmd │ ├── windows_c_build_as_dynamic.cmd │ ├── windows_vs2008_c.cmd │ └── windowsce_c.cmd ├── pal │ ├── README.md │ ├── agenttime.c │ ├── dns_async.c │ ├── freertos │ │ ├── lock.c │ │ ├── threadapi.c │ │ └── tickcounter.c │ ├── generic │ │ └── refcount_os.h │ ├── inc │ │ ├── dns_async.h │ │ ├── sntp.h │ │ └── socket_async.h │ ├── ios-osx │ │ ├── platform_appleios.c │ │ ├── tlsio_appleios.c │ │ └── tlsio_appleios.h │ ├── linux │ │ ├── refcount_os.h │ │ └── socket_async_os.h │ ├── lwip │ │ ├── sntp_lwip.c │ │ └── sntp_os.h │ ├── socket_async.c │ ├── tickcounter.c │ ├── tlsio_options.c │ └── windows │ │ └── refcount_os.h ├── samples │ ├── CMakeLists.txt │ ├── iot_c_utility │ │ ├── CMakeLists.txt │ │ └── iot_c_utility.c │ ├── socketio_connect │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── mbed │ │ │ ├── CMakeLists.txt │ │ │ └── socketio_connect_filelist.txt │ └── tlsio_connect │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── mbed │ │ ├── CMakeLists.txt │ │ └── tlsio_connect_filelist.txt ├── src │ ├── README.md │ ├── aziotsharedutil.def │ ├── base32.c │ ├── base64.c │ ├── buffer.c │ ├── connection_string_parser.c │ ├── consolelogger.c │ ├── constbuffer.c │ ├── constmap.c │ ├── crt_abstractions.c │ ├── doublylinkedlist.c │ ├── etw_provider_generate.cmd │ ├── etwlogger.man │ ├── etwlogger_driver.c │ ├── etwxlogging.c │ ├── gb_rand.c │ ├── gb_stdio.c │ ├── gb_time.c │ ├── gballoc.c │ ├── gbnetwork.c │ ├── hmac.c │ ├── hmacsha256.c │ ├── http_proxy_io.c │ ├── httpapiex.c │ ├── httpapiexsas.c │ ├── httpheaders.c │ ├── map.c │ ├── optionhandler.c │ ├── sastoken.c │ ├── sha1.c │ ├── sha224.c │ ├── sha384-512.c │ ├── singlylinkedlist.c │ ├── string_tokenizer.c │ ├── strings.c │ ├── tlsio_cyclonessl.c │ ├── tlsio_cyclonessl_socket.c │ ├── tlsio_cyclonessl_socket_bsd.c │ ├── tlsio_openssl.c │ ├── tlsio_schannel.c │ ├── tlsio_wolfssl.c │ ├── urlencode.c │ ├── usha.c │ ├── utf8_checker.c │ ├── uuid.c │ ├── uws_client.c │ ├── uws_frame_encoder.c │ ├── vector.c │ ├── wsio.c │ ├── x509_openssl.c │ ├── x509_schannel.c │ ├── xio.c │ └── xlogging.c ├── tests │ ├── CMakeLists.txt │ ├── agenttime_ut │ │ ├── CMakeLists.txt │ │ ├── agenttime_ut.c │ │ └── main.c │ ├── base32_ut │ │ ├── CMakeLists.txt │ │ ├── base32_ut.c │ │ └── main.c │ ├── base64_ut │ │ ├── CMakeLists.txt │ │ ├── base64_ut.c │ │ └── main.c │ ├── buffer_ut │ │ ├── CMakeLists.txt │ │ ├── buffer_ut.c │ │ └── main.c │ ├── condition_ut │ │ ├── CMakeLists.txt │ │ ├── condition_ut.c │ │ └── main.c │ ├── connectionstringparser_ut │ │ ├── CMakeLists.txt │ │ ├── connectionstringparser_ut.c │ │ └── main.c │ ├── constbuffer_ut │ │ ├── CMakeLists.txt │ │ ├── constbuffer_ut.c │ │ └── main.c │ ├── constmap_ut │ │ ├── CMakeLists.txt │ │ ├── constmap_ut.c │ │ └── main.c │ ├── crtabstractions_ut │ │ ├── CMakeLists.txt │ │ ├── crtabstractions_ut.c │ │ └── main.c │ ├── dns_async_ut │ │ ├── CMakeLists.txt │ │ ├── dns_async_ut.c │ │ ├── main.c │ │ └── win32_fake_linux │ │ │ ├── readme.txt │ │ │ └── socket_async_os.h │ ├── doublylinkedlist_ut │ │ ├── CMakeLists.txt │ │ ├── doublylinkedlist_ut.c │ │ └── main.c │ ├── gballoc_ut │ │ ├── CMakeLists.txt │ │ ├── gballoc_undertest.c │ │ ├── gballoc_ut.c │ │ └── main.c │ ├── gballoc_without_init_ut │ │ ├── CMakeLists.txt │ │ ├── gballoc_undertest.c │ │ ├── gballoc_without_init_ut.c │ │ └── main.c │ ├── hmacsha256_ut │ │ ├── CMakeLists.txt │ │ ├── hmacsha256_ut.c │ │ └── main.c │ ├── http_proxy_io_ut │ │ ├── CMakeLists.txt │ │ ├── http_proxy_io_ut.c │ │ └── main.c │ ├── httpapicompact_ut │ │ ├── CMakeLists.txt │ │ ├── httpapicompact_ut.c │ │ └── main.c │ ├── httpapiex_ut │ │ ├── CMakeLists.txt │ │ ├── httpapiex_ut.c │ │ └── main.c │ ├── httpapiexsas_ut │ │ ├── CMakeLists.txt │ │ ├── httpapiexsas_ut.c │ │ └── main.c │ ├── httpheaders_ut │ │ ├── CMakeLists.txt │ │ ├── httpheaders_ut.c │ │ └── main.c │ ├── lock_ut │ │ ├── CMakeLists.txt │ │ ├── lock_ut.c │ │ └── main.c │ ├── map_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── map_ut.c │ ├── optionhandler_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── optionhandler_ut.c │ ├── platform_win32_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── platform_win32_ut.c │ ├── real_test_files │ │ ├── real_buffer.c │ │ ├── real_constbuffer.c │ │ ├── real_crt_abstractions.c │ │ ├── real_map.c │ │ ├── real_map.h │ │ ├── real_singlylinkedlist.c │ │ ├── real_string_tokenizer.c │ │ ├── real_string_tokenizer.h │ │ ├── real_strings.c │ │ ├── real_strings.h │ │ └── real_vector.c │ ├── refcount_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ ├── refcount_ut.c │ │ ├── some_refcount_impl.c │ │ └── some_refcount_impl.h │ ├── sastoken_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── sastoken_ut.c │ ├── singlylinkedlist_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── singlylinkedlist_ut.c │ ├── socket_async_ut │ │ ├── CMakeLists.txt │ │ ├── keep_alive.h │ │ ├── main.c │ │ ├── socket_async_ut.c │ │ ├── test_defines.h │ │ └── win32_fake_linux │ │ │ ├── readme.txt │ │ │ └── socket_async_os.h │ ├── socketio_berkeley_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── socketio_berkeley_ut.c │ ├── socketio_win32_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── socketio_win32_ut.c │ ├── string_tokenizer_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── string_tokenizer_ut.c │ ├── strings_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── strings_ut.c │ ├── template_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ ├── target │ │ │ ├── callee.h │ │ │ ├── target.c │ │ │ └── target.h │ │ └── template_ut.c │ ├── tickcounter_freertos_ut │ │ ├── CMakeLists.txt │ │ ├── freertos │ │ │ ├── FreeRTOS.h │ │ │ └── task.h │ │ ├── main.c │ │ └── tickcounter_freertos_ut.c │ ├── tickcounter_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── tickcounter_ut.c │ ├── tlsio_cyclonessl_socket_bsd_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── tlsio_cyclonessl_socket_bsd_ut.c │ ├── tlsio_cyclonessl_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── tlsio_cyclonessl_ut.c │ ├── tlsio_esp8266_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── tlsio_esp8266_ut.c │ ├── tlsio_options_ut │ │ ├── CMakeLists.txt │ │ ├── gballoc_ut_impl_1.h │ │ ├── gballoc_ut_impl_2.h │ │ ├── main.c │ │ └── tlsio_options_ut.c │ ├── tlsio_wolfssl_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── tlsio_wolfssl_ut.c │ ├── uniqueid_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ ├── uniqueid_ut_linux.c │ │ └── uniqueid_ut_win32.c │ ├── urlencode_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── urlencode_ut.c │ ├── utf8_checker_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── utf8_checker_ut.c │ ├── uuid_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── uuid_ut.c │ ├── uws_client_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── uws_client_ut.c │ ├── uws_frame_encoder_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── uws_frame_encoder_ut.c │ ├── vector_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── vector_ut.c │ ├── wsio_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── wsio_ut.c │ ├── x509_openssl_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── x509_openssl_ut.c │ ├── x509_schannel_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── x509_schannel_ut.c │ └── xio_ut │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── xio_ut.c ├── testtools │ ├── CMakeLists.txt │ ├── SerialPort │ │ ├── SerialPort.sln │ │ └── SerialPort │ │ │ ├── App.config │ │ │ ├── Enumerations.cs │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ │ ├── SerialPort.cs │ │ │ ├── SerialPort.csproj │ │ │ ├── SerialPortState.cs │ │ │ ├── SerialPortTimeouts.cs │ │ │ ├── Win32Api.cs │ │ │ └── Win32Exceptioncs.cs │ ├── ctest │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── README.md │ │ ├── configs │ │ │ └── ctestConfig.cmake │ │ ├── doc │ │ │ └── ctest_user_manual.docx │ │ ├── inc │ │ │ ├── aux_inc │ │ │ │ ├── cstdbool │ │ │ │ ├── cstdint │ │ │ │ ├── inttypes.h │ │ │ │ ├── stdbool.h │ │ │ │ └── stdint.h │ │ │ ├── ctest.h │ │ │ └── ctest_macros.h │ │ ├── jenkins │ │ │ ├── linux_c_gcc44.sh │ │ │ ├── osx_c.sh │ │ │ ├── ubuntu_clang.sh │ │ │ ├── windows_c.cmd │ │ │ └── windows_vs2008_c.cmd │ │ ├── src │ │ │ └── ctest.c │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ └── ctest_ut │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── assertfailurestests.c │ │ │ │ ├── assertsuccesstests.c │ │ │ │ ├── ctestunittests.c │ │ │ │ ├── simpletestsuiteonetest.c │ │ │ │ ├── simpletestsuiteonetestcpp.cpp │ │ │ │ ├── simpletestsuitetwotests.c │ │ │ │ ├── testfunctioncleanupfailstests.c │ │ │ │ ├── testfunctioncleanuptests.c │ │ │ │ ├── testfunctioninitializetests.c │ │ │ │ ├── testsuiteinitializecleanuptests.c │ │ │ │ ├── whentestfunctioninitializefailstests.c │ │ │ │ └── whentestsuiteinitializefailstests.c │ │ └── tools │ │ │ └── kick_jenkins.cmd │ ├── micromock │ │ ├── CMakeLists.txt │ │ ├── doc │ │ │ ├── micromock.md │ │ │ └── timediscretemicromock.xps │ │ ├── inc │ │ │ ├── globalmock.h │ │ │ ├── micromock.h │ │ │ ├── micromockcallmacros.h │ │ │ ├── micromockcharstararenullterminatedstrings.h │ │ │ ├── micromockcommon.h │ │ │ ├── micromockenumtostring.h │ │ │ ├── micromockexception.h │ │ │ ├── micromocktestmutex.h │ │ │ ├── micromocktestrunnerhooks.h │ │ │ ├── mock.h │ │ │ ├── mockcallargument.h │ │ │ ├── mockcallargumentbase.h │ │ │ ├── mockcallcomparer.h │ │ │ ├── mockcallrecorder.h │ │ │ ├── mockmethodcall.h │ │ │ ├── mockmethodcallbase.h │ │ │ ├── mockresultvalue.h │ │ │ ├── mockvalue.h │ │ │ ├── mockvaluebase.h │ │ │ ├── nicecallcomparer.h │ │ │ ├── runtimemock.h │ │ │ ├── stdafx.h │ │ │ ├── strictorderedcallcomparer.h │ │ │ ├── strictunorderedcallcomparer.h │ │ │ ├── targetver.h │ │ │ ├── threadsafeglobalmock.h │ │ │ ├── timediscretemicromock.h │ │ │ └── timediscretemicromockcallmacros.h │ │ ├── src │ │ │ ├── micromockcharstararenullterminatedstrings.cpp │ │ │ ├── micromockexception.cpp │ │ │ ├── micromocktestmutex.cpp │ │ │ ├── mockcallrecorder.cpp │ │ │ ├── mockmethodcallbase.cpp │ │ │ ├── mockvaluebase.cpp │ │ │ └── timediscretemicromock.cpp │ │ ├── tools │ │ │ └── micromockgenerator │ │ │ │ ├── micromockgenerator.cpp │ │ │ │ ├── micromockgenerator.rc │ │ │ │ ├── stdafx.cpp │ │ │ │ ├── stdafx.h │ │ │ │ └── targetver.h │ │ └── unittests │ │ │ ├── CMakeLists.txt │ │ │ └── micromocktest │ │ │ ├── CMakeLists.txt │ │ │ ├── cmockvalueunittests.cpp │ │ │ ├── hypothetic_module.c │ │ │ ├── hypothetic_module.h │ │ │ ├── hypothetic_module_interfaces.h │ │ │ ├── main.c │ │ │ ├── micromockcallcomparisonunittests.cpp │ │ │ ├── micromocktest.cpp │ │ │ ├── micromocktest_with_ctest.c │ │ │ ├── micromockvalidateargumentbufferunittests.cpp │ │ │ ├── nullargsstringificationunittests.cpp │ │ │ ├── resource.h │ │ │ ├── stdafx.cpp │ │ │ ├── stdafx.h │ │ │ ├── stdafx_c.h │ │ │ ├── targetver.h │ │ │ ├── timediscretemicromocktest_stim.cpp │ │ │ ├── timediscretemicromocktestvoidvoid.cpp │ │ │ ├── timediscretemicromockwithreturnandparameters.cpp │ │ │ └── unittestsgenericresource.rc │ ├── sal │ │ ├── CMakeLists.txt │ │ └── inc │ │ │ ├── no_sal2.h │ │ │ └── sal.h │ ├── testrunner │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── configs │ │ │ └── testrunnerswitcherConfig.cmake │ │ ├── inc │ │ │ ├── macro_utils.h │ │ │ ├── testmutex.h │ │ │ └── testrunnerswitcher.h │ │ ├── jenkins │ │ │ ├── linux_c.sh │ │ │ ├── linux_c_gcc44.sh │ │ │ ├── osx_c.sh │ │ │ ├── ubuntu_clang.sh │ │ │ ├── windows_c.cmd │ │ │ ├── windows_vs2008_c.cmd │ │ │ └── windowsce_c.cmd │ │ ├── readme.md │ │ ├── src │ │ │ └── testmutex.c │ │ └── tools │ │ │ └── kick_jenkins.cmd │ └── umock-c │ │ ├── .gitignore │ │ ├── .gitmodules │ │ ├── CMakeLists.txt │ │ ├── configs │ │ ├── umock_cConfig.cmake │ │ └── umock_cFunctions.cmake │ │ ├── dependencies.cmake │ │ ├── deps │ │ ├── CMakeLists.txt │ │ ├── ctest │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── configs │ │ │ │ └── ctestConfig.cmake │ │ │ ├── doc │ │ │ │ └── ctest_user_manual.docx │ │ │ ├── inc │ │ │ │ ├── aux_inc │ │ │ │ │ ├── cstdbool │ │ │ │ │ ├── cstdint │ │ │ │ │ ├── inttypes.h │ │ │ │ │ ├── stdbool.h │ │ │ │ │ └── stdint.h │ │ │ │ ├── ctest.h │ │ │ │ └── ctest_macros.h │ │ │ ├── jenkins │ │ │ │ ├── linux_c_gcc44.sh │ │ │ │ ├── osx_c.sh │ │ │ │ ├── ubuntu_clang.sh │ │ │ │ ├── windows_c.cmd │ │ │ │ └── windows_vs2008_c.cmd │ │ │ ├── src │ │ │ │ └── ctest.c │ │ │ ├── tests │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── ctest_ut │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── assertfailurestests.c │ │ │ │ │ ├── assertsuccesstests.c │ │ │ │ │ ├── ctestunittests.c │ │ │ │ │ ├── simpletestsuiteonetest.c │ │ │ │ │ ├── simpletestsuiteonetestcpp.cpp │ │ │ │ │ ├── simpletestsuitetwotests.c │ │ │ │ │ ├── testfunctioncleanupfailstests.c │ │ │ │ │ ├── testfunctioncleanuptests.c │ │ │ │ │ ├── testfunctioninitializetests.c │ │ │ │ │ ├── testsuiteinitializecleanuptests.c │ │ │ │ │ ├── whentestfunctioninitializefailstests.c │ │ │ │ │ └── whentestsuiteinitializefailstests.c │ │ │ └── tools │ │ │ │ └── kick_jenkins.cmd │ │ └── testrunner │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── configs │ │ │ └── testrunnerswitcherConfig.cmake │ │ │ ├── inc │ │ │ ├── macro_utils.h │ │ │ ├── testmutex.h │ │ │ └── testrunnerswitcher.h │ │ │ ├── jenkins │ │ │ ├── linux_c.sh │ │ │ ├── linux_c_gcc44.sh │ │ │ ├── osx_c.sh │ │ │ ├── ubuntu_clang.sh │ │ │ ├── windows_c.cmd │ │ │ ├── windows_vs2008_c.cmd │ │ │ └── windowsce_c.cmd │ │ │ ├── readme.md │ │ │ ├── src │ │ │ └── testmutex.c │ │ │ └── tools │ │ │ └── kick_jenkins.cmd │ │ ├── devdoc │ │ ├── umock_c_lib_requirements_with_ids.md │ │ ├── umock_c_negative_tests_requirements.md │ │ ├── umock_c_requirements.md │ │ ├── umockalloc_requirements.md │ │ ├── umockautoignoreargs_requirements.md │ │ ├── umockcall_requirements.md │ │ ├── umockcallpairs_requirements.md │ │ ├── umockcallrecorder_requirements.md │ │ ├── umockstring_requirements.md │ │ ├── umocktypename_requirements.md │ │ ├── umocktypes_bool_requirements.md │ │ ├── umocktypes_c_requirements.md │ │ ├── umocktypes_charptr_requirements.md │ │ ├── umocktypes_requirements.md │ │ └── umocktypes_stdint_requirements.md │ │ ├── doc │ │ └── umock_c.md │ │ ├── inc │ │ ├── aux_inc │ │ │ ├── cstdbool │ │ │ ├── cstdint │ │ │ ├── inttypes.h │ │ │ ├── stdbool.h │ │ │ └── stdint.h │ │ ├── macro_utils.h │ │ ├── umock_c.h │ │ ├── umock_c_internal.h │ │ ├── umock_c_negative_tests.h │ │ ├── umock_c_prod.h │ │ ├── umock_log.h │ │ ├── umockalloc.h │ │ ├── umockautoignoreargs.h │ │ ├── umockcall.h │ │ ├── umockcallpairs.h │ │ ├── umockcallrecorder.h │ │ ├── umockstring.h │ │ ├── umocktypename.h │ │ ├── umocktypes.h │ │ ├── umocktypes_bool.h │ │ ├── umocktypes_c.h │ │ ├── umocktypes_charptr.h │ │ └── umocktypes_stdint.h │ │ ├── jenkins │ │ ├── linux_c_gcc44.sh │ │ ├── osx_c.sh │ │ ├── ubuntu_clang.sh │ │ ├── windows_c.cmd │ │ ├── windows_vs2008_c.cmd │ │ └── windowsce_c.cmd │ │ ├── readme.md │ │ ├── src │ │ ├── umock_c.c │ │ ├── umock_c_negative_tests.c │ │ ├── umock_log.c │ │ ├── umockalloc.c │ │ ├── umockautoignoreargs.c │ │ ├── umockcall.c │ │ ├── umockcallpairs.c │ │ ├── umockcallrecorder.c │ │ ├── umockstring.c │ │ ├── umocktypename.c │ │ ├── umocktypes.c │ │ ├── umocktypes_bool.c │ │ ├── umocktypes_c.c │ │ ├── umocktypes_charptr.c │ │ └── umocktypes_stdint.c │ │ ├── tests │ │ ├── CMakeLists.txt │ │ ├── umock_c_gen_func_decl_int │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ └── umock_c_gen_func_decl_int.c │ │ ├── umock_c_int │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── test_dependency.h │ │ │ └── umock_c_int.c │ │ ├── umock_c_malloc_hook_int │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ └── umock_c_malloc_hook_int.c │ │ ├── umock_c_negt_int │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── test_dependency.h │ │ │ └── umock_c_negt_int_tests.c │ │ ├── umock_c_negt_noini_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ └── umock_c_negt_noint_tests.c │ │ ├── umock_c_negt_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ └── umock_c_negative_tests_ut.c │ │ ├── umock_c_ptrarg_leak_int │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ └── umock_c_ptrarg_leak_int.c │ │ ├── umock_c_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ └── umock_c_ut.c │ │ ├── umock_c_wout_init_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ └── umock_c_wout_init_ut.c │ │ ├── umockalloc_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umockalloc_mocked.c │ │ │ └── umockalloc_ut.c │ │ ├── umockautoignoreargs_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ └── umockautoignoreargs_ut.c │ │ ├── umockcall_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umockcall_mocked.c │ │ │ └── umockcall_ut.c │ │ ├── umockcallpairs_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umockcallpairs_mocked.c │ │ │ └── umockcallpairs_ut.c │ │ ├── umockcallrecorder_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umockcallrecorder_mocked.c │ │ │ └── umockcallrecorder_ut.c │ │ ├── umockstring_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umockstring_mocked.c │ │ │ └── umockstring_ut.c │ │ ├── umocktypename_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umocktypename_mocked.c │ │ │ └── umocktypename_ut.c │ │ ├── umocktypes_bool_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umocktypes_bool_mocked.c │ │ │ └── umocktypes_bool_ut.c │ │ ├── umocktypes_c_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umocktypes_c_mocked.c │ │ │ └── umocktypes_c_ut.c │ │ ├── umocktypes_charptr_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umocktypes_charptr_mocked.c │ │ │ └── umocktypes_charptr_ut.c │ │ ├── umocktypes_stdint_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umocktypes_stdint_mocked.c │ │ │ └── umocktypes_stdint_ut.c │ │ ├── umocktypes_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umocktypes_mocked.c │ │ │ └── umocktypes_ut.c │ │ └── umocktypes_wout_init_ut │ │ │ ├── CMakeLists.txt │ │ │ ├── main.c │ │ │ ├── umocktypes_mocked.c │ │ │ └── umocktypes_wout_init_ut.c │ │ └── tools │ │ └── kick_jenkins.cmd ├── thirdpartynotice.txt ├── tools │ ├── compilembed │ │ ├── App.config │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── build.cmd │ │ ├── compilembed.csproj │ │ ├── compilembed.sln │ │ ├── mbedonlinecompile.cs │ │ └── program.cs │ ├── kick_jenkins.cmd │ ├── macro_utils_h_generator │ │ ├── app.config │ │ ├── macro_utils.cs │ │ ├── macro_utils.tt │ │ ├── macro_utils_h_generator.csproj │ │ ├── macro_utils_h_generator.exe.config │ │ ├── macro_utils_h_generator.sln │ │ ├── macro_utils_h_generator.vshost.exe.config │ │ ├── program.cs │ │ └── properties │ │ │ └── assemblyinfo.cs │ └── mbed_build_scripts │ │ ├── mbedbldtemplate.txt │ │ └── release_mbed_project.cmd └── version.txt ├── certs ├── certs.c └── certs.h ├── configs ├── iotcore_c_sdkConfig.cmake └── iotcore_c_sdkFunctions.cmake ├── dependencies-test.cmake ├── dependencies.cmake ├── iotcore_client ├── CMakeLists.txt ├── inc │ ├── iotcore_client_version.h │ ├── iotcore_mqtt_client.h │ ├── iotcore_param.h │ ├── iotcore_retry.h │ └── iotcore_type.h ├── samples │ ├── CMakeLists.txt │ └── iotcore_client_sample │ │ ├── CMakeLists.txt │ │ ├── freertos │ │ ├── .gitignore │ │ ├── Makefile │ │ └── project.xml │ │ ├── iotcore_mqtt_client_sample.c │ │ ├── iotcore_mqtt_client_sample.h │ │ ├── linux │ │ └── main.c │ │ ├── mbed │ │ ├── CMakeLists.txt │ │ ├── main.c │ │ └── mqtt_client_sample_filelist.txt │ │ └── windows │ │ └── main.c └── src │ ├── _md5.c │ ├── _md5.h │ ├── iotcore_mqtt_client.c │ ├── iotcore_param_util.c │ ├── iotcore_param_util.h │ ├── iotcore_retry_logic.c │ ├── iotcore_retry_logic.h │ └── iotcore_version.c ├── jenkins └── esp32_c.sh ├── pictures ├── io_chains.png └── porting_arch.png └── serializer ├── CMakeLists.txt ├── inc ├── agenttypesystem.h ├── codefirst.h ├── commanddecoder.h ├── datamarshaller.h ├── datapublisher.h ├── dataserializer.h ├── iotdevice.h ├── jsondecoder.h ├── jsonencoder.h ├── methodreturn.h ├── multitree.h ├── schema.h ├── schemalib.h ├── schemaserializer.h ├── serializer.h └── serializer_devicetwin.h ├── readme.md ├── src ├── agenttypesystem.c ├── codefirst.c ├── commanddecoder.c ├── datamarshaller.c ├── datapublisher.c ├── dataserializer.c ├── iotdevice.c ├── jsondecoder.c ├── jsonencoder.c ├── makefile ├── methodreturn.c ├── multitree.c ├── schema.c ├── schemalib.c ├── schemaserializer.c └── serializer.def └── tests ├── CMakeLists.txt ├── agentmacros_ut ├── CMakeLists.txt ├── agentmacros_ut.cpp └── main.c ├── agenttypesystem_ut ├── CMakeLists.txt ├── agenttypesystem_ut.cpp └── main.c ├── codefirst_cpp_ut ├── CMakeLists.txt ├── c_bool_size.c ├── c_bool_size.h ├── codefirst_cpp_ut.cpp └── main.c ├── codefirst_ut ├── CMakeLists.txt ├── c_bool_size.c ├── c_bool_size.h ├── codefirst_ut.c └── main.c ├── codefirst_withstructs_cpp_ut ├── CMakeLists.txt ├── codefirst_withstructs_cpp_ut.cpp └── main.c ├── codefirst_withstructs_ut ├── CMakeLists.txt ├── codefirst_withstructs_ut.c └── main.c ├── commanddecoder_ut ├── CMakeLists.txt ├── commanddecoder_ut.c └── main.c ├── datamarshaller_ut ├── CMakeLists.txt ├── datamarshaller_ut.c ├── main.c ├── real_agenttypesystem.c ├── real_agenttypesystem.h ├── real_parson.c └── real_parson.h ├── dataserializer_ut ├── CMakeLists.txt ├── dataserializer_ut.cpp └── main.c ├── iotdevice_ut ├── CMakeLists.txt ├── iotdevice_ut.c └── main.c ├── jsondecoder_ut ├── CMakeLists.txt ├── jsondecoder_ut.cpp └── main.c ├── jsonencoder_ut ├── CMakeLists.txt ├── jsonencoder_ut.cpp └── main.c ├── methodreturn_ut ├── CMakeLists.txt ├── main.c ├── methodreturn_ut.c ├── real_strings.c └── real_strings.h ├── multitree_ut ├── CMakeLists.txt ├── main.c └── multitree_ut.cpp ├── schema_ut ├── CMakeLists.txt ├── main.c └── schema_ut.c ├── schemalib_ut ├── CMakeLists.txt ├── main.c └── schemalib_ut.cpp ├── schemalib_without_init_ut ├── CMakeLists.txt ├── main.c └── schemalib_without_init_ut.cpp ├── schemaserializer_ut ├── CMakeLists.txt ├── main.c └── schemaserializer_ut.c ├── serializer_dt_int ├── CMakeLists.txt ├── main.c └── serializer_dt_int.c └── serializer_int ├── CMakeLists.txt ├── main.c ├── serializer_int.c └── serializer_int.md /.gitignore: -------------------------------------------------------------------------------- 1 | # put all ignore file to here 2 | 3 | .idea 4 | cmake 5 | cmake-build-debug 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "parson"] 2 | path = parson 3 | url = https://github.com/kgabis/parson.git 4 | [submodule "umqtt"] 5 | path = umqtt 6 | url = https://github.com/jewelzhu/azure-umqtt-c.git 7 | -------------------------------------------------------------------------------- /build_all/arduino/CMakeList.append: -------------------------------------------------------------------------------- 1 | SET(IN_OPENWRT $ENV{IN_OPENWRT}) 2 | 3 | if(IN_OPENWRT) 4 | ADD_DEFINITIONS("$ENV{TARGET_LDFLAGS}" "$ENV{TARGET_CPPFLAGS}" "$ENV{TARGET_CFLAGS}") 5 | INCLUDE_DIRECTORIES("$ENV{TOOLCHAIN_DIR}/usr/include" "$ENV{TARGET_LDFLAGS}" "$ENV{TARGET_CPPFLAGS}" "$ENV{TARGET_CFLAGS}") 6 | INCLUDE_DIRECTORIES("$ENV{TOOLCHAIN_DIR}/usr/include/openssl") 7 | INCLUDE_DIRECTORIES("$ENV{TOOLCHAIN_DIR}/usr/include/uuid") 8 | endif() 9 | -------------------------------------------------------------------------------- /build_all/esp32/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := esp32 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | -------------------------------------------------------------------------------- /build_all/esp32/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config WIFI_SSID 4 | string "WiFi SSID" 5 | default "myssid" 6 | help 7 | SSID (network name) for the example to connect to. 8 | 9 | config WIFI_PASSWORD 10 | string "WiFi Password" 11 | default "myssid" 12 | help 13 | WiFi password (WPA or WPA2) for the example to use. 14 | 15 | Can be left blank if the network has no security set. 16 | 17 | endmenu 18 | -------------------------------------------------------------------------------- /build_all/esp32/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | 7 | -------------------------------------------------------------------------------- /build_all/linux/print_failed_tests.sed: -------------------------------------------------------------------------------- 1 | # Run in shell with: sed -n -f 2 | # Saves output for a test case until it can determine whether the test 3 | # succeeded or failed. Discards output for successful test cases, prints 4 | # output for failed test cases. 5 | 6 | :in_testcase # loop entry point 7 | /^Suceeded\./ b # test case succeeded; discard output & exit loop 8 | /^!!! FAILED !!!$/ {x;p;b} # test case failed; print output & exit loop 9 | /^Executing test / h # if new test case found, start saving output 10 | /^Executing test /! H # else keep saving output 11 | n # grab the next line of output 12 | b in_testcase # branch to the top of the loop 13 | 14 | -------------------------------------------------------------------------------- /c-utility/adapters/agenttime.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/gballoc.h" 5 | 6 | #include 7 | #include "azure_c_shared_utility/agenttime.h" 8 | 9 | time_t get_time(time_t* p) 10 | { 11 | return time(p); 12 | } 13 | 14 | struct tm* get_gmtime(time_t* currentTime) 15 | { 16 | return gmtime(currentTime); 17 | } 18 | 19 | time_t get_mktime(struct tm* cal_time) 20 | { 21 | return mktime(cal_time); 22 | } 23 | 24 | char* get_ctime(time_t* timeToGet) 25 | { 26 | return ctime(timeToGet); 27 | } 28 | 29 | double get_difftime(time_t stopTime, time_t startTime) 30 | { 31 | return difftime(stopTime, startTime); 32 | } -------------------------------------------------------------------------------- /c-utility/adapters/agenttime_esp8266.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/agenttime.h" 5 | #include "azure_c_shared_utility/xlogging.h" 6 | #include "lwip/apps/sntp.h" 7 | #include "lwip/apps/sntp_time.h" 8 | 9 | time_t get_time(time_t* currentTime) 10 | { 11 | return sntp_get_current_timestamp(); 12 | } 13 | 14 | double get_difftime(time_t stopTime, time_t startTime) 15 | { 16 | return (double)stopTime - (double)startTime; 17 | } 18 | 19 | struct tm* get_gmtime(time_t* currentTime) 20 | { 21 | return NULL; 22 | } 23 | 24 | char* get_ctime(time_t* timeToGet) 25 | { 26 | return NULL; 27 | } 28 | -------------------------------------------------------------------------------- /c-utility/adapters/agenttime_mbed.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/agenttime.h" 5 | 6 | // mbed version of gmtime() returns NULL. 7 | // system RTC should be set to UTC as its localtime 8 | 9 | time_t get_time(time_t* currentTime) 10 | { 11 | return time(currentTime); 12 | } 13 | 14 | double get_difftime(time_t stopTime, time_t startTime) 15 | { 16 | return difftime(stopTime, startTime); 17 | } 18 | 19 | 20 | struct tm* get_gmtime(time_t* currentTime) 21 | { 22 | return localtime(currentTime); 23 | } 24 | 25 | char* get_ctime(time_t* timeToGet) 26 | { 27 | return ctime(timeToGet); 28 | } 29 | -------------------------------------------------------------------------------- /c-utility/adapters/linux_time.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef LINUX_TIME_H 5 | #define LINUX_TIME_H 6 | 7 | #include 8 | #include 9 | 10 | #ifndef __MACH__ 11 | extern clockid_t time_basis; 12 | #endif 13 | 14 | extern void set_time_basis(void); 15 | extern int get_time_ns(struct timespec* ts); 16 | extern time_t get_time_s(void); 17 | 18 | #define INVALID_TIME_VALUE (time_t)(-1) 19 | 20 | 21 | #define NANOSECONDS_IN_1_SECOND 1000000000L 22 | #define MILLISECONDS_IN_1_SECOND 1000 23 | #define NANOSECONDS_IN_1_MILLISECOND 1000000L 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /c-utility/adapters/platform_stub.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/platform.h" 5 | 6 | int platform_init(void) 7 | { 8 | return 0; 9 | } 10 | 11 | const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void) 12 | { 13 | return NULL; 14 | } 15 | 16 | STRING_HANDLE platform_get_platform_info(void) 17 | { 18 | // Expected format: "(; ; )" 19 | 20 | return STRING_construct("(native; undefined; undefined)"); 21 | } 22 | 23 | void platform_deinit(void) 24 | { 25 | return; 26 | } 27 | -------------------------------------------------------------------------------- /c-utility/build_all/mbed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(shared_util_base_path ../..) 7 | set(mbed_project_base "azure_c_shared_utility" CACHE STRING "The item being built") 8 | include (${shared_util_base_path}/tools/mbed_build_scripts/mbedbldtemplate.txt) 9 | -------------------------------------------------------------------------------- /c-utility/build_all/mbed3/.yotta.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": { 3 | "target": "frdm-k64f-gcc,*", 4 | "targetSetExplicitly": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /c-utility/build_all/mbed3/build.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | setlocal 5 | 6 | @REM Script arguments: 7 | 8 | @REM %1 File list for the project that is being built 9 | 10 | set project_path=..\.. 11 | set filelist=shared-util_filelist.txt 12 | 13 | if exist source rd /s /q source 14 | 15 | mkdir source 16 | 17 | echo Copying files ... 18 | 19 | for /f "tokens=*" %%i in (%filelist%) DO ( 20 | xcopy /y "%project_path%\%%i" "source" 21 | if !ERRORLEVEL! neq 0 goto :eof 22 | ) 23 | echo . 24 | 25 | yotta target frdm-k64f-gcc 26 | if !ERRORLEVEL! neq 0 goto :eof 27 | 28 | yotta build 29 | if !ERRORLEVEL! neq 0 goto :eof 30 | -------------------------------------------------------------------------------- /c-utility/build_all/mbed3/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "azure-c-shared-utility", 3 | "version": "0.0.2", 4 | "description": "Azure C shared utility library", 5 | "repository": { 6 | "url": "git@github.com:Azure/azure-c-shared-utility.git", 7 | "type": "git" 8 | }, 9 | "keywords": [], 10 | "author": "Microsoft", 11 | "license": "MIT", 12 | "dependencies": {}, 13 | "targetDependencies": { 14 | "arm": { 15 | 16 | "mbedtls": "^2.0.0" 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/azure-c-shared-util-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib/ 2 | usr/include/ 3 | usr/include/azureiot/ 4 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/azure-c-shared-util-dev.install: -------------------------------------------------------------------------------- 1 | inc usr/include/azureiot 2 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/azure-c-shared-util-lib.dirs: -------------------------------------------------------------------------------- 1 | usr/ 2 | usr/lib 3 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/azure-c-shared-util-lib.install: -------------------------------------------------------------------------------- 1 | /obj-*/lib*.a /usr/lib 2 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/changelog-trusty: -------------------------------------------------------------------------------- 1 | azure-c-shared-util (0.2.0-1trusty) trusty; urgency=low 2 | 3 | * See https://github.com/Azure/azure-iot-sdk-c/releases for details of the release 4 | 5 | -- AzureIoT User Tue, 27 Sep 2016 17:00:00 +0000 6 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/changelog-vivid: -------------------------------------------------------------------------------- 1 | azure-c-shared-util (0.1.0-60vivid) vivid; urgency=low 2 | 3 | * See https://github.com/Azure/azure-iot-sdk-c/releases for details of the release 4 | 5 | -- AzureIoT User Thu, 29 Sep 2016 11:00:00 +0000 6 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/changelog-wily: -------------------------------------------------------------------------------- 1 | azure-c-shared-util (undefined) wily; urgency=low 2 | 3 | * See https://github.com/Azure/azure-iot-sdk-c/releases for details of the release 4 | 5 | -- AzureIoT User Thu, 29 Sep 2016 11:00:00 +0000 6 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/changelog-xenial: -------------------------------------------------------------------------------- 1 | azure-c-shared-util (0.2.0.0-1xenial) xenial; urgency=low 2 | 3 | * See https://github.com/Azure/azure-iot-sdk-c/releases for details of the release 4 | 5 | -- AzureIoT User Thu, 29 Sep 2016 11:00:00 +0000 6 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/docs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/build_all/packaging/linux/debian/docs -------------------------------------------------------------------------------- /c-utility/build_all/packaging/linux/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /c-utility/build_all/packaging/windows/Microsoft.Azure.C.SharedUtility_thirdpartynotice.txt: -------------------------------------------------------------------------------- 1 | Third Party Notices for Azure Shared Utility project 2 | 3 | This project incorporates material from the project(s) listed below (collectively, "Third Party Code"). 4 | Microsoft Corporation is not the original author of the Third Party Code. 5 | The original copyright notice and license, under which Microsoft Corporation received such Third Party Code, 6 | are set out below. This Third Party Code is licensed to you under their original license terms set forth below. 7 | Microsoft Corporation reserves all other rights not expressly granted, whether by implication, estoppel or otherwise. 8 | -------------------------------------------------------------------------------- /c-utility/build_all/tirtos/package.xdc: -------------------------------------------------------------------------------- 1 | /* 2 | * ======== package.xdc ======== 3 | */ 4 | package build_all.tirtos { 5 | } 6 | -------------------------------------------------------------------------------- /c-utility/configs/azure_c_shared_utilityConfig.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | include("${CMAKE_CURRENT_LIST_DIR}/azure_c_shared_utilityTargets.cmake") 5 | 6 | get_target_property(AZURE_C_SHARED_UTILITY_INCLUDES aziotsharedutil INTERFACE_INCLUDE_DIRECTORIES) 7 | 8 | set(AZURE_C_SHARED_UTILITY_INCLUDES ${AZURE_C_SHARED_UTILITY_INCLUDES} CACHE INTERNAL "") 9 | 10 | include("${CMAKE_CURRENT_LIST_DIR}/azure_c_shared_utilityFunctions.cmake") -------------------------------------------------------------------------------- /c-utility/dependencies-test.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | if(${use_installed_dependencies}) 5 | find_package(umock_c REQUIRED CONFIG) 6 | endif() -------------------------------------------------------------------------------- /c-utility/dependencies.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | -------------------------------------------------------------------------------- /c-utility/devdoc/httpapiex_retry_mechanism.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/devdoc/httpapiex_retry_mechanism.vsdx -------------------------------------------------------------------------------- /c-utility/devdoc/img/porting_guide_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/devdoc/img/porting_guide_overview.png -------------------------------------------------------------------------------- /c-utility/devdoc/img/readme.txt: -------------------------------------------------------------------------------- 1 | The images in this directory were generated from source files in the sibling 'img_src' directory. 2 | -------------------------------------------------------------------------------- /c-utility/devdoc/img/tlsio_state_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/devdoc/img/tlsio_state_diagram.png -------------------------------------------------------------------------------- /c-utility/devdoc/img/xio_chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/devdoc/img/xio_chain.png -------------------------------------------------------------------------------- /c-utility/devdoc/img_src/porting_guide_overview.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/devdoc/img_src/porting_guide_overview.vsdx -------------------------------------------------------------------------------- /c-utility/devdoc/img_src/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains the source files used to generate the image files in the sibling 'img' directory. 2 | -------------------------------------------------------------------------------- /c-utility/devdoc/img_src/tlsio_state_diagram.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/devdoc/img_src/tlsio_state_diagram.pptx -------------------------------------------------------------------------------- /c-utility/devdoc/img_src/xio_chain.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/devdoc/img_src/xio_chain.pptx -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/const_defines.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CONST_DEFINES_H 5 | #define CONST_DEFINES_H 6 | 7 | // Used to remove GCC warning unused 8 | #ifdef __GNUC__ 9 | #define STATIC_VAR_UNUSED __attribute__ ((unused)) 10 | #else 11 | #define STATIC_VAR_UNUSED 12 | #endif 13 | 14 | #ifndef AZURE_UNREFERENCED_PARAMETER 15 | #define AZURE_UNREFERENCED_PARAMETER(param) (void)(param) 16 | #endif 17 | 18 | #endif // CONST_DEFINES -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/gb_rand.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef GB_RAND_H 5 | #define GB_RAND_H 6 | 7 | #include "azure_c_shared_utility/umock_c_prod.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | MOCKABLE_FUNCTION(, int, gb_rand); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif /* GB_RAND_H */ 20 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/hmac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef HMAC_H 5 | #define HMAC_H 6 | 7 | #include "azure_c_shared_utility/sha.h" 8 | #include "azure_c_shared_utility/umock_c_prod.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | MOCKABLE_FUNCTION(, int, hmac, SHAversion, whichSha, const unsigned char *, text, int, text_len, 15 | const unsigned char *, key, int, key_len, 16 | uint8_t, digest[USHAMaxHashSize]); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif /* HMAC_H */ 23 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/optimize_size.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef OPTIMIZE_SIZE_H 5 | #define OPTIMIZE_SIZE_H 6 | 7 | #if (defined __MSP430FR5969__) 8 | #define OPTIMIZE_RETURN_CODES 9 | #define NO_VERBOSE_OUTPUT 10 | #ifdef DEBUG 11 | #define MINIMAL_LOGERROR 12 | #else 13 | #define NO_LOGGING 14 | #endif 15 | #endif 16 | 17 | #if (defined OPTIMIZE_RETURN_CODES) 18 | #define __FAILURE__ 1 19 | #else 20 | #define __FAILURE__ __LINE__ 21 | #endif 22 | 23 | #endif // OPTIMIZE_SIZE_H 24 | 25 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/stdint_ce6.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | typedef signed char int8_t; 5 | typedef signed short int16_t; 6 | typedef signed int int32_t; 7 | typedef unsigned char uint8_t; 8 | typedef unsigned short uint16_t; 9 | typedef unsigned int uint32_t; 10 | typedef signed __int64 int64_t; 11 | typedef unsigned __int64 uint64_t; 12 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/string_tokenizer_types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef STRING_TOKENIZER_TYPES_H 5 | #define STRING_TOKENIZER_TYPES_H 6 | 7 | typedef struct STRING_TOKEN_TAG* STRING_TOKENIZER_HANDLE; 8 | 9 | #endif /*STRING_TOKENIZER_TYPES_H*/ 10 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/strings_types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef STRINGS_TYPES_H 5 | #define STRINGS_TYPES_H 6 | 7 | typedef struct STRING_TAG* STRING_HANDLE; 8 | 9 | #endif /*STRINGS_TYPES_H*/ 10 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/tls_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __TLS_CONFIG_H__ 2 | #define __TLS_CONFIG_H__ 3 | 4 | // DEPRECATED: This file will be removed from the tree. 5 | 6 | // WolfSSL or mbedTLS 7 | //#define USE_WOLF_SSL 8 | #define USE_MBED_TLS 9 | 10 | #endif // __TLS_CONFIG_H__ -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/tlsio.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TLSIO_H 5 | #define TLSIO_H 6 | 7 | #include "xio.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif /* __cplusplus */ 12 | 13 | typedef struct TLSIO_CONFIG_TAG 14 | { 15 | const char* hostname; 16 | int port; 17 | const IO_INTERFACE_DESCRIPTION* underlying_io_interface; 18 | void* underlying_io_parameters; 19 | } TLSIO_CONFIG; 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif /* __cplusplus */ 24 | 25 | #endif /* TLSIO_H */ 26 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/tlsio_cyclonessl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TLSIO_CYCLONESSL_H 5 | #define TLSIO_CYCLONESSL_H 6 | 7 | #include "azure_c_shared_utility/xio.h" 8 | #include "azure_c_shared_utility/umock_c_prod.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #include 13 | #else 14 | #include 15 | #endif /* __cplusplus */ 16 | 17 | MOCKABLE_FUNCTION(, const IO_INTERFACE_DESCRIPTION*, tlsio_cyclonessl_get_interface_description); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif /* __cplusplus */ 22 | 23 | #endif /* TLSIO_CYCLONESSL_H */ 24 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/tlsio_cyclonessl_socket.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TLSIO_CYCLONESSL_SOCKET_H 5 | #define TLSIO_CYCLONESSL_SOCKET_H 6 | 7 | #include "tls.h" 8 | #include "azure_c_shared_utility/umock_c_prod.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif /* __cplusplus */ 13 | 14 | MOCKABLE_FUNCTION(, int, tlsio_cyclonessl_socket_create, const char*, hostname, unsigned int, port, TlsSocket*, new_socket); 15 | MOCKABLE_FUNCTION(, void, tlsio_cyclonessl_socket_destroy, TlsSocket, socket); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif /* __cplusplus */ 20 | 21 | #endif /* TLSIO_CYCLONESSL_SOCKET_H */ 22 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/utf8_checker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef UTF8_CHECKER_H 5 | #define UTF8_CHECKER_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | extern "C" { 10 | #else 11 | #include 12 | #include 13 | #endif 14 | 15 | #include "azure_c_shared_utility/umock_c_prod.h" 16 | 17 | MOCKABLE_FUNCTION(, bool, utf8_checker_is_valid_utf8, const unsigned char*, utf8_str, size_t, length); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif /* __cplusplus */ 22 | 23 | #endif /* UTF8_CHECKER_H */ 24 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/vector_types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef VECTOR_TYPES_H 5 | #define VECTOR_TYPES_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" 9 | { 10 | #else 11 | #include 12 | #endif 13 | 14 | typedef struct VECTOR_TAG* VECTOR_HANDLE; 15 | 16 | typedef bool(*PREDICATE_FUNCTION)(const void* element, const void* value); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif /* VECTOR_TYPES_H */ 23 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/vector_types_internal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef VECTOR_TYPES_INTERNAL_H 5 | #define VECTOR_TYPES_INTERNAL_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | typedef struct VECTOR_TAG 14 | { 15 | void* storage; 16 | size_t count; 17 | size_t elementSize; 18 | } VECTOR; 19 | 20 | #endif /* VECTOR_TYPES_INTERNAL_H */ 21 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/windowsce/cstdbool: -------------------------------------------------------------------------------- 1 | // cstdbool standard header 2 | #pragma once 3 | #ifndef _CSTDBOOL_ 4 | #define _CSTDBOOL_ 5 | #include 6 | 7 | #include 8 | #endif /* _CSTDBOOL_ */ 9 | 10 | /* 11 | * Copyright (c) 1992-2013 by P.J. Plauger. ALL RIGHTS RESERVED. 12 | * Consult your license regarding permissions and restrictions. 13 | V6.40:0009 */ 14 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/windowsce/cstdint: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CSTDINT_H 5 | #define CSTDINT_H 6 | 7 | #include "stdint.h" 8 | 9 | #endif /* CSTDINT_H */ 10 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/windowsce/inttypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef INTTYPES_H 5 | #define INTTYPES_H 6 | 7 | #define PRId8 "hhd" 8 | #define PRId16 "hd" 9 | #define PRId32 "d" 10 | #define PRId64 "lld" 11 | 12 | #define PRIu8 "hhu" 13 | #define PRIu16 "hu" 14 | #define PRIu32 "u" 15 | #define PRIu64 "llu" 16 | 17 | #endif // INTTYPES_H 18 | -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/windowsce/stdbool.h: -------------------------------------------------------------------------------- 1 | #ifndef _WINCE_STDBOOL 2 | #define _WINCE_STDBOOL 3 | 4 | #define __bool_true_false_are_defined 1 5 | 6 | #define HAS_STDBOOL 7 | 8 | #ifndef __cplusplus 9 | 10 | typedef unsigned char bool; 11 | typedef bool _Bool; 12 | 13 | #define false 0 14 | #define true 1 15 | 16 | #endif /* __cplusplus */ 17 | 18 | #endif /* _WINCE_STDBOOL */ -------------------------------------------------------------------------------- /c-utility/inc/azure_c_shared_utility/x509_openssl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef X509_OPENSSL_H 5 | #define X509_OPENSSL_H 6 | 7 | #include "openssl/ssl.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include "azure_c_shared_utility/umock_c_prod.h" 14 | 15 | MOCKABLE_FUNCTION(,int, x509_openssl_add_certificates, SSL_CTX*, ssl_ctx, const char*, certificates); 16 | MOCKABLE_FUNCTION(,int, x509_openssl_add_credentials, SSL_CTX*, ssl_ctx, const char*, x509certificate, const char*, x509privatekey); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c-utility/jenkins/debian_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | build_root=$(cd "$(dirname "$0")/.." && pwd) 6 | cd $build_root 7 | 8 | build_folder=$build_root"/cmake/shared-util_linux" 9 | 10 | # Set the default cores 11 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 12 | 13 | rm -r -f $build_folder 14 | mkdir -p $build_folder 15 | pushd $build_folder 16 | cmake -Drun_valgrind:BOOL=ON $build_root -Drun_unittests:BOOL=ON 17 | make --jobs=$CORES 18 | 19 | #use doctored openssl 20 | export LD_LIBRARY_PATH=/usr/local/ssl/lib 21 | ctest -j $CORES --output-on-failure 22 | export LD_LIBRARY_PATH= 23 | 24 | popd 25 | -------------------------------------------------------------------------------- /c-utility/jenkins/linux_c_gcc44.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | build_root=$(cd "$(dirname "$0")/.." && pwd) 8 | cd $build_root 9 | 10 | build_folder=$build_root"/cmake/shared-util_linux" 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | 15 | rm -r -f $build_folder 16 | mkdir -p $build_folder 17 | pushd $build_folder 18 | cmake $build_root -Drun_unittests:bool=ON -Drun_valgrind:BOOL=ON 19 | make --jobs=$CORES 20 | 21 | popd 22 | -------------------------------------------------------------------------------- /c-utility/jenkins/linux_wolfssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | build_root=$(cd "$(dirname "$0")/.." && pwd) 6 | cd $build_root 7 | 8 | build_folder=$build_root"/cmake/shared-util_linux" 9 | 10 | # Set the default cores 11 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 12 | 13 | rm -r -f $build_folder 14 | mkdir -p $build_folder 15 | pushd $build_folder 16 | cmake $build_root -Drun_unittests:BOOL=ON -Duse_wolfssl:BOOL=ON 17 | make --jobs=$CORES 18 | 19 | #use doctored openssl 20 | export LD_LIBRARY_PATH=/usr/local/ssl/lib 21 | ctest -j $CORES --output-on-failure 22 | export LD_LIBRARY_PATH= 23 | 24 | popd 25 | -------------------------------------------------------------------------------- /c-utility/jenkins/mbed_c.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | setlocal 5 | 6 | set build-root=%~dp0.. 7 | rem // resolve to fully qualified path 8 | for %%i in ("%build-root%") do set build-root=%%~fi 9 | 10 | REM -- C -- 11 | cd %build-root%\build_all\mbed 12 | 13 | call build.cmd %* 14 | if errorlevel 1 goto :eof 15 | cd %build-root% -------------------------------------------------------------------------------- /c-utility/jenkins/osx_gcc_openssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -DOPENSSL_ROOT_DIR:PATH=/usr/local/opt/openssl -Duse_openssl:bool=ON -Drun_unittests:bool=ON 18 | cmake --build . -- --jobs=$CORES 19 | ctest -C "debug" -V 20 | popd 21 | -------------------------------------------------------------------------------- /c-utility/jenkins/osx_xcode_native.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_unittests:bool=ON -G Xcode 18 | cmake --build . -- --jobs=$CORES 19 | ctest -C "debug" -V 20 | popd 21 | -------------------------------------------------------------------------------- /c-utility/jenkins/ubuntu1510_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | build_root=$(cd "$(dirname "$0")/.." && pwd) 8 | cd $build_root 9 | 10 | build_folder=$build_root"/cmake/shared-util_linux" 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | 15 | rm -r -f $build_folder 16 | mkdir -p $build_folder 17 | pushd $build_folder 18 | cmake -Drun_valgrind:BOOL=ON $build_root -Drun_unittests:BOOL=ON -Duse_wsio:BOOL=ON 19 | make --jobs=$CORES 20 | 21 | popd 22 | -------------------------------------------------------------------------------- /c-utility/jenkins/ubuntu1604_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | build_root=$(cd "$(dirname "$0")/.." && pwd) 8 | cd $build_root 9 | 10 | build_folder=$build_root"/cmake/shared-util_linux" 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | 15 | rm -r -f $build_folder 16 | mkdir -p $build_folder 17 | pushd $build_folder 18 | cmake $build_root -Drun_unittests:BOOL=ON 19 | make --jobs=$CORES 20 | ctest -C "debug" -V 21 | 22 | popd 23 | -------------------------------------------------------------------------------- /c-utility/jenkins/ubuntu_clang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | rm -r -f $build_folder 13 | mkdir -p $build_folder 14 | pushd $build_folder 15 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON -Duse_wsio:BOOL=ON 16 | cmake --build . -- --jobs=$(nproc) 17 | ctest -C "debug" -V 18 | 19 | popd 20 | : -------------------------------------------------------------------------------- /c-utility/jenkins/windows_c.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | setlocal 5 | 6 | set build-root=%~dp0.. 7 | rem // resolve to fully qualified path 8 | for %%i in ("%build-root%") do set build-root=%%~fi 9 | 10 | REM -- C -- 11 | cd %build-root%\build_all\windows 12 | 13 | call build.cmd %* 14 | if errorlevel 1 goto :eof 15 | cd %build-root% -------------------------------------------------------------------------------- /c-utility/jenkins/windows_c_build_as_dynamic.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | @setlocal 5 | @echo off 6 | 7 | set cmake_dir=dynamic_build 8 | set build-root=%~dp0.. 9 | @REM // resolve to fully qualified path 10 | for %%i in ("%build-root%") do set build-root=%%~fi 11 | 12 | if EXIST %build-root%\cmake\%cmake_dir% ( 13 | rmdir /s/q %build-root%\cmake\%cmake_dir% 14 | ) 15 | mkdir %build-root%\cmake\%cmake_dir% 16 | if errorlevel 1 goto :eof 17 | 18 | cd %build-root%\cmake\%cmake_dir% 19 | 20 | cmake -Dskip_samples=ON -Dbuild_as_dynamic=ON ..\.. 21 | if errorlevel 1 goto :eof 22 | 23 | cmake --build . -- /m 24 | if errorlevel 1 goto :eof 25 | -------------------------------------------------------------------------------- /c-utility/jenkins/windowsce_c.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | setlocal 5 | 6 | set build-root=%~dp0.. 7 | rem // resolve to fully qualified path 8 | for %%i in ("%build-root%") do set build-root=%%~fi 9 | 10 | REM -- C -- 11 | cd %build-root%\build_all\windowsce 12 | call build.cmd 13 | if errorlevel 1 goto :eof 14 | cd %build-root% 15 | -------------------------------------------------------------------------------- /c-utility/pal/linux/socket_async_os.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | //This file pulls in OS-specific header files to allow compilation of socket_async.c under 5 | // most OS's except for Windows. 6 | 7 | // For Linux systems 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | -------------------------------------------------------------------------------- /c-utility/pal/lwip/sntp_os.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | //This file pulls in OS-specific header files to allow compilation of socket_async.c under 5 | // most OS's except for Windows. 6 | 7 | // For ESP32 lwIP systems which use the ESP-IDF's non-standard lwIP include structure 8 | // Tested with: 9 | // ESP32 10 | 11 | #ifndef LWIP_SNTP_OS_H 12 | #define LWIP_SNTP_OS_H 13 | 14 | #include "apps/sntp/sntp.h" 15 | 16 | #endif // LWIP_SNTP_OS_H -------------------------------------------------------------------------------- /c-utility/samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | function(add_sample_directory whatIsBuilding) 7 | add_subdirectory(${whatIsBuilding}) 8 | 9 | set_target_properties(${whatIsBuilding} 10 | PROPERTIES 11 | FOLDER "C-Utility_Samples") 12 | endfunction() 13 | 14 | add_sample_directory(iot_c_utility) 15 | 16 | if (NOT ("${ARCHITECTURE}" STREQUAL "ARM")) 17 | add_sample_directory(socketio_connect) 18 | add_sample_directory(tlsio_connect) 19 | endif() -------------------------------------------------------------------------------- /c-utility/samples/iot_c_utility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | compileAsC99() 5 | 6 | set(iot_c_utility_c_files 7 | iot_c_utility.c 8 | ) 9 | 10 | if (WIN32) 11 | #windows needs this define 12 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) 13 | add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) 14 | ENDIF(WIN32) 15 | 16 | if (${use_http}) 17 | add_definitions(-DUSE_HTTP) 18 | endif() 19 | 20 | add_executable(iot_c_utility ${iot_c_utility_c_files}) 21 | 22 | target_link_libraries(iot_c_utility 23 | aziotsharedutil 24 | ) -------------------------------------------------------------------------------- /c-utility/samples/socketio_connect/mbed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(shared_util_base_path ../../..) 7 | set(mbed_project_base "socketio_connect" CACHE STRING "The item being built") 8 | include (${shared_util_base_path}/tools/mbed_build_scripts/mbedbldtemplate.txt) 9 | -------------------------------------------------------------------------------- /c-utility/samples/socketio_connect/mbed/socketio_connect_filelist.txt: -------------------------------------------------------------------------------- 1 | set(mbed_project_files 2 | ${CMAKE_CURRENT_SOURCE_DIR}/../main.c 3 | ) 4 | -------------------------------------------------------------------------------- /c-utility/samples/tlsio_connect/mbed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(shared_util_base_path ../../..) 7 | set(mbed_project_base "tlsio_connect" CACHE STRING "The item being built") 8 | include (${shared_util_base_path}/tools/mbed_build_scripts/mbedbldtemplate.txt) 9 | -------------------------------------------------------------------------------- /c-utility/samples/tlsio_connect/mbed/tlsio_connect_filelist.txt: -------------------------------------------------------------------------------- 1 | set(mbed_project_files 2 | ${CMAKE_CURRENT_SOURCE_DIR}/../main.c 3 | ) 4 | -------------------------------------------------------------------------------- /c-utility/src/gb_rand.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifdef __cplusplus 5 | #include 6 | #else 7 | #include 8 | #endif 9 | 10 | #include "azure_c_shared_utility/gb_rand.h" 11 | 12 | /*this is rand*/ 13 | int gb_rand(void) 14 | { 15 | return rand(); 16 | } 17 | -------------------------------------------------------------------------------- /c-utility/tests/agenttime_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for agenttime_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | 9 | set(theseTestsName agenttime_ut) 10 | 11 | set(${theseTestsName}_test_files 12 | ${theseTestsName}.c 13 | ) 14 | 15 | set(${theseTestsName}_c_files 16 | ../../pal/agenttime.c 17 | ) 18 | 19 | set(${theseTestsName}_h_files 20 | ) 21 | 22 | 23 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 24 | -------------------------------------------------------------------------------- /c-utility/tests/agenttime_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(agenttime_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/base32_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | compileAsC11() 7 | set(theseTestsName base32_ut) 8 | 9 | set(${theseTestsName}_test_files 10 | ${theseTestsName}.c 11 | ) 12 | 13 | set(${theseTestsName}_c_files 14 | ../../src/base32.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | -------------------------------------------------------------------------------- /c-utility/tests/base32_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(base32_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/base64_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for base64_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName base64_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/base64.c 16 | ../../src/strings.c 17 | ../../src/buffer.c 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 24 | -------------------------------------------------------------------------------- /c-utility/tests/base64_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(base64_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/buffer_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for buffer_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName buffer_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/buffer.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/buffer_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(Buffer_UnitTests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/condition_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(Condition_UnitTests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/connectionstringparser_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(connectionstringparser_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/constbuffer_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for buffer_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName constbuffer_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/constbuffer.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/constbuffer_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(constbuffer_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/constmap_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for map_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName constmap_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/constmap.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/constmap_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(constmap_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/crtabstractions_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for crt_abstractions_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | 9 | set(theseTestsName crt_abstractions_ut) 10 | 11 | set(${theseTestsName}_test_files 12 | crtabstractions_ut.c 13 | ) 14 | 15 | set(${theseTestsName}_c_files 16 | ../../src/crt_abstractions.c 17 | ) 18 | 19 | set(${theseTestsName}_h_files 20 | ) 21 | 22 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") -------------------------------------------------------------------------------- /c-utility/tests/crtabstractions_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(CRTAbstractions_UnitTests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/dns_async_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | /** 10 | * Identify the test suite to run here. 11 | */ 12 | RUN_TEST_SUITE(dns_async_ut, failedTestCount); 13 | 14 | return failedTestCount; 15 | } 16 | -------------------------------------------------------------------------------- /c-utility/tests/dns_async_ut/win32_fake_linux/readme.txt: -------------------------------------------------------------------------------- 1 | This file is a convenience for debugging socket_async.c under Windows, and does not need to 2 | normally be part of the SDK build. 3 | -------------------------------------------------------------------------------- /c-utility/tests/doublylinkedlist_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for doublylinkedlist_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | 9 | set(theseTestsName doublylinkedlist_ut) 10 | 11 | set(${theseTestsName}_test_files 12 | ${theseTestsName}.c 13 | ) 14 | 15 | set(${theseTestsName}_c_files 16 | ../../src/doublylinkedlist.c 17 | ) 18 | 19 | set(${theseTestsName}_h_files 20 | ) 21 | 22 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 23 | -------------------------------------------------------------------------------- /c-utility/tests/doublylinkedlist_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(doublylinkedlist_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/gballoc_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for gballoc_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | set(theseTestsName gballoc_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | ${theseTestsName}.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | gballoc_undertest.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 20 | 21 | -------------------------------------------------------------------------------- /c-utility/tests/gballoc_ut/gballoc_undertest.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #define malloc mock_malloc 6 | #define calloc mock_calloc 7 | #define realloc mock_realloc 8 | #define free mock_free 9 | 10 | extern void* mock_malloc(size_t size); 11 | extern void* mock_calloc(size_t nmemb, size_t size); 12 | extern void* mock_realloc(void* ptr, size_t size); 13 | extern void mock_free(void* ptr); 14 | 15 | #undef _CRTDBG_MAP_ALLOC 16 | #include "../src/gballoc.c" 17 | -------------------------------------------------------------------------------- /c-utility/tests/gballoc_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(GBAlloc_UnitTests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/gballoc_without_init_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for gballoc_without_init_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | set(theseTestsName gballoc_without_init_ut) 8 | 9 | set(${theseTestsName}_test_files 10 | ${theseTestsName}.c 11 | ) 12 | 13 | set(${theseTestsName}_c_files 14 | gballoc_undertest.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | -------------------------------------------------------------------------------- /c-utility/tests/gballoc_without_init_ut/gballoc_undertest.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #define malloc mock_malloc 6 | #define calloc mock_calloc 7 | #define realloc mock_realloc 8 | #define free mock_free 9 | 10 | extern void* mock_malloc(size_t size); 11 | extern void* mock_calloc(size_t nmemb, size_t size); 12 | extern void* mock_realloc(void* ptr, size_t size); 13 | extern void mock_free(void* ptr); 14 | 15 | #undef _CRTDBG_MAP_ALLOC 16 | #include "../src/gballoc.c" 17 | -------------------------------------------------------------------------------- /c-utility/tests/gballoc_without_init_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(GBAlloc_For_Init_UnitTests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/hmacsha256_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for hmacsha256_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName hmacsha256_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/hmacsha256.c 16 | ../../src/hmac.c 17 | ../../src/usha.c 18 | ../../src/sha1.c 19 | ../../src/sha224.c 20 | ../../src/sha384-512.c 21 | ../../src/buffer.c 22 | ) 23 | 24 | set(${theseTestsName}_h_files 25 | ) 26 | 27 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 28 | -------------------------------------------------------------------------------- /c-utility/tests/hmacsha256_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(HMACSHA256_UnitTests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/http_proxy_io_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | compileAsC11() 7 | set(theseTestsName http_proxy_io_ut) 8 | 9 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 10 | 11 | set(${theseTestsName}_test_files 12 | ${theseTestsName}.c 13 | ) 14 | 15 | set(${theseTestsName}_c_files 16 | ../../src/http_proxy_io.c 17 | ../real_test_files/real_crt_abstractions.c 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 24 | -------------------------------------------------------------------------------- /c-utility/tests/http_proxy_io_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(http_proxy_io_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/httpapicompact_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for httpapi_compact_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | if(NOT ${use_http}) 8 | message(FATAL_ERROR "httpapi_compact_ut being generated without HTTP support") 9 | endif() 10 | 11 | compileAsC11() 12 | set(theseTestsName httpapi_compact_ut) 13 | 14 | set(${theseTestsName}_test_files 15 | httpapicompact_ut.c 16 | ) 17 | 18 | set(${theseTestsName}_c_files 19 | ../../adapters/httpapi_compact.c 20 | ) 21 | 22 | set(${theseTestsName}_h_files 23 | ) 24 | 25 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 26 | -------------------------------------------------------------------------------- /c-utility/tests/httpapicompact_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(httpapicompact_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/httpapiex_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(httpapiex_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/httpapiexsas_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for httpapiexsas_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | if(NOT ${use_http}) 8 | message(FATAL_ERROR "httpapiexsas_ut being generated without HTTP support") 9 | endif() 10 | 11 | compileAsC11() 12 | set(theseTestsName httpapiexsas_ut) 13 | 14 | set(${theseTestsName}_test_files 15 | ${theseTestsName}.c 16 | ) 17 | 18 | set(${theseTestsName}_c_files 19 | ../../src/httpapiexsas.c 20 | ) 21 | 22 | set(${theseTestsName}_h_files 23 | ) 24 | 25 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 26 | -------------------------------------------------------------------------------- /c-utility/tests/httpapiexsas_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(httpapiexsas_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/httpheaders_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for httpheaders_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | if(NOT ${use_http}) 8 | message(FATAL_ERROR "httpheaders_ut being generated without HTTP support") 9 | endif() 10 | 11 | compileAsC11() 12 | set(theseTestsName httpheaders_ut) 13 | 14 | set(${theseTestsName}_test_files 15 | ${theseTestsName}.c 16 | ) 17 | 18 | set(${theseTestsName}_c_files 19 | ../../src/httpheaders.c 20 | ) 21 | 22 | set(${theseTestsName}_h_files 23 | ) 24 | 25 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 26 | -------------------------------------------------------------------------------- /c-utility/tests/httpheaders_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(HTTPHeaders_UnitTests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/lock_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for lock_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName lock_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ${LOCK_C_FILE} 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/lock_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(LOCK_UnitTests, failedTestCount); 11 | return failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /c-utility/tests/map_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for map_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName map_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/map.c 16 | ../../src/crt_abstractions.c 17 | ) 18 | 19 | set(${theseTestsName}_h_files 20 | ) 21 | 22 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") -------------------------------------------------------------------------------- /c-utility/tests/map_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(map_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/optionhandler_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for optionhandler_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName optionhandler_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/optionhandler.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/optionhandler_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(optionhandler_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/platform_win32_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(platform_win32_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/real_test_files/real_constbuffer.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define CONSTBUFFER_Create real_CONSTBUFFER_Create 5 | #define CONSTBUFFER_CreateFromBuffer real_CONSTBUFFER_CreateFromBuffer 6 | #define CONSTBUFFER_Clone real_CONSTBUFFER_Clone 7 | #define CONSTBUFFER_GetContent real_CONSTBUFFER_GetContent 8 | #define CONSTBUFFER_Destroy real_CONSTBUFFER_Destroy 9 | 10 | #define GBALLOC_H 11 | 12 | #include "constbuffer.c" 13 | -------------------------------------------------------------------------------- /c-utility/tests/real_test_files/real_crt_abstractions.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define mallocAndStrcpy_s real_mallocAndStrcpy_s 5 | #define unsignedIntToString real_unsignedIntToString 6 | #define size_tToString real_size_tToString 7 | 8 | #define GBALLOC_H 9 | 10 | #include "crt_abstractions.c" 11 | -------------------------------------------------------------------------------- /c-utility/tests/real_test_files/real_string_tokenizer.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define COMPILING_REAL_REAL_STRING_TOKENIZER_H_C 5 | 6 | #define GBALLOC_H 7 | 8 | #include "real_string_tokenizer.h" 9 | #include "string_tokenizer.c" 10 | -------------------------------------------------------------------------------- /c-utility/tests/real_test_files/real_strings.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define COMPILING_REAL_STRINGS_C 5 | 6 | #define GBALLOC_H 7 | #include "real_strings.h" 8 | #include "strings.c" 9 | -------------------------------------------------------------------------------- /c-utility/tests/real_test_files/real_vector.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define VECTOR_create real_VECTOR_create 5 | #define VECTOR_move real_VECTOR_move 6 | #define VECTOR_destroy real_VECTOR_destroy 7 | #define VECTOR_push_back real_VECTOR_push_back 8 | #define VECTOR_erase real_VECTOR_erase 9 | #define VECTOR_clear real_VECTOR_clear 10 | #define VECTOR_element real_VECTOR_element 11 | #define VECTOR_front real_VECTOR_front 12 | #define VECTOR_back real_VECTOR_back 13 | #define VECTOR_find_if real_VECTOR_find_if 14 | #define VECTOR_size real_VECTOR_size 15 | 16 | #define GBALLOC_H 17 | 18 | #include "vector.c" 19 | -------------------------------------------------------------------------------- /c-utility/tests/refcount_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for map_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName refcount_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | some_refcount_impl.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | some_refcount_impl.h 20 | ) 21 | 22 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 23 | -------------------------------------------------------------------------------- /c-utility/tests/refcount_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(refcount_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/refcount_ut/some_refcount_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef SOME_REFCOUNT_IMPL_H 5 | #define SOME_REFCOUNT_IMPL_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" 9 | { 10 | #endif 11 | 12 | typedef struct pos* POS_HANDLE; 13 | 14 | extern POS_HANDLE Pos_Create(int x); 15 | extern POS_HANDLE Pos_Clone(POS_HANDLE posHandle); 16 | extern void Pos_Destroy(POS_HANDLE posHandle); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif /*SOME_REFCOUNT_IMPL_H*/ 23 | -------------------------------------------------------------------------------- /c-utility/tests/sastoken_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for sastoken_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName sastoken_ut) 9 | set(${theseTestsName}_test_files 10 | ${theseTestsName}.c 11 | ) 12 | 13 | set(${theseTestsName}_c_files 14 | ../../src/sastoken.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | -------------------------------------------------------------------------------- /c-utility/tests/sastoken_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(sastoken_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/singlylinkedlist_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for lock_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName singlylinkedlist_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/singlylinkedlist.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/singlylinkedlist_ut/main.c: -------------------------------------------------------------------------------- 1 | #include "testrunnerswitcher.h" 2 | 3 | int main(void) 4 | { 5 | size_t failedTestCount = 0; 6 | RUN_TEST_SUITE(singlylinkedlist_unittests, failedTestCount); 7 | return failedTestCount; 8 | } 9 | -------------------------------------------------------------------------------- /c-utility/tests/socket_async_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | /** 10 | * Identify the test suite to run here. 11 | */ 12 | RUN_TEST_SUITE(socket_async_ut, failedTestCount); 13 | 14 | return failedTestCount; 15 | } 16 | -------------------------------------------------------------------------------- /c-utility/tests/socket_async_ut/win32_fake_linux/readme.txt: -------------------------------------------------------------------------------- 1 | This file is a convenience for debugging socket_async.c under Windows, and does not need to 2 | normally be part of the SDK build. 3 | -------------------------------------------------------------------------------- /c-utility/tests/socketio_berkeley_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | if(MSVC) 7 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4217") 8 | set(CMAKE_SHARED_LINKER_FLAGS "$(CMAKE_SHARED_LINKER_FLAGS) /IGNORE:4217") 9 | endif() 10 | 11 | compileAsC99() 12 | set(theseTestsName socketio_berkeley_ut) 13 | set(${theseTestsName}_test_files 14 | ${theseTestsName}.c 15 | ) 16 | 17 | set(${theseTestsName}_c_files 18 | ../../adapters/socketio_berkeley.c 19 | ) 20 | 21 | set(${theseTestsName}_h_files 22 | ) 23 | 24 | build_c_test_artifacts(${theseTestsName} ON "azure_c_shared_utility_tests") 25 | -------------------------------------------------------------------------------- /c-utility/tests/socketio_berkeley_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(socketio_berkeley_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/socketio_win32_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | if(MSVC) 7 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4217") 8 | set(CMAKE_SHARED_LINKER_FLAGS "$(CMAKE_SHARED_LINKER_FLAGS) /IGNORE:4217") 9 | endif() 10 | 11 | compileAsC99() 12 | set(theseTestsName socketio_win32_ut) 13 | set(${theseTestsName}_test_files 14 | ${theseTestsName}.c 15 | ) 16 | 17 | set(${theseTestsName}_c_files 18 | ../../adapters/socketio_win32.c 19 | ) 20 | 21 | set(${theseTestsName}_h_files 22 | ) 23 | 24 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") -------------------------------------------------------------------------------- /c-utility/tests/socketio_win32_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(socketio_win32_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/string_tokenizer_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for $string_tokenizer_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName string_tokenizer_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/string_tokenizer.c 16 | 17 | ../../src/strings.c 18 | ../../src/crt_abstractions.c 19 | ) 20 | 21 | set(${theseTestsName}_h_files 22 | ) 23 | 24 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 25 | -------------------------------------------------------------------------------- /c-utility/tests/string_tokenizer_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(string_tokenizer_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/strings_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for strings_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName strings_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/strings.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/strings_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(strings_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/template_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | /** 10 | * Identify the test suite to run here. 11 | */ 12 | RUN_TEST_SUITE(template_ut, failedTestCount); 13 | 14 | return failedTestCount; 15 | } 16 | -------------------------------------------------------------------------------- /c-utility/tests/tickcounter_freertos_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for urlencode_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName tickcounter_freertos_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../pal/freertos/tickcounter.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | include_directories(.) 22 | 23 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 24 | -------------------------------------------------------------------------------- /c-utility/tests/tickcounter_freertos_ut/freertos/FreeRTOS.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef FREERTOS_H 5 | #define FREERTOS_H 6 | 7 | #ifdef __cplusplus 8 | 9 | extern "C" { 10 | #include 11 | #else 12 | #include 13 | #endif /* __cplusplus */ 14 | 15 | #define CONFIG_FREERTOS_HZ 100 16 | #include "azure_c_shared_utility/umock_c_prod.h" 17 | 18 | MOCKABLE_FUNCTION(, uint32_t, xTaskGetTickCount); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif /* __cplusplus */ 23 | 24 | #endif // FREERTOS_H -------------------------------------------------------------------------------- /c-utility/tests/tickcounter_freertos_ut/freertos/task.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef FREERTOS_TASK_H 5 | #define FREERTOS_TASK_H 6 | 7 | // This file must exist to keep tickcounter_freertos.c compatible with FreeRTOS 8 | 9 | 10 | #endif // FREERTOS_TASK_H 11 | -------------------------------------------------------------------------------- /c-utility/tests/tickcounter_freertos_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tickcounter_freertos_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/tickcounter_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tickcounter_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/tlsio_cyclonessl_socket_bsd_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tlsio_cyclonessl_socket_bsd_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/tlsio_cyclonessl_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tlsio_cyclonessl_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/tlsio_esp8266_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for tlsio_esp8266_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName tlsio_esp8266_ut) 9 | 10 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 11 | 12 | set(${theseTestsName}_test_files 13 | ${theseTestsName}.c 14 | ) 15 | 16 | set(${theseTestsName}_c_files 17 | ../../adapters/tlsio_ssl_esp8266.c 18 | ../real_test_files/real_crt_abstractions.c 19 | ) 20 | 21 | set(${theseTestsName}_h_files 22 | ) 23 | 24 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 25 | -------------------------------------------------------------------------------- /c-utility/tests/tlsio_esp8266_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | /** 10 | * Identify the test suite to run here. 11 | */ 12 | RUN_TEST_SUITE(tlsio_esp8266_ut, failedTestCount); 13 | 14 | return failedTestCount; 15 | } 16 | -------------------------------------------------------------------------------- /c-utility/tests/tlsio_options_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for urlencode_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName tlsio_options_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../pal/tlsio_options.c 16 | ../../src/optionhandler.c 17 | ../../src/crt_abstractions.c 18 | ../../src/vector.c 19 | ) 20 | 21 | set(${theseTestsName}_h_files 22 | gballoc_ut_impl_1.h 23 | gballoc_ut_impl_2.h 24 | ) 25 | 26 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 27 | -------------------------------------------------------------------------------- /c-utility/tests/tlsio_options_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tlsio_options_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/tlsio_wolfssl_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | compileAsC11() 7 | set(theseTestsName tlsio_wolfssl_ut) 8 | 9 | set(${theseTestsName}_test_files 10 | ${theseTestsName}.c 11 | ) 12 | 13 | set(${theseTestsName}_c_files 14 | ../../src/tlsio_wolfssl.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | -------------------------------------------------------------------------------- /c-utility/tests/tlsio_wolfssl_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tlsio_wolfssl_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/uniqueid_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(uniqueid_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/urlencode_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for urlencode_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName urlencode_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/urlencode.c 16 | ../../src/strings.c 17 | ) 18 | 19 | set(${theseTestsName}_h_files 20 | ) 21 | 22 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 23 | -------------------------------------------------------------------------------- /c-utility/tests/urlencode_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(URLEncode_UnitTests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/utf8_checker_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | compileAsC99() 7 | set(theseTestsName utf8_checker_ut) 8 | 9 | set(${theseTestsName}_test_files 10 | ${theseTestsName}.c 11 | ) 12 | 13 | set(${theseTestsName}_c_files 14 | ../../src/utf8_checker.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") -------------------------------------------------------------------------------- /c-utility/tests/utf8_checker_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(utf8_checker_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/uuid_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for uuid_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName uuid_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/uuid.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/uuid_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(uuid_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/uws_client_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | compileAsC99() 7 | set(theseTestsName uws_client_ut) 8 | 9 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 10 | 11 | set(${theseTestsName}_test_files 12 | ${theseTestsName}.c 13 | ) 14 | 15 | set(${theseTestsName}_c_files 16 | ../../src/uws_client.c 17 | ../real_test_files/real_buffer.c 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") -------------------------------------------------------------------------------- /c-utility/tests/uws_client_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(uws_client_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/uws_frame_encoder_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | compileAsC99() 7 | set(theseTestsName uws_frame_encoder_ut) 8 | 9 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 10 | 11 | set(${theseTestsName}_test_files 12 | ${theseTestsName}.c 13 | ) 14 | 15 | set(${theseTestsName}_c_files 16 | ../../src/uws_frame_encoder.c 17 | ../real_test_files/real_buffer.c 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") -------------------------------------------------------------------------------- /c-utility/tests/uws_frame_encoder_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(uws_frame_encoder_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/vector_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for vector_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName vector_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/vector.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/vector_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(Vector_UnitTests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/wsio_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | compileAsC99() 7 | set(theseTestsName wsio_ut) 8 | 9 | set(${theseTestsName}_test_files 10 | ${theseTestsName}.c 11 | ) 12 | 13 | set(${theseTestsName}_c_files 14 | ../../src/wsio.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | -------------------------------------------------------------------------------- /c-utility/tests/wsio_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(wsio_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/x509_openssl_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for vector_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName x509_openssl_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/x509_openssl.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/x509_openssl_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(x509_openssl_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/x509_schannel_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(x509_schannel_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/tests/xio_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for lock_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC11() 8 | set(theseTestsName xio_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/xio.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | -------------------------------------------------------------------------------- /c-utility/tests/xio_ut/main.c: -------------------------------------------------------------------------------- 1 | #include "testrunnerswitcher.h" 2 | 3 | int main(void) 4 | { 5 | size_t failedTestCount = 0; 6 | RUN_TEST_SUITE(xio_unittests, failedTestCount); 7 | return failedTestCount; 8 | } 9 | -------------------------------------------------------------------------------- /c-utility/testtools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists for testtools. It does nothing, except loads other folders 5 | 6 | include("../configs/azure_c_shared_utilityFunctions.cmake") 7 | 8 | usePermissiveRulesForSamplesAndTests() 9 | 10 | if(NOT ${use_installed_dependencies}) 11 | add_subdirectory(ctest) 12 | add_subdirectory(testrunner) 13 | add_subdirectory(umock-c) 14 | endif() 15 | 16 | add_subdirectory(sal) 17 | add_subdirectory(micromock) 18 | -------------------------------------------------------------------------------- /c-utility/testtools/SerialPort/SerialPort/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /c-utility/testtools/SerialPort/SerialPort/SerialPortTimeouts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Azure.IoT.Internal.Tools 8 | { 9 | /// 10 | /// See the Win32 API COMMTIMEOUTS for details. 11 | /// 12 | public struct SerialPortTimeouts // a.k.a. COMMTIMEOUTS 13 | { 14 | public uint ReadIntervalTimeout; 15 | public uint ReadTotalTimeoutMultiplier; 16 | public uint ReadTotalTimeoutConstant; 17 | public uint WriteTotalTimeoutMultiplier; 18 | public uint WriteTotalTimeoutConstant; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /c-utility/testtools/SerialPort/SerialPort/Win32Exceptioncs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Azure.IoT.Internal.Tools 8 | { 9 | public class Win32Exception : Exception 10 | { 11 | public Win32Exception(int errorCode, string message, params object[] args) 12 | :base(String.Format(message, args) + String.Format("(error {0})", errorCode)) 13 | { } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | /cmake 6 | /build 7 | *.jar 8 | 9 | #Visual Studio Code Files 10 | /.vscode 11 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/configs/ctestConfig.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | include("${CMAKE_CURRENT_LIST_DIR}/ctestTargets.cmake") 5 | 6 | get_target_property(CTEST_INCLUDES ctest INTERFACE_INCLUDE_DIRECTORIES) 7 | 8 | set(CTEST_INCLUDES ${CTEST_INCLUDES} CACHE INTERNAL "") -------------------------------------------------------------------------------- /c-utility/testtools/ctest/doc/ctest_user_manual.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/testtools/ctest/doc/ctest_user_manual.docx -------------------------------------------------------------------------------- /c-utility/testtools/ctest/inc/aux_inc/cstdbool: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CSTDBOOL_H 5 | #define CSTDBOOL_H 6 | 7 | #include "stdbool.h" 8 | 9 | #endif /* STDBOOL_H */ 10 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/inc/aux_inc/cstdint: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CSTDINT_H 5 | #define CSTDINT_H 6 | 7 | #include "stdint.h" 8 | 9 | #endif /* CSTDINT_H */ 10 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/inc/aux_inc/inttypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef INTTYPES_H 5 | #define INTTYPES_H 6 | 7 | #define PRId8 "hhd" 8 | #define PRId16 "hd" 9 | #define PRId32 "d" 10 | #define PRId64 "lld" 11 | 12 | #define PRIu8 "hhu" 13 | #define PRIu16 "hu" 14 | #define PRIu32 "u" 15 | #define PRIu64 "llu" 16 | 17 | #endif // INTTYPES_H 18 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/inc/aux_inc/stdbool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef STDBOOL_H 5 | #define STDBOOL_H 6 | 7 | #define __bool_true_false_are_defined 1 8 | 9 | #define HAS_STDBOOL 10 | 11 | #ifndef __cplusplus 12 | 13 | typedef unsigned char bool; 14 | typedef bool _Bool; 15 | 16 | #define false 0 17 | #define true 1 18 | 19 | #endif /* __cplusplus */ 20 | 21 | #endif /* STDBOOL_H */ 22 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/jenkins/linux_c_gcc44.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | log_dir=$build_root 11 | make_install= 12 | build_folder=$build_root"/cmake" 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON 18 | make --jobs=$(nproc) 19 | if [[ $make_install == 1 ]] ; 20 | then 21 | echo "Installing packaging" 22 | # install the package 23 | make install 24 | fi 25 | 26 | popd 27 | : -------------------------------------------------------------------------------- /c-utility/testtools/ctest/jenkins/osx_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON 18 | cmake --build . -- --jobs=$CORES 19 | ctest -C "debug" -V 20 | popd 21 | : 22 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/jenkins/ubuntu_clang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | log_dir=$build_root 11 | make_install= 12 | build_folder=$build_root"/cmake" 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON 18 | cmake --build . -- --jobs=$(nproc) 19 | ctest -C "debug" -V 20 | if [[ $make_install == 1 ]] ; 21 | then 22 | echo "Installing packaging" 23 | # install the package 24 | make install 25 | fi 26 | 27 | popd 28 | : -------------------------------------------------------------------------------- /c-utility/testtools/ctest/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | add_subdirectory(ctest_ut) 5 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/tests/ctest_ut/simpletestsuiteonetest.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | CTEST_BEGIN_TEST_SUITE(SimpleTestSuiteOneTest) 7 | 8 | CTEST_FUNCTION(Test1) 9 | { 10 | } 11 | 12 | CTEST_END_TEST_SUITE(SimpleTestSuiteOneTest) 13 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/tests/ctest_ut/simpletestsuiteonetestcpp.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | CTEST_BEGIN_TEST_SUITE(SimpleTestSuiteOneTestCpp) 7 | 8 | CTEST_FUNCTION(Test1) 9 | { 10 | } 11 | 12 | CTEST_END_TEST_SUITE(SimpleTestSuiteOneTestCpp) 13 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/tests/ctest_ut/simpletestsuitetwotests.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | CTEST_BEGIN_TEST_SUITE(SimpleTestSuiteTwoTests) 7 | 8 | CTEST_FUNCTION(Test1) 9 | { 10 | } 11 | 12 | CTEST_FUNCTION(Test2) 13 | { 14 | } 15 | 16 | CTEST_END_TEST_SUITE(SimpleTestSuiteTwoTests) 17 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/tests/ctest_ut/testfunctioninitializetests.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | static int x = 0; 7 | static int y = 0; 8 | 9 | CTEST_BEGIN_TEST_SUITE(TestFunctionInitializeTests) 10 | 11 | CTEST_FUNCTION_INITIALIZE() 12 | { 13 | x++; 14 | } 15 | 16 | CTEST_FUNCTION_CLEANUP() 17 | { 18 | } 19 | 20 | CTEST_FUNCTION(Test1) 21 | { 22 | y++; 23 | CTEST_ASSERT_ARE_EQUAL(int, y, x); 24 | } 25 | 26 | CTEST_FUNCTION(Test2) 27 | { 28 | y++; 29 | CTEST_ASSERT_ARE_EQUAL(int, y, x); 30 | } 31 | 32 | CTEST_END_TEST_SUITE(TestFunctionInitializeTests) 33 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/tests/ctest_ut/testsuiteinitializecleanuptests.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | static int x; 7 | 8 | CTEST_BEGIN_TEST_SUITE(TestSuiteInitializeCleanupTests) 9 | 10 | CTEST_SUITE_INITIALIZE() 11 | { 12 | x = 42; 13 | } 14 | 15 | CTEST_SUITE_CLEANUP() 16 | { 17 | } 18 | 19 | CTEST_FUNCTION(Test1) 20 | { 21 | CTEST_ASSERT_ARE_EQUAL(int, 42, x); 22 | } 23 | 24 | CTEST_END_TEST_SUITE(TestSuiteInitializeCleanupTests) 25 | -------------------------------------------------------------------------------- /c-utility/testtools/ctest/tests/ctest_ut/whentestsuiteinitializefailstests.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | CTEST_BEGIN_TEST_SUITE(whentestsuiteinitializefailstests) 7 | 8 | CTEST_SUITE_INITIALIZE() 9 | { 10 | CTEST_ASSERT_FAIL("it needs to fail"); 11 | } 12 | 13 | CTEST_SUITE_CLEANUP() 14 | { 15 | } 16 | 17 | CTEST_FUNCTION(Test1) 18 | { 19 | 20 | } 21 | 22 | CTEST_END_TEST_SUITE(whentestsuiteinitializefailstests) 23 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/doc/timediscretemicromock.xps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/testtools/micromock/doc/timediscretemicromock.xps -------------------------------------------------------------------------------- /c-utility/testtools/micromock/inc/micromockcommon.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MICROMOCKCOMMON_H 5 | #define MICROMOCKCOMMON_H 6 | 7 | #pragma once 8 | 9 | #include "tchar.h" 10 | #include "string" 11 | #include "sstream" 12 | 13 | #define COUNT_OF(a) (sizeof(a) / sizeof((a)[0])) 14 | 15 | namespace std 16 | { 17 | typedef std::basic_string tstring; 18 | typedef std::basic_ostringstream tostringstream; 19 | } 20 | 21 | #endif // MICROMOCKCOMMON_H 22 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/inc/mock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MOCK_H 5 | #define MOCK_H 6 | 7 | #pragma once 8 | 9 | #include "mockcallrecorder.h" 10 | #include "strictunorderedcallcomparer.h" 11 | 12 | #ifndef UNREFERENCED_PARAMETER 13 | #define UNREFERENCED_PARAMETER(param) param = param; 14 | #endif 15 | 16 | template 17 | class CMock : public CMockCallRecorder 18 | { 19 | public: 20 | CMock(_In_ AUTOMATIC_CALL_COMPARISON performAutomaticCallComparison = AUTOMATIC_CALL_COMPARISON_ON) 21 | { 22 | SetPerformAutomaticCallComparison(performAutomaticCallComparison); 23 | } 24 | }; 25 | 26 | #endif // MOCK_H 27 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/inc/mockresultvalue.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MOCKRESULTVALUE_H 5 | #define MOCKRESULTVALUE_H 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "mockvalue.h" 11 | 12 | template 13 | class CMockResultValue : 14 | public CMockValue 15 | { 16 | public: 17 | CMockResultValue(T argValue) : 18 | CMockValue(argValue) 19 | { 20 | } 21 | }; 22 | 23 | #endif // MOCKRESULTVALUE_H 24 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/inc/mockvaluebase.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MOCKVALUEBASE_H 5 | #define MOCKVALUEBASE_H 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | 11 | class CMockValueBase 12 | { 13 | public: 14 | virtual ~CMockValueBase(); 15 | 16 | public: 17 | virtual std::tstring ToString() const = 0; 18 | virtual bool EqualTo(_In_ const CMockValueBase* right) = 0; 19 | }; 20 | 21 | #endif // MOCKVALUEBASE_H 22 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/inc/targetver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TARGETVER_H 5 | #define TARGETVER_H 6 | 7 | #pragma once 8 | 9 | // Including SDKDDKVer.h defines the highest available Windows platform. 10 | 11 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 12 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 13 | 14 | #endif // TARGETVER_H 15 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/src/mockvaluebase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "stdafx.h" 5 | #include "mockvaluebase.h" 6 | 7 | CMockValueBase::~CMockValueBase() 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/src/timediscretemicromock.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /*defines*/ 5 | #include "stdafx.h" 6 | #include "timediscretemicromock.h" 7 | 8 | /*types*/ 9 | /*static variables*/ 10 | /*static functions*/ 11 | 12 | /*variable exports*/ 13 | std::vector stims_base::allPlayers; 14 | 15 | /*debug variables*/ 16 | UINT32 theTick; 17 | UINT32 totalTicksPlayed; 18 | 19 | /*function exports*/ 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/tools/micromockgenerator/micromockgenerator.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/testtools/micromock/tools/micromockgenerator/micromockgenerator.rc -------------------------------------------------------------------------------- /c-utility/testtools/micromock/tools/micromockgenerator/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "stdafx.h" 5 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/tools/micromockgenerator/stdafx.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | #include 7 | #ifdef _CRTDBG_MAP_ALLOC 8 | #include 9 | #endif 10 | 11 | #include "targetver.h" 12 | 13 | #include "stdio.h" 14 | #include "tchar.h" 15 | #include "string" 16 | #include "sstream" 17 | 18 | #ifndef WIN32_LEAN_AND_MEAN 19 | #define WIN32_LEAN_AND_MEAN 20 | #endif // WIN32_LEAN_AND_MEAN 21 | #include "windows.h" 22 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/tools/micromockgenerator/targetver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | // Including SDKDDKVer.h defines the highest available Windows platform. 7 | 8 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 9 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 10 | 11 | #include 12 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/unittests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists for micromock unittests folder, it is empty 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | add_subdirectory(micromocktest) -------------------------------------------------------------------------------- /c-utility/testtools/micromock/unittests/micromocktest/micromocktest_with_ctest.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | int main(void) 6 | { 7 | RUN_TEST_SUITE(CMockValue_tests); 8 | RUN_TEST_SUITE(MicroMockCallComparisonUnitTests); 9 | RUN_TEST_SUITE(MicroMockTest); 10 | RUN_TEST_SUITE(MicroMockValidateArgumentBufferTests); 11 | RUN_TEST_SUITE(NULLArgsStringificationTests); 12 | RUN_TEST_SUITE(MicroMockVoidVoidTest); 13 | RUN_TEST_SUITE(MicroMockStimTest); 14 | RUN_TEST_SUITE(MicroMockTestWithReturnAndParameters); 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/unittests/micromocktest/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/testtools/micromock/unittests/micromocktest/resource.h -------------------------------------------------------------------------------- /c-utility/testtools/micromock/unittests/micromocktest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "stdafx.h" 5 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/unittests/micromocktest/stdafx.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | #include 7 | #ifdef _CRTDBG_MAP_ALLOC 8 | #include 9 | #endif 10 | 11 | // 4505 is disabled due to unused template specializations declared in CppUnitTest 12 | #pragma warning(disable:4505) 13 | 14 | // Headers for CppUnitTest 15 | //#include "testrunnerswitcher.h" 16 | 17 | #ifndef WIN32_LEAN_AND_MEAN 18 | #define WIN32_LEAN_AND_MEAN 19 | #endif // WIN32_LEAN_AND_MEAN 20 | #include "micromock.h" 21 | #include "timediscretemicromock.h" 22 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/unittests/micromocktest/stdafx_c.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | #include "targetver.h" 7 | #include "string.h" 8 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/unittests/micromocktest/targetver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | // Including SDKDDKVer.h defines the highest available Windows platform. 7 | 8 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 9 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 10 | 11 | #include 12 | -------------------------------------------------------------------------------- /c-utility/testtools/micromock/unittests/micromocktest/unittestsgenericresource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/testtools/micromock/unittests/micromocktest/unittestsgenericresource.rc -------------------------------------------------------------------------------- /c-utility/testtools/sal/inc/sal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef SAL_H 5 | #define SAL_H 6 | 7 | #include "no_sal2.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /c-utility/testtools/testrunner/.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | /cmake/** 6 | /build/** 7 | 8 | *.jar 9 | 10 | /.vscode -------------------------------------------------------------------------------- /c-utility/testtools/testrunner/configs/testrunnerswitcherConfig.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | include("${CMAKE_CURRENT_LIST_DIR}/testrunnerswitcherTargets.cmake") 5 | 6 | get_target_property(TESTRUNNERSWITCHER_INCLUDES testrunnerswitcher INTERFACE_INCLUDE_DIRECTORIES) 7 | 8 | set(TESTRUNNERSWITCHER_INCLUDES ${TESTRUNNERSWITCHER_INCLUDES} CACHE INTERNAL "") -------------------------------------------------------------------------------- /c-utility/testtools/testrunner/jenkins/linux_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -o pipefail 3 | # 4 | 5 | set -e 6 | 7 | script_dir=$(cd "$(dirname "$0")" && pwd) 8 | build_root=$(cd "${script_dir}/.." && pwd) 9 | log_dir=$build_root 10 | make_install= 11 | build_folder=$build_root"/cmake" 12 | 13 | rm -r -f $build_folder 14 | mkdir -p $build_folder 15 | pushd $build_folder 16 | cmake .. -Drun_valgrind:BOOL=ON 17 | make --jobs=$(nproc) 18 | if [[ $make_install == 1 ]] ; 19 | then 20 | echo "Installing packaging" 21 | # install the package 22 | make install 23 | fi 24 | 25 | popd 26 | -------------------------------------------------------------------------------- /c-utility/testtools/testrunner/jenkins/linux_c_gcc44.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -o pipefail 3 | # 4 | 5 | set -e 6 | 7 | ./jenkins/linux_c.sh 8 | -------------------------------------------------------------------------------- /c-utility/testtools/testrunner/jenkins/osx_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_valgrind:BOOL=ON 18 | cmake --build . -- --jobs=$CORES 19 | popd 20 | -------------------------------------------------------------------------------- /c-utility/testtools/testrunner/jenkins/ubuntu_clang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | log_dir=$build_root 11 | make_install= 12 | build_folder=$build_root"/cmake" 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON 18 | cmake --build . -- --jobs=$(nproc) 19 | ctest -C "debug" -V 20 | if [[ $make_install == 1 ]] ; 21 | then 22 | echo "Installing packaging" 23 | # install the package 24 | make install 25 | fi 26 | 27 | popd 28 | : -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/.gitignore: -------------------------------------------------------------------------------- 1 | #Typical cmake folder 2 | /cmake 3 | /build 4 | *.jar 5 | 6 | /.vscode -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/azure-ctest"] 2 | path = deps/ctest 3 | url = https://github.com/Azure/azure-ctest.git 4 | [submodule "deps/testrunner"] 5 | path = deps/testrunner 6 | url = https://github.com/Azure/azure-c-testrunnerswitcher.git 7 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/configs/umock_cConfig.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | if(NOT ctest_FOUND) 5 | find_package(ctest REQUIRED CONFIG) 6 | endif() 7 | if(NOT testrunnerswitcher_FOUND) 8 | find_package(testrunnerswitcher REQUIRED CONFIG) 9 | endif() 10 | 11 | include("${CMAKE_CURRENT_LIST_DIR}/umock_cTargets.cmake") 12 | include("${CMAKE_CURRENT_LIST_DIR}/umock_cFunctions.cmake") 13 | 14 | get_target_property(UMOCK_C_INCLUDES umock_c INTERFACE_INCLUDE_DIRECTORIES) 15 | 16 | set(UMOCK_C_INCLUDES ${UMOCK_C_INCLUDES} CACHE INTERNAL "") -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/dependencies.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | if(${use_installed_dependencies}) 5 | find_package(ctest REQUIRED CONFIG) 6 | find_package(testrunnerswitcher REQUIRED CONFIG) 7 | else() 8 | add_subdirectory(deps) 9 | endif() -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | if (${run_unittests} OR ${run_int_tests}) 7 | add_subdirectory(ctest) 8 | add_subdirectory(testrunner) 9 | endif() -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | /cmake 6 | /build 7 | *.jar 8 | 9 | #Visual Studio Code Files 10 | /.vscode 11 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/configs/ctestConfig.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | include("${CMAKE_CURRENT_LIST_DIR}/ctestTargets.cmake") 5 | 6 | get_target_property(CTEST_INCLUDES ctest INTERFACE_INCLUDE_DIRECTORIES) 7 | 8 | set(CTEST_INCLUDES ${CTEST_INCLUDES} CACHE INTERNAL "") -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/doc/ctest_user_manual.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/c-utility/testtools/umock-c/deps/ctest/doc/ctest_user_manual.docx -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/inc/aux_inc/cstdbool: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CSTDBOOL_H 5 | #define CSTDBOOL_H 6 | 7 | #include "stdbool.h" 8 | 9 | #endif /* STDBOOL_H */ 10 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/inc/aux_inc/cstdint: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CSTDINT_H 5 | #define CSTDINT_H 6 | 7 | #include "stdint.h" 8 | 9 | #endif /* CSTDINT_H */ 10 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/inc/aux_inc/inttypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef INTTYPES_H 5 | #define INTTYPES_H 6 | 7 | #define PRId8 "hhd" 8 | #define PRId16 "hd" 9 | #define PRId32 "d" 10 | #define PRId64 "lld" 11 | 12 | #define PRIu8 "hhu" 13 | #define PRIu16 "hu" 14 | #define PRIu32 "u" 15 | #define PRIu64 "llu" 16 | 17 | #endif // INTTYPES_H 18 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/inc/aux_inc/stdbool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef STDBOOL_H 5 | #define STDBOOL_H 6 | 7 | #define __bool_true_false_are_defined 1 8 | 9 | #define HAS_STDBOOL 10 | 11 | #ifndef __cplusplus 12 | 13 | typedef unsigned char bool; 14 | typedef bool _Bool; 15 | 16 | #define false 0 17 | #define true 1 18 | 19 | #endif /* __cplusplus */ 20 | 21 | #endif /* STDBOOL_H */ 22 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/jenkins/linux_c_gcc44.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | log_dir=$build_root 11 | make_install= 12 | build_folder=$build_root"/cmake" 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON 18 | make --jobs=$(nproc) 19 | if [[ $make_install == 1 ]] ; 20 | then 21 | echo "Installing packaging" 22 | # install the package 23 | make install 24 | fi 25 | 26 | popd 27 | : -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/jenkins/osx_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON 18 | cmake --build . -- --jobs=$CORES 19 | ctest -C "debug" -V 20 | popd 21 | : 22 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | add_subdirectory(ctest_ut) 5 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/tests/ctest_ut/simpletestsuiteonetest.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | CTEST_BEGIN_TEST_SUITE(SimpleTestSuiteOneTest) 7 | 8 | CTEST_FUNCTION(Test1) 9 | { 10 | } 11 | 12 | CTEST_END_TEST_SUITE(SimpleTestSuiteOneTest) 13 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/tests/ctest_ut/simpletestsuiteonetestcpp.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | CTEST_BEGIN_TEST_SUITE(SimpleTestSuiteOneTestCpp) 7 | 8 | CTEST_FUNCTION(Test1) 9 | { 10 | } 11 | 12 | CTEST_END_TEST_SUITE(SimpleTestSuiteOneTestCpp) 13 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/tests/ctest_ut/simpletestsuitetwotests.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | CTEST_BEGIN_TEST_SUITE(SimpleTestSuiteTwoTests) 7 | 8 | CTEST_FUNCTION(Test1) 9 | { 10 | } 11 | 12 | CTEST_FUNCTION(Test2) 13 | { 14 | } 15 | 16 | CTEST_END_TEST_SUITE(SimpleTestSuiteTwoTests) 17 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/tests/ctest_ut/testfunctioninitializetests.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | static int x = 0; 7 | static int y = 0; 8 | 9 | CTEST_BEGIN_TEST_SUITE(TestFunctionInitializeTests) 10 | 11 | CTEST_FUNCTION_INITIALIZE() 12 | { 13 | x++; 14 | } 15 | 16 | CTEST_FUNCTION_CLEANUP() 17 | { 18 | } 19 | 20 | CTEST_FUNCTION(Test1) 21 | { 22 | y++; 23 | CTEST_ASSERT_ARE_EQUAL(int, y, x); 24 | } 25 | 26 | CTEST_FUNCTION(Test2) 27 | { 28 | y++; 29 | CTEST_ASSERT_ARE_EQUAL(int, y, x); 30 | } 31 | 32 | CTEST_END_TEST_SUITE(TestFunctionInitializeTests) 33 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/tests/ctest_ut/testsuiteinitializecleanuptests.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | static int x; 7 | 8 | CTEST_BEGIN_TEST_SUITE(TestSuiteInitializeCleanupTests) 9 | 10 | CTEST_SUITE_INITIALIZE() 11 | { 12 | x = 42; 13 | } 14 | 15 | CTEST_SUITE_CLEANUP() 16 | { 17 | } 18 | 19 | CTEST_FUNCTION(Test1) 20 | { 21 | CTEST_ASSERT_ARE_EQUAL(int, 42, x); 22 | } 23 | 24 | CTEST_END_TEST_SUITE(TestSuiteInitializeCleanupTests) 25 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/ctest/tests/ctest_ut/whentestsuiteinitializefailstests.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "ctest.h" 5 | 6 | CTEST_BEGIN_TEST_SUITE(whentestsuiteinitializefailstests) 7 | 8 | CTEST_SUITE_INITIALIZE() 9 | { 10 | CTEST_ASSERT_FAIL("it needs to fail"); 11 | } 12 | 13 | CTEST_SUITE_CLEANUP() 14 | { 15 | } 16 | 17 | CTEST_FUNCTION(Test1) 18 | { 19 | 20 | } 21 | 22 | CTEST_END_TEST_SUITE(whentestsuiteinitializefailstests) 23 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/testrunner/.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | /cmake/** 6 | /build/** 7 | 8 | *.jar 9 | 10 | /.vscode -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/testrunner/configs/testrunnerswitcherConfig.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | include("${CMAKE_CURRENT_LIST_DIR}/testrunnerswitcherTargets.cmake") 5 | 6 | get_target_property(TESTRUNNERSWITCHER_INCLUDES testrunnerswitcher INTERFACE_INCLUDE_DIRECTORIES) 7 | 8 | set(TESTRUNNERSWITCHER_INCLUDES ${TESTRUNNERSWITCHER_INCLUDES} CACHE INTERNAL "") -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/testrunner/jenkins/linux_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -o pipefail 3 | # 4 | 5 | set -e 6 | 7 | script_dir=$(cd "$(dirname "$0")" && pwd) 8 | build_root=$(cd "${script_dir}/.." && pwd) 9 | log_dir=$build_root 10 | make_install= 11 | build_folder=$build_root"/cmake" 12 | 13 | rm -r -f $build_folder 14 | mkdir -p $build_folder 15 | pushd $build_folder 16 | cmake .. -Drun_valgrind:BOOL=ON 17 | make --jobs=$(nproc) 18 | if [[ $make_install == 1 ]] ; 19 | then 20 | echo "Installing packaging" 21 | # install the package 22 | make install 23 | fi 24 | 25 | popd 26 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/testrunner/jenkins/linux_c_gcc44.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -o pipefail 3 | # 4 | 5 | set -e 6 | 7 | ./jenkins/linux_c.sh 8 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/deps/testrunner/jenkins/osx_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_valgrind:BOOL=ON 18 | cmake --build . -- --jobs=$CORES 19 | popd 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/inc/aux_inc/cstdbool: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CSTDBOOL_H 5 | #define CSTDBOOL_H 6 | 7 | #include "stdbool.h" 8 | 9 | #endif /* STDBOOL_H */ 10 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/inc/aux_inc/cstdint: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CSTDINT_H 5 | #define CSTDINT_H 6 | 7 | #include "stdint.h" 8 | 9 | #endif /* CSTDINT_H */ 10 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/inc/aux_inc/inttypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef INTTYPES_H 5 | #define INTTYPES_H 6 | 7 | #define PRId8 "hhd" 8 | #define PRId16 "hd" 9 | #define PRId32 "d" 10 | #define PRId64 "lld" 11 | 12 | #define PRIu8 "hhu" 13 | #define PRIu16 "hu" 14 | #define PRIu32 "u" 15 | #define PRIu64 "llu" 16 | 17 | #endif // INTTYPES_H 18 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/inc/aux_inc/stdbool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef STDBOOL_H 5 | #define STDBOOL_H 6 | 7 | #define __bool_true_false_are_defined 1 8 | 9 | #define HAS_STDBOOL 10 | 11 | #ifndef __cplusplus 12 | 13 | typedef unsigned char bool; 14 | typedef bool _Bool; 15 | 16 | #define false 0 17 | #define true 1 18 | 19 | #endif /* __cplusplus */ 20 | 21 | #endif /* STDBOOL_H */ 22 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/inc/umock_log.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef UMOCK_LOG_H 5 | #define UMOCK_LOG_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | void UMOCK_LOG(const char* format, ...); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | 18 | 19 | #endif /* UMOCK_LOG_H */ 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/inc/umockalloc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef UMOCKALLOC_H 5 | #define UMOCKALLOC_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #include 10 | #else 11 | #include 12 | #endif 13 | 14 | extern void* umockalloc_malloc(size_t size); 15 | extern void* umockalloc_realloc(void* ptr, size_t size); 16 | extern void umockalloc_free(void* ptr); 17 | 18 | extern char* umockc_stringify_buffer(const void* bytes, size_t length); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif /* UMOCKALLOC_H */ 25 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/inc/umockautoignoreargs.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef UMOCKAUTOIGNOREARGS_H 5 | #define UMOCKAUTOIGNOREARGS_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #include 10 | #else 11 | #include 12 | #endif 13 | 14 | extern int umockautoignoreargs_is_call_argument_ignored(const char* call, size_t argument_index, int* is_argument_ignored); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif /* UMOCKAUTOIGNOREARGS_H */ 21 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/inc/umockstring.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef UMOCKSTRING_H 5 | #define UMOCKSTRING_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | extern char* umockstring_clone(const char* source); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif /* UMOCKSTRING_H */ 18 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/inc/umocktypename.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef UMOCKTYPENAME_H 5 | #define UMOCKTYPENAME_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | extern char* umocktypename_normalize(const char* type_name); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif /* UMOCKTYPENAME_H */ 18 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/jenkins/linux_c_gcc44.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | log_dir=$build_root 11 | build_folder=$build_root"/cmake" 12 | 13 | rm -r -f $build_folder 14 | mkdir -p $build_folder 15 | pushd $build_folder 16 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON -Drun_int_tests:bool=ON 17 | make --jobs=$(nproc) 18 | 19 | popd 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/jenkins/osx_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_unittests:bool=ON -Drun_int_tests:bool=ON 18 | cmake --build . -- --jobs=$CORES 19 | ctest -C "debug" -V 20 | popd 21 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/jenkins/ubuntu_clang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | log_dir=$build_root 11 | build_folder=$build_root"/cmake" 12 | 13 | rm -r -f $build_folder 14 | mkdir -p $build_folder 15 | pushd $build_folder 16 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON -Drun_int_tests:bool=ON 17 | cmake --build . -- --jobs=$(nproc) 18 | ctest -C "debug" -V 19 | 20 | popd 21 | : -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/src/umock_log.c: -------------------------------------------------------------------------------- 1 | 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | #include 6 | #include 7 | 8 | #include "umock_log.h" 9 | #include "umock_c_internal.h" 10 | 11 | void UMOCK_LOG(const char* format, ...) 12 | { 13 | va_list params; 14 | va_start(params, format); 15 | (void)vprintf(format, params); 16 | va_end(params); 17 | printf("\r\n"); 18 | umock_c_indicate_error(UMOCK_C_ERROR); 19 | } 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_gen_func_decl_int/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umock_c_generate_function_declaration_integrationtests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_int/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umock_c_integrationtests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_malloc_hook_int/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umock_c_malloc_hook_integrationtests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_negt_int/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umock_c_negative_tests_integrationtests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_negt_noini_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umock_c_negt_noint_tests) 7 | 8 | set(${theseTestsName}_test_files 9 | umock_c_negt_noint_tests.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../src/umock_c_negative_tests.c 14 | ) 15 | 16 | umockc_build_test_artifacts(${theseTestsName} ON) 17 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_negt_noini_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umock_c_negative_tests_no_init_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_negt_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umock_c_negative_tests_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umock_c_negative_tests_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../src/umock_c_negative_tests.c 14 | ) 15 | 16 | umockc_build_test_artifacts(${theseTestsName} ON) 17 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_negt_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umock_c_negative_tests_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_ptrarg_leak_int/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umock_c_ptrarg_leak_integrationtests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umock_c_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umock_c_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../src/umock_c.c 14 | ) 15 | 16 | umockc_build_test_artifacts(${theseTestsName} ON) 17 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umock_c_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_wout_init_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umock_c_wout_init_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umock_c_wout_init_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../src/umock_c.c 14 | ) 15 | 16 | umockc_build_test_artifacts(${theseTestsName} ON) 17 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umock_c_wout_init_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umock_c_without_init_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockalloc_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umockalloc_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umockalloc_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umockalloc_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockalloc_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umockalloc_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockalloc_ut/umockalloc_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include 6 | 7 | extern void* mock_malloc(size_t size); 8 | extern void* mock_calloc(size_t nmemb, size_t size); 9 | extern void* mock_realloc(void* ptr, size_t size); 10 | extern void mock_free(void* ptr); 11 | 12 | #define malloc(size) mock_malloc(size) 13 | #define calloc(nmemb, size) mock_calloc(nmemb, size) 14 | #define realloc(ptr, size) mock_realloc(ptr, size) 15 | #define free(ptr) mock_free(ptr) 16 | 17 | /* include code under test */ 18 | #include "../../src/umockalloc.c" 19 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockautoignoreargs_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umockautoignoreargs_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umockautoignoreargs_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../src/umockautoignoreargs.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockautoignoreargs_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umockautoignoreargs_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockcall_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umockcall_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umockcall_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umockcall_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockcall_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umockcall_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockcall_ut/umockcall_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umockcall.c" 16 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockcallpairs_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umockcallpairs_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umockcallpairs_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umockcallpairs_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockcallpairs_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umockcallpairs_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockcallpairs_ut/umockcallpairs_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umockcallpairs.c" 16 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockcallrecorder_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umockcallrecorder_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umockcallrecorder_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umockcallrecorder_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockcallrecorder_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umockcallrecorder_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockcallrecorder_ut/umockcallrecorder_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umockcallrecorder.c" 16 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockstring_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umockstring_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umockstring_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umockstring_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockstring_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umockstring_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umockstring_ut/umockstring_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void mock_free(void* ptr); 8 | 9 | #define umockalloc_malloc(size) mock_malloc(size) 10 | #define umockalloc_free(ptr) mock_free(ptr) 11 | 12 | /* include code under test */ 13 | #include "../../src/umockstring.c" 14 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypename_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umocktypename_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umocktypename_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umocktypename_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypename_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umocktypename_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypename_ut/umocktypename_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umocktypename.c" 16 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_bool_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umocktypes_bool_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umocktypes_bool_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umocktypes_bool_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_bool_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umocktypes_bool_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_bool_ut/umocktypes_bool_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umocktypes_bool.c" 16 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_c_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umocktypes_c_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umocktypes_c_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umocktypes_c_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_c_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umocktypes_c_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_c_ut/umocktypes_c_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umocktypes_c.c" 16 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_charptr_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umocktypes_charptr_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umocktypes_charptr_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umocktypes_charptr_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_charptr_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umocktypes_charptr_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_charptr_ut/umocktypes_charptr_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umocktypes_charptr.c" 16 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_stdint_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umocktypes_stdint_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umocktypes_stdint_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umocktypes_stdint_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_stdint_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umocktypes_stdint_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_stdint_ut/umocktypes_stdint_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umocktypes_stdint.c" 16 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umocktypes_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umocktypes_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umocktypes_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umocktypes_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_ut/umocktypes_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umocktypes.c" 16 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_wout_init_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(theseTestsName umocktypes_wout_init_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | umocktypes_wout_init_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | umocktypes_mocked.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | umockc_build_test_artifacts(${theseTestsName} ON) 20 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_wout_init_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(umocktypes_without_init_unittests, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /c-utility/testtools/umock-c/tests/umocktypes_wout_init_ut/umocktypes_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | extern void* mock_malloc(size_t size); 7 | extern void* mock_realloc(void* ptr, size_t size); 8 | extern void mock_free(void* ptr); 9 | 10 | #define umockalloc_malloc(size) mock_malloc(size) 11 | #define umockalloc_realloc(ptr, size) mock_realloc(ptr, size) 12 | #define umockalloc_free(ptr) mock_free(ptr) 13 | 14 | /* include code under test */ 15 | #include "../../src/umocktypes.c" 16 | -------------------------------------------------------------------------------- /c-utility/tools/compilembed/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /c-utility/tools/macro_utils_h_generator/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /c-utility/tools/macro_utils_h_generator/macro_utils_h_generator.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /c-utility/tools/macro_utils_h_generator/macro_utils_h_generator.vshost.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /c-utility/tools/mbed_build_scripts/release_mbed_project.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | @setlocal EnableDelayedExpansion 5 | 6 | @REM Script arguments: 7 | @REM %1 Local path to the project to be released. 8 | 9 | set project_path=%1 10 | set hg_commit_message="1.1.32" 11 | set project_name_override="" 12 | 13 | if NOT "%2" equ "" ( 14 | set project_name_override="-Dmbed_repo_name:string=%2" 15 | ) 16 | 17 | rmdir /s /q hg 2>nul 18 | mkdir hg 19 | cd hg 20 | 21 | cmake -DHG_COMMIT_MSG:string=%hg_commit_message% -Drelease_the_project:bool=ON %project_name_override% %project_path%\mbed 22 | if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL! 23 | -------------------------------------------------------------------------------- /c-utility/version.txt: -------------------------------------------------------------------------------- 1 | 1.1.2 -------------------------------------------------------------------------------- /iotcore_client/samples/iotcore_client_sample/freertos/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | -------------------------------------------------------------------------------- /iotcore_client/samples/iotcore_client_sample/mbed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.8.11) 3 | 4 | set(shared_util_base_path ../../../../c-utility) 5 | set(mbed_project_base "mqtt_client_sample" CACHE STRING "The item being built") 6 | include (${shared_util_base_path}/tools/mbed_build_scripts/mbedbldtemplate.txt) 7 | -------------------------------------------------------------------------------- /iotcore_client/samples/iotcore_client_sample/mbed/mqtt_client_sample_filelist.txt: -------------------------------------------------------------------------------- 1 | set(mbed_project_files 2 | ${CMAKE_CURRENT_SOURCE_DIR}/main.c 3 | ${CMAKE_CURRENT_SOURCE_DIR}/../iotcore_mqtt_client_sample.h 4 | ${CMAKE_CURRENT_SOURCE_DIR}/../iotcore_mqtt_client_sample.c 5 | ) 6 | -------------------------------------------------------------------------------- /iotcore_client/src/_md5.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef struct 4 | { 5 | unsigned int count[2]; 6 | unsigned int state[4]; 7 | unsigned char buffer[64]; 8 | } MD5_CTX; 9 | 10 | void _MD5Init(MD5_CTX *context); 11 | void _MD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputlen); 12 | void _MD5Final(MD5_CTX *context, unsigned char digest[16]); -------------------------------------------------------------------------------- /pictures/io_chains.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/pictures/io_chains.png -------------------------------------------------------------------------------- /pictures/porting_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baidu/iot-sdk-c/7b814542f6c2051a96bf767ee7e9d8d8cd623789/pictures/porting_arch.png -------------------------------------------------------------------------------- /serializer/readme.md: -------------------------------------------------------------------------------- 1 | # Baidu IoT 序列化C函数库 2 | 3 | 该文件夹包含如下组件 4 | * 一个数据序列化、反序列化函数库 5 | * 一些例子来说明如何使用该序列化/反序列化库。 6 | 7 | ## 特性 8 | * 该库可以序列化你要发给云端的数据,同时反序列化从云端接收到的数据。 9 | * 用户只需要简单地(通过“宏”)为设备定义一个 "model" 即可。 10 | * 可以方便地实现Baidu IoT设备孪生。 11 | 12 | ## 使用C序列化函数库 13 | 14 | Baidu IoT 设备端SDK使用了该C序列化函数库,关于如何在不同多平台(例如Linux, mbed, Windows等)使用该SDK可以参考[这里][device-sdk]。 15 | 16 | ## 示例 17 | 18 | 该工程中包含了很多简单的例子来指导您如何和使用该库。详细请参考[这里][samples]。 19 | 20 | 21 | [samples]: ./samples/ 22 | [device-sdk]: ../iothub_client/ -------------------------------------------------------------------------------- /serializer/src/makefile: -------------------------------------------------------------------------------- 1 | !if 0 2 | Copyright (c) Microsoft. All rights reserved. 3 | Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | !endif 5 | 6 | !INCLUDE $(_MAKEENVROOT)\makefile.def 7 | -------------------------------------------------------------------------------- /serializer/tests/agentmacros_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for agentmacros_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName agentmacros_ut) 9 | 10 | set(${theseTestsName}_cpp_files 11 | ${theseTestsName}.cpp 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ${SHARED_UTIL_SRC_FOLDER}/gballoc.c 16 | ${LOCK_C_FILE} 17 | ) 18 | 19 | set(${theseTestsName}_h_files 20 | ) 21 | 22 | build_test_artifacts(${theseTestsName} ON) -------------------------------------------------------------------------------- /serializer/tests/agentmacros_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(AgentMacros_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/agenttypesystem_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for agenttypesystem_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName agenttypesystem_ut) 9 | 10 | set(${theseTestsName}_cpp_files 11 | ${theseTestsName}.cpp 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/agenttypesystem.c 16 | 17 | 18 | ${SHARED_UTIL_SRC_FOLDER}/gballoc.c 19 | ${LOCK_C_FILE} 20 | ${SHARED_UTIL_SRC_FOLDER}/crt_abstractions.c 21 | ) 22 | 23 | set(${theseTestsName}_h_files 24 | ) 25 | 26 | build_test_artifacts(${theseTestsName} ON) -------------------------------------------------------------------------------- /serializer/tests/agenttypesystem_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(AgentTypeSystem_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/codefirst_cpp_ut/c_bool_size.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/crt_abstractions.h" 5 | #include 6 | 7 | extern size_t sizeof_bool(void) 8 | { 9 | return sizeof(bool); 10 | } 11 | -------------------------------------------------------------------------------- /serializer/tests/codefirst_cpp_ut/c_bool_size.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef C_SIZEOF_BOOL_H 5 | #define C_SIZEOF_BOOL_H 6 | 7 | 8 | #ifdef __cplusplus 9 | #include 10 | extern "C" 11 | { 12 | #else 13 | #include 14 | #endif 15 | 16 | extern size_t sizeof_bool(void); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif -------------------------------------------------------------------------------- /serializer/tests/codefirst_cpp_ut/codefirst_cpp_ut.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef __cplusplus 5 | #error NO CHEATING! 6 | #endif 7 | #include "../codefirst_ut/codefirst_ut.c" 8 | 9 | -------------------------------------------------------------------------------- /serializer/tests/codefirst_cpp_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(CodeFirst_ut_Dummy_Data_Provider, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/codefirst_ut/c_bool_size.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/crt_abstractions.h" 5 | #include 6 | 7 | size_t sizeof_bool(void) 8 | { 9 | return sizeof(bool); 10 | } 11 | -------------------------------------------------------------------------------- /serializer/tests/codefirst_ut/c_bool_size.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef C_SIZEOF_BOOL_H 5 | #define C_SIZEOF_BOOL_H 6 | 7 | 8 | #ifdef __cplusplus 9 | #include 10 | extern "C" 11 | { 12 | #else 13 | #include 14 | #endif 15 | 16 | extern size_t sizeof_bool(void); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif -------------------------------------------------------------------------------- /serializer/tests/codefirst_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(CodeFirst_ut_Dummy_Data_Provider, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/codefirst_withstructs_cpp_ut/codefirst_withstructs_cpp_ut.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "../codefirst_withstructs_ut/codefirst_withstructs_ut.c" 5 | -------------------------------------------------------------------------------- /serializer/tests/codefirst_withstructs_cpp_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(CodeFirst_ut_Two_Providers_With_Structs, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/codefirst_withstructs_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(CodeFirst_ut_Two_Providers_With_Structs, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/commanddecoder_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for commanddecoder_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName commanddecoder_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/commanddecoder.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/UnitTests") -------------------------------------------------------------------------------- /serializer/tests/commanddecoder_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(CommandDecoder_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/datamarshaller_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(DataMarshaller_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/datamarshaller_ut/real_agenttypesystem.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define COMPILING_REAL_AGENTTYPESYSTEM_C 5 | #include "real_agenttypesystem.h" 6 | 7 | #include "agenttypesystem.c" 8 | -------------------------------------------------------------------------------- /serializer/tests/datamarshaller_ut/real_agenttypesystem.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef REAL_AGENTTYPESYSTEM_H 5 | #define REAL_AGENTTYPESYSTEM_H 6 | 7 | #define AgentDataTypes_ToString real_AgentDataTypes_ToString 8 | 9 | #undef AGENT_DATA_TYPES_H 10 | #include "agenttypesystem.h" 11 | 12 | #ifndef COMPILING_REAL_AGENTTYPESYSTEM_C 13 | #undef AgentDataTypes_ToString 14 | #endif 15 | 16 | #undef AGENT_DATA_TYPES_H 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /serializer/tests/datamarshaller_ut/real_parson.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define COMPILING_REAL_PARSON_C 5 | #include "real_parson.h" 6 | 7 | #include "parson.c" 8 | -------------------------------------------------------------------------------- /serializer/tests/dataserializer_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for dataserializer_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName dataserializer_ut) 9 | 10 | set(${theseTestsName}_cpp_files 11 | ${theseTestsName}.cpp 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/dataserializer.c 16 | ${SHARED_UTIL_SRC_FOLDER}/gballoc.c 17 | ${LOCK_C_FILE} 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | -------------------------------------------------------------------------------- /serializer/tests/dataserializer_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(DataSerializer_ut, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/iotdevice_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(IoTDevice_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/jsondecoder_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for jsondecoder_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName jsondecoder_ut) 9 | set(${theseTestsName}_cpp_files 10 | ${theseTestsName}.cpp 11 | ) 12 | 13 | set(${theseTestsName}_c_files 14 | ../../src/jsondecoder.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_test_artifacts(${theseTestsName} ON) -------------------------------------------------------------------------------- /serializer/tests/jsondecoder_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(JSONDecoder_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/jsonencoder_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for jsonencoder_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName jsonencoder_ut) 9 | 10 | set(${theseTestsName}_cpp_files 11 | ${theseTestsName}.cpp 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/jsonencoder.c 16 | 17 | ${SHARED_UTIL_SRC_FOLDER}/gballoc.c 18 | ${LOCK_C_FILE} 19 | ) 20 | 21 | set(${theseTestsName}_h_files 22 | ) 23 | 24 | build_test_artifacts(${theseTestsName} ON) -------------------------------------------------------------------------------- /serializer/tests/jsonencoder_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(JSONEncoder_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/methodreturn_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | compileAsC99() 7 | set(theseTestsName methodreturn_ut) 8 | 9 | include_directories(${SERIALIZER_INC_FOLDER}) 10 | 11 | set(${theseTestsName}_test_files 12 | ${theseTestsName}.c 13 | ) 14 | 15 | set(${theseTestsName}_c_files 16 | ../../src/methodreturn.c 17 | real_strings.c 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | real_strings.h 22 | ) 23 | 24 | build_c_test_artifacts(${theseTestsName} ON "tests/UnitTests") 25 | -------------------------------------------------------------------------------- /serializer/tests/methodreturn_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(methodreturn_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/methodreturn_ut/real_strings.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define COMPILING_REAL_STRINGS_C 5 | 6 | #define GBALLOC_H 7 | #include "real_strings.h" 8 | #include "strings.c" 9 | -------------------------------------------------------------------------------- /serializer/tests/multitree_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for multitree_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName multitree_ut) 9 | 10 | set(${theseTestsName}_cpp_files 11 | ${theseTestsName}.cpp 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/multitree.c 16 | ${SHARED_UTIL_SRC_FOLDER}/crt_abstractions.c 17 | ) 18 | 19 | set(${theseTestsName}_h_files 20 | ) 21 | 22 | build_test_artifacts(${theseTestsName} ON) 23 | -------------------------------------------------------------------------------- /serializer/tests/multitree_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(MultiTree_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/schema_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for schema_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName schema_ut) 9 | set(${theseTestsName}_test_files 10 | ${theseTestsName}.c 11 | ) 12 | 13 | set(${theseTestsName}_c_files 14 | ../../src/schema.c 15 | ${LOCK_C_FILE} 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/UnitTests") -------------------------------------------------------------------------------- /serializer/tests/schema_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(Schema_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/schemalib_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for schemalib_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName schemalib_ut) 9 | 10 | set(${theseTestsName}_cpp_files 11 | ${theseTestsName}.cpp 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/schemalib.c 16 | ${SHARED_UTIL_SRC_FOLDER}/gballoc.c 17 | ${LOCK_C_FILE} 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | build_test_artifacts(${theseTestsName} ON) -------------------------------------------------------------------------------- /serializer/tests/schemalib_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(serializer_ut, failedTestCount); 11 | return failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /serializer/tests/schemalib_without_init_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for schemalib_without_init_ut 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName schemalib_without_init_ut) 9 | 10 | set(${theseTestsName}_cpp_files 11 | ${theseTestsName}.cpp 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/schemalib.c 16 | 17 | 18 | ${SHARED_UTIL_SRC_FOLDER}/gballoc.c 19 | ${LOCK_C_FILE} 20 | ) 21 | 22 | set(${theseTestsName}_h_files 23 | ) 24 | 25 | build_test_artifacts(${theseTestsName} ON) -------------------------------------------------------------------------------- /serializer/tests/schemalib_without_init_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(serializer_ut_without_init, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/schemaserializer_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists.txt for ${theseTestsName} 5 | cmake_minimum_required(VERSION 2.8.11) 6 | 7 | compileAsC99() 8 | set(theseTestsName schemaserializer_ut) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/schemaserializer.c 16 | ${SHARED_UTIL_SRC_FOLDER}/gballoc.c 17 | ${LOCK_C_FILE} 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | build_c_test_artifacts(${theseTestsName} ON "tests/UnitTests") -------------------------------------------------------------------------------- /serializer/tests/schemaserializer_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(SchemaSerializer_ut, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/serializer_dt_int/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(serializer_dt_int, failedTestCount); 10 | return failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /serializer/tests/serializer_int/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(serializer_int, failedTestCount); 10 | return failedTestCount; 11 | } 12 | --------------------------------------------------------------------------------