From 2ad15081b0fd9ef0fcce082b69097c5d565f1d6f Mon Sep 17 00:00:00 2001 From: Torsten Schmits Date: Sun, 30 Jul 2023 03:45:52 +0200 Subject: [PATCH] clean up tests --- test/auto-1/root/app/Main.hs | 8 ----- test/auto-1/root/flake.nix | 37 -------------------- test/auto-1/root/src/Root/Lib.hs | 5 --- test/auto-1/test.nix | 15 -------- test/auto-2/root/cabal.project | 1 - test/auto-2/root/flake.nix | 16 --------- test/auto-2/root/src/Root/Lib.hs | 5 --- test/auto-2/test.nix | 13 ------- test/auto-3/root/Main.hs | 7 ---- test/auto-3/root/Root/Lib.hs | 5 --- test/auto-3/root/cabal.project | 1 - test/auto-3/root/flake.nix | 18 ---------- test/auto-3/test.nix | 25 ------------- test/auto-4/root/Main.hs | 8 ----- test/auto-4/root/Root/Lib.hs | 8 ----- test/auto-4/root/flake.nix | 20 ----------- test/auto-4/test.nix | 13 ------- test/auto-5/root/app/Main.hs | 7 ---- test/auto-5/root/cabal.project | 1 - test/{auto-2/root/app => basic/root}/Main.hs | 0 test/{auto-1 => basic}/root/cabal.project | 0 test/{auto-5 => basic}/root/flake.nix | 5 ++- test/{auto-5 => basic}/root/lib/Root/Lib.hs | 2 +- test/{auto-5 => basic}/root/test/Main.hs | 0 test/{auto-5 => basic}/test.nix | 5 ++- test/default.nix | 6 +--- test/deps/test.nix | 2 -- test/ghci/root/flake.nix | 1 - test/overrides/root/flake.nix | 3 +- test/overrides/test.nix | 1 + 30 files changed, 9 insertions(+), 229 deletions(-) delete mode 100644 test/auto-1/root/app/Main.hs delete mode 100644 test/auto-1/root/flake.nix delete mode 100644 test/auto-1/root/src/Root/Lib.hs delete mode 100644 test/auto-1/test.nix delete mode 100644 test/auto-2/root/cabal.project delete mode 100644 test/auto-2/root/flake.nix delete mode 100644 test/auto-2/root/src/Root/Lib.hs delete mode 100644 test/auto-2/test.nix delete mode 100644 test/auto-3/root/Main.hs delete mode 100644 test/auto-3/root/Root/Lib.hs delete mode 100644 test/auto-3/root/cabal.project delete mode 100644 test/auto-3/root/flake.nix delete mode 100644 test/auto-3/test.nix delete mode 100644 test/auto-4/root/Main.hs delete mode 100644 test/auto-4/root/Root/Lib.hs delete mode 100644 test/auto-4/root/flake.nix delete mode 100644 test/auto-4/test.nix delete mode 100644 test/auto-5/root/app/Main.hs delete mode 100644 test/auto-5/root/cabal.project rename test/{auto-2/root/app => basic/root}/Main.hs (100%) rename test/{auto-1 => basic}/root/cabal.project (100%) rename test/{auto-5 => basic}/root/flake.nix (67%) rename test/{auto-5 => basic}/root/lib/Root/Lib.hs (85%) rename test/{auto-5 => basic}/root/test/Main.hs (100%) rename test/{auto-5 => basic}/test.nix (90%) diff --git a/test/auto-1/root/app/Main.hs b/test/auto-1/root/app/Main.hs deleted file mode 100644 index fcde38a..0000000 --- a/test/auto-1/root/app/Main.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Main where - -import Polysemy -import Root.Lib (string) - -main :: IO () -main = - putStrLn string diff --git a/test/auto-1/root/flake.nix b/test/auto-1/root/flake.nix deleted file mode 100644 index 1616746..0000000 --- a/test/auto-1/root/flake.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - description = "hix test project"; - - inputs.hix.url = path:HIX; - - outputs = { hix, ... }: hix { - cabal = { - base = { name = "base"; version = ">= 4.12 && < 5"; }; - version = "23"; - license = "GPL-3"; - meta.author = "Author McCodeface"; - }; - packages.root = { - src = ./.; - - library = { - enable = true; - source-dirs = "src"; - dependencies = ["transformers >= 0 && < 100" "aeson"]; - paths = false; - }; - - executables.run = { - source-dirs = "app"; - dependencies = ["polysemy"]; - }; - - buildInputs = pkgs: [pkgs.socat]; - - }; - compat.enable = false; - overrides = {self, notest, ...}: { - root1 = notest self.root; - }; - output.extraPackages = ["root1"]; - }; -} diff --git a/test/auto-1/root/src/Root/Lib.hs b/test/auto-1/root/src/Root/Lib.hs deleted file mode 100644 index 7e635af..0000000 --- a/test/auto-1/root/src/Root/Lib.hs +++ /dev/null @@ -1,5 +0,0 @@ -module Root.Lib where - -string :: String -string = - "string" diff --git a/test/auto-1/test.nix b/test/auto-1/test.nix deleted file mode 100644 index 559f267..0000000 --- a/test/auto-1/test.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs }: -{ - test = builtins.toFile "auto-1-test" '' - cd ./root - nix flake update - - nix build .#root1 - output=$(result/bin/run) - - if [[ $output != 'string' ]] - then - fail "Running the main package produced the wrong output:\n$output" - fi - ''; -} diff --git a/test/auto-2/root/cabal.project b/test/auto-2/root/cabal.project deleted file mode 100644 index e6fdbad..0000000 --- a/test/auto-2/root/cabal.project +++ /dev/null @@ -1 +0,0 @@ -packages: . diff --git a/test/auto-2/root/flake.nix b/test/auto-2/root/flake.nix deleted file mode 100644 index cde4e5a..0000000 --- a/test/auto-2/root/flake.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - description = "hix test project"; - - inputs.hix.url = path:HIX; - - outputs = { hix, ... }: hix.lib.flake ({config, ...}: { - packages.root = { - src = ./.; - library = { enable = true; source-dirs = "src"; }; - executable.enable = true; - buildInputs = [config.pkgs.socat]; - }; - compat.enable = false; - envs.dev.ghc.compiler = "ghc90"; - }); -} diff --git a/test/auto-2/root/src/Root/Lib.hs b/test/auto-2/root/src/Root/Lib.hs deleted file mode 100644 index 7e635af..0000000 --- a/test/auto-2/root/src/Root/Lib.hs +++ /dev/null @@ -1,5 +0,0 @@ -module Root.Lib where - -string :: String -string = - "string" diff --git a/test/auto-2/test.nix b/test/auto-2/test.nix deleted file mode 100644 index db12a6c..0000000 --- a/test/auto-2/test.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs }: -{ - test = builtins.toFile "auto-2-test" '' - cd ./root - nix flake update - nix build - output=$(result/bin/root) - if [[ $output != 'string' ]] - then - fail "Running the main package produced the wrong output:\n$output" - fi - ''; -} diff --git a/test/auto-3/root/Main.hs b/test/auto-3/root/Main.hs deleted file mode 100644 index f5a49c1..0000000 --- a/test/auto-3/root/Main.hs +++ /dev/null @@ -1,7 +0,0 @@ -module Main where - -import Root.Lib (string) - -main :: IO () -main = - putStrLn string diff --git a/test/auto-3/root/Root/Lib.hs b/test/auto-3/root/Root/Lib.hs deleted file mode 100644 index 7e635af..0000000 --- a/test/auto-3/root/Root/Lib.hs +++ /dev/null @@ -1,5 +0,0 @@ -module Root.Lib where - -string :: String -string = - "string" diff --git a/test/auto-3/root/cabal.project b/test/auto-3/root/cabal.project deleted file mode 100644 index e6fdbad..0000000 --- a/test/auto-3/root/cabal.project +++ /dev/null @@ -1 +0,0 @@ -packages: . diff --git a/test/auto-3/root/flake.nix b/test/auto-3/root/flake.nix deleted file mode 100644 index c8e51de..0000000 --- a/test/auto-3/root/flake.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - description = "hix test project"; - - inputs.hix.url = path:HIX; - - outputs = { hix, ... }: - hix.lib.flake { - packages.root = { - src = ./.; - executable = { - enable = true; - source-dirs = "."; - }; - }; - buildInputs = pkgs: [pkgs.socat]; - envs.dev.ghc.compiler = "ghc90"; - }; -} diff --git a/test/auto-3/test.nix b/test/auto-3/test.nix deleted file mode 100644 index db08367..0000000 --- a/test/auto-3/test.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ pkgs }: -{ - test = builtins.toFile "auto-3-test" '' - cd ./root - nix flake update - - nix build - output=$(result/bin/root) - if [[ $output != 'string' ]] - then - fail "Running the main package with 'build' produced the wrong output:\n$output" - fi - - output=$(nix run) - if [[ $output != 'string' ]] - then - fail "Running the main package with 'nix run' produced the wrong output:\n$output" - fi - - check_match 'nix develop -c ghc --version' '9.0.2' 'Devshell GHC version is wrong' - - check_match 'nix develop .#ghc92 -c ghc --version' '9.2.8' 'Devshell GHC version for ghc92 is wrong' - - ''; -} diff --git a/test/auto-4/root/Main.hs b/test/auto-4/root/Main.hs deleted file mode 100644 index fcde38a..0000000 --- a/test/auto-4/root/Main.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Main where - -import Polysemy -import Root.Lib (string) - -main :: IO () -main = - putStrLn string diff --git a/test/auto-4/root/Root/Lib.hs b/test/auto-4/root/Root/Lib.hs deleted file mode 100644 index b9b3f4a..0000000 --- a/test/auto-4/root/Root/Lib.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Root.Lib where - -import Polysemy -import Data.Aeson - -string :: String -string = - "string" diff --git a/test/auto-4/root/flake.nix b/test/auto-4/root/flake.nix deleted file mode 100644 index 121fe1b..0000000 --- a/test/auto-4/root/flake.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - description = "hix test project"; - - inputs.hix.url = path:HIX; - - outputs = { hix, ... }: - hix.lib.flake { - packages.root = { - src = ./.; - cabal.dependencies = ["aeson"]; - executable = { - enable = true; - source-dirs = "."; - }; - }; - cabal.dependencies = ["base" "polysemy"]; - compat.enable = false; - envs.dev.ghc.compiler = "ghc90"; - }; -} diff --git a/test/auto-4/test.nix b/test/auto-4/test.nix deleted file mode 100644 index 3a3ea4b..0000000 --- a/test/auto-4/test.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs }: -{ - test = builtins.toFile "auto-4-test" '' - cd ./root - nix flake update - nix build - output=$(result/bin/root) - if [[ $output != 'string' ]] - then - fail "Running the main package with 'build' produced the wrong output:\n$output" - fi - ''; -} diff --git a/test/auto-5/root/app/Main.hs b/test/auto-5/root/app/Main.hs deleted file mode 100644 index f5a49c1..0000000 --- a/test/auto-5/root/app/Main.hs +++ /dev/null @@ -1,7 +0,0 @@ -module Main where - -import Root.Lib (string) - -main :: IO () -main = - putStrLn string diff --git a/test/auto-5/root/cabal.project b/test/auto-5/root/cabal.project deleted file mode 100644 index e6fdbad..0000000 --- a/test/auto-5/root/cabal.project +++ /dev/null @@ -1 +0,0 @@ -packages: . diff --git a/test/auto-2/root/app/Main.hs b/test/basic/root/Main.hs similarity index 100% rename from test/auto-2/root/app/Main.hs rename to test/basic/root/Main.hs diff --git a/test/auto-1/root/cabal.project b/test/basic/root/cabal.project similarity index 100% rename from test/auto-1/root/cabal.project rename to test/basic/root/cabal.project diff --git a/test/auto-5/root/flake.nix b/test/basic/root/flake.nix similarity index 67% rename from test/auto-5/root/flake.nix rename to test/basic/root/flake.nix index 85ee043..6d5ca09 100644 --- a/test/auto-5/root/flake.nix +++ b/test/basic/root/flake.nix @@ -10,10 +10,9 @@ cabal.dependencies = ["aeson"]; library.enable = true; library.dependencies = ["messagepack"]; - executables.root = { enable = true; source-dirs = "app"; }; + executables.root = { enable = true; source-dirs = "."; }; test.enable = true; }; - cabal.dependencies = ["base" "polysemy"]; - envs.dev.ghc.compiler = "ghc90"; + cabal.dependencies = ["base" "some"]; }; } diff --git a/test/auto-5/root/lib/Root/Lib.hs b/test/basic/root/lib/Root/Lib.hs similarity index 85% rename from test/auto-5/root/lib/Root/Lib.hs rename to test/basic/root/lib/Root/Lib.hs index 53109d3..17f8e7b 100644 --- a/test/auto-5/root/lib/Root/Lib.hs +++ b/test/basic/root/lib/Root/Lib.hs @@ -1,6 +1,6 @@ module Root.Lib where -import Polysemy +import Data.Some import Data.Aeson import Data.MessagePack diff --git a/test/auto-5/root/test/Main.hs b/test/basic/root/test/Main.hs similarity index 100% rename from test/auto-5/root/test/Main.hs rename to test/basic/root/test/Main.hs diff --git a/test/auto-5/test.nix b/test/basic/test.nix similarity index 90% rename from test/auto-5/test.nix rename to test/basic/test.nix index e102f8c..d1bd3e7 100644 --- a/test/auto-5/test.nix +++ b/test/basic/test.nix @@ -1,6 +1,6 @@ { pkgs }: { - test = builtins.toFile "auto-5-test" '' + test = builtins.toFile "basic-test" '' cd ./root nix flake update @@ -12,8 +12,7 @@ check 'nix develop .#ghc94 -c ghc --version' 'The Glorious Glasgow Haskell Compilation System, version 9.4.5' - nix build .#ghc90-root + nix build .#ghc92-root check 'result/bin/root' 'string' 'Running the main package produced the wrong output' - ''; } diff --git a/test/default.nix b/test/default.nix index ac399ce..158ce76 100644 --- a/test/default.nix +++ b/test/default.nix @@ -5,15 +5,11 @@ let test = name: (import (./. + "/${name}/test.nix") { inherit pkgs; }).test; tests = { + basic = test "basic"; deps = test "deps"; ghci = test "ghci"; packages = test "packages"; hackage = test "hackage"; - auto-1 = test "auto-1"; - auto-2 = test "auto-2"; - auto-3 = test "auto-3"; - auto-4 = test "auto-4"; - auto-5 = test "auto-5"; cross = test "cross"; service = test "service"; postgres = test "postgres"; diff --git a/test/deps/test.nix b/test/deps/test.nix index 570a78c..0954d13 100644 --- a/test/deps/test.nix +++ b/test/deps/test.nix @@ -20,8 +20,6 @@ fail "Running the main package produced the wrong output:\n$output" fi - nix build .#ghc90-root - nix run .#hls 2>/dev/null ''; } diff --git a/test/ghci/root/flake.nix b/test/ghci/root/flake.nix index 610f704..f3943ad 100644 --- a/test/ghci/root/flake.nix +++ b/test/ghci/root/flake.nix @@ -13,7 +13,6 @@ test.enable = true; test.env = "hix-ghci-test"; }; - compiler = "ghc90"; envs.hix-ghci-test.services.test.enable = true; services.test = { nixos.services.nginx = { diff --git a/test/overrides/root/flake.nix b/test/overrides/root/flake.nix index 24252bf..0cada16 100644 --- a/test/overrides/root/flake.nix +++ b/test/overrides/root/flake.nix @@ -17,12 +17,13 @@ }; }; compat.enable = false; + gen-overrides.enable = true; overrides = {self, pkgs, hackage, jailbreak, buildInputs, ...}: { aeson = hackage "2.1.2.1" "1f1f6h2r60ghz4p1ddi6wnq6z3i07j60sgm77hx2rvmncz4vizp0"; extra = jailbreak; root1 = jailbreak self.root; root = buildInputs [pkgs.git]; }; - gen-overrides.enable = true; + output.extraPackages = ["root1"]; }); } diff --git a/test/overrides/test.nix b/test/overrides/test.nix index 50c55bd..cad9f8e 100644 --- a/test/overrides/test.nix +++ b/test/overrides/test.nix @@ -59,6 +59,7 @@ in { check 'nix eval .#legacyPackages.${pkgs.system}.ghc.aeson.version' '"2.1.2.1"' 'aeson version wrong after gen-overrides' + nix build .#root1 nix flake check sed -i 's/2\.1/5.8/' flake.nix