From b81da489f58dfaa5c5bcf8e624de2161bd1c80d5 Mon Sep 17 00:00:00 2001 From: Russel Waters Date: Mon, 24 Feb 2020 10:21:28 -0500 Subject: [PATCH] friendly backtraces in actions (#2591) * symlink to backtrace.h in dockerfile Add defines for BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE update testing scripts to handle clang linking to gcc backtrace.h symlinked location Continue on Error in ps1 scripts * use boost 1.70 for clang to allow for `BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE` definition revert win actions guards in assert_internal --- CMakeLists.txt | 3 +++ ci/actions/windows/build.ps1 | 3 +-- ci/actions/windows/deploy.ps1 | 3 +-- ci/actions/windows/disable_windows_defender.ps1 | 2 ++ ci/actions/windows/install_deps.ps1 | 2 ++ ci/actions/windows/signing.ps1 | 2 ++ ci/build-travis.sh | 8 ++++++++ docker/ci/Dockerfile-clang | 9 +++++++-- 8 files changed, 26 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0318dbd6..a67294ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,9 @@ set (NANO_FUZZER_TEST OFF CACHE BOOL "") option (NANO_STACKTRACE_BACKTRACE "Use BOOST_STACKTRACE_USE_BACKTRACE in stacktraces, for POSIX" OFF) if (NANO_STACKTRACE_BACKTRACE) add_definitions(-DNANO_STACKTRACE_BACKTRACE=1) + if (BACKTRACE_INCLUDE) + add_definitions(-DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=${BACKTRACE_INCLUDE}) + endif() endif () if (${NANO_TIMED_LOCKS} GREATER 0) diff --git a/ci/actions/windows/build.ps1 b/ci/actions/windows/build.ps1 index 5525f913..9fe4dc7d 100644 --- a/ci/actions/windows/build.ps1 +++ b/ci/actions/windows/build.ps1 @@ -1,5 +1,4 @@ -# Stop immediately if any error happens -$ErrorActionPreference = "Stop" +$ErrorActionPreference = "Continue" if (${env:artifact} -eq 1) { if ( ${env:BETA} -eq 1 ) { diff --git a/ci/actions/windows/deploy.ps1 b/ci/actions/windows/deploy.ps1 index 948df01f..2e766bf2 100644 --- a/ci/actions/windows/deploy.ps1 +++ b/ci/actions/windows/deploy.ps1 @@ -1,5 +1,4 @@ -# Stop immediately if any error happens -$ErrorActionPreference = "Stop" +$ErrorActionPreference = "Continue" if ( ${env:BETA} -eq 1 ) { $network_cfg="beta" diff --git a/ci/actions/windows/disable_windows_defender.ps1 b/ci/actions/windows/disable_windows_defender.ps1 index 3184a263..4d674308 100644 --- a/ci/actions/windows/disable_windows_defender.ps1 +++ b/ci/actions/windows/disable_windows_defender.ps1 @@ -1,3 +1,5 @@ +$ErrorActionPreference = "Continue" + Set-MpPreference -DisableArchiveScanning $true Set-MpPreference -DisableRealtimeMonitoring $true Set-MpPreference -DisableBehaviorMonitoring $true \ No newline at end of file diff --git a/ci/actions/windows/install_deps.ps1 b/ci/actions/windows/install_deps.ps1 index 3bf40e6e..29909727 100644 --- a/ci/actions/windows/install_deps.ps1 +++ b/ci/actions/windows/install_deps.ps1 @@ -1,3 +1,5 @@ +$ErrorActionPreference = "Continue" + function Get-RedirectedUri { <# .SYNOPSIS diff --git a/ci/actions/windows/signing.ps1 b/ci/actions/windows/signing.ps1 index 4cbe63f7..78de3886 100644 --- a/ci/actions/windows/signing.ps1 +++ b/ci/actions/windows/signing.ps1 @@ -1,3 +1,5 @@ +$ErrorActionPreference = "Continue" + if (Test-Path env:CSC_LINK) { $path = Join-Path -Path "$env:TMP" -ChildPath csc.p12 [IO.File]::WriteAllBytes($path, [Convert]::FromBase64String($env:CSC_LINK)) diff --git a/ci/build-travis.sh b/ci/build-travis.sh index e8da49f1..6f38483f 100755 --- a/ci/build-travis.sh +++ b/ci/build-travis.sh @@ -44,8 +44,15 @@ ulimit -S -n 8192 if [[ "$OS" == 'Linux' ]]; then ROCKSDB="-DROCKSDB_LIBRARIES=/tmp/rocksdb/lib/librocksdb.a \ -DROCKSDB_INCLUDE_DIRS=/tmp/rocksdb/include" + if clang --version; then + BACKTRACE="-DNANO_STACKTRACE_BACKTRACE=ON \ + -DBACKTRACE_INCLUDE=" + else + BACKTRACE="-DNANO_STACKTRACE_BACKTRACE=ON" + fi else ROCKSDB="" + BACKTRACE="" fi cmake \ @@ -61,6 +68,7 @@ cmake \ -DBOOST_ROOT=/tmp/boost/ \ -DQt5_DIR=${qt_dir} \ -DCI_TEST="1" \ + ${BACKTRACE} \ ${SANITIZERS} \ .. diff --git a/docker/ci/Dockerfile-clang b/docker/ci/Dockerfile-clang index 6d1ba365..dd6cfdab 100644 --- a/docker/ci/Dockerfile-clang +++ b/docker/ci/Dockerfile-clang @@ -14,6 +14,11 @@ RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100 ENV BOOST_ROOT=/tmp/boost -ADD util/build_prep/fetch_boost.sh fetch_boost.sh +ADD util/build_prep/bootstrap_boost.sh bootstrap_boost.sh +RUN ./bootstrap_boost.sh -m -c -B 1.70 -RUN ./fetch_boost.sh +# workaround to get a path that can be easily passed into cmake for +# BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE +# see https://www.boost.org/doc/libs/1_70_0/doc/html/stacktrace/configuration_and_build.html#stacktrace.configuration_and_build.f3 + +RUN ln -s /usr/lib/gcc/x86_64-linux-gnu/5/include/backtrace.h /tmp/backtrace.h \ No newline at end of file