Adding more sanitize tests as part of the CI. (#267)

* Adding more sanitize tests as part of the CI.
This commit is contained in:
Daniel Lemire 2019-08-09 17:26:05 -04:00 committed by GitHub
parent 9dfab9d9a4
commit 7be2998cae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 284 additions and 35 deletions

View File

@ -19,4 +19,4 @@ build_script:
- cd build
- ps: cmake -DSIMDJSON_BUILD_STATIC="$env:SIMDJSON_BUILD_STATIC" -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=x64 ..
- cmake --build .
- ctest --verbose
- ctest --verbose --output-on-failure

View File

@ -25,19 +25,46 @@ jobs:
command: make quiettest amalgamate
- run:
name: Building (gcc, cmake)
name: Building (gcc, cmake, dynamic)
command: |
mkdir build
cd build
cmake ..
cmake -DSIMDJSON_BUILD_STATIC=OFF ..
make
- run:
name: Running tests (gcc, cmake)
name: Running tests (gcc, cmake, dynamic)
command: |
cd build
make test
- run:
name: Building (gcc, cmake, static)
command: |
mkdir buildstatic
cd buildstatic
cmake -DSIMDJSON_BUILD_STATIC=ON ..
make
- run:
name: Running tests (gcc, cmake, static)
command: |
cd buildstatic
make test
- run:
name: Building (gcc, cmake, sanitize)
command: |
mkdir buildsani
cd buildsani
cmake -DSIMDJSON_SANITIZE=ON -DSIMDJSON_BUILD_STATIC=OFF ..
make
- run:
name: Running tests (gcc, cmake, sanitize)
command: |
cd buildsani
make test
"gccnoavx":
docker:
- image: ubuntu:18.04
@ -63,19 +90,46 @@ jobs:
command: ARCHFLAGS="-march=nehalem" make quiettest amalgamate
- run:
name: Building (gcc, cmake)
name: Building (gcc, cmake, dynamic)
command: |
mkdir build
cd build
cmake -DSIMDJSON_DISABLE_AVX=on ..
cmake -DSIMDJSON_DISABLE_AVX=ON -DSIMDJSON_BUILD_STATIC=OFF ..
make
- run:
name: Running tests (gcc, cmake)
name: Running tests (gcc, cmake, dynamic)
command: |
cd build
make test
- run:
name: Building (gcc, cmake, static)
command: |
mkdir buildstatic
cd buildstatic
cmake -DSIMDJSON_DISABLE_AVX=ON -DSIMDJSON_BUILD_STATIC=ON ..
make
- run:
name: Running tests (gcc, cmake, static)
command: |
cd buildstatic
make test
- run:
name: Building (gcc, cmake, sanitize)
command: |
mkdir buildsani
cd buildsani
cmake -DSIMDJSON_BUILD_STATIC=OFF -DSIMDJSON_DISABLE_AVX=ON -DSIMDJSON_SANITIZE=ON ..
make
- run:
name: Running tests (gcc, cmake, sanitize)
command: |
cd buildsani
make test
"clang":
docker:
- image: ubuntu:18.04
@ -101,19 +155,47 @@ jobs:
command: make quiettest amalgamate
- run:
name: Building (clang, cmake)
name: Building (clang, cmake, dynamic)
command: |
mkdir build
cd build
cmake ..
cmake -DSIMDJSON_BUILD_STATIC=OFF ..
make
- run:
name: Running tests (clang, cmake)
name: Running tests (clang, cmake, dynamic)
command: |
cd build
make test
- run:
name: Building (clang, cmake, static)
command: |
mkdir buildstatic
cd buildstatic
cmake -DSIMDJSON_BUILD_STATIC=ON ..
make
- run:
name: Running tests (clang, cmake, static)
command: |
cd buildstatic
make test
- run:
name: Building (clang, cmake, sanitize)
command: |
mkdir buildsani
cd buildsani
cmake -DSIMDJSON_BUILD_STATIC=OFF -DSIMDJSON_SANITIZE=ON ..
make
- run:
name: Running tests (clang, cmake, sanitize)
command: |
cd buildsani
make test
"clangnoavx":
docker:
- image: ubuntu:18.04
@ -139,19 +221,49 @@ jobs:
command: ARCHFLAGS="-march=nehalem" make quiettest amalgamate
- run:
name: Building (clang, cmake)
name: Building (clang, cmake, dynamic)
command: |
mkdir build
cd build
cmake -DSIMDJSON_DISABLE_AVX=on ..
cmake -DSIMDJSON_BUILD_STATIC=OFF -DSIMDJSON_DISABLE_AVX=on ..
make
- run:
name: Running tests (clang, cmake)
name: Running tests (clang, cmake, dynamic)
command: |
cd build
make test
- run:
name: Building (clang, cmake, static)
command: |
mkdir buildstatic
cd buildstatic
cmake -DSIMDJSON_BUILD_STATIC=ON -DSIMDJSON_DISABLE_AVX=on ..
make
- run:
name: Running tests (clang, cmake, static)
command: |
cd buildstatic
make test
- run:
name: Building (clang, cmake, sanitize)
command: |
mkdir buildsani
cd buildsani
cmake -DSIMDJSON_BUILD_STATIC=OFF -DSIMDJSON_DISABLE_AVX=ON -DSIMDJSON_SANITIZE=ON ..
make
- run:
name: Running tests (clang, cmake, sanitize)
command: |
cd buildsani
make test
workflows:
version: 2
build_and_test:
@ -159,4 +271,4 @@ workflows:
- "clang"
- "gcc"
- "clangnoavx"
- "gccnoavx"
- "gccnoavx"

View File

@ -63,7 +63,7 @@ steps:
- mkdir build && cd build
- cmake -DSIMDJSON_BUILD_STATIC=OFF $CMAKE_FLAGS ..
- make -j
- ctest
- ctest --output-on-failure
---
kind: pipeline
name: amd64_clang_cmake_static
@ -85,7 +85,7 @@ steps:
- mkdir build && cd build
- cmake -DSIMDJSON_BUILD_STATIC=ON $CMAKE_FLAGS ..
- make -j
- ctest
- ctest --output-on-failure
---
kind: pipeline
name: amd64_gcc_cmake_static
@ -107,7 +107,7 @@ steps:
- mkdir build && cd build
- cmake -DSIMDJSON_BUILD_STATIC=ON $CMAKE_FLAGS ..
- make -j
- ctest
- ctest --output-on-failure
---
kind: pipeline
name: amd64_gcc_cmake_dynamic
@ -129,7 +129,7 @@ steps:
- mkdir build && cd build
- cmake -DSIMDJSON_BUILD_STATIC=OFF $CMAKE_FLAGS ..
- make -j
- ctest
- ctest --output-on-failure
---
kind: pipeline
name: arm64_clang_cmake_dynamic
@ -151,7 +151,7 @@ steps:
- mkdir build && cd build
- cmake -DSIMDJSON_BUILD_STATIC=OFF $CMAKE_FLAGS ..
- make -j
- ctest
- ctest --output-on-failure
---
kind: pipeline
name: arm64_gcc_cmake_dynamic
@ -173,7 +173,7 @@ steps:
- mkdir build && cd build
- cmake $CMAKE_FLAGS ..
- make -j
- ctest
- ctest --output-on-failure
commands:
- apt-get update -y
@ -182,7 +182,7 @@ steps:
- mkdir build && cd build
- cmake -DSIMDJSON_BUILD_STATIC=OFF $CMAKE_FLAGS ..
- make -j
- ctest
- ctest --output-on-failure
---
kind: pipeline
name: arm64_clang_cmake_static
@ -204,7 +204,7 @@ steps:
- mkdir build && cd build
- cmake -DSIMDJSON_BUILD_STATIC=ON $CMAKE_FLAGS ..
- make -j
- ctest
- ctest --output-on-failure
---
kind: pipeline
name: arm64_gcc_cmake_static
@ -226,9 +226,139 @@ steps:
- mkdir build && cd build
- cmake -DSIMDJSON_BUILD_STATIC=ON $CMAKE_FLAGS ..
- make -j
- ctest
- ctest --output-on-failure
---
kind: pipeline
name: arm64_clang_cmake_sanitize
platform:
os: linux
arch: arm64
steps:
- name: Build and Test
image: ubuntu:18.04
environment:
CC: clang
CXX: clang++
commands:
- apt-get update -y
- apt-get install -y make $CC g++ cmake
- $CC --version
- mkdir build && cd build
- cmake -DSIMDJSON_SANITIZE=ON $CMAKE_FLAGS ..
- make -j
- ASAN_OPTIONS="detect_leaks=0" ctest --output-on-failure
---
kind: pipeline
name: arm64_gcc_cmake_sanitize
platform:
os: linux
arch: arm64
steps:
- name: Build and Test
image: ubuntu:18.04
environment:
CC: gcc
CXX: g++
commands:
- apt-get update -y
- apt-get install -y make $CC g++ cmake
- $CC --version
- mkdir build && cd build
- cmake -DSIMDJSON_SANITIZE=ON $CMAKE_FLAGS ..
- make -j
- ASAN_OPTIONS="detect_leaks=0" ctest --output-on-failure
---
kind: pipeline
name: amd64_clang_cmake_sanitize
platform:
os: linux
arch: amd64
steps:
- name: Build and Test
image: ubuntu:18.04
environment:
CC: clang
CXX: clang++
commands:
- apt-get update -y
- apt-get install -y make $CC g++ cmake
- $CC --version
- mkdir build && cd build
- cmake -DSIMDJSON_SANITIZE=ON $CMAKE_FLAGS ..
- make -j
- ASAN_OPTIONS="detect_leaks=0" ctest --output-on-failure
---
kind: pipeline
name: amd64_gcc_cmake_sanitize
platform:
os: linux
arch: amd64
steps:
- name: Build and Test
image: ubuntu:18.04
environment:
CC: gcc
CXX: g++
commands:
- apt-get update -y
- apt-get install -y make $CC g++ cmake
- $CC --version
- mkdir build && cd build
- cmake -DSIMDJSON_SANITIZE=ON $CMAKE_FLAGS ..
- make -j
- ASAN_OPTIONS="detect_leaks=0" ctest --output-on-failure
---
kind: pipeline
name: amd64_clang_cmake_sanitize_noavx
platform:
os: linux
arch: amd64
steps:
- name: Build and Test
image: ubuntu:18.04
environment:
CC: clang
CXX: clang++
commands:
- apt-get update -y
- apt-get install -y make $CC g++ cmake
- $CC --version
- mkdir build && cd build
- cmake -DSIMDJSON_SANITIZE=ON -DSIMDJSON_DISABLE_AVX=ON $CMAKE_FLAGS ..
- make -j
- ASAN_OPTIONS="detect_leaks=0" ctest --output-on-failure
---
kind: pipeline
name: amd64_gcc_cmake_sanitize_noavx
platform:
os: linux
arch: amd64
steps:
- name: Build and Test
image: ubuntu:18.04
environment:
CC: gcc
CXX: g++
commands:
- apt-get update -y
- apt-get install -y make $CC g++ cmake
- $CC --version
- mkdir build && cd build
- cmake -DSIMDJSON_SANITIZE=ON -DSIMDJSON_DISABLE_AVX=ON $CMAKE_FLAGS ..
- make -j
- ASAN_OPTIONS="detect_leaks=0" ctest --output-on-failure

View File

@ -12,19 +12,26 @@ if(SIMDJSON_SANITIZE)
endif()
endif()
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64)|(AMD64)|(x86_64)")
set (X64 TRUE)
else ()
set (X64 FALSE)
endif ()
if(SIMDJSON_DISABLE_AVX)
if(NOT MSVC)
set (OPT_FLAGS "${OPT_FLAGS} -mno-avx -mno-bmi -mno-pclmul -msse4.2")
else()
set (OPT_FLAGS "${OPT_FLAGS}")
endif()
else()
# some compilers like clang do not automagically define __AVX2__ and __BMI2__ even when the hardware supports it
if(NOT MSVC)
#set (OPT_FLAGS "${OPT_FLAGS} -mpclmul")
else()
#set (OPT_FLAGS "${OPT_FLAGS} /arch:AVX2")
if(X64)
message(STATUS "Detected x64 processor: ${CMAKE_SYSTEM_PROCESSOR}")
if(SIMDJSON_DISABLE_AVX)
message(STATUS "Disabling AVX. No runtime dispatch.")
if(NOT MSVC)
set (OPT_FLAGS "${OPT_FLAGS} -mno-avx -mno-bmi -mpclmul -msse4.2") #westmere
else()
set (OPT_FLAGS "${OPT_FLAGS}")
endif()
else()
if(NOT MSVC)
message(STATUS "Assuming Westmere or better")
set (OPT_FLAGS "${OPT_FLAGS} -mpclmul -msse4.2")
endif()
endif()
endif()