summary refs log tree commit diff
path: root/pkgs/test
diff options
context:
space:
mode:
authorBenjamin Saunders <benjamin.saunders@here.com>2018-05-07 13:22:50 -0700
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-24 02:57:44 -0400
commit46eeef1898ffbf57330ec31b96a6c2d89f8fcb36 (patch)
tree1ff7be30a066e05a6ae78b8fd315a8f60e2d0c58 /pkgs/test
parent16da44b5c115fe58048d7ba8aa597ed1598ea090 (diff)
downloadnixpkgs-46eeef1898ffbf57330ec31b96a6c2d89f8fcb36.tar
nixpkgs-46eeef1898ffbf57330ec31b96a6c2d89f8fcb36.tar.gz
nixpkgs-46eeef1898ffbf57330ec31b96a6c2d89f8fcb36.tar.bz2
nixpkgs-46eeef1898ffbf57330ec31b96a6c2d89f8fcb36.tar.lz
nixpkgs-46eeef1898ffbf57330ec31b96a6c2d89f8fcb36.tar.xz
nixpkgs-46eeef1898ffbf57330ec31b96a6c2d89f8fcb36.tar.zst
nixpkgs-46eeef1898ffbf57330ec31b96a6c2d89f8fcb36.zip
tests.cc-wrapper: verify building with sanitizers
Diffstat (limited to 'pkgs/test')
-rw-r--r--pkgs/test/cc-wrapper/default.nix5
-rw-r--r--pkgs/test/cc-wrapper/sanitizers.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/test/cc-wrapper/default.nix b/pkgs/test/cc-wrapper/default.nix
index 41a7685ed2e..06113e40561 100644
--- a/pkgs/test/cc-wrapper/default.nix
+++ b/pkgs/test/cc-wrapper/default.nix
@@ -38,6 +38,11 @@ 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
+  '' + stdenv.lib.optionalString (stdenv.cc.isCompilerRT or false) ''
+
+    $CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
+    ./sanitizers
+  '' + ''
 
     touch $out
   '';
diff --git a/pkgs/test/cc-wrapper/sanitizers.c b/pkgs/test/cc-wrapper/sanitizers.c
new file mode 100644
index 00000000000..93dd78a903c
--- /dev/null
+++ b/pkgs/test/cc-wrapper/sanitizers.c
@@ -0,0 +1,8 @@
+#include <sanitizer/asan_interface.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+  fprintf(stderr, "ok\n");
+  return 0;
+}