core/pkgs/build-support/trivial-builders/test/writeClosure-union.nix

19 lines
604 B
Nix
Raw Normal View History

2024-05-13 21:24:10 +00:00
{ lib, runCommandLocal
# Test targets
, writeClosure, samples }:
2024-05-02 00:46:19 +00:00
runCommandLocal "test-trivial-builders-writeClosure-union" {
__structuredAttrs = true;
closures = lib.mapAttrs (n: v: writeClosure [ v ]) samples;
collectiveClosure = writeClosure (lib.attrValues samples);
inherit samples;
2024-05-13 21:24:10 +00:00
meta.maintainers = with lib.maintainers; [ ShamrockLee ];
2024-05-02 00:46:19 +00:00
} ''
set -eu -o pipefail
echo >&2 Testing mixed closures...
echo >&2 Checking all samples "(''${samples[*]})" "$collectiveClosure"
diff -U3 \
<(sort <"$collectiveClosure") \
<(cat "''${closures[@]}" | sort | uniq)
touch "$out"
''