s7: installCheckPhase: use writableTmpDirAsHomeHook, create $HOME/test (#434209)

This commit is contained in:
Yohann Boniface 2025-08-19 15:34:41 +02:00 committed by GitHub
commit c6e7aaf33b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,7 @@
gsl, gsl,
man, man,
pkg-config, pkg-config,
writableTmpDirAsHomeHook,
unstableGitUpdater, unstableGitUpdater,
writeScript, writeScript,
@ -183,6 +184,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeInstallCheckInputs = [ nativeInstallCheckInputs = [
man man
pkg-config pkg-config
writableTmpDirAsHomeHook
]; ];
installCheckInputs = [ installCheckInputs = [
@ -190,19 +192,18 @@ stdenv.mkDerivation (finalAttrs: {
]; ];
/* /*
XXX: The upstream assumes that `$HOME` is `/home/$USER`, and the source files The test suite assumes that "there are two subdirectories of the home directory referred to: cl and test",
lie in `$HOME/cl` . The script presented here uses a fake `$USER` and a where `cl` is "the s7 source directory" and `test` is "a safe place to write temp files".
symbolic linked `$HOME/cl` , which make the test suite work but do not meet
the conditions completely.
*/ */
installCheckPhase = '' installCheckPhase = ''
runHook preInstallCheck runHook preInstallCheck
ln -sr . $HOME/cl
mkdir $HOME/test
$CC s7.c -c -o s7.o $CC s7.c -c -o s7.o
$CC ffitest.c s7.o -o ffitest $CC ffitest.c s7.o -o ffitest
mv ffitest $dst_bin mv ffitest $dst_bin
mkdir -p nix-build/home
ln -sr . nix-build/home/cl
${lib.optionalString withArb '' ${lib.optionalString withArb ''
substituteInPlace s7test.scm \ substituteInPlace s7test.scm \
@ -211,7 +212,7 @@ stdenv.mkDerivation (finalAttrs: {
cp $out/lib/libarb_s7.so . cp $out/lib/libarb_s7.so .
''} ''}
USER=nix-s7-builder PATH="$dst_bin:$PATH" HOME=$PWD/nix-build/home \ PATH="$dst_bin:$PATH" \
s7-repl s7test.scm s7-repl s7test.scm
rm $dst_bin/ffitest rm $dst_bin/ffitest