summary refs log tree commit diff
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2022-04-20 18:43:21 +0300
committerArtturin <Artturin@artturin.com>2022-04-22 16:24:29 +0300
commit3cc2e86bab4dcfa1abc7c835fae6336b068cd77e (patch)
tree6354cf6694d558efab06193fba7793e0a4413985
parentf1c7f19e49190cf58041908f9c194431e2513688 (diff)
downloadnixpkgs-3cc2e86bab4dcfa1abc7c835fae6336b068cd77e.tar
nixpkgs-3cc2e86bab4dcfa1abc7c835fae6336b068cd77e.tar.gz
nixpkgs-3cc2e86bab4dcfa1abc7c835fae6336b068cd77e.tar.bz2
nixpkgs-3cc2e86bab4dcfa1abc7c835fae6336b068cd77e.tar.lz
nixpkgs-3cc2e86bab4dcfa1abc7c835fae6336b068cd77e.tar.xz
nixpkgs-3cc2e86bab4dcfa1abc7c835fae6336b068cd77e.tar.zst
nixpkgs-3cc2e86bab4dcfa1abc7c835fae6336b068cd77e.zip
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'
-rw-r--r--pkgs/build-support/testers/default.nix62
-rw-r--r--pkgs/build-support/testers/test-equal-derivation.nix17
2 files changed, 39 insertions, 40 deletions
diff --git a/pkgs/build-support/testers/default.nix b/pkgs/build-support/testers/default.nix
index b63ba5742b2..e5a8dbc7960 100644
--- a/pkgs/build-support/testers/default.nix
+++ b/pkgs/build-support/testers/default.nix
@@ -1,31 +1,47 @@
 { pkgs, lib, callPackage, runCommand }:
 {
+
+  /* Checks that two packages produce the exact same build instructions.
+
+     This can be used to make sure that a certain difference of configuration,
+     such as the presence of an overlay does not cause a cache miss.
+
+     When the derivations are equal, the return value is an empty file.
+     Otherwise, the build log explains the difference via `nix-diff`.
+
+     Example:
+
+         testEqualDerivation
+           "The hello package must stay the same when enabling checks."
+           hello
+           (hello.overrideAttrs(o: { doCheck = true; }))
+  */
   testEqualDerivation = callPackage ./test-equal-derivation.nix { };
 
   /* 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";
-   * };
-   */
+
+     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",
diff --git a/pkgs/build-support/testers/test-equal-derivation.nix b/pkgs/build-support/testers/test-equal-derivation.nix
index 652f3716b2a..610d5f58557 100644
--- a/pkgs/build-support/testers/test-equal-derivation.nix
+++ b/pkgs/build-support/testers/test-equal-derivation.nix
@@ -1,22 +1,5 @@
 { lib, runCommand, emptyFile, nix-diff }:
 
-/*
-  Checks that two packages produce the exact same build instructions.
-
-  This can be used to make sure that a certain difference of configuration,
-  such as the presence of an overlay does not cause a cache miss.
-
-  When the derivations are equal, the return value is an empty file.
-  Otherwise, the build log explains the difference via `nix-diff`.
-
-  Example:
-
-      testEqualDerivation
-        "The hello package must stay the same when enabling checks."
-        hello
-        (hello.overrideAttrs(o: { doCheck = true; }))
-
-*/
 assertion: a: b:
 let
   drvA = builtins.unsafeDiscardOutputDependency a.drvPath or (throw "testEqualDerivation second argument must be a package");