testers: convert to a format that is kind of compatible with nixdoc

Examples: support has to be added to https://github.com/nix-community/nixdoc

'nixdoc --category testers --description "nixpkgs testers" --file ./pkgs/build-support/testers/default.nix'

Artturin 3cc2e86b f1c7f19e

+39 -40
+39 -23
pkgs/build-support/testers/default.nix
··· 1 1 { pkgs, lib, callPackage, runCommand }: 2 2 { 3 + 4 + /* Checks that two packages produce the exact same build instructions. 5 + 6 + This can be used to make sure that a certain difference of configuration, 7 + such as the presence of an overlay does not cause a cache miss. 8 + 9 + When the derivations are equal, the return value is an empty file. 10 + Otherwise, the build log explains the difference via `nix-diff`. 11 + 12 + Example: 13 + 14 + testEqualDerivation 15 + "The hello package must stay the same when enabling checks." 16 + hello 17 + (hello.overrideAttrs(o: { doCheck = true; })) 18 + */ 3 19 testEqualDerivation = callPackage ./test-equal-derivation.nix { }; 4 20 5 21 /* 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 - */ 22 + 23 + Although simplistic, this test assures that the main program 24 + can run. While there's no substitute for a real test case, 25 + it does catch dynamic linking errors and such. It also provides 26 + some protection against accidentally building the wrong version, 27 + for example when using an 'old' hash in a fixed-output derivation. 28 + 29 + Examples: 30 + 31 + passthru.tests.version = testVersion { package = hello; }; 32 + 33 + passthru.tests.version = testVersion { 34 + package = seaweedfs; 35 + command = "weed version"; 36 + }; 37 + 38 + passthru.tests.version = testVersion { 39 + package = key; 40 + command = "KeY --help"; 41 + # Wrong '2.5' version in the code. Drop on next version. 42 + version = "2.5"; 43 + }; 44 + */ 29 45 testVersion = 30 46 { package, 31 47 command ? "${package.meta.mainProgram or package.pname or package.name} --version",
-17
pkgs/build-support/testers/test-equal-derivation.nix
··· 1 1 { lib, runCommand, emptyFile, nix-diff }: 2 2 3 - /* 4 - Checks that two packages produce the exact same build instructions. 5 - 6 - This can be used to make sure that a certain difference of configuration, 7 - such as the presence of an overlay does not cause a cache miss. 8 - 9 - When the derivations are equal, the return value is an empty file. 10 - Otherwise, the build log explains the difference via `nix-diff`. 11 - 12 - Example: 13 - 14 - testEqualDerivation 15 - "The hello package must stay the same when enabling checks." 16 - hello 17 - (hello.overrideAttrs(o: { doCheck = true; })) 18 - 19 - */ 20 3 assertion: a: b: 21 4 let 22 5 drvA = builtins.unsafeDiscardOutputDependency a.drvPath or (throw "testEqualDerivation second argument must be a package");