Skip to content

Commit

Permalink
tests.cc-wrapper: skip known-broken sanitizer cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed May 31, 2018
1 parent a8ed1fc commit f24f6d7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pkgs/test/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{ stdenv }:

stdenv.mkDerivation {
with stdenv.lib;
let
# Sanitizer headers aren't available in older libc++ stdenvs due to a bug
sanitizersBroken = stdenv.cc.isClang && builtins.compareVersions (getVersion stdenv.cc.name) "6.0.0" < 0;
in stdenv.mkDerivation {
name = "cc-wrapper-test";

buildCommand = ''
Expand All @@ -15,7 +18,7 @@ stdenv.mkDerivation {
$CXX -o cxx-check ${./cxx-main.cc}
./cxx-check
${stdenv.lib.optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
${optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
printf "checking whether compiler can build with CoreFoundation.framework... " >&2
mkdir -p foo/lib
$CC -framework CoreFoundation -o core-foundation-check ${./core-foundation-main.c}
Expand All @@ -31,19 +34,22 @@ stdenv.mkDerivation {
printf "checking whether compiler uses NIX_LDFLAGS... " >&2
mkdir -p foo/lib
$CC -shared \
${stdenv.lib.optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
${optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
-DVALUE=42 \
-o foo/lib/libfoo${stdenv.hostPlatform.extensions.sharedLibrary} \
${./foo.c}
NIX_LDFLAGS="-L$NIX_BUILD_TOP/foo/lib -rpath $NIX_BUILD_TOP/foo/lib" $CC -lfoo -o ldflags-check ${./ldflags-main.c}
./ldflags-check
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
./sanitizers
${optionalString (!sanitizersBroken) ''
printf "checking whether sanitizers are fully functional... ">&2
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
./sanitizers
''}
touch $out
'';

meta.platforms = stdenv.lib.platforms.all;
meta.platforms = platforms.all;
}

0 comments on commit f24f6d7

Please sign in to comment.