Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
RCoeurjoly committed May 22, 2024
1 parent 772e9bc commit 49618f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,23 @@
yosysWithSanitizers = sanitizer: pkgs.clangStdenv.mkDerivation (commonAttrs {
doCheck = true;
sanitizer = sanitizer;
sanitizerFlags = sanitizer == "memory" ? "-fsanitize-memory-track-origins=2" : "";
sanitizerFlags = if sanitizer == "memory" then "-fsanitize-memory-track-origins=2" else "";
} // {
name = "yosys-with-${sanitizer}";
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git pkg-configUpstream gcc ];
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang llvmPackages.libstdcxxClang zlib git pkg-configUpstream ];
preConfigure = "make config-clang";
checkTarget = "test";
buildPhase = ''
export CXXFLAGS="$CXXFLAGS -g -fsanitize=${sanitizer} ${sanitizerFlags}" # Enable debug symbols and sanitizer flags
export CXXFLAGS="$CXXFLAGS -g -fsanitize=${sanitizer} ${if sanitizer == "memory" then "-fsanitize-memory-track-origins=2" else ""}" # Enable debug symbols and sanitizer flags
export LDFLAGS="-L${pkgs.gcc.libc}/lib"
make -j$(nproc) ABCEXTERNAL=yosys-abc SANITIZER=${sanitizer}
'';
checkPhase = ''
export CXXFLAGS="$CXXFLAGS -g -fsanitize=${sanitizer} ${sanitizerFlags}" # Enable debug symbols and sanitizer flags
export CXXFLAGS="$CXXFLAGS -g -fsanitize=${sanitizer} ${if sanitizer == "memory" then "-fsanitize-memory-track-origins=2" else ""}" # Enable debug symbols and sanitizer flags
export LDFLAGS="-L${pkgs.gcc.libc}/lib"
make test SANITIZER=${sanitizer}
'';
doCheck = false;
});

yosysWithMultipleSanitizers = pkgs.clangStdenv.mkDerivation (commonAttrs {
Expand Down Expand Up @@ -118,6 +119,7 @@
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
};
};

checks = {
makeTest = pkgs.runCommand "make-test" {
buildInputs = [ pkgs.makeWrapper ];
Expand Down

0 comments on commit 49618f0

Please sign in to comment.