diff --git a/Tests/test_fault.py b/Tests/test_fault.py index 8eb8944..5ce8f05 100644 --- a/Tests/test_fault.py +++ b/Tests/test_fault.py @@ -10,7 +10,7 @@ def run(label, steps): if step[0] == "nl2bench": cmd = step else: - cmd = ["swift", "run", "fault"] + step + cmd = shlex.split(os.getenv("PYTEST_FAULT_BIN", "swift run Fault")) + step print(f"$ {shlex.join(cmd)}") subprocess.check_call(cmd) diff --git a/default.nix b/default.nix index 7426384..1f0997a 100644 --- a/default.nix +++ b/default.nix @@ -23,7 +23,6 @@ stdenv.mkDerivation (finalAttrs: { src = nix-gitignore.gitignoreSourcePure ./.gitignore ./.; - nativeBuildInputs = [ swift swiftpm makeBinaryWrapper ]; swiftpmFlags = [ "--verbose" ]; @@ -39,6 +38,12 @@ stdenv.mkDerivation (finalAttrs: { # "-Xswiftc" # "x86_64-apple-macosx11" # ]; + nativeBuildInputs = [ swift swiftpm makeBinaryWrapper ]; + + buildInputs = with swiftPackages; [ + Foundation + XCTest + ] ++ lib.lists.optional (!stdenv.isDarwin) [Dispatch]; propagatedBuildInputs = [ pyenv @@ -48,10 +53,9 @@ stdenv.mkDerivation (finalAttrs: { nl2bench ]; - buildInputs = with swiftPackages; [ - Foundation - XCTest - ] ++ lib.lists.optional (!stdenv.isDarwin) [Dispatch]; + nativeCheckInputs = with python3.pkgs; [ + pytest + ]; configurePhase = generated.configure; @@ -66,9 +70,9 @@ stdenv.mkDerivation (finalAttrs: { export LD_LIBRARY_PATH=${swiftPackages.Dispatch}/lib:$LD_LIBRARY_PATH ''; - doCheck = !swiftPackages.stdenv.isDarwin; + doCheck = true; - preCheck = '' + faultEnv = '' export PYTHONPATH=${pyenv}/${pyenv.sitePackages} export PATH=${verilog}/bin:$PATH export PATH=${yosys}/bin:$PATH @@ -77,9 +81,8 @@ stdenv.mkDerivation (finalAttrs: { ''; checkPhase = '' - ${finalAttrs.preCheck} - echo $PATH - swift test + ${finalAttrs.faultEnv} + PYTEST_FAULT_BIN="$(swiftpmBinPath)/fault" pytest ''; fixupPhase = '' @@ -98,5 +101,5 @@ stdenv.mkDerivation (finalAttrs: { platforms = platforms.linux ++ platforms.darwin; }; - shellHook = finalAttrs.preCheck + finalAttrs.preBuild; + shellHook = finalAttrs.faultEnv + finalAttrs.preBuild; }) diff --git a/flake.lock b/flake.lock index 39efd17..410a1eb 100644 --- a/flake.lock +++ b/flake.lock @@ -177,15 +177,16 @@ ] }, "locked": { - "lastModified": 1721137344, - "narHash": "sha256-ZRWbrI+HCpTZAbgTjqf4IWMuUspk++DI4DGeVTBNumQ=", - "owner": "coloquinte", + "lastModified": 1722000917, + "narHash": "sha256-OcvZO3l8CyjGpfIoR0nAMKqUQu8FPwY1dNX2vqopvrk=", + "owner": "donn", "repo": "quaigh", - "rev": "1b690ebece60a0181df7af22546f13427914cf82", + "rev": "cfad5cae30496b1ad49e58118d4649e2aac20935", "type": "github" }, "original": { - "owner": "coloquinte", + "owner": "donn", + "ref": "fix_nix_linux", "repo": "quaigh", "type": "github" } diff --git a/flake.nix b/flake.nix index 5dc6505..3d4fe39 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ nix-eda.url = github:efabless/nix-eda; nl2bench.url = github:donn/nl2bench; quaigh = { - url = github:coloquinte/quaigh; + url = github:donn/quaigh/fix_nix_linux; inputs.nixpkgs.follows = "nix-eda/nixpkgs"; }; };