Skip to content

Commit

Permalink
Merge branch 'master' into mercury_profiling_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
srini009 committed Jul 22, 2020
2 parents b7fdd9b + d190059 commit c174d8d
Show file tree
Hide file tree
Showing 10 changed files with 729 additions and 53 deletions.
107 changes: 64 additions & 43 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ compiler:
- gcc
- clang

dist: xenial
dist: bionic

cache:
directories:
Expand All @@ -21,71 +21,92 @@ env:

jobs:
include:
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-9
- g++-9
- libtsan0
- libasan5
- liblsan0
env: MERCURY_BUILD_CONFIGURATION="Tsan"
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-9
- g++-9
- libtsan0
- libasan5
- liblsan0
env: MERCURY_BUILD_CONFIGURATION="Asan"
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-9
- g++-9
env: MERCURY_DO_COVERAGE="true"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- clang-format-10
env: CHECK_FORMAT="true"
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-10
- g++-10
- libtsan0
- libasan6
- libubsan1
env: MERCURY_BUILD_CONFIGURATION="Tsan"
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-10
- g++-10
- libtsan0
- libasan6
- libubsan1
env: MERCURY_BUILD_CONFIGURATION="Asan"
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-10
- g++-10
- libtsan0
- libasan6
- libubsan1
env: MERCURY_BUILD_CONFIGURATION="Ubsan"
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-10
- g++-10
env: MERCURY_DO_COVERAGE="true"

branches:
only:
- master

before_install:
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then git fetch origin pull/${TRAVIS_PULL_REQUEST}/head:pr${TRAVIS_PULL_REQUEST}; git checkout pr${TRAVIS_PULL_REQUEST}; fi
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]] && [[ "$CHECK_FORMAT" != "true" ]]; then git fetch origin pull/${TRAVIS_PULL_REQUEST}/head:pr${TRAVIS_PULL_REQUEST}; git checkout pr${TRAVIS_PULL_REQUEST}; fi
- echo "Existing directories in $HOME" && ls $HOME
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cask uninstall --force oclint; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$CC" == "gcc" ]]; then brew install gcc; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libfabric; fi

install:
- ./Testing/script/travis_build.sh
- if [[ "$CHECK_FORMAT" == "true" ]]; then install -D ./Testing/script/git-clang-format $HOME/install/bin/git-clang-format; else ./Testing/script/travis_build.sh; fi

before_script:
- if [ -d "$HOME/install/bin" ]; then ls $HOME/install/bin; fi
- export PATH=$HOME/install/bin:$PATH
- export LD_LIBRARY_PATH=$HOME/install/lib:$HOME/install/lib64:$LD_LIBRARY_PATH
- export PKG_CONFIG_PATH=$HOME/install/lib/pkgconfig:$PKG_CONFIG_PATH
- if [[ "$CC" == "gcc" && `command -v gcc-9` ]]; then export CC=gcc-9; export CXX=g++-9; export AR=gcc-ar-9; export NM=gcc-nm-9; export RANLIB=gcc-ranlib-9; export COV=gcov-9; fi
- if [[ "$CC" == "gcc" && `command -v gcc-10` ]]; then export CC=gcc-10; export CXX=g++-10; export AR=gcc-ar-10; export NM=gcc-nm-10; export RANLIB=gcc-ranlib-10; export COV=gcov-10; fi
- $CC --version
- if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then export MERCURY_DASHBOARD_MODEL="Nightly"; elif [[ "$TRAVIS_EVENT_TYPE" == "pull_request" ]]; then export MERCURY_DASHBOARD_MODEL="Experimental"; else export MERCURY_DASHBOARD_MODEL="Continuous"; fi
- ctest --version
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cat /proc/sys/kernel/yama/ptrace_scope; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ulimit -a; fi
- fi_info
- if [[ "$CHECK_FORMAT" != "true" ]]; then fi_info; fi
- if [[ "$CHECK_FORMAT" == "true" ]]; then which clang-format-10; git config --global clangFormat.binary clang-format-10; fi

script:
- ctest -VV --output-on-failure -S ./Testing/script/travis_script.cmake

- if [[ "$CHECK_FORMAT" == "true" ]]; then echo "${TRAVIS_COMMIT_RANGE/.../}"; ./Testing/script/travis_format.sh "${TRAVIS_COMMIT_RANGE/.../ }"; else ctest -VV --output-on-failure -S ./Testing/script/travis_script.cmake; fi
37 changes: 37 additions & 0 deletions CMake/CheckUbsan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
set(UBSAN_FLAG "-fsanitize=undefined")
set(UBSAN_C_FLAGS "-O1 -g ${UBSAN_FLAG} -fno-omit-frame-pointer")
set(UBSAN_CXX_FLAGS ${UBSAN_C_FLAGS})

get_property(UBSAN_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
foreach(lang ${UBSAN_LANGUAGES})
set(UBSAN_${lang}_LANG_ENABLED 1)
endforeach()

if(UBSAN_C_LANG_ENABLED)
include(CheckCCompilerFlag)
set(CMAKE_REQUIRED_LINK_OPTIONS ${UBSAN_FLAG})
check_c_compiler_flag(${UBSAN_FLAG} UBSAN_C_FLAG_SUPPORTED)
if(NOT UBSAN_C_FLAG_SUPPORTED)
message(STATUS "Ubsan flags are not supported by the C compiler.")
else()
if(NOT CMAKE_C_FLAGS_UBSAN)
set(CMAKE_C_FLAGS_UBSAN ${UBSAN_C_FLAGS} CACHE STRING "Flags used by the C compiler during UBSAN builds." FORCE)
endif()
endif()
unset(CMAKE_REQUIRED_LINK_OPTIONS)
endif()

if(UBSAN_CXX_LANG_ENABLED)
include(CheckCXXCompilerFlag)
set(CMAKE_REQUIRED_LINK_OPTIONS ${UBSAN_FLAG})
check_cxx_compiler_flag(${UBSAN_FLAG} UBSAN_CXX_FLAG_SUPPORTED)
if(NOT UBSAN_CXX_FLAG_SUPPORTED)
message(STATUS "Ubsan flags are not supported by the CXX compiler.")
else()
if(NOT CMAKE_CXX_FLAGS_UBSAN)
set(CMAKE_CXX_FLAGS_UBSAN ${UBSAN_CXX_FLAGS} CACHE STRING "Flags used by the CXX compiler during UBSAN builds." FORCE)
endif()
endif()
unset(CMAKE_REQUIRED_LINK_OPTIONS)
endif()

6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,18 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo" "Asan" "Tsan")
"MinSizeRel" "RelWithDebInfo" "Asan" "Tsan" "Ubsan")
endif()

if(NOT CMAKE_C_FLAGS AND CMAKE_COMPILER_IS_GNUCC)
message(STATUS "GCC detected, setting additional flags")
set(CMAKE_C_FLAGS "-Wall -Wextra -Winline -Wcast-qual -std=gnu99 -Wshadow" CACHE STRING "Flags used by the compiler during all build types." FORCE)
endif()

# Detect Asan and Tsan compiler flags
# Detect Asan/Tsan/Ubsan compiler flags
include(CheckAsan)
include(CheckTsan)
include(CheckUbsan)

#-----------------------------------------------------------------------------
# Targets built within this project are exported at Install time for use
Expand Down Expand Up @@ -222,6 +223,7 @@ function(mercury_set_lib_options libtarget libname libtype)
OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME}
OUTPUT_NAME_ASAN ${LIB_DEBUG_NAME}
OUTPUT_NAME_TSAN ${LIB_DEBUG_NAME}
OUTPUT_NAME_UBSAN ${LIB_DEBUG_NAME}
VERSION ${LIB_VERSION}
SOVERSION ${API_VERSION}
)
Expand Down
1 change: 1 addition & 0 deletions Testing/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(MERCURY_TEST_DRIVER CXX)

include(CheckAsan)
include(CheckTsan)
include(CheckUbsan)

set(KWSYS_NAMESPACE mercury_sys)
set(KWSYS_USE_SystemTools 1)
Expand Down
Loading

0 comments on commit c174d8d

Please sign in to comment.