Suppress abort() dialog on windows (#549)

This commit is contained in:
Tom M 2019-08-06 17:29:49 +02:00 committed by GitHub
parent d8bbd56fea
commit 5c795791c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 8 deletions

View file

@ -38,7 +38,7 @@ install:
build_script:
- mkdir build
- cd build
- cmake -G "%generator%" -T "%toolset%" -Denable-pkgconfig=0 -DCMAKE_TOOLCHAIN_FILE=c:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake ..
- cmake -G "%generator%" -T "%toolset%" -Denable-pkgconfig=0 -DCMAKE_TOOLCHAIN_FILE=c:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DNO_GUI=1 ..
- cmake --build . --config Release # build libfluidsynth and fluidsynth exec
- cmake --build . --config Release --target check # build and exec unittests

View file

@ -15,7 +15,7 @@ jobs:
- script: |
mkdir build && cd build
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
cmake -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 ..
cmake -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 ..
make
displayName: 'Compile fluidsynth'
@ -70,7 +70,7 @@ jobs:
SET "PATH=d:\deps\bin;%PATH%"
pkg-config --list-all
mkdir build && cd build || exit -1
cmake -A $(platform) -T $(toolset) -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -Denable-readline=0 -Denable-floats=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 .. || exit -1
cmake -A $(platform) -T $(toolset) -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -Denable-readline=0 -Denable-floats=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 .. || exit -1
cmake --build . --config Release || exit -1
displayName: 'Compile fluidsynth'
- script: |
@ -142,7 +142,7 @@ jobs:
@ECHO ON
SET "PATH=d:\deps\bin;%PATH%"
mkdir build && cd build || exit -1
cmake -A x64 -DCMAKE_BUILD_TYPE=$(CMAKE_CONFIG) -DCMAKE_VERBOSE_MAKEFILE=1 $(CMAKE_FLAGS) .. || exit -1
cmake -A x64 -DCMAKE_BUILD_TYPE=$(CMAKE_CONFIG) -DCMAKE_VERBOSE_MAKEFILE=1 $(CMAKE_FLAGS) -DNO_GUI=1 .. || exit -1
cmake --build . --config $(CMAKE_CONFIG) || exit -1
displayName: 'Compile fluidsynth'
- script: |
@ -204,7 +204,7 @@ jobs:
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
pkg-config --list-all
mkdir build && cd build || exit -1
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) $(CMAKE_FLAGS) -Denable-readline=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 .. || exit -1
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) $(CMAKE_FLAGS) -Denable-readline=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 .. || exit -1
mingw32-make.exe all || exit -1
displayName: 'Compile fluidsynth'
- script: |

View file

@ -4,7 +4,7 @@ freebsd_instance:
task:
install_script: pwd && ls -la && pkg install -y cmake glib alsa-lib ladspa portaudio pulseaudio pkgconf sdl2
compile_script: pwd && ls -la && mkdir $HOME/fluidsynth_install/ && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=0 .. && make -j4 && make check && make install
compile_script: pwd && ls -la && mkdir $HOME/fluidsynth_install/ && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=0 -DNO_GUI=1 .. && make -j4 && make check && make install

View file

@ -59,7 +59,7 @@ before_script:
- mkdir build && cd build
script:
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install ${CMAKE_FLAGS} -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=1 ..
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install ${CMAKE_FLAGS} -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 ..
- make -j4
- make check
- if [ $TRAVIS_OS_NAME = linux ]; then make install; fi # install only on linux, as CMAKE_INSTALL_PREFIX is ignored for frameworks on macosx and I cant tell whether that's correct or a bug.

View file

@ -154,6 +154,9 @@
/* Define to enable network support */
#cmakedefine NETWORK_SUPPORT @NETWORK_SUPPORT@
/* Defined when fluidsynth is build in an automated enviornment, where no MSVC++ Runtime Debug Assertion dialogs should pop up */
#cmakedefine NO_GUI @NO_GUI@
/* libinstpatch for DLS and GIG */
#cmakedefine LIBINSTPATCH_SUPPORT @LIBINSTPATCH_SUPPORT@

View file

@ -1,10 +1,29 @@
#pragma once
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#define TEST_ASSERT(COND) do { if (!(COND)) { fprintf(stderr, __FILE__ ":%d assertion (%s) failed\n", __LINE__, #COND); abort(); } } while (0)
/*
* We call abort() because on Linux this sends a signal to the process and causes the debugger to break.
*
* MSVC++ runtime opens a dialog when abort() is called, saying that abort() has been called and you can
* click "Retry" to make the debugger break.
* When executed by CI build however, the dialog causes the unit tests to be stuck forever.
* Thus suppress the dialog on windows.
* MinGW however requires explicit linking against MSVCRT >= 8.0 for _set_abort_behavior().
* It's not worth the hassle to implement this with cmake...
*/
#if defined(NO_GUI) && defined(MINGW32)
#define TEST_ABORT exit(EXIT_FAILURE);
#elif defined(NO_GUI) && defined(WIN32)
#define TEST_ABORT _set_abort_behavior(0, _WRITE_ABORT_MSG); abort()
#else
#define TEST_ABORT abort()
#endif
#define TEST_ASSERT(COND) do { if (!(COND)) { fprintf(stderr, __FILE__ ":%d assertion (%s) failed\n", __LINE__, #COND); TEST_ABORT; } } while (0)
/* macro to test whether a fluidsynth function succeeded or not */
#define TEST_SUCCESS(FLUID_FUNCT) TEST_ASSERT((FLUID_FUNCT) != FLUID_FAILED)