varnishtest "Coverage test for -sfile"

server s1 {
	rxreq
	txresp -nolen -hdr "Transfer-encoding: chunked"
	chunkedlen 65536
	chunkedlen 65536
	chunkedlen 65536
	chunkedlen 65536
	chunkedlen 1
	chunkedlen 0

	rxreq
	txresp -nolen -hdr "Transfer-encoding: chunked"
	chunkedlen 262
	chunkedlen 0
} -start

varnish v1 \
	-arg "-sTransient=file,${tmpdir}/_.file,10m" \
	-arg "-sdir=file,${tmpdir}/,10m" \
	-vcl+backend {
		sub vcl_backend_response {
			set beresp.do_stream = false;
			set beresp.ttl = 0.1s;
			set beresp.grace = 0.1s;
			set beresp.keep = 0.1s;
		}
	} \
	-start

client c1 {
	txreq
	rxresp
	expect resp.bodylen == 262145

	delay 2

	txreq
	rxresp
	expect resp.bodylen == 262
} -run

varnish v1 -vsl_catchup

varnish v1 -cliok "ban obj.http.date ~ ."

process p1 {
	varnishd -sTransient=file,${tmpdir}/foo,xxx -blocalhost -a:0 -n ${tmpdir} 2>&1
} -expect-exit 0x2 -dump -start -expect-text 0 0 "Invalid number" -wait -screen_dump

process p1 {
	varnishd -sTransient=file,${tmpdir}/foo,10M,xxx -blocalhost -a:0 -n ${tmpdir} 2>&1
} -expect-exit 0x2 -dump -start -expect-text 0 0 "granularity" -wait -screen_dump

process p1 {
	varnishd -sTransient=file,${tmpdir}/foo,10m,,foo -blocalhost -a:0 -n ${tmpdir} 2>&1
} -expect-exit 0x2 -dump -start -expect-text 0 0 "invalid advice" -wait

