From 9a1705ed4ca3c04069da3652af174764138712c7 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 7 Mar 2022 12:07:54 +0000 Subject: [PATCH] Added CMakeFiles.txt for initializer_list tests --- .gitignore | 4 ++ support/Release notes.txt | 3 ++ test/etl_initializer_list/CMakeLists.txt | 34 ++++++++++++++ .../etl_initializer_list.vcxproj | 3 ++ .../etl_initializer_list.vcxproj.filters | 33 ------------- test/runtests.sh | 47 +++++++++++++++++++ 6 files changed, 91 insertions(+), 33 deletions(-) create mode 100644 test/etl_initializer_list/CMakeLists.txt delete mode 100644 test/etl_initializer_list/etl_initializer_list.vcxproj.filters diff --git a/.gitignore b/.gitignore index 02390dbd..55b56e9b 100644 --- a/.gitignore +++ b/.gitignore @@ -354,3 +354,7 @@ test/vs2019/Debug Intel test/vs2019/Debug Intel - No STL EmbeddedTemplateLibrary-20.24.1.tar.gz test/etl_initializer_list/.vs +test/build-etl_initializer_list-Desktop_x86_windows_msvc2019_pe_32bit-Debug +test/build-etl_initializer_list-GCC-Debug +test/etl_initializer_list/etl_initializer_list.vcxproj.filters +test/etl_initializer_list/build-make diff --git a/support/Release notes.txt b/support/Release notes.txt index 85e52ce7..3186381c 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -3,6 +3,9 @@ Added message_timer_interrupt Added callback_timer_interrupt Changed message_timer_atomic and callback_timer_atomic to require an atomic counter template type. +Added extra condition compile macros to control std::initializer_list. +Initializer list tests are in a separate project. +Modified etl::instance_count to take an optional counter type. Renamed Arduino files to stop PlatformIO getting confused. Changed from C cast to C++ cast in memory.h Always use stddef.h diff --git a/test/etl_initializer_list/CMakeLists.txt b/test/etl_initializer_list/CMakeLists.txt new file mode 100644 index 00000000..44488510 --- /dev/null +++ b/test/etl_initializer_list/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.5.0) +project(etl_initializer_list_unit_tests) + +add_definitions(-DETL_DEBUG) +add_definitions(-DETL_NO_STL) +add_definitions(-DETL_FORCE_ETL_INITIALIZER_LIST) + +include_directories(${PROJECT_SOURCE_DIR}/../../include) + +set(TEST_SOURCE_FILES + test_initializer_list.cpp + ) + +add_executable(etl_tests + ${TEST_SOURCE_FILES} + ) + +target_include_directories(etl_tests + PUBLIC + ${CMAKE_CURRENT_LIST_DIR} + ) + +# Enable the 'make test' CMake target using the executable defined above +add_test(etl_initializer_list_unit_tests etl_tests) + +# Since ctest will only show you the results of the single executable +# define a target that will output all of the failing or passing tests +# as they appear from UnitTest++ +add_custom_target(test_verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose) + + +#RSG +set_property(TARGET etl_tests PROPERTY CXX_STANDARD 17) + diff --git a/test/etl_initializer_list/etl_initializer_list.vcxproj b/test/etl_initializer_list/etl_initializer_list.vcxproj index 9139ed0b..61eaaf3c 100644 --- a/test/etl_initializer_list/etl_initializer_list.vcxproj +++ b/test/etl_initializer_list/etl_initializer_list.vcxproj @@ -26,6 +26,9 @@ + + + 16.0 Win32Proj diff --git a/test/etl_initializer_list/etl_initializer_list.vcxproj.filters b/test/etl_initializer_list/etl_initializer_list.vcxproj.filters deleted file mode 100644 index 07681d6c..00000000 --- a/test/etl_initializer_list/etl_initializer_list.vcxproj.filters +++ /dev/null @@ -1,33 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/test/runtests.sh b/test/runtests.sh index cb7d8833..74a8008b 100755 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -173,6 +173,53 @@ else echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt exit $? fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Initializer list test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../etl_initializer_list/ +mkdir -p build-make || exit 1 +cd build-make || exit 1 +gcc --version | grep gcc | tee -a log.txt +CC=gcc CXX=g++ cmake --cmake-clean-cache .. +make -j8 +if [ $? -eq 0 ]; then + echo "<<<< Passed initializer_list >>>>" +else + echo "****************\n**** Failed initializer_list ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Initializer list test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +clang --version | grep clang | tee -a log.txt +CC=clang CXX=clang++ cmake --cmake-clean-cache .. +make -j8 +if [ $? -eq 0 ]; then + echo "<<<< Passed initializer_list >>>>" +else + echo "****************\n**** Failed initializer_list ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +cd ../.. + echo "" echo "-----------------------------------------------" | tee -a log.txt echo " All Tests Completed OK" | tee -a log.txt