@@ -0,0 +1,41 @@
1+#!/usr/bin/env bash
2+
3+# -------------------------------------------------------------------------- #
4+#
5+# trivial-builders test
6+#
7+# -------------------------------------------------------------------------- #
8+#
9+# This file can be run independently (quick):
10+#
11+# $ pkgs/build-support/trivial-builders/test.sh
12+#
13+# or in the build sandbox with a ~20s VM overhead
14+#
15+# $ nix-build -A tests.trivial-builders
16+#
17+# -------------------------------------------------------------------------- #
18+
19+# strict bash
20+set -euo pipefail
21+
22+# debug
23+# set -x
24+# PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
25+
26+cd "$(dirname ${BASH_SOURCE[0]})" # nixpkgs root
27+
28+testDirectReferences() {
29+ expr="$1"
30+ diff -U3 \
31+ <(sort <$(nix-build --no-out-link --expr "with import ../../.. {}; writeDirectReferencesToFile ($expr)")) \
32+ <(nix-store -q --references $(nix-build --no-out-link --expr "with import ../../.. {}; ($expr)") | sort)
33+}
34+
35+testDirectReferences 'hello'
36+testDirectReferences 'figlet'
37+testDirectReferences 'writeText "hi" "hello"'
38+testDirectReferences 'writeText "hi" "hello ${hello}"'
39+testDirectReferences 'writeText "hi" "hello ${hello} ${figlet}"'
40+
41+echo 'OK!'