writeDirectReferencesToFile: init
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
#
|
||||
# trivial-builders test
|
||||
#
|
||||
# -------------------------------------------------------------------------- #
|
||||
#
|
||||
# This file can be run independently (quick):
|
||||
#
|
||||
# $ pkgs/build-support/trivial-builders/test.sh
|
||||
#
|
||||
# or in the build sandbox with a ~20s VM overhead
|
||||
#
|
||||
# $ nix-build -A tests.trivial-builders
|
||||
#
|
||||
# -------------------------------------------------------------------------- #
|
||||
|
||||
# strict bash
|
||||
set -euo pipefail
|
||||
|
||||
# debug
|
||||
# set -x
|
||||
# PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
||||
|
||||
cd "$(dirname ${BASH_SOURCE[0]})" # nixpkgs root
|
||||
|
||||
testDirectReferences() {
|
||||
expr="$1"
|
||||
diff -U3 \
|
||||
<(sort <$(nix-build --no-out-link --expr "with import ../../.. {}; writeDirectReferencesToFile ($expr)")) \
|
||||
<(nix-store -q --references $(nix-build --no-out-link --expr "with import ../../.. {}; ($expr)") | sort)
|
||||
}
|
||||
|
||||
testDirectReferences 'hello'
|
||||
testDirectReferences 'figlet'
|
||||
testDirectReferences 'writeText "hi" "hello"'
|
||||
testDirectReferences 'writeText "hi" "hello ${hello}"'
|
||||
testDirectReferences 'writeText "hi" "hello ${hello} ${figlet}"'
|
||||
|
||||
echo 'OK!'
|
||||
Reference in New Issue
Block a user