Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions pkgs/development/interpreters/octave/build-octave-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
stdenv,
config,
octave,
callPackage,
texinfo,
computeRequiredOctavePackages,
writeRequiredOctavePackagesHook,
Expand Down Expand Up @@ -64,13 +65,6 @@ let
writeRequiredOctavePackagesHook
] ++ nativeBuildInputs;

passthru' = {
updateScript = [
../../../../maintainers/scripts/update-octave-packages
(builtins.unsafeGetAttrPos "pname" octave.pkgs.${attrs.pname}).file
];
} // passthru;

# This step is required because when
# a = { test = [ "a" "b" ]; }; b = { test = [ "c" "d" ]; };
# (a // b).test = [ "c" "d" ];
Expand All @@ -81,9 +75,9 @@ let
"nativeBuildInputs"
"passthru"
];

in
stdenv.mkDerivation (
finalAttrs:
{
packageName = "${fullLibName}";
# The name of the octave package ends up being
Expand Down Expand Up @@ -136,7 +130,22 @@ stdenv.mkDerivation (
# together with Octave.
dontInstall = true;

passthru = passthru';
passthru =
{
updateScript = [
../../../../maintainers/scripts/update-octave-packages
(builtins.unsafeGetAttrPos "pname" octave.pkgs.${attrs.pname}).file
];
}
// passthru
// {
tests = {
testOctaveBuildEnv = (octave.withPackages (os: [ finalAttrs.finalPackage ])).overrideAttrs (old: {
name = "${finalAttrs.name}-pkg-install";
});
testOctavePkgTests = callPackage ./run-pkg-test.nix { } finalAttrs.finalPackage;
} // passthru.tests or { };
};

inherit meta;
}
Expand Down
25 changes: 25 additions & 0 deletions pkgs/development/interpreters/octave/run-pkg-test.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
octave,
runCommand,
}:
package:

runCommand "${package.name}-pkg-test"
{
nativeBuildInputs = [
(octave.withPackages (os: [ package ]))
];
}
''
{ octave-cli --eval 'pkg test ${package.pname}' || touch FAILED_ERRCODE; } \
|& tee >( grep --quiet '^Failure Summary:$' && touch FAILED_OUTPUT || : ; cat >/dev/null )
if [[ -f FAILED_ERRCODE ]]; then
echo >&2 "octave-cli returned with non-zero exit code."
false
elif [[ -f FAILED_OUTPUT ]]; then
echo >&2 "Test failures detected in output."
false
else
touch $out
fi
''