Prechádzať zdrojové kódy

build system: add ubsan to the CI

Michele Caini 5 rokov pred
rodič
commit
02b6ffc771

+ 1 - 1
.github/workflows/coverage.yml

@@ -30,4 +30,4 @@ jobs:
       run: |
       run: |
         wget https://codecov.io/bash -O codecov
         wget https://codecov.io/bash -O codecov
         chmod +x codecov
         chmod +x codecov
-        ./codecov -a "-u" -t $CODECOV_TOKEN -B $GITHUB_REF -s .
+        ./codecov -t $CODECOV_TOKEN -B $GITHUB_REF -s .

+ 2 - 2
.github/workflows/sanitizer.yml

@@ -9,7 +9,7 @@ jobs:
 
 
     strategy:
     strategy:
       matrix:
       matrix:
-        compiler: [g++, clang++]
+        compiler: [clang++]
 
 
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
 
 
@@ -20,7 +20,7 @@ jobs:
       env:
       env:
         CXX: ${{ matrix.compiler }}
         CXX: ${{ matrix.compiler }}
       run: |
       run: |
-        cmake -DENTT_USE_ASAN=ON -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ..
+        cmake -DENTT_USE_SANITIZER=ON -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ..
         make -j4
         make -j4
     - name: Run tests
     - name: Run tests
       working-directory: build
       working-directory: build

+ 4 - 4
CMakeLists.txt

@@ -43,7 +43,7 @@ message(VERBOSE "* Copyright (c) 2017-2021 Michele Caini <michele.caini@gmail.co
 message(VERBOSE "*")
 message(VERBOSE "*")
 
 
 option(ENTT_USE_LIBCPP "Use libc++ by adding -stdlib=libc++ flag if availbale." ON)
 option(ENTT_USE_LIBCPP "Use libc++ by adding -stdlib=libc++ flag if availbale." ON)
-option(ENTT_USE_ASAN "Use address sanitizer by adding -fsanitize=address -fno-omit-frame-pointer flags" OFF)
+option(ENTT_USE_SANITIZER "Enable sanitizers by adding -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined flags" OFF)
 
 
 #
 #
 # Compiler stuff
 # Compiler stuff
@@ -85,9 +85,9 @@ target_include_directories(
         $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
         $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
 )
 )
 
 
-if(ENTT_USE_ASAN)
-    target_compile_options(EnTT INTERFACE $<$<CONFIG:Debug>:-fsanitize=address -fno-omit-frame-pointer>)
-    target_link_libraries(EnTT INTERFACE $<$<CONFIG:Debug>:-fsanitize=address -fno-omit-frame-pointer>)
+if(ENTT_USE_SANITIZER)
+    target_compile_options(EnTT INTERFACE $<$<CONFIG:Debug>:-fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined>)
+    target_link_libraries(EnTT INTERFACE $<$<CONFIG:Debug>:-fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined>)
 endif()
 endif()
 
 
 if(ENTT_HAS_LIBCPP)
 if(ENTT_HAS_LIBCPP)