···11-{ pkgs, lib, callPackage }:
11+{ pkgs, lib, callPackage, runCommand }:
22{
33 testEqualDerivation = callPackage ./test-equal-derivation.nix { };
44+55+ /* Checks the command output contains the specified version
66+ *
77+ * Although simplistic, this test assures that the main program
88+ * can run. While there's no substitute for a real test case,
99+ * it does catch dynamic linking errors and such. It also provides
1010+ * some protection against accidentally building the wrong version,
1111+ * for example when using an 'old' hash in a fixed-output derivation.
1212+ *
1313+ * Examples:
1414+ *
1515+ * passthru.tests.version = testVersion { package = hello; };
1616+ *
1717+ * passthru.tests.version = testVersion {
1818+ * package = seaweedfs;
1919+ * command = "weed version";
2020+ * };
2121+ *
2222+ * passthru.tests.version = testVersion {
2323+ * package = key;
2424+ * command = "KeY --help";
2525+ * # Wrong '2.5' version in the code. Drop on next version.
2626+ * version = "2.5";
2727+ * };
2828+ */
2929+ testVersion =
3030+ { package,
3131+ command ? "${package.meta.mainProgram or package.pname or package.name} --version",
3232+ version ? package.version,
3333+ }: runCommand "${package.name}-test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } ''
3434+ if output=$(${command} 2>&1); then
3535+ grep -Fw "${version}" - <<< "$output"
3636+ touch $out
3737+ else
3838+ echo "$output" >&2 && exit 1
3939+ fi
4040+ '';
441}
-37
pkgs/build-support/trivial-builders.nix
···784784 outputHash = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
785785 preferLocalBuild = true;
786786 } "mkdir $out";
787787-788788- /* Checks the command output contains the specified version
789789- *
790790- * Although simplistic, this test assures that the main program
791791- * can run. While there's no substitute for a real test case,
792792- * it does catch dynamic linking errors and such. It also provides
793793- * some protection against accidentally building the wrong version,
794794- * for example when using an 'old' hash in a fixed-output derivation.
795795- *
796796- * Examples:
797797- *
798798- * passthru.tests.version = testVersion { package = hello; };
799799- *
800800- * passthru.tests.version = testVersion {
801801- * package = seaweedfs;
802802- * command = "weed version";
803803- * };
804804- *
805805- * passthru.tests.version = testVersion {
806806- * package = key;
807807- * command = "KeY --help";
808808- * # Wrong '2.5' version in the code. Drop on next version.
809809- * version = "2.5";
810810- * };
811811- */
812812- testVersion =
813813- { package,
814814- command ? "${package.meta.mainProgram or package.pname or package.name} --version",
815815- version ? package.version,
816816- }: runCommand "${package.name}-test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } ''
817817- if output=$(${command} 2>&1); then
818818- grep -Fw "${version}" - <<< "$output"
819819- touch $out
820820- else
821821- echo "$output" >&2 && exit 1
822822- fi
823823- '';
824787}
+1
pkgs/top-level/aliases.nix
···12531253 terraform_1_0 = throw "terraform_1_0 has been renamed to terraform_1"; # Added 2021-12-08
12541254 terraform_1_0_0 = throw "terraform_1_0_0 has been renamed to terraform_1"; # Added 2021-06-15
12551255 tesseract_4 = throw "'tesseract_4' has been renamed to/replaced by 'tesseract4'"; # Converted to throw 2022-02-22
12561256+ testVersion = testers.testVersion; # Added 2022-04-20
12561257 tex-gyre-bonum-math = throw "'tex-gyre-bonum-math' has been renamed to/replaced by 'tex-gyre-math.bonum'"; # Converted to throw 2022-02-22
12571258 tex-gyre-pagella-math = throw "'tex-gyre-pagella-math' has been renamed to/replaced by 'tex-gyre-math.pagella'"; # Converted to throw 2022-02-22
12581259 tex-gyre-schola-math = throw "'tex-gyre-schola-math' has been renamed to/replaced by 'tex-gyre-math.schola'"; # Converted to throw 2022-02-22