varnishtest "double sub unref warning / warnings output for -f"

# Also tests #3160

filewrite ${tmpdir}/unref.vcl {
	vcl 4.1;
	backend be none;
	sub foo { }
}

process p1 -log {
	varnishd -F -n "${tmpdir}/t" -a "${tmpdir}/sock" \
	    -p vcc_feature=-err_unref -f "${tmpdir}/unref.vcl" \
	    -l 2m 2>&1
} -start -expect-exit 0x40

shell {
	# wait for startup vcl.load to complete
	varnishadm -n ${tmpdir}/t ping ||
	varnishadm -n ${tmpdir}/t ping
}

process p1 -screen_dump
process p1 -expect-text 0 1 "Unused sub foo, defined:"
process p1 -expect-text 0 1 "(That was just a warning)"

process p2 -log {
	set -e
	varnishadm -n ${tmpdir}/t "vcl.list"
	varnishadm -n ${tmpdir}/t -t 20 "vcl.load unref ${tmpdir}/unref.vcl"
	varnishadm -n ${tmpdir}/t "vcl.list"
} -run

process p2 -screen_dump
process p2 -expect-text 0 1 "Unused sub foo, defined:"
process p2 -expect-text 0 1 "(That was just a warning)"

process p1 -kill TERM
