From 094f6b98c7afca9012a48cac3ceb71419308537b Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Thu, 19 Oct 2023 11:54:08 -0400 Subject: [PATCH 01/14] sbcl: doCheck = true --- pkgs/development/compilers/sbcl/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 2f18dcc78d4c..c74f213943ba 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -161,6 +161,13 @@ stdenv.mkDerivation rec { runHook postBuild ''; + doCheck = true; + + # From the INSTALL docs + checkPhase = '' + (cd tests && sh run-tests.sh) + ''; + installPhase = '' runHook preInstall From d09db9c0967989234a07a4188f43392271b5ed7e Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Mon, 23 Oct 2023 12:30:27 -0400 Subject: [PATCH 02/14] sbcl: fix patching of test files & timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s unclear what problem the test patching was trying to solve, but on current SBCL builds this does more harm than good. Removing those patches leaves the test in its original state, which builds and passes. As for the timestamps: also unclear, removing it doesn’t seem to affect anything either way and this feels very much like a fix for /nix/store read-only access. I’ve test SBCL without these and it works fine, so I don’t think this is relevant anymore? Unfortunately there are no comments so it’s hard to know why these existed. --- pkgs/development/compilers/sbcl/default.nix | 32 ++++++--------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index c74f213943ba..3a1533ddf607 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -85,27 +85,13 @@ stdenv.mkDerivation rec { ./fix-2.4.0-aarch64-darwin.patch ]; - postPatch = '' - echo '"${version}.nixos"' > version.lisp-expr - - # SBCL checks whether files are up-to-date in many places.. - # Unfortunately, same timestamp is not good enough - sed -e 's@> x y@>= x y@' -i contrib/sb-aclrepl/repl.lisp - #sed -e '/(date)/i((= date 2208988801) 2208988800)' -i contrib/asdf/asdf.lisp - sed -i src/cold/slam.lisp -e \ - '/file-write-date input/a)' - sed -i src/cold/slam.lisp -e \ - '/file-write-date output/i(or (and (= 2208988801 (file-write-date output)) (= 2208988801 (file-write-date input)))' - sed -i src/code/target-load.lisp -e \ - '/date defaulted-fasl/a)' - sed -i src/code/target-load.lisp -e \ - '/date defaulted-source/i(or (and (= 2208988801 (file-write-date defaulted-source-truename)) (= 2208988801 (file-write-date defaulted-fasl-truename)))' - - # Fix the tests - sed -e '5,$d' -i contrib/sb-bsd-sockets/tests.lisp - sed -e '5,$d' -i contrib/sb-simple-streams/*test*.lisp - '' - + (if purgeNixReferences + postPatch = (lib.optionalString (builtins.elem stdenv.hostPlatform.system [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + ]) '' + rm -f tests/foreign-stack-alignment.impure.lisp + '') + (if purgeNixReferences then # This is the default location to look for the core; by default in $out/lib/sbcl '' @@ -117,9 +103,7 @@ stdenv.mkDerivation rec { '' sed -e "s@/bin/uname@$(command -v uname)@g" -i src/code/*-os.lisp \ src/code/run-program.lisp - '' - ); - + ''); preBuild = '' export INSTALL_ROOT=$out From b1f97bf100a8b1c0c1938a1b633d08c1c141b0de Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Sat, 20 Jan 2024 12:17:49 -0500 Subject: [PATCH 03/14] sbcl: remove unused import --- pkgs/development/compilers/sbcl/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 3a1533ddf607..5d50f4c97575 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, callPackage, clisp, fetchurl, fetchpatch, writeText, zstd +{ lib, stdenv, callPackage, clisp, fetchurl, writeText, zstd , threadSupport ? (stdenv.hostPlatform.isx86 || "aarch64-linux" == stdenv.hostPlatform.system || "aarch64-darwin" == stdenv.hostPlatform.system) , linkableRuntime ? stdenv.hostPlatform.isx86 , disableImmobileSpace ? false From 949059e7c971468ca44a53f99f3d290ca98bd811 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Sat, 20 Jan 2024 12:18:35 -0500 Subject: [PATCH 04/14] sbcl: allow overriding bootstrapLisp Makes development more pleasant because using your existing SBCL as a boostrap host is considerably faster. --- pkgs/development/compilers/sbcl/default.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 5d50f4c97575..3d13d2e0ed05 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -10,6 +10,12 @@ , markRegionGC ? lib.versionAtLeast version "2.4.0" , texinfo , version + # Set this to a lisp binary to use a custom bootstrap lisp compiler for + # SBCL. Leave as null to use the default. This is useful for local development + # of SBCL, because you can use your existing stock SBCL as a boostrap. On Hydra + # of course we can’t do that because SBCL hasn’t been built yet, so we use + # CLISP, but that’s much slower. +, bootstrapLisp ? null }: let @@ -62,8 +68,10 @@ let sbclBootstrap = callPackage ./bootstrap.nix { cfg = bootstrapBinaries.${stdenv.hostPlatform.system}; }; - bootstrapLisp = - if (builtins.hasAttr stdenv.hostPlatform.system bootstrapBinaries) + bootstrapLisp' = + if bootstrapLisp != null + then bootstrapLisp + else if (builtins.hasAttr stdenv.hostPlatform.system bootstrapBinaries) then "${sbclBootstrap}/bin/sbcl --disable-debugger --no-userinit --no-sysinit" else "${clisp}/bin/clisp -E UTF-8 --silent -norc"; @@ -135,7 +143,7 @@ stdenv.mkDerivation rec { buildPhase = '' runHook preBuild - sh make.sh --prefix=$out --xc-host="${bootstrapLisp}" ${ + sh make.sh --prefix=$out --xc-host="${bootstrapLisp'}" ${ lib.concatStringsSep " " (builtins.map (x: "--with-${x}") enableFeatures ++ builtins.map (x: "--without-${x}") disableFeatures) From bf07f42487d37df20a4d839edabe7aae5820c205 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Sat, 20 Jan 2024 12:40:06 -0500 Subject: [PATCH 05/14] sbcl: allow overriding build flags from Nix E.g.: sbcl.overrideAttrs (old: { enableFeatures = old.enableFeatures ++ [ "foobar" ]; }) --- pkgs/development/compilers/sbcl/default.nix | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 3d13d2e0ed05..3b397a887894 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -77,7 +77,7 @@ let in -stdenv.mkDerivation rec { +stdenv.mkDerivation (self: rec { pname = "sbcl"; inherit version; @@ -130,7 +130,16 @@ stdenv.mkDerivation rec { optional (!threadSupport) "sb-thread" ++ optionals disableImmobileSpace [ "immobile-space" "immobile-code" "compact-instance-header" ]; - env.NIX_CFLAGS_COMPILE = toString (lib.optionals (lib.versionOlder version "2.1.10") [ + buildArgs = [ + "--prefix=$out" + "--xc-host=${lib.escapeShellArg bootstrapLisp'}" + ] ++ builtins.map (x: "--with-${x}") self.enableFeatures + ++ builtins.map (x: "--without-${x}") self.disableFeatures + ++ lib.optionals (stdenv.hostPlatform.system == "aarch64-darwin") [ + "--arch=arm64" + ]; + + env.NIX_CFLAGS_COMPILE = toString (lib.optionals (lib.versionOlder self.version "2.1.10") [ # Workaround build failure on -fno-common toolchains like upstream # clang-13. Without the change build fails as: # duplicate symbol '_static_code_space_free_pointer' in: alloc.o traceroot.o @@ -143,11 +152,7 @@ stdenv.mkDerivation rec { buildPhase = '' runHook preBuild - sh make.sh --prefix=$out --xc-host="${bootstrapLisp'}" ${ - lib.concatStringsSep " " - (builtins.map (x: "--with-${x}") enableFeatures ++ - builtins.map (x: "--without-${x}") disableFeatures) - } ${lib.optionalString (stdenv.hostPlatform.system == "aarch64-darwin") "--arch=arm64"} + sh make.sh ${lib.concatStringsSep " " self.buildArgs} (cd doc/manual ; make info) runHook postBuild @@ -197,4 +202,4 @@ stdenv.mkDerivation rec { "aarch64-linux" ]; }; -} +}) From b9464efdb307f4994578bd11db1181d8768c598e Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Sun, 21 Jan 2024 19:15:15 -0500 Subject: [PATCH 06/14] sbcl: update meta.description field --- pkgs/development/compilers/sbcl/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 3b397a887894..b3a0bff02112 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -190,7 +190,7 @@ stdenv.mkDerivation (self: rec { ''); meta = with lib; { - description = "Lisp compiler"; + description = "Common Lisp compiler"; homepage = "https://sbcl.org"; license = licenses.publicDomain; # and FreeBSD maintainers = lib.teams.lisp.members; From 5e8a9aa362c28d2e30fd952a874d0696460eadc7 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Thu, 1 Feb 2024 12:54:54 -0500 Subject: [PATCH 07/14] sbcl: include test binaries during checks --- pkgs/development/compilers/sbcl/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index b3a0bff02112..7ef7cd3201b1 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, callPackage, clisp, fetchurl, writeText, zstd +{ lib, stdenv, callPackage, clisp, fetchurl, strace, texinfo, which, writeText, zstd , threadSupport ? (stdenv.hostPlatform.isx86 || "aarch64-linux" == stdenv.hostPlatform.system || "aarch64-darwin" == stdenv.hostPlatform.system) , linkableRuntime ? stdenv.hostPlatform.isx86 , disableImmobileSpace ? false @@ -8,7 +8,6 @@ , purgeNixReferences ? false , coreCompression ? lib.versionAtLeast version "2.2.6" , markRegionGC ? lib.versionAtLeast version "2.4.0" -, texinfo , version # Set this to a lisp binary to use a custom bootstrap lisp compiler for # SBCL. Leave as null to use the default. This is useful for local development @@ -86,7 +85,15 @@ stdenv.mkDerivation (self: rec { inherit (versionMap.${version}) sha256; }; - nativeBuildInputs = [ texinfo ]; + nativeBuildInputs = [ + texinfo + ] ++ lib.optionals self.doCheck ( + [ + which + ] ++ lib.optionals (builtins.elem stdenv.system strace.meta.platforms) [ + strace + ] + ); buildInputs = lib.optionals coreCompression [ zstd ]; patches = lib.optionals (version == "2.4.0") [ From 65e6531546311119ceda42a10848b43990f9f39b Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Thu, 1 Feb 2024 03:30:43 -0500 Subject: [PATCH 08/14] sbcl: disable floating point tests --- pkgs/development/compilers/sbcl/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 7ef7cd3201b1..62cb4ebbd587 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -106,6 +106,10 @@ stdenv.mkDerivation (self: rec { "aarch64-linux" ]) '' rm -f tests/foreign-stack-alignment.impure.lisp + # Floating point tests are fragile + # https://sourceforge.net/p/sbcl/mailman/message/58728554/ + rm -f tests/compiler.pure.lisp \ + tests/float.pure.lisp '') + (if purgeNixReferences then # This is the default location to look for the core; by default in $out/lib/sbcl From 5cd820b39a0aa98c1a8aeb86f7df4b53c7ff95e7 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Wed, 24 Jan 2024 15:10:00 -0500 Subject: [PATCH 09/14] sbcl: patch all paths to uname, env and sh --- pkgs/development/compilers/sbcl/default.nix | 36 ++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 62cb4ebbd587..7a5b4170c976 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, callPackage, clisp, fetchurl, strace, texinfo, which, writeText, zstd +{ lib, stdenv, callPackage, clisp, coreutils, fetchurl, strace, texinfo, which, writeText, zstd , threadSupport ? (stdenv.hostPlatform.isx86 || "aarch64-linux" == stdenv.hostPlatform.system || "aarch64-darwin" == stdenv.hostPlatform.system) , linkableRuntime ? stdenv.hostPlatform.isx86 , disableImmobileSpace ? false @@ -100,7 +100,7 @@ stdenv.mkDerivation (self: rec { ./fix-2.4.0-aarch64-darwin.patch ]; - postPatch = (lib.optionalString (builtins.elem stdenv.hostPlatform.system [ + postPatch = lib.optionalString (builtins.elem stdenv.hostPlatform.system [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" @@ -110,19 +110,25 @@ stdenv.mkDerivation (self: rec { # https://sourceforge.net/p/sbcl/mailman/message/58728554/ rm -f tests/compiler.pure.lisp \ tests/float.pure.lisp - '') + (if purgeNixReferences - then - # This is the default location to look for the core; by default in $out/lib/sbcl - '' - sed 's@^\(#define SBCL_HOME\) .*$@\1 "/no-such-path"@' \ - -i src/runtime/runtime.c - '' - else - # Fix software version retrieval - '' - sed -e "s@/bin/uname@$(command -v uname)@g" -i src/code/*-os.lisp \ - src/code/run-program.lisp - ''); + '' + + lib.optionalString purgeNixReferences '' + # This is the default location to look for the core; by default in $out/lib/sbcl + sed 's@^\(#define SBCL_HOME\) .*$@\1 "/no-such-path"@' \ + -i src/runtime/runtime.c + '' + + '' + ( + shopt -s nullglob + # Tests need patching regardless of purging of paths from the final + # binary. There are some tricky files in nested directories which should + # definitely NOT be patched this way, hence just a single * (and no + # globstar). + substituteInPlace ${if purgeNixReferences then "tests" else "{tests,src/code}"}/*.{lisp,sh} \ + --replace-quiet /usr/bin/env "${coreutils}/bin/env" \ + --replace-quiet /bin/uname "${coreutils}/bin/uname" \ + --replace-quiet /bin/sh "${stdenv.shell}" + ) + ''; preBuild = '' export INSTALL_ROOT=$out From fb3be43ae1bf98789524db72cc3e85038b1127d5 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Thu, 1 Feb 2024 17:57:30 -0500 Subject: [PATCH 10/14] sbcl: run postInstall hook after installPhase --- pkgs/development/compilers/sbcl/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 7a5b4170c976..3389ccd600cc 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -187,7 +187,6 @@ stdenv.mkDerivation (self: rec { INSTALL_ROOT=$out sh install.sh - runHook postInstall '' + lib.optionalString (!purgeNixReferences) '' cp -r src $out/lib/sbcl @@ -197,6 +196,8 @@ stdenv.mkDerivation (self: rec { '(("SYS:SRC;**;*.*.*" #P"$out/lib/sbcl/src/**/*.*") ("SYS:CONTRIB;**;*.*.*" #P"$out/lib/sbcl/contrib/**/*.*"))) EOF + '' + '' + runHook postInstall ''; setupHook = lib.optional purgeNixReferences (writeText "setupHook.sh" '' From 1c6e7b5937f6bbbe0615f24870651ec6cda04ce4 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Thu, 1 Feb 2024 19:38:22 -0500 Subject: [PATCH 11/14] sbcl: run pre/postCheck hooks --- pkgs/development/compilers/sbcl/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 3389ccd600cc..5fab77f5fb34 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -179,7 +179,11 @@ stdenv.mkDerivation (self: rec { # From the INSTALL docs checkPhase = '' + runHook preCheck + (cd tests && sh run-tests.sh) + + runHook postCheck ''; installPhase = '' From e8de41602f7c3f90cd1d8d0b6c4650628338d2e0 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Mon, 5 Feb 2024 01:47:30 -0500 Subject: [PATCH 12/14] sbcl: find test binaries in PATH --- pkgs/development/compilers/sbcl/default.nix | 4 +- .../sbcl/search-for-binaries-in-PATH.patch | 108 ++++++++++++++++++ 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/compilers/sbcl/search-for-binaries-in-PATH.patch diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 5fab77f5fb34..50f7900554d0 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -96,7 +96,9 @@ stdenv.mkDerivation (self: rec { ); buildInputs = lib.optionals coreCompression [ zstd ]; - patches = lib.optionals (version == "2.4.0") [ + patches = [ + ./search-for-binaries-in-PATH.patch + ] ++ lib.optionals (version == "2.4.0") [ ./fix-2.4.0-aarch64-darwin.patch ]; diff --git a/pkgs/development/compilers/sbcl/search-for-binaries-in-PATH.patch b/pkgs/development/compilers/sbcl/search-for-binaries-in-PATH.patch new file mode 100644 index 000000000000..95263ec85753 --- /dev/null +++ b/pkgs/development/compilers/sbcl/search-for-binaries-in-PATH.patch @@ -0,0 +1,108 @@ +From 35856b09e3606361b17f21225c759632be1cdf34 Mon Sep 17 00:00:00 2001 +From: Hraban Luyat +Date: Wed, 24 Jan 2024 14:58:53 -0500 +Subject: [PATCH] Search for binaries in tests in PATH, not /usr/bin +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Same as 8ed662fbfeb5dde35eb265f390b55b01f79f70c1 but for tests, and for more +than just ‘cat’. For the same reasons as that diff. +--- + tests/run-program.impure.lisp | 18 ++++++++++-------- + tests/run-program.test.sh | 9 ++++----- + 2 files changed, 14 insertions(+), 13 deletions(-) + +diff --git a/tests/run-program.impure.lisp b/tests/run-program.impure.lisp +index 0eab8884c..b07d1e4fb 100644 +--- a/tests/run-program.impure.lisp ++++ b/tests/run-program.impure.lisp +@@ -15,7 +15,7 @@ + + (defun bin-pwd-ignoring-result () + (let ((initially-open-fds (directory "/proc/self/fd/*" :resolve-symlinks nil))) +- (sb-ext:run-program "/usr/bin/pwd" nil :input :stream :output :stream :wait nil) ++ (sb-ext:run-program "pwd" nil :search t :input :stream :output :stream :wait nil) + (length initially-open-fds))) + + (with-test (:name (run-program :autoclose-streams) +@@ -49,7 +49,7 @@ + (with-test (:name (run-program :cat 2) + :skipped-on (or (not :sb-thread) :win32)) + ;; Tests that reading from a FIFO is interruptible. +- (let* ((process (run-program "/bin/cat" '() ++ (let* ((process (run-program "cat" '() :search t + :wait nil :output :stream :input :stream)) + (in (process-input process)) + (out (process-output process)) +@@ -167,7 +167,7 @@ + (defparameter *cat-out* (make-synonym-stream '*cat-out-pipe*))) + + (with-test (:name (run-program :cat 5) :fails-on :win32) +- (let ((cat (run-program "/bin/cat" nil :input *cat-in* :output *cat-out* ++ (let ((cat (run-program "cat" nil :search t :input *cat-in* :output *cat-out* + :wait nil))) + (dolist (test '("This is a test!" + "This is another test!" +@@ -310,14 +310,16 @@ + (let ((had-error-p nil)) + (flet ((barf (&optional (format :default)) + (with-output-to-string (stream) +- (run-program #-netbsd "/usr/bin/perl" #+netbsd "/usr/pkg/bin/perl" ++ (run-program #-netbsd "perl" #+netbsd "/usr/pkg/bin/perl" + '("-e" "print \"\\x20\\xfe\\xff\\x0a\"") ++ :search #-netbsd t #+netbsd nil + :output stream + :external-format format))) + (no-barf () + (with-output-to-string (stream) +- (run-program "/bin/echo" ++ (run-program "echo" + '("This is a test") ++ :search t + :output stream)))) + (handler-case + (barf :utf-8) +@@ -353,9 +355,9 @@ + ;; If the permitted inputs are :ANY then leave it be + (listp (symbol-value 'run-tests::*allowed-inputs*))) + (push (namestring file) (symbol-value 'run-tests::*allowed-inputs*))) +- (assert (null (run-program "/bin/cat" '() :input file))) +- (assert (null (run-program "/bin/cat" '() :output #.(or *compile-file-truename* +- *load-truename*) ++ (assert (null (run-program "cat" '() :search t :input file))) ++ (assert (null (run-program "cat" '() :search t :output #.(or *compile-file-truename* ++ *load-truename*) + :if-output-exists nil))))) + + +diff --git a/tests/run-program.test.sh b/tests/run-program.test.sh +index 48eaef889..c926e5a05 100755 +--- a/tests/run-program.test.sh ++++ b/tests/run-program.test.sh +@@ -39,9 +39,8 @@ run_sbcl --eval "(defvar *exit-ok* $EXIT_LISP_WIN)" <<'EOF' + (assert (not (zerop (sb-ext:process-exit-code + (sb-ext:run-program "false" () :search t :wait t))))) + (let ((string (with-output-to-string (stream) +- (our-run-program "/bin/echo" +- '("foo" "bar") +- :output stream)))) ++ (run-program "echo" '("foo" "bar") ++ :search t :output stream)))) + (assert (string= string "foo bar + "))) + (format t ";;; Smoke tests: PASS~%") +@@ -103,8 +102,8 @@ run_sbcl --eval "(defvar *exit-ok* $EXIT_LISP_WIN)" <<'EOF' + ;; make sure that a stream input argument is basically reasonable. + (let ((string (let ((i (make-string-input-stream "abcdef"))) + (with-output-to-string (stream) +- (our-run-program "/bin/cat" () +- :input i :output stream))))) ++ (run-program "cat" () ++ :search t :input i :output stream))))) + (assert (= (length string) 6)) + (assert (string= string "abcdef"))) + +-- +2.43.0 + From f8719ace2a6f1e53ab850cd16d107246ab3e6d1d Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Thu, 22 Feb 2024 23:13:21 -0500 Subject: [PATCH 13/14] sbcl: disable traceroot (GC) test on aarch64-linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This isn’t about perfect test coverage, but about codifying what works today. --- pkgs/development/compilers/sbcl/default.nix | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 50f7900554d0..351f4dd861ac 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -102,16 +102,27 @@ stdenv.mkDerivation (self: rec { ./fix-2.4.0-aarch64-darwin.patch ]; - postPatch = lib.optionalString (builtins.elem stdenv.hostPlatform.system [ + # I don’t know why these are failing (on ofBorg), and I’d rather just disable + # them and move forward with the succeeding tests than block testing + # altogether. One by one hopefully we can fix these (on ofBorg, + # upstream--somehow some way) in due time. + disabledTestFiles = lib.optionals (builtins.elem stdenv.hostPlatform.system [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" - ]) '' - rm -f tests/foreign-stack-alignment.impure.lisp + ]) [ + "foreign-stack-alignment.impure.lisp" # Floating point tests are fragile # https://sourceforge.net/p/sbcl/mailman/message/58728554/ - rm -f tests/compiler.pure.lisp \ - tests/float.pure.lisp + "compiler.pure.lisp" + "float.pure.lisp" + ] ++ lib.optionals (stdenv.hostPlatform.system == "aarch64-linux") [ + # This is failing on aarch64-linux on ofBorg. Not on my local machine nor on + # a VM on my laptop. Not sure what’s wrong. + "traceroot.impure.lisp" + ]; + postPatch = lib.optionalString (self.disabledTestFiles != [ ]) '' + (cd tests ; rm -f ${lib.concatStringsSep " " self.disabledTestFiles}) '' + lib.optionalString purgeNixReferences '' # This is the default location to look for the core; by default in $out/lib/sbcl From 3029b8dc4dcd5cc0bcc8855c242795ab29f8d1cb Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Fri, 23 Feb 2024 09:48:19 -0500 Subject: [PATCH 14/14] sbcl: disable all checks on x86_64-darwin --- pkgs/development/compilers/sbcl/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 351f4dd861ac..fbd0970848d1 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -108,7 +108,6 @@ stdenv.mkDerivation (self: rec { # upstream--somehow some way) in due time. disabledTestFiles = lib.optionals (builtins.elem stdenv.hostPlatform.system [ "x86_64-linux" - "x86_64-darwin" "aarch64-linux" ]) [ "foreign-stack-alignment.impure.lisp" @@ -188,7 +187,11 @@ stdenv.mkDerivation (self: rec { runHook postBuild ''; - doCheck = true; + # Tests on ofBorg’s x86_64-darwin platforms are so unstable that a random one + # will fail every other run. There’s a deeper problem here; we might as well + # disable them entirely so at least the other platforms get to benefit from + # testing. + doCheck = stdenv.hostPlatform.system != "x86_64-darwin"; # From the INSTALL docs checkPhase = ''