From 7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249 Mon Sep 17 00:00:00 2001 From: oxalica Date: Mon, 4 Jul 2022 18:00:14 +0800 Subject: [PATCH] check-utils: use the same success derivation (#75) A successful check doesn't need reporting, so we use the same derivation to reduce building jobs. --- check-utils.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/check-utils.nix b/check-utils.nix index 8aa7050..5aaff17 100644 --- a/check-utils.nix +++ b/check-utils.nix @@ -34,16 +34,18 @@ let builder = "/bin/sh"; args = [ "-c" command ]; }; + + success = test "SUCCESS" "echo success > $out"; in { isEqual = a: b: if a == b - then test "SUCCESS__${str a}__IS_EQUAL__${str b}" "echo success > $out" + then success else test "FAILURE__${str a}__NOT_EQUAL__${str b}" "exit 1"; hasKey = attrset: key: if attrset ? ${str key} - then test "SUCCESS__${str key}__EXISTS_IN_ATTRSET" "echo success > $out" + then success else test "FAILURE__${str key}__DOES_NOT_EXISTS_IN_ATTRSET_SIZE_${str(length (attrNames attrset))}" "exit 1"; }