lib.modules: Test infinite recursion hint
We don't want it to occur in the trace of any unrelated errors.
This commit is contained in:
@@ -82,6 +82,30 @@ checkConfigOutput() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invertIfUnset() {
|
||||||
|
gate="$1"
|
||||||
|
shift
|
||||||
|
if [[ -n "${!gate:-}" ]]; then
|
||||||
|
"$@"
|
||||||
|
else
|
||||||
|
! "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
globalErrorLogCheck() {
|
||||||
|
invertIfUnset "REQUIRE_INFINITE_RECURSION_HINT" \
|
||||||
|
grep -i 'if you get an infinite recursion here' \
|
||||||
|
<<<"$err" >/dev/null \
|
||||||
|
|| {
|
||||||
|
if [[ -n "${REQUIRE_INFINITE_RECURSION_HINT:-}" ]]; then
|
||||||
|
echo "Unexpected infinite recursion hint"
|
||||||
|
else
|
||||||
|
echo "Expected infinite recursion hint, but none found"
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
checkConfigError() {
|
checkConfigError() {
|
||||||
local errorContains=$1
|
local errorContains=$1
|
||||||
local err=""
|
local err=""
|
||||||
@@ -94,6 +118,14 @@ checkConfigError() {
|
|||||||
logFailure
|
logFailure
|
||||||
logEndFailure
|
logEndFailure
|
||||||
else
|
else
|
||||||
|
if ! globalErrorLogCheck "$err"; then
|
||||||
|
logStartFailure
|
||||||
|
echo "LOG:"
|
||||||
|
reportFailure "$@"
|
||||||
|
echo "GLOBAL ERROR LOG CHECK FAILED"
|
||||||
|
logFailure
|
||||||
|
logEndFailure
|
||||||
|
fi
|
||||||
if echo "$err" | grep -zP --silent "$errorContains" ; then
|
if echo "$err" | grep -zP --silent "$errorContains" ; then
|
||||||
((++pass))
|
((++pass))
|
||||||
else
|
else
|
||||||
@@ -488,7 +520,7 @@ checkConfigOutput '^"bar"$' config.nest.bar ./freeform-attrsOf.nix ./freeform-ne
|
|||||||
checkConfigOutput '^null$' config.foo ./freeform-attrsOf.nix ./freeform-str-dep-unstr.nix
|
checkConfigOutput '^null$' config.foo ./freeform-attrsOf.nix ./freeform-str-dep-unstr.nix
|
||||||
checkConfigOutput '^"24"$' config.foo ./freeform-attrsOf.nix ./freeform-str-dep-unstr.nix ./define-value-string.nix
|
checkConfigOutput '^"24"$' config.foo ./freeform-attrsOf.nix ./freeform-str-dep-unstr.nix ./define-value-string.nix
|
||||||
# Check whether an freeform-typed value can depend on a declared option, this can only work with lazyAttrsOf
|
# Check whether an freeform-typed value can depend on a declared option, this can only work with lazyAttrsOf
|
||||||
checkConfigError 'infinite recursion encountered' config.foo ./freeform-attrsOf.nix ./freeform-unstr-dep-str.nix
|
REQUIRE_INFINITE_RECURSION_HINT=1 checkConfigError 'infinite recursion encountered' config.foo ./freeform-attrsOf.nix ./freeform-unstr-dep-str.nix
|
||||||
checkConfigError 'The option .* was accessed but has no value defined. Try setting the option.' config.foo ./freeform-lazyAttrsOf.nix ./freeform-unstr-dep-str.nix
|
checkConfigError 'The option .* was accessed but has no value defined. Try setting the option.' config.foo ./freeform-lazyAttrsOf.nix ./freeform-unstr-dep-str.nix
|
||||||
checkConfigOutput '^"24"$' config.foo ./freeform-lazyAttrsOf.nix ./freeform-unstr-dep-str.nix ./define-value-string.nix
|
checkConfigOutput '^"24"$' config.foo ./freeform-lazyAttrsOf.nix ./freeform-unstr-dep-str.nix ./define-value-string.nix
|
||||||
# submodules in freeformTypes should have their locations annotated
|
# submodules in freeformTypes should have their locations annotated
|
||||||
|
|||||||
Reference in New Issue
Block a user