2021-07-15 19:17:18 +03:00
|
|
|
source common.sh
|
|
|
|
|
|
|
|
replCmds="
|
2021-12-09 17:35:27 +02:00
|
|
|
simple = 1
|
2021-07-15 19:17:18 +03:00
|
|
|
simple = import ./simple.nix
|
|
|
|
:b simple
|
2021-11-26 17:03:07 +02:00
|
|
|
:log simple
|
|
|
|
"
|
|
|
|
|
|
|
|
replFailingCmds="
|
|
|
|
failing = import ./simple-failing.nix
|
|
|
|
:b failing
|
|
|
|
:log failing
|
2021-07-15 19:17:18 +03:00
|
|
|
"
|
|
|
|
|
|
|
|
testRepl () {
|
|
|
|
local nixArgs=("$@")
|
2021-11-03 11:54:17 +02:00
|
|
|
local replOutput="$(nix repl "${nixArgs[@]}" <<< "$replCmds")"
|
|
|
|
echo "$replOutput"
|
|
|
|
local outPath=$(echo "$replOutput" |&
|
2021-07-15 19:17:18 +03:00
|
|
|
grep -o -E "$NIX_STORE_DIR/\w*-simple")
|
|
|
|
nix path-info "${nixArgs[@]}" "$outPath"
|
2021-11-26 17:03:07 +02:00
|
|
|
# simple.nix prints a PATH during build
|
|
|
|
echo "$replOutput" | grep -qs 'PATH=' || fail "nix repl :log doesn't output logs"
|
|
|
|
local replOutput="$(nix repl "${nixArgs[@]}" <<< "$replFailingCmds")"
|
|
|
|
echo "$replOutput"
|
|
|
|
echo "$replOutput" | grep -qs 'This should fail' \
|
|
|
|
|| fail "nix repl :log doesn't output logs for a failed derivation"
|
2021-07-15 19:17:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
# Simple test, try building a drv
|
|
|
|
testRepl
|
|
|
|
# Same thing (kind-of), but with a remote store.
|
|
|
|
testRepl --store "$TEST_ROOT/store?real=$NIX_STORE_DIR"
|