Skip to content

Commit

Permalink
silence flake update and gen-cabal in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tek committed Oct 8, 2023
1 parent fe4db9a commit 78c3cb8
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/with-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ let
${pkgs.git}/bin/git init
fi
${pkgs.git}/bin/git add .
${nixC} flake update
${nixC} flake update --quiet --quiet
${pkgs.git}/bin/git add flake.lock
${post}
'';
Expand All @@ -123,7 +123,7 @@ let
${pkgs.git}/bin/git init
fi
${pkgs.git}/bin/git add .
${nixC} flake update
${nixC} flake update --quiet --quiet
${pkgs.git}/bin/git add flake.lock
${post}
'';
Expand Down
2 changes: 1 addition & 1 deletion test/basic/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
test = builtins.toFile "basic-test" ''
cd ./root
nix flake update
flake_update
target='[ "ghc90-root" "ghc92-root" "ghc94-root" "ghc96-root" "root" ]'
check 'nix eval .#checks.x86_64-linux --apply builtins.attrNames' $target 'Checks are wrong'
Expand Down
2 changes: 1 addition & 1 deletion test/cross/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
test = builtins.toFile "cross-test" ''
cd ./root
nix flake update --quiet --quiet
flake_update
check_musl()
{
Expand Down
5 changes: 5 additions & 0 deletions test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ in {
check_match "nix run $1 <<< ':quit'" $2 $3
}
flake_update()
{
nix flake update --quiet --quiet
}
runtest()
{
setopt local_options err_return
Expand Down
2 changes: 1 addition & 1 deletion test/dep-versions/test.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{...}: {
test = builtins.toFile "dep-versions-test" ''
cd ./root
nix flake update
flake_update
target='
dep
Expand Down
2 changes: 1 addition & 1 deletion test/deps/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
test = builtins.toFile "deps-test" ''
cd ./root
nix flake update
flake_update
check_match 'nix run .#show-overrides -- dev' 'Hackage: 1.0.0' 'show-overrides does not contain "Hackage: 1.0.0"'
Expand Down
2 changes: 1 addition & 1 deletion test/env/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
test = builtins.toFile "env-test" ''
cd ./root
nix flake update --quiet --quiet
flake_update
# TODO this can be 1 when a solution for component env fallback is implemented
check 'nix run .#cmd.number' 2 'Wrong output for plain command with component'
Expand Down
4 changes: 2 additions & 2 deletions test/ghci-vm/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
test = builtins.toFile "ghci-vm-test" ''
cd ./root
nix flake update
nix run .#gen-cabal
flake_update
nix run .#gen-cabal-quiet
ghci_match '.#ghci -- -p root -t main' 'test-endpoint' "ghci service output with component env does not contain 'test-endpoint'"
Expand Down
4 changes: 2 additions & 2 deletions test/ghci/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
test = builtins.toFile "ghci-test" ''
cd ./root
nix flake update
nix run .#gen-cabal
flake_update
nix run .#gen-cabal-quiet
ghci_match ".#ghci -- --root $PWD -c lib -m Root.Lib -r cwd" "$PWD/pkg/" 'ghci cwd with cd printed wrong directory'
Expand Down
4 changes: 2 additions & 2 deletions test/hackage/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let

regular = ''
cd ./root
nix flake update
flake_update
git init --quiet
git add .
git commit -m "init" --quiet
Expand Down Expand Up @@ -114,7 +114,7 @@ let

synthetic = ''
cd ./nix-hpack
nix flake update
flake_update
nix run .#hpack-quiet
git init --quiet
git add .
Expand Down
2 changes: 1 addition & 1 deletion test/local-prelude/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
test = builtins.toFile "local-prelude-test" ''
cd ./root
nix flake update
flake_update
ghci_match ".#ghci -- -p root -t main" "success" 'local-prelude broken'
'';
Expand Down
2 changes: 1 addition & 1 deletion test/new-static-github/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
mkdir root
cd ./root
nix run "github:tek/hix#new" -- --name 'red-panda'
nix run .#gen-cabal
nix run .#gen-cabal-quiet
check_match 'nix run .#ghci -- -p red-panda -t main <<< :quit' 'passed 1 test' 'Running tests in generated project failed'
check_match 'nix run' 'Hello red-panda' 'App in generated project failed'
'';
Expand Down
2 changes: 1 addition & 1 deletion test/new-static/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
mkdir root
cd ./root
nix run "path:$hix_dir#new" -- --name 'red-panda' --author='Red Panda'
nix run .#gen-cabal
nix run .#gen-cabal-quiet
check_match 'nix run .#ghci -- -p red-panda -t main <<< :quit' 'passed 1 test' 'Running tests in generated project failed'
check_match 'nix run' 'Hello red-panda' 'App in generated project failed'
'';
Expand Down
2 changes: 1 addition & 1 deletion test/new/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
mkdir root
cd ./root
nix run path:$hix_dir#cli -- new --hix-url="path:$hix_dir" --name 'red-panda' --author 'Panda'
nix run .#gen-cabal
nix run .#gen-cabal-quiet
check_match 'nix run .#ghci -- -p red-panda -t main <<< :quit' 'passed 1 test' 'Running tests in generated project failed'
check_match 'nix run' 'Hello red-panda' 'App in generated project failed'
'';
Expand Down
2 changes: 1 addition & 1 deletion test/overrides/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ in {
cd ./dep
nix run .#gen-overrides
cd ../root
nix flake update
flake_update
check_eq '${finalSingle.version}' '2.1.2.1' 'Wrong version for aeson (single)'
check_eq '${finalMulti.version}' '2.1.2.1' 'Wrong version for aeson (multi)'
Expand Down
2 changes: 1 addition & 1 deletion test/packages/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ let
in {
test = builtins.toFile "packages-test" ''
cd ./root
nix flake update
flake_update
nix run .#gen-cabal-quiet
if ! diff ${targetDep} dep/dep-lib.cabal
Expand Down
2 changes: 1 addition & 1 deletion test/postgres/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
test = builtins.toFile "postgres-test" ''
cd ./root
nix flake update
flake_update
output=$(nix run .#cmd.db-test | tail -n5)
target=' ?column?
Expand Down
2 changes: 1 addition & 1 deletion test/service/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
test = builtins.toFile "service-test" ''
cd ./root
nix flake update
flake_update
check_match 'nix run .#cmd.test' 'received' 'invalid output of service command'
'';
}
4 changes: 2 additions & 2 deletions test/subdir/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
git init --quiet
git add .
cd sub
nix flake update
flake_update
nix run .#gen-cabal
nix run .#gen-cabal-quiet
'';
}

0 comments on commit 78c3cb8

Please sign in to comment.