Skip to content

Commit

Permalink
Fix tests on non-x86_64-linux (#87)
Browse files Browse the repository at this point in the history
- `builtins.currentSystem` isn't predictable, let's use `x86_64-linux`
for consistency
- Add `interactiveTests` so that tasty-silver can actually show you the
diff when golden tests fail
  • Loading branch information
9999years authored Oct 24, 2024
1 parent 1f8f2ff commit 5591d26
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
10 changes: 5 additions & 5 deletions golden-tests/derivations/simple/new/drv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ let
name = "second_derivation";
derivations = [ one ];
builder = "builder";
system = builtins.currentSystem;
system = "x86_64-linux";
};
three = derivation {
name = "third_derivation";
derivations = [ one ];
builder = "builder";
system = builtins.currentSystem;
system = "x86_64-linux";
};
namesMissmatch = derivation {
name = "new";
builder = "builder";
system = builtins.currentSystem;
system = "x86_64-linux";
};
outputsMissmatch = derivation {
name = "outputs";
outputs = [ "lib" "headers" "doc" ];
builder = "builder";
system = builtins.currentSystem;
system = "x86_64-linux";
};
in
derivation {
Expand All @@ -35,5 +35,5 @@ derivation {
srcs = [ ./changed-file ./new-file ];
derivations = [ two three namesMissmatch outputsMissmatch ];
args = [ "one" "three" "four" ];
system = builtins.currentSystem;
system = "x86_64-linux";
}
10 changes: 5 additions & 5 deletions golden-tests/derivations/simple/old/drv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ let
name = "second_derivation";
derivations = [ one ];
builder = "builder";
system = builtins.currentSystem;
system = "x86_64-linux";
};
three = derivation {
name = "third_derivation";
derivations = [ one ];
builder = "builder";
system = builtins.currentSystem;
system = "x86_64-linux";
};
namesMissmatch = derivation {
name = "old";
builder = "builder";
system = builtins.currentSystem;
system = "x86_64-linux";
};
outputsMissmatch = derivation {
name = "outputs";
outputs = [ "out" "bin" ];
builder = "builder";
system = builtins.currentSystem;
system = "x86_64-linux";
};
in
derivation {
Expand All @@ -35,5 +35,5 @@ derivation {
srcs = [ ./changed-file ./missing-file ];
derivations = [ two three namesMissmatch outputsMissmatch ];
args = [ "one" "two" "three" ];
system = builtins.currentSystem;
system = "x86_64-linux";
}
7 changes: 5 additions & 2 deletions test/Main.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Main where

import Test.Tasty
import Test.Tasty.Silver.Interactive (interactiveTests)

import Golden.Utils (initSimpleDerivations, initComplexDerivations)
import Golden.Tests (goldenTests)
Expand All @@ -10,5 +11,7 @@ main :: IO ()
main = do
simpleTd <- initSimpleDerivations
complexTd <- initComplexDerivations
defaultMain $
testGroup "Tests" [goldenTests simpleTd complexTd, properties]
defaultMainWithIngredients
[ interactiveTests (const False)
]
$ testGroup "Tests" [goldenTests simpleTd complexTd, properties]

0 comments on commit 5591d26

Please sign in to comment.