summary refs log tree commit diff
path: root/pkgs/test/coq/overrideCoqDerivation
diff options
context:
space:
mode:
authorDennis Gosnell <cdep.illabout@gmail.com>2022-08-29 14:46:20 +0900
committerDennis Gosnell <cdep.illabout@gmail.com>2022-08-29 14:46:20 +0900
commit7efd4aa67c44be8fa854daf81243b300cf94259f (patch)
treeb8f3ea687aabf46a62dbcdf5270512b241488340 /pkgs/test/coq/overrideCoqDerivation
parent06ece659f09716f744ee5e6fcf5565d7dcbab30b (diff)
tests.coq.overrideCoqDerivation: add test
Diffstat (limited to 'pkgs/test/coq/overrideCoqDerivation')
-rw-r--r--pkgs/test/coq/overrideCoqDerivation/default.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/pkgs/test/coq/overrideCoqDerivation/default.nix b/pkgs/test/coq/overrideCoqDerivation/default.nix
new file mode 100644
index 0000000000000..9fef57765400f
--- /dev/null
+++ b/pkgs/test/coq/overrideCoqDerivation/default.nix
@@ -0,0 +1,40 @@
+{ lib, coq, mkCoqPackages, runCommandNoCC }:
+
+let
+
+  # This is just coq, but with dontFilter set to true. We need to set
+  # dontFilter to true here so that _all_ packages are visibile in coqPackages.
+  # There may be some versions of the top-level coq and coqPackages that don't
+  # build QuickChick, which is what we are using for this test below.
+  coqWithAllPackages = coq // { dontFilter = true; };
+
+  coqPackages = mkCoqPackages coqWithAllPackages;
+
+  # This is the main test.  This uses overrideCoqDerivation to
+  # override arguments to mkCoqDerivation.
+  #
+  # Here, we override the defaultVersion and release arguments to
+  # mkCoqDerivation.
+  overriddenQuickChick =
+    coqPackages.lib.overrideCoqDerivation
+      {
+        defaultVersion = "9999";
+        release."9999".sha256 = lib.fakeSha256;
+      }
+      coqPackages.QuickChick;
+in
+
+runCommandNoCC
+  "coq-overrideCoqDerivation-test-0.1"
+  { meta.maintainers = with lib.maintainers; [cdepillabout]; }
+  ''
+    # Confirm that the computed version number for the overridden QuickChick does
+    # actually become 9999, as set above.
+    if [ "${overriddenQuickChick.version}" -eq "9999" ]; then
+      echo "overriddenQuickChick version was successfully set to 9999"
+      touch $out
+    else
+      echo "ERROR: overriddenQuickChick version was supposed to be 9999, but was actually: ${overriddenQuickChick.version}"
+      exit 1
+    fi
+  ''