From d883877a0e309bd587985e9815c106f939984997 Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Sun, 3 Feb 2019 13:15:40 +0300 Subject: [PATCH] travis: Enable ASan build --- .travis.yml | 9 +++++++-- CMakeLists.txt | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f46d234..5c61adf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,11 @@ matrix: - env: OPENSSL_BRANCH=master os: linux compiler: gcc + - env: + - OPENSSL_BRANCH=master + - ASAN=-DASAN=1 + os: linux + compiler: gcc # - env: OPENSSL_BRANCH=OpenSSL_1_1_0-stable # os: linux # compiler: gcc @@ -26,12 +31,12 @@ matrix: before_script: - git clone --depth 1 -b ${OPENSSL_BRANCH} https://github.com/openssl/openssl.git - cd openssl - - ./config shared --prefix=${PREFIX} --openssldir=${PREFIX} && make -j$(nproc) all && make install_sw > build.log 2>&1 || (cat build.log && exit 1) + - ./config shared -d --prefix=${PREFIX} --openssldir=${PREFIX} && make -j$(nproc) all && make install_sw > build.log 2>&1 || (cat build.log && exit 1) - cd .. script: - mkdir build - cd build - - cmake -DOPENSSL_ROOT_DIR=${PREFIX} -DOPENSSL_LIBRARIES=${PREFIX}/lib -DOPENSSL_ENGINES_DIR=${PREFIX}/engines .. + - cmake -DOPENSSL_ROOT_DIR=${PREFIX} -DOPENSSL_LIBRARIES=${PREFIX}/lib -DOPENSSL_ENGINES_DIR=${PREFIX}/engines ${ASAN} .. - make - make test CTEST_OUTPUT_ON_FAILURE=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 326b8f4..cbbf312 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,11 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") add_compile_options(/MP /WX /W4 /wd4100 /wd4267 /wd4206 /wd4706 /wd4244 /wd4115) endif() +if (ASAN) + message(STATUS "address sanitizer enabled") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g3 -fno-omit-frame-pointer") +endif() + set(CMAKE_C_STANDARD 90) include (TestBigEndian) @@ -159,11 +164,13 @@ target_link_libraries(test_gost89 gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY add_test(NAME gost89 COMMAND test_gost89) +if(NOT ASAN) add_test(NAME engine COMMAND perl run_tests WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test) set_tests_properties(engine PROPERTIES ENVIRONMENT "OPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR};OPENSSL_ENGINES=${OUTPUT_DIRECTORY}") +endif() add_executable(sign benchmark/sign.c) target_link_libraries(sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY}) -- 2.39.5