From 278b82d662505d6a376f5c6ba425e5449417142e Mon Sep 17 00:00:00 2001 From: saji Date: Fri, 7 Feb 2025 18:00:09 -0600 Subject: [PATCH] start making tests work --- flake.nix | 38 ++++---------------------------------- pkgs/litedram.nix | 3 --- pkgs/liteeth.nix | 7 ++----- pkgs/liteiclink.nix | 11 ++++++++++- pkgs/litescope.nix | 6 +----- pkgs/litespi.nix | 3 --- 6 files changed, 17 insertions(+), 51 deletions(-) diff --git a/flake.nix b/flake.nix index b819c0d..0e8176d 100644 --- a/flake.nix +++ b/flake.nix @@ -55,6 +55,10 @@ checks = forAllSystems (pkgs: { formatting = treefmtEval.${pkgs.system}.config.build.check self; + packages = pkgs.symlinkJoin { + name = "all"; + paths = pkgs.lib.attrsets.attrValues self.packages.${pkgs.system}; + }; }); # this is mainly so that nix-update works. I have no idea if this works without it. @@ -66,39 +70,5 @@ path = ./templates/default; description = "basic template to get started with an ecp5"; }; - - # example, not really something you should import unless you want everything. - devShells = forAllSystems (pkgs: { - default = pkgs.mkShell { - packages = with pkgs; [ - (python3.withPackages ( - ps: with ps; [ - cocotb - cocotb-bus - litex - litedram - liteeth - litescope - litespi - liteiclink - pythondata-cpu-vexriscv - pythondata-software-compiler_rt - pythondata-software-picolibc - amaranth - ] - )) - yosys - nextpnr - # simulators - verilog - verilator - # support package - trellis - # loader - openfpgaloader - ecpdap # easier to poke probes. - ]; - }; - }); }; } diff --git a/pkgs/litedram.nix b/pkgs/litedram.nix index 7a09061..43b8182 100644 --- a/pkgs/litedram.nix +++ b/pkgs/litedram.nix @@ -21,8 +21,5 @@ buildPythonPackage rec { migen ]; - checkPhase = '' - python -m unittest test - ''; doCheck = true; } diff --git a/pkgs/liteeth.nix b/pkgs/liteeth.nix index 84ef19f..4fb8251 100644 --- a/pkgs/liteeth.nix +++ b/pkgs/liteeth.nix @@ -1,10 +1,9 @@ { pkgs, - lib, buildPythonPackage, migen, - setuptools, litex, + litespi, pyyaml, }: buildPythonPackage rec { @@ -27,11 +26,9 @@ buildPythonPackage rec { ]; nativeCheckInputs = [ + litespi pyyaml ]; - checkPhase = '' - python -m unittest test - ''; doCheck = true; } diff --git a/pkgs/liteiclink.nix b/pkgs/liteiclink.nix index eba1182..4f5bba7 100644 --- a/pkgs/liteiclink.nix +++ b/pkgs/liteiclink.nix @@ -2,6 +2,9 @@ pkgs, buildPythonPackage, litex, + migen, + liteeth, + pytest, }: buildPythonPackage rec { pname = "liteiclink"; @@ -16,10 +19,16 @@ buildPythonPackage rec { buildInputs = [ litex + migen + ]; + + nativeCheckInputs = [ + pytest + liteeth ]; checkPhase = '' - python -m unittest test + pytest -v test/ ''; doCheck = true; } diff --git a/pkgs/litescope.nix b/pkgs/litescope.nix index 3bf9121..2d02c09 100644 --- a/pkgs/litescope.nix +++ b/pkgs/litescope.nix @@ -1,9 +1,7 @@ { pkgs, - lib, buildPythonPackage, migen, - setuptools, litex, }: buildPythonPackage rec { @@ -19,10 +17,8 @@ buildPythonPackage rec { buildInputs = [ litex + migen ]; - checkPhase = '' - python -m unittest test - ''; doCheck = true; } diff --git a/pkgs/litespi.nix b/pkgs/litespi.nix index 72b6e01..33f896b 100644 --- a/pkgs/litespi.nix +++ b/pkgs/litespi.nix @@ -28,8 +28,5 @@ buildPythonPackage rec { nativeCheckInputs = [ ]; - checkPhase = '' - python -m unittest test - ''; doCheck = true; }