lol

testers.testVersion: move from trivial-builders.nix

we will have more testers in the future so they should have their own
location

putting 'testers' in args will also make it simpler to use multiple testers

Artturin 250ef1ff daac0432

+40 -40
+1 -2
pkgs/applications/misc/hello/default.nix
··· 2 2 , stdenv 3 3 , fetchurl 4 4 , nixos 5 - , testVersion 6 5 , testers 7 6 , hello 8 7 }: ··· 19 18 doCheck = true; 20 19 21 20 passthru.tests = { 22 - version = testVersion { package = hello; }; 21 + version = testers.testVersion { package = hello; }; 23 22 24 23 invariant-under-noXlibs = 25 24 testers.testEqualDerivation
+38 -1
pkgs/build-support/testers/default.nix
··· 1 - { pkgs, lib, callPackage }: 1 + { pkgs, lib, callPackage, runCommand }: 2 2 { 3 3 testEqualDerivation = callPackage ./test-equal-derivation.nix { }; 4 + 5 + /* Checks the command output contains the specified version 6 + * 7 + * Although simplistic, this test assures that the main program 8 + * can run. While there's no substitute for a real test case, 9 + * it does catch dynamic linking errors and such. It also provides 10 + * some protection against accidentally building the wrong version, 11 + * for example when using an 'old' hash in a fixed-output derivation. 12 + * 13 + * Examples: 14 + * 15 + * passthru.tests.version = testVersion { package = hello; }; 16 + * 17 + * passthru.tests.version = testVersion { 18 + * package = seaweedfs; 19 + * command = "weed version"; 20 + * }; 21 + * 22 + * passthru.tests.version = testVersion { 23 + * package = key; 24 + * command = "KeY --help"; 25 + * # Wrong '2.5' version in the code. Drop on next version. 26 + * version = "2.5"; 27 + * }; 28 + */ 29 + testVersion = 30 + { package, 31 + command ? "${package.meta.mainProgram or package.pname or package.name} --version", 32 + version ? package.version, 33 + }: runCommand "${package.name}-test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } '' 34 + if output=$(${command} 2>&1); then 35 + grep -Fw "${version}" - <<< "$output" 36 + touch $out 37 + else 38 + echo "$output" >&2 && exit 1 39 + fi 40 + ''; 4 41 }
-37
pkgs/build-support/trivial-builders.nix
··· 784 784 outputHash = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5"; 785 785 preferLocalBuild = true; 786 786 } "mkdir $out"; 787 - 788 - /* Checks the command output contains the specified version 789 - * 790 - * Although simplistic, this test assures that the main program 791 - * can run. While there's no substitute for a real test case, 792 - * it does catch dynamic linking errors and such. It also provides 793 - * some protection against accidentally building the wrong version, 794 - * for example when using an 'old' hash in a fixed-output derivation. 795 - * 796 - * Examples: 797 - * 798 - * passthru.tests.version = testVersion { package = hello; }; 799 - * 800 - * passthru.tests.version = testVersion { 801 - * package = seaweedfs; 802 - * command = "weed version"; 803 - * }; 804 - * 805 - * passthru.tests.version = testVersion { 806 - * package = key; 807 - * command = "KeY --help"; 808 - * # Wrong '2.5' version in the code. Drop on next version. 809 - * version = "2.5"; 810 - * }; 811 - */ 812 - testVersion = 813 - { package, 814 - command ? "${package.meta.mainProgram or package.pname or package.name} --version", 815 - version ? package.version, 816 - }: runCommand "${package.name}-test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } '' 817 - if output=$(${command} 2>&1); then 818 - grep -Fw "${version}" - <<< "$output" 819 - touch $out 820 - else 821 - echo "$output" >&2 && exit 1 822 - fi 823 - ''; 824 787 }
+1
pkgs/top-level/aliases.nix
··· 1253 1253 terraform_1_0 = throw "terraform_1_0 has been renamed to terraform_1"; # Added 2021-12-08 1254 1254 terraform_1_0_0 = throw "terraform_1_0_0 has been renamed to terraform_1"; # Added 2021-06-15 1255 1255 tesseract_4 = throw "'tesseract_4' has been renamed to/replaced by 'tesseract4'"; # Converted to throw 2022-02-22 1256 + testVersion = testers.testVersion; # Added 2022-04-20 1256 1257 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 1257 1258 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 1258 1259 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