diff options
Diffstat (limited to 'nix/buildLisp')
-rw-r--r-- | nix/buildLisp/default.nix | 14 | ||||
-rw-r--r-- | nix/buildLisp/tests/argv0.nix | 92 |
2 files changed, 63 insertions, 43 deletions
diff --git a/nix/buildLisp/default.nix b/nix/buildLisp/default.nix index 9d6ce4edda..0d68a2818b 100644 --- a/nix/buildLisp/default.nix +++ b/nix/buildLisp/default.nix @@ -8,7 +8,7 @@ let inherit (builtins) map elemAt match filter; - inherit (pkgs) lib runCommandNoCC makeWrapper writeText writeShellScriptBin sbcl ecl-static ccl; + inherit (pkgs) lib runCommand makeWrapper writeText writeShellScriptBin sbcl ecl-static ccl; inherit (pkgs.stdenv) targetPlatform; # @@ -154,8 +154,7 @@ let let implementation = old.implementation or defaultImplementation; brokenOn = old.brokenOn or [ ]; - # TODO(sterni): https://github.com/Clozure/ccl/issues/405 - targets = lib.subtractLists (brokenOn ++ [ "ccl" implementation.name ]) + targets = lib.subtractLists (brokenOn ++ [ implementation.name ]) (builtins.attrNames impls); in { @@ -188,7 +187,7 @@ let lispNativeDeps = allNative native lispDeps; filteredSrcs = implFilter implementation srcs; in - runCommandNoCC name + runCommand name { LD_LIBRARY_PATH = lib.makeLibraryPath lispNativeDeps; LANG = "C.UTF-8"; @@ -476,7 +475,7 @@ let } $@ ''; - bundled = name: runCommandNoCC "${name}-cllib" + bundled = name: runCommand "${name}-cllib" { passthru = { lispName = name; @@ -514,7 +513,6 @@ let # See https://ccl.clozure.com/docs/ccl.html#building-definitions faslExt = - /**/ if targetPlatform.isPower && targetPlatform.is32bit then "pfsl" else if targetPlatform.isPower && targetPlatform.is64bit then "p64fsl" else if targetPlatform.isx86_64 && targetPlatform.isLinux then "lx64fsl" @@ -641,7 +639,7 @@ let } else null; in - lib.fix (self: runCommandNoCC "${name}-cllib" + lib.fix (self: runCommand "${name}-cllib" { LD_LIBRARY_PATH = lib.makeLibraryPath lispNativeDeps; LANG = "C.UTF-8"; @@ -708,7 +706,7 @@ let } else null; in - lib.fix (self: runCommandNoCC "${name}" + lib.fix (self: runCommand "${name}" { nativeBuildInputs = [ makeWrapper ]; LD_LIBRARY_PATH = libPath; diff --git a/nix/buildLisp/tests/argv0.nix b/nix/buildLisp/tests/argv0.nix index bc29337d06..ca5f2b9741 100644 --- a/nix/buildLisp/tests/argv0.nix +++ b/nix/buildLisp/tests/argv0.nix @@ -1,36 +1,58 @@ -{ depot, pkgs, ... }: - -depot.nix.buildLisp.program { - name = "argv0-test"; - - srcs = [ - (pkgs.writeText "argv0-test.lisp" '' - (defpackage :argv0-test (:use :common-lisp :uiop) (:export :main)) - (in-package :argv0-test) - - (defun main () - (format t "~A~%" (uiop:argv0))) - '') - ]; - - deps = [ - { - sbcl = depot.nix.buildLisp.bundled "uiop"; - default = depot.nix.buildLisp.bundled "asdf"; - } - ]; - - passthru.meta.ci = { - extraSteps.verify = { - label = "verify argv[0] output"; - needsOutput = true; - command = pkgs.writeShellScript "check-argv0" '' - set -eux - - for invocation in "$(pwd)/result/bin/argv0-test" "./result/bin/argv0-test"; do - test "$invocation" = "$("$invocation")" - done - ''; +{ depot, pkgs, lib, ... }: + +let + # Trivial test program that outputs argv[0] and exits + prog = + depot.nix.buildLisp.program { + name = "argv0-test"; + + srcs = [ + (pkgs.writeText "argv0-test.lisp" '' + (defpackage :argv0-test (:use :common-lisp :uiop) (:export :main)) + (in-package :argv0-test) + + (defun main () + (format t "~A~%" (uiop:argv0))) + '') + ]; + + deps = [ + { + sbcl = depot.nix.buildLisp.bundled "uiop"; + default = depot.nix.buildLisp.bundled "asdf"; + } + ]; }; - }; -} + + # Extract verify argv[0] output for given buildLisp program + checkImplementation = prog: + pkgs.runCommand "check-argv0" { } '' + set -eux + + checkInvocation() { + invocation="$1" + test "$invocation" = "$("$invocation")" + } + + checkInvocation "${prog}/bin/argv0-test" + + cd ${prog} + checkInvocation "./bin/argv0-test" + + cd bin + checkInvocation ./argv0-test + + set +x + + touch "$out" + ''; + + inherit (prog.meta.ci) targets; +in + +(checkImplementation prog).overrideAttrs (_: { + # Wire up a subtarget all (active) non-default implementations + passthru = lib.genAttrs targets (name: checkImplementation prog.${name}); + + meta.ci = { inherit targets; }; +}) |