From 145a3821ff5d8e30bdba89d37c868ef150c91f85 Mon Sep 17 00:00:00 2001 From: mmontin Date: Fri, 16 Feb 2024 17:37:19 +0100 Subject: [PATCH 1/3] adding cabal-test alias to run test with coverage witout too much noise --- cabal.project | 5 ++++- flake.nix | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cabal.project b/cabal.project index c37ea17d2..255788306 100644 --- a/cabal.project +++ b/cabal.project @@ -1,6 +1,10 @@ packages: . +package cooked-validators + coverage: True + library-coverage: True + package cardano-crypto-praos flags: -external-libsodium-vrf @@ -24,7 +28,6 @@ source-repository-package -- Everything below this point has been copied from plutus-apps' cabal.project - -- Custom repository for cardano haskell packages -- See https://github.com/input-output-hk/cardano-haskell-packages on how to use CHaP in a Haskell project. repository cardano-haskell-packages diff --git a/flake.nix b/flake.nix index d826e19eb..23cf1985b 100644 --- a/flake.nix +++ b/flake.nix @@ -69,9 +69,13 @@ ## one pinned by HLS. buildInputs = buildInputs ++ (with pkgs; [ ormolu hpack hlint ]) ++ (with hpkgs; [ haskell-language-server ]); - inherit (pre-commit) shellHook; + inherit LD_LIBRARY_PATH; inherit LANG; + + shellHook = pre-commit.shellHook + '' + alias cabal-test='cabal --test-option=--color=always test all | grep -vE --color=never "^Writing:.*html$"' + ''; }; }; From 209e757566df9563fe2673ca62538a93277ba776 Mon Sep 17 00:00:00 2001 From: mmontin Date: Fri, 16 Feb 2024 17:46:26 +0100 Subject: [PATCH 2/3] tmp --- flake.nix | 1 + scripts/cabal | 5 +++++ 2 files changed, 6 insertions(+) create mode 100755 scripts/cabal diff --git a/flake.nix b/flake.nix index 23cf1985b..2e8a55985 100644 --- a/flake.nix +++ b/flake.nix @@ -74,6 +74,7 @@ inherit LANG; shellHook = pre-commit.shellHook + '' + export PATH=$PATH:./scripts alias cabal-test='cabal --test-option=--color=always test all | grep -vE --color=never "^Writing:.*html$"' ''; }; diff --git a/scripts/cabal b/scripts/cabal new file mode 100755 index 000000000..5e28e6ed9 --- /dev/null +++ b/scripts/cabal @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + + + +cabal --test-option=--color=always test all | grep -vE --color=never "^Writing:.*html$" \ No newline at end of file From 8c4d298a03a00872a77ecde210e8dc666a263739 Mon Sep 17 00:00:00 2001 From: "Florent C." Date: Fri, 16 Feb 2024 18:12:28 +0100 Subject: [PATCH 3/3] Define a cabal wrapper in the flake to remove annying test junk output --- flake.nix | 13 +++++++++++-- scripts/cabal | 5 ----- 2 files changed, 11 insertions(+), 7 deletions(-) delete mode 100755 scripts/cabal diff --git a/flake.nix b/flake.nix index 2e8a55985..35b4cb0c3 100644 --- a/flake.nix +++ b/flake.nix @@ -73,9 +73,18 @@ inherit LD_LIBRARY_PATH; inherit LANG; + # In addition to the pre-commit hooks, this redefines a cabal + # command that gets rid of annoying "Writing: .....*.html" output + # when running cabal test. shellHook = pre-commit.shellHook + '' - export PATH=$PATH:./scripts - alias cabal-test='cabal --test-option=--color=always test all | grep -vE --color=never "^Writing:.*html$"' + function cabal() { + if [ "$1" != "test" ]; then + command cabal $@ + else + command cabal --test-option=--color=always $@ | grep -vE --color=never "^Writing:.*html$" + fi + } + export -f cabal ''; }; }; diff --git a/scripts/cabal b/scripts/cabal deleted file mode 100755 index 5e28e6ed9..000000000 --- a/scripts/cabal +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - - - -cabal --test-option=--color=always test all | grep -vE --color=never "^Writing:.*html$" \ No newline at end of file