push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
{
lib,
stdenv,
fetchurl,
makeWrapper,
cfg,
}:
stdenv.mkDerivation rec {
pname = "sbcl-bootstrap";
inherit (cfg) version;
src = fetchurl {
url = "mirror://sourceforge/project/sbcl/sbcl/${version}/sbcl-${version}-${cfg.system}-binary.tar.bz2";
inherit (cfg) sha256;
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/bin
cp -p src/runtime/sbcl $out/bin
mkdir -p $out/share/sbcl
cp -p src/runtime/sbcl $out/share/sbcl
cp -p output/sbcl.core $out/share/sbcl
mkdir -p $out/bin
makeWrapper $out/share/sbcl/sbcl $out/bin/sbcl \
--add-flags "--core $out/share/sbcl/sbcl.core"
'';
postFixup = lib.optionalString (!stdenv.hostPlatform.isAarch32 && stdenv.hostPlatform.isLinux) ''
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $out/share/sbcl/sbcl
'';
meta.sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
}

View File

@@ -0,0 +1,298 @@
{
lib,
stdenv,
callPackage,
ecl,
coreutils,
fetchurl,
ps,
strace,
texinfo,
which,
writableTmpDirAsHomeHook,
writeText,
zstd,
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 bootstrap. On Hydra
# of course we cant do that because SBCL hasnt been built yet, so we use
# ECL but thats much slower.
bootstrapLisp ? null,
}:
let
versionMap = {
# Necessary for Nyxt
"2.4.6".sha256 = "sha256-pImQeELa4JoXJtYphb96VmcKrqLz7KH7cCO8pnw/MJE=";
# Necessary for stumpwm
"2.4.10".sha256 = "sha256-zus5a2nSkT7uBIQcKva+ylw0LOFGTD/j5FPy3hDF4vg=";
# By unofficial and very loose convention we keep the latest version of
# SBCL, and the previous one in case someone quickly needs to roll back.
"2.5.5".sha256 = "sha256-ZQJnCvs2G6m+RKL6/pr5tZ57JK5QmnkaZrVIHylVlQs=";
"2.5.7".sha256 = "sha256-xPr+t5VpnVvP+QhQkazHYtz15V+FI1Yl89eu8SyJ0dM=";
};
# Collection of pre-built SBCL binaries for platforms that need them for
# bootstrapping. Ideally these are to be avoided. If ECL (or any other
# non-binary-distributed Lisp) can run on any of these systems, that entry
# should be removed from this list.
bootstrapBinaries = rec {
i686-linux = {
version = "1.2.7";
system = "x86-linux";
sha256 = "07f3bz4br280qvn85i088vpzj9wcz8wmwrf665ypqx181pz2ai3j";
};
armv7l-linux = {
version = "1.2.14";
system = "armhf-linux";
sha256 = "0sp5445rbvms6qvzhld0kwwvydw51vq5iaf4kdqsf2d9jvaz3yx5";
};
armv6l-linux = armv7l-linux;
x86_64-freebsd = {
version = "1.2.7";
system = "x86-64-freebsd";
sha256 = "14k42xiqd2rrim4pd5k5pjcrpkac09qnpynha8j1v4jngrvmw7y6";
};
x86_64-solaris = {
version = "1.2.7";
system = "x86-64-solaris";
sha256 = "05c12fmac4ha72k1ckl6i780rckd7jh4g5s5hiic7fjxnf1kx8d0";
};
};
sbclBootstrap = callPackage ./bootstrap.nix {
cfg = bootstrapBinaries.${stdenv.hostPlatform.system};
};
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
"${lib.getExe ecl} --norc";
in
stdenv.mkDerivation (self: {
pname = "sbcl";
inherit version;
src = fetchurl {
# Changing the version shouldnt change the source for the
# derivation. Override the src entirely if desired.
url = "mirror://sourceforge/project/sbcl/sbcl/${version}/sbcl-${version}-source.tar.bz2";
inherit (versionMap.${version}) sha256;
};
nativeBuildInputs = [
texinfo
]
++ lib.optionals self.doCheck (
[
which
writableTmpDirAsHomeHook
]
++ lib.optionals (builtins.elem stdenv.system strace.meta.platforms) [
strace
]
++ lib.optionals (lib.versionOlder "2.4.10" self.version) [
ps
]
);
buildInputs = lib.optionals self.coreCompression (
# Declare at the point of actual use in case the caller wants to override
# buildInputs to sidestep this.
assert lib.assertMsg (!self.purgeNixReferences) ''
Cannot enable coreCompression when purging Nix references, because compression requires linking in zstd
'';
[ zstd ]
);
threadSupport = (
stdenv.hostPlatform.isx86
|| "aarch64-linux" == stdenv.hostPlatform.system
|| "aarch64-darwin" == stdenv.hostPlatform.system
);
# Meant for sbcl used for creating binaries portable to non-NixOS via save-lisp-and-die.
# Note that the created binaries still need `patchelf --set-interpreter ...`
# to get rid of ${glibc} dependency.
purgeNixReferences = false;
coreCompression = true;
markRegionGC = self.threadSupport;
disableImmobileSpace = false;
linkableRuntime = stdenv.hostPlatform.isx86;
# I dont know why these are failing (on ofBorg), and Id 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 (lib.versionOlder "2.5.2" self.version) [ "debug.impure.lisp" ]
++
lib.optionals
(builtins.elem stdenv.hostPlatform.system [
"x86_64-linux"
"aarch64-linux"
])
[
"foreign-stack-alignment.impure.lisp"
# Floating point tests are fragile
# https://sourceforge.net/p/sbcl/mailman/message/58728554/
"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 whats wrong.
"traceroot.impure.lisp"
# Heisentest, sometimes fails on ofBorg, would rather just disable it than
# have it block a release.
"futex-wait.test.sh"
];
patches =
# Support the NIX_SBCL_DYNAMIC_SPACE_SIZE envvar. Upstream SBCL didnt want
# to include this (see
# "https://sourceforge.net/p/sbcl/mailman/sbcl-devel/thread/2cf20df7-01d0-44f2-8551-0df01fe55f1a%400brg.net/"),
# but for Nix envvars are sufficiently useful that its worth maintaining
# this functionality downstream.
if lib.versionOlder "2.5.2" self.version then
[
./dynamic-space-size-envvar-2.5.3-feature.patch
./dynamic-space-size-envvar-2.5.3-tests.patch
]
else
[
./dynamic-space-size-envvar-2.5.2-feature.patch
./dynamic-space-size-envvar-2.5.2-tests.patch
];
sbclPatchPhase =
lib.optionalString (self.disabledTestFiles != [ ]) ''
(cd tests ; rm -f ${lib.concatStringsSep " " self.disabledTestFiles})
''
+ lib.optionalString self.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 self.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}"
)
# Official source release tarballs will have a version.lispexpr, but if you
# want to override { src = ... } it might not exist. Its required for
# building, so create a mock version as a backup.
if [[ ! -a version.lisp-expr ]]; then
echo '"${self.version}.nixos"' > version.lisp-expr
fi
'';
preConfigurePhases = "sbclPatchPhase";
enableFeatures =
assert lib.assertMsg (
self.markRegionGC -> self.threadSupport
) "SBCL mark region GC requires thread support";
lib.optional self.threadSupport "sb-thread"
++ lib.optional self.linkableRuntime "sb-linkable-runtime"
++ lib.optional self.coreCompression "sb-core-compression"
++ lib.optional stdenv.hostPlatform.isAarch32 "arm"
++ lib.optional self.markRegionGC "mark-region-gc";
disableFeatures =
lib.optional (!self.threadSupport) "sb-thread"
++ lib.optionals self.disableImmobileSpace [
"immobile-space"
"immobile-code"
"compact-instance-header"
];
buildArgs = [
"--prefix=$out"
"--xc-host=${lib.escapeShellArg bootstrapLisp'}"
]
++ map (x: "--with-${x}") self.enableFeatures
++ map (x: "--without-${x}") self.disableFeatures
++ lib.optionals (stdenv.hostPlatform.system == "aarch64-darwin") [
"--arch=arm64"
];
# Fails to find `O_LARGEFILE` otherwise.
env.NIX_CFLAGS_COMPILE = "-D_GNU_SOURCE";
buildPhase = ''
runHook preBuild
export INSTALL_ROOT=$out
sh make.sh ${lib.concatStringsSep " " self.buildArgs}
(cd doc/manual ; make info)
runHook postBuild
'';
# Tests on ofBorgs x86_64-darwin platforms are so unstable that a random one
# will fail every other run. Theres 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 = ''
runHook preCheck
(cd tests && sh run-tests.sh)
runHook postCheck
'';
installPhase = ''
runHook preInstall
sh install.sh
''
+ lib.optionalString (!self.purgeNixReferences) ''
cp -r src $out/lib/sbcl
cp -r contrib $out/lib/sbcl
cat >$out/lib/sbcl/sbclrc <<EOF
(setf (logical-pathname-translations "SYS")
'(("SYS:SRC;**;*.*.*" #P"$out/lib/sbcl/src/**/*.*")
("SYS:CONTRIB;**;*.*.*" #P"$out/lib/sbcl/contrib/**/*.*")))
EOF
''
+ ''
runHook postInstall
'';
setupHook = lib.optional self.purgeNixReferences (
writeText "setupHook.sh" ''
addEnvHooks "$targetOffset" _setSbclHome
_setSbclHome() {
export SBCL_HOME='@out@/lib/sbcl/'
}
''
);
meta = with lib; {
description = "Common Lisp compiler";
homepage = "https://sbcl.org";
license = licenses.publicDomain; # and FreeBSD
mainProgram = "sbcl";
teams = [ lib.teams.lisp ];
platforms = attrNames bootstrapBinaries ++ [
# These arent bootstrapped using the binary distribution but compiled
# using a separate (lisp) host
"x86_64-darwin"
"x86_64-linux"
"aarch64-darwin"
"aarch64-linux"
];
};
})

View File

@@ -0,0 +1,63 @@
From ac15f9f7c75c1fb5767514e64b609e2a75e6fe9d Mon Sep 17 00:00:00 2001
From: Hraban Luyat <hraban@0brg.net>
Date: Sat, 13 Apr 2024 14:04:57 -0400
Subject: [PATCH] feat: NIX_SBCL_DYNAMIC_SPACE_SIZE envvar
Read SBCL dynamic space size configuration from env if available.
---
src/runtime/runtime.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c
index 274687c8f..970caa8f4 100644
--- a/src/runtime/runtime.c
+++ b/src/runtime/runtime.c
@@ -422,6 +422,29 @@ static int is_memsize_arg(char *argv[], int argi, int argc, int *merge_core_page
return 0;
}
+/**
+ * Read memory options from the environment, if present.
+ *
+ * Memory settings are read in the following priority:
+ *
+ * 1. command line arguments
+ * 2. environment variable
+ * 3. embedded options in core
+ * 4. default
+ */
+static void
+read_memsize_from_env(void) {
+ const char *val = getenv("NIX_SBCL_DYNAMIC_SPACE_SIZE");
+ // The distinction is blurry between setting an envvar to the empty string and
+ // unsetting it entirely. Depending on the calling environment it can even be
+ // tricky to properly unset an envvar in the first place. An empty envvar is
+ // practically always intended to just mean “unset”, so lets interpret it
+ // that way.
+ if (val != NULL && (strcmp(val, "") != 0)) {
+ dynamic_space_size = parse_size_arg(val, "NIX_SBCL_DYNAMIC_SPACE_SIZE");
+ }
+}
+
static struct cmdline_options
parse_argv(struct memsize_options memsize_options,
int argc, char *argv[], char *envp[], char *core)
@@ -462,6 +485,7 @@ parse_argv(struct memsize_options memsize_options,
dynamic_space_size = memsize_options.dynamic_space_size;
thread_control_stack_size = memsize_options.thread_control_stack_size;
dynamic_values_bytes = memsize_options.thread_tls_bytes;
+ read_memsize_from_env();
int stop_parsing = 0; // have we seen '--'
int output_index = 1;
@@ -488,6 +512,7 @@ parse_argv(struct memsize_options memsize_options,
}
sbcl_argv[output_index] = 0;
} else {
+ read_memsize_from_env();
bool end_runtime_options = 0;
/* Parse our any of the command-line options that we handle from C,
* stopping at the first one that we don't, and leave the rest */
--
2.44.0

View File

@@ -0,0 +1,104 @@
From 9d4a886a8a76ea8be51bcf754cefacdf30986f46 Mon Sep 17 00:00:00 2001
From: Hraban Luyat <hraban@0brg.net>
Date: Sat, 13 Apr 2024 15:39:58 -0400
Subject: [PATCH 2/2] test: dynamic space size envvar and precedence
---
tests/memory-args.test.sh | 22 ++++++++++++++++++++++
tests/save7.test.sh | 37 ++++++++++++++++++++++++++++++++-----
2 files changed, 54 insertions(+), 5 deletions(-)
create mode 100755 tests/memory-args.test.sh
diff --git a/tests/memory-args.test.sh b/tests/memory-args.test.sh
new file mode 100755
index 000000000..72ef0cc79
--- /dev/null
+++ b/tests/memory-args.test.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ./subr.sh
+
+use_test_subdirectory
+
+set -e
+
+# Allow slight shrinkage if heap relocation has to adjust for alignment
+NIX_SBCL_DYNAMIC_SPACE_SIZE=234mb run_sbcl_with_args --script <<EOF
+(assert (<= 0 (- (* 234 1024 1024) (sb-ext:dynamic-space-size)) 65536))
+EOF
+
+NIX_SBCL_DYNAMIC_SPACE_SIZE=555mb run_sbcl_with_args --dynamic-space-size 234mb --script <<EOF
+(assert (<= 0 (- (* 234 1024 1024) (sb-ext:dynamic-space-size)) 65536))
+EOF
+
+run_sbcl_with_args --dynamic-space-size 234mb --script <<EOF
+(assert (<= 0 (- (* 234 1024 1024) (sb-ext:dynamic-space-size)) 65536))
+EOF
+
+exit $EXIT_TEST_WIN
diff --git a/tests/save7.test.sh b/tests/save7.test.sh
index f9225543b..3c35e7b31 100644
--- a/tests/save7.test.sh
+++ b/tests/save7.test.sh
@@ -59,9 +59,9 @@ run_sbcl_with_core "$tmpcore" --noinform --control-stack-size 640KB \
(assert (eql (extern-alien "dynamic_values_bytes" (unsigned 32))
(* 5000 sb-vm:n-word-bytes)))
; allow slight shrinkage if heap relocation has to adjust for alignment
- (defun dynamic-space-size-good-p ()
- (<= 0 (- (* 260 1048576) (dynamic-space-size)) 65536))
- (assert (dynamic-space-size-good-p))
+ (defun dynamic-space-size-good-p (expected-mb)
+ (<= 0 (- (* expected-mb 1024 1024) (dynamic-space-size)) 65536))
+ (assert (dynamic-space-size-good-p 260))
(save-lisp-and-die "${tmpcore}2" :executable t :save-runtime-options t)
EOF
chmod u+x "${tmpcore}2"
@@ -70,15 +70,42 @@ echo "::: INFO: prepared test core"
(when (and (eql (extern-alien "thread_control_stack_size" unsigned) (* 640 1024))
(eql (extern-alien "dynamic_values_bytes" (unsigned 32))
(* 5000 sb-vm:n-word-bytes))
- (dynamic-space-size-good-p))
+ (dynamic-space-size-good-p 260))
(exit :code 42))
EOF
status=$?
-rm "$tmpcore" "${tmpcore}2"
if [ $status -ne 42 ]; then
echo "re-saved executable used wrong memory size options"
exit 1
fi
echo "::: Success"
+echo "::: Running :DYNAMIC-SPACE-SIZE-ENV"
+NIX_SBCL_DYNAMIC_SPACE_SIZE=432MB ./"${tmpcore}2" --no-userinit --no-sysinit --noprint <<EOF
+ (when (dynamic-space-size-good-p 432)
+ (exit :code 42))
+EOF
+status=$?
+if [ $status -ne 42 ]; then
+ echo "re-saved executable should have prioritized memory specification from env"
+ exit 1
+fi
+echo "::: Success"
+
+echo "::: Running :DYNAMIC-SPACE-SIZE-PRECEDENCE"
+NIX_SBCL_DYNAMIC_SPACE_SIZE=432MB ./"${tmpcore}2" --dynamic-space-size 333MB \
+ --no-userinit --no-sysinit --noprint <<EOF
+ (when (dynamic-space-size-good-p 333))
+ (exit :code 42))
+EOF
+status=$?
+rm "$tmpcore" "${tmpcore}2"
+if [ $status -ne 42 ]; then
+ echo "re-saved executable should have prioritized memory specification from arg"
+ exit 1
+fi
+echo "::: Success"
+
+
+
exit $EXIT_TEST_WIN
--
2.44.0

View File

@@ -0,0 +1,64 @@
From 9c899f7b8089eee7ce471f237d2046882298c4fc Mon Sep 17 00:00:00 2001
From: Hraban Luyat <hraban@0brg.net>
Date: Sat, 13 Apr 2024 14:04:57 -0400
Subject: [PATCH 1/2] feat: NIX_SBCL_DYNAMIC_SPACE_SIZE envvar
---
src/runtime/runtime.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c
index 2b1f8b634..4f3f51139 100644
--- a/src/runtime/runtime.c
+++ b/src/runtime/runtime.c
@@ -416,6 +416,29 @@ static int is_memsize_arg(char *argv[], int argi, int argc, int *merge_core_page
return 0;
}
+/**
+ * Read memory options from the environment, if present.
+ *
+ * Memory settings are read in the following priority:
+ *
+ * 1. command line arguments
+ * 2. environment variable
+ * 3. embedded options in core
+ * 4. default
+ */
+static void
+read_memsize_from_env(void) {
+ const char *val = getenv("NIX_SBCL_DYNAMIC_SPACE_SIZE");
+ // The distinction is blurry between setting an envvar to the empty string and
+ // unsetting it entirely. Depending on the calling environment it can even be
+ // tricky to properly unset an envvar in the first place. An empty envvar is
+ // practically always intended to just mean “unset”, so lets interpret it
+ // that way.
+ if (val != NULL && (strcmp(val, "") != 0)) {
+ dynamic_space_size = parse_size_arg(val, "NIX_SBCL_DYNAMIC_SPACE_SIZE");
+ }
+}
+
static struct cmdline_options
parse_argv(struct memsize_options memsize_options,
int argc, char *argv[], char *envp[], char *core)
@@ -457,6 +480,9 @@ parse_argv(struct memsize_options memsize_options,
thread_control_stack_size = memsize_options.thread_control_stack_size;
dynamic_values_bytes = memsize_options.thread_tls_bytes;
if (memsize_options.present_in_core == 2) {
+ /* Only accept environment variable memory options where you would
+ * accept those options as command-line arguments. */
+ read_memsize_from_env();
int stop_parsing = 0; // have we seen '--'
int output_index = 1;
#ifndef LISP_FEATURE_WIN32
@@ -490,6 +516,7 @@ parse_argv(struct memsize_options memsize_options,
#endif
}
} else {
+ read_memsize_from_env();
bool end_runtime_options = 0;
/* Parse our any of the command-line options that we handle from C,
* stopping at the first one that we don't, and leave the rest */
--
2.48.1

View File

@@ -0,0 +1,130 @@
From 979a92d10731bae90e611b98d29be8d187f0f1f8 Mon Sep 17 00:00:00 2001
From: Hraban Luyat <hraban@0brg.net>
Date: Sat, 13 Apr 2024 15:39:58 -0400
Subject: [PATCH 2/2] test: dynamic space size envvar and precedence
---
tests/memory-args.test.sh | 22 ++++++++++++++++++
tests/save7.test.sh | 49 ++++++++++++++++++++++++++++++++++-----
2 files changed, 65 insertions(+), 6 deletions(-)
create mode 100755 tests/memory-args.test.sh
diff --git a/tests/memory-args.test.sh b/tests/memory-args.test.sh
new file mode 100755
index 000000000..72ef0cc79
--- /dev/null
+++ b/tests/memory-args.test.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ./subr.sh
+
+use_test_subdirectory
+
+set -e
+
+# Allow slight shrinkage if heap relocation has to adjust for alignment
+NIX_SBCL_DYNAMIC_SPACE_SIZE=234mb run_sbcl_with_args --script <<EOF
+(assert (<= 0 (- (* 234 1024 1024) (sb-ext:dynamic-space-size)) 65536))
+EOF
+
+NIX_SBCL_DYNAMIC_SPACE_SIZE=555mb run_sbcl_with_args --dynamic-space-size 234mb --script <<EOF
+(assert (<= 0 (- (* 234 1024 1024) (sb-ext:dynamic-space-size)) 65536))
+EOF
+
+run_sbcl_with_args --dynamic-space-size 234mb --script <<EOF
+(assert (<= 0 (- (* 234 1024 1024) (sb-ext:dynamic-space-size)) 65536))
+EOF
+
+exit $EXIT_TEST_WIN
diff --git a/tests/save7.test.sh b/tests/save7.test.sh
index dd112f220..d56bddbc2 100644
--- a/tests/save7.test.sh
+++ b/tests/save7.test.sh
@@ -25,6 +25,9 @@ echo "::: Success"
run_sbcl_with_args --noinform --control-stack-size 384KB --dynamic-space-size 260MB \
--disable-debugger --no-userinit --no-sysinit --noprint <<EOF
+ ; allow slight shrinkage if heap relocation has to adjust for alignment
+ (defun dynamic-space-size-good-p (expected-mb)
+ (<= 0 (- (* expected-mb 1024 1024) (dynamic-space-size)) 65536))
(save-lisp-and-die "$tmpcore" :executable t :save-runtime-options :accept-runtime-options)
EOF
chmod u+x "$tmpcore"
@@ -57,6 +60,29 @@ if [ $? -ne 0 ]; then
fi
echo "::: Success"
+echo "::: Running :DYNAMIC-SPACE-SIZE-ENV-ACCEPT"
+NIX_SBCL_DYNAMIC_SPACE_SIZE=432MB ./"$tmpcore" --no-userinit --no-sysinit --noprint <<EOF
+ (when (dynamic-space-size-good-p 432)
+ (exit :code 42))
+EOF
+if [ $? -ne 42 ]; then
+ exit 1
+fi
+echo "::: Success"
+
+echo "::: Running :DYNAMIC-SPACE-SIZE-PRECEDENCE"
+NIX_SBCL_DYNAMIC_SPACE_SIZE=432MB ./"$tmpcore" --dynamic-space-size 333MB \
+ --no-userinit --no-sysinit --noprint <<EOF
+ (when (dynamic-space-size-good-p 333))
+ (exit :code 42))
+EOF
+status=$?
+if [ $status -ne 42 ]; then
+ echo "saved core should have prioritized memory specification from arg"
+ exit 1
+fi
+echo "::: Success"
+
echo "::: Running :DYNAMIC-SPACE-SIZE-ARG"
run_sbcl_with_core "$tmpcore" --noinform --control-stack-size 640KB \
--tls-limit 5000 \
@@ -64,10 +90,7 @@ run_sbcl_with_core "$tmpcore" --noinform --control-stack-size 640KB \
(assert (eql (extern-alien "thread_control_stack_size" unsigned) (* 640 1024)))
(assert (eql (extern-alien "dynamic_values_bytes" (unsigned 32))
(* 5000 sb-vm:n-word-bytes)))
- ; allow slight shrinkage if heap relocation has to adjust for alignment
- (defun dynamic-space-size-good-p ()
- (<= 0 (- (* 260 1048576) (dynamic-space-size)) 65536))
- (assert (dynamic-space-size-good-p))
+ (assert (dynamic-space-size-good-p 260))
(save-lisp-and-die "${tmpcore}2" :executable t :save-runtime-options t)
EOF
chmod u+x "${tmpcore}2"
@@ -76,15 +99,29 @@ echo "::: INFO: prepared test core"
(when (and (eql (extern-alien "thread_control_stack_size" unsigned) (* 640 1024))
(eql (extern-alien "dynamic_values_bytes" (unsigned 32))
(* 5000 sb-vm:n-word-bytes))
- (dynamic-space-size-good-p))
+ (dynamic-space-size-good-p 260))
(exit :code 42))
EOF
status=$?
-rm "$tmpcore" "${tmpcore}2"
if [ $status -ne 42 ]; then
echo "re-saved executable used wrong memory size options"
exit 1
fi
echo "::: Success"
+echo "::: Running :DYNAMIC-SPACE-SIZE-ENV-IGNORE"
+NIX_SBCL_DYNAMIC_SPACE_SIZE=432MB ./"${tmpcore}2" --no-userinit --no-sysinit --noprint <<EOF
+ (when (dynamic-space-size-good-p 260)
+ (exit :code 42))
+EOF
+status=$?
+if [ $status -ne 42 ]; then
+ echo "re-saved executable should have ignored memory specification from env"
+ exit 1
+fi
+echo "::: Success"
+rm "$tmpcore" "${tmpcore}2"
+
+
+
exit $EXIT_TEST_WIN
--
2.48.1