Merge pull request #121896 from raboof/extract-version-test-to-utility
test-utilities: version test
This commit is contained in:
commit
aaec26af39
@ -2,6 +2,7 @@
|
|||||||
, bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg, djvulibre
|
, bzip2, zlib, libX11, libXext, libXt, fontconfig, freetype, ghostscript, libjpeg, djvulibre
|
||||||
, lcms2, openexr, libpng, librsvg, libtiff, libxml2, openjpeg, libwebp, libheif
|
, lcms2, openexr, libpng, librsvg, libtiff, libxml2, openjpeg, libwebp, libheif
|
||||||
, ApplicationServices
|
, ApplicationServices
|
||||||
|
, testVersion, imagemagick
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -72,6 +73,9 @@ stdenv.mkDerivation rec {
|
|||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests.version =
|
||||||
|
testVersion { package = imagemagick; };
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "http://www.imagemagick.org/";
|
homepage = "http://www.imagemagick.org/";
|
||||||
description = "A software suite to create, edit, compose, or convert bitmap images";
|
description = "A software suite to create, edit, compose, or convert bitmap images";
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
{ lib, stdenv, fetchurl }:
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, fetchurl
|
||||||
|
, testVersion
|
||||||
|
, hello
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "hello";
|
pname = "hello";
|
||||||
@ -11,6 +16,9 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
|
passthru.tests.version =
|
||||||
|
testVersion { package = hello; };
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "A program that produces a familiar, friendly greeting";
|
description = "A program that produces a familiar, friendly greeting";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, buildGoModule
|
, buildGoModule
|
||||||
, runCommand
|
, testVersion
|
||||||
, seaweedfs
|
, seaweedfs
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -20,10 +20,8 @@ buildGoModule rec {
|
|||||||
|
|
||||||
subPackages = [ "weed" ];
|
subPackages = [ "weed" ];
|
||||||
|
|
||||||
passthru.tests.check-version = runCommand "weed-version" { meta.timeout = 3; } ''
|
passthru.tests.version =
|
||||||
${seaweedfs}/bin/weed version | grep -Fw ${version}
|
testVersion { package = seaweedfs; command = "weed version"; };
|
||||||
touch $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Simple and highly scalable distributed file system";
|
description = "Simple and highly scalable distributed file system";
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
, ant
|
, ant
|
||||||
, jre
|
, jre
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, runCommand
|
, testVersion
|
||||||
, key
|
, key
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -51,10 +51,13 @@ in stdenv.mkDerivation rec {
|
|||||||
--add-flags "-cp $out/share/java/KeY.jar de.uka.ilkd.key.core.Main"
|
--add-flags "-cp $out/share/java/KeY.jar de.uka.ilkd.key.core.Main"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.tests.check-version = runCommand "key-help" {} ''
|
passthru.tests.version =
|
||||||
${key}/bin/KeY --help | grep 2.5 # Wrong version in the code. On next version change to ${version}
|
testVersion {
|
||||||
touch $out
|
package = key;
|
||||||
'';
|
command = "KeY --help";
|
||||||
|
# Wrong '2.5' version in the code. On next version change to ${version}
|
||||||
|
version = "2.5";
|
||||||
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Java formal verification tool";
|
description = "Java formal verification tool";
|
||||||
|
@ -541,4 +541,37 @@ rec {
|
|||||||
phases = "unpackPhase patchPhase installPhase";
|
phases = "unpackPhase patchPhase installPhase";
|
||||||
installPhase = "cp -R ./ $out";
|
installPhase = "cp -R ./ $out";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Checks the command output contains the specified version
|
||||||
|
*
|
||||||
|
* Although simplistic, this test assures that the main program
|
||||||
|
* can run. While there's no substitute for a real test case,
|
||||||
|
* it does catch dynamic linking errors and such. It also provides
|
||||||
|
* some protection against accidentally building the wrong version,
|
||||||
|
* for example when using an 'old' hash in a fixed-output derivation.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* passthru.tests.version = testVersion { package = hello; };
|
||||||
|
*
|
||||||
|
* passthru.tests.version = testVersion {
|
||||||
|
* package = seaweedfs;
|
||||||
|
* command = "weed version";
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* passthru.tests.version = testVersion {
|
||||||
|
* package = key;
|
||||||
|
* command = "KeY --help";
|
||||||
|
* # Wrong '2.5' version in the code. Drop on next version.
|
||||||
|
* version = "2.5";
|
||||||
|
* };
|
||||||
|
*/
|
||||||
|
testVersion =
|
||||||
|
{ package,
|
||||||
|
command ? "${package.meta.mainProgram or package.pname or package.name} --version",
|
||||||
|
version ? package.version,
|
||||||
|
}: runCommand "test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } ''
|
||||||
|
${command} | grep -Fw ${version}
|
||||||
|
touch $out
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user