tests.cc-wrapper: Fix sanitizer condition

fc9644d4c9 accidentally enabled the
sanitizer tests for GCC on Darwin, when fixing that case was never
attempted. Also inverted the condition from broken to working for
clarity.
This commit is contained in:
John Ericson 2018-06-18 15:05:23 -04:00
parent 42a88a43c9
commit e3b1937baf

View File

@ -3,7 +3,9 @@ with stdenv.lib;
let
# Sanitizers are not supported on Darwin.
# Sanitizer headers aren't available in older libc++ stdenvs due to a bug
sanitizersBroken = stdenv.cc.isClang && versionOlder (getVersion stdenv.cc.name) "6.0.0";
sanitizersWorking =
(stdenv.cc.isClang && versionAtLeast (getVersion stdenv.cc.name) "6.0.0")
|| (stdenv.cc.isGNU && stdenv.isLinux);
in stdenv.mkDerivation {
name = "cc-wrapper-test";
@ -43,7 +45,7 @@ in stdenv.mkDerivation {
NIX_LDFLAGS="-L$NIX_BUILD_TOP/foo/lib -rpath $NIX_BUILD_TOP/foo/lib" $CC -lfoo -o ldflags-check ${./ldflags-main.c}
./ldflags-check
${optionalString (!sanitizersBroken) ''
${optionalString sanitizersWorking ''
printf "checking whether sanitizers are fully functional... ">&2
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
./sanitizers