Commit bc19f22d authored by Per Buer's avatar Per Buer
parents 880b0f85 1c9bf690
...@@ -5,6 +5,8 @@ server s1 { ...@@ -5,6 +5,8 @@ server s1 {
txresp -hdr "Foo: bar" -body "abcdef\n" txresp -hdr "Foo: bar" -body "abcdef\n"
rxreq rxreq
txresp -hdr "Panic: please" -body "012345\n" txresp -hdr "Panic: please" -body "012345\n"
close
sema r1 sync 2 sema r1 sync 2
accept accept
rxreq rxreq
...@@ -25,25 +27,23 @@ varnish v1 -cliok "param.set diag_bitmap 0x00001000" ...@@ -25,25 +27,23 @@ varnish v1 -cliok "param.set diag_bitmap 0x00001000"
# Force the (random) port selected to be used again after restart. # Force the (random) port selected to be used again after restart.
varnish v1 -cliok "param.set listen_address ${v1_addr}:${v1_port}" varnish v1 -cliok "param.set listen_address ${v1_addr}:${v1_port}"
# varnishtest defaults to auto_restart off, to avoid masking bugs.
varnish v1 -cliok "param.set auto_restart on"
client c1 { client c1 {
txreq -url "/" txreq -url "/"
rxresp rxresp
txreq -url "/foo" txreq -url "/foo"
# Don't expect answer, the server crashed. # Don't expect answer, the server crashed.
sema r1 sync 2
} -run } -run
delay 2.5 varnish v1 -wait-stopped
varnish v1 -cliok "panic.show"
varnish v1 -cliok "panic.clear"
varnish v1 -clierr 300 "panic.clear"
varnish v1 -cliok "start"
varnish v1 -wait-running
sema r1 sync 2
client c1 { client c1 {
txreq -url "/" txreq -url "/"
rxresp rxresp
expect resp.http.foo == "foo" expect resp.http.foo == "foo"
} -run } -run
varnish v1 -cliok "panic.show"
varnish v1 -cliok "panic.clear"
varnish v1 -clierr 300 "panic.clear"
...@@ -119,6 +119,55 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl) ...@@ -119,6 +119,55 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl)
return ((enum VCLI_status_e)retval); return ((enum VCLI_status_e)retval);
} }
/**********************************************************************
*
*/
static void
wait_stopped(const struct varnish *v)
{
char *r;
enum VCLI_status_e st;
while (1) {
vtc_log(v->vl, 3, "wait-stopped");
st = varnish_ask_cli(v, "status", &r);
if (st != CLIS_OK)
vtc_log(v->vl, 0,
"CLI status command failed: %u %s", st, r);
if (!strcmp(r, "Child in state stopped")) {
free(r);
break;
}
free(r);
(void)usleep(200000);
}
}
/**********************************************************************
*
*/
static void
wait_running(const struct varnish *v)
{
char *r;
enum VCLI_status_e st;
while (1) {
vtc_log(v->vl, 3, "wait-running");
st = varnish_ask_cli(v, "status", &r);
if (st != CLIS_OK)
vtc_log(v->vl, 0,
"CLI status command failed: %u %s", st, r);
if (!strcmp(r, "Child in state running")) {
free(r);
break;
}
free(r);
(void)usleep(200000);
}
}
/********************************************************************** /**********************************************************************
* Varnishlog gatherer + thread * Varnishlog gatherer + thread
*/ */
...@@ -439,6 +488,7 @@ varnish_start(struct varnish *v) ...@@ -439,6 +488,7 @@ varnish_start(struct varnish *v)
return; return;
if (u != CLIS_OK) if (u != CLIS_OK)
vtc_log(v->vl, 0, "CLI start command failed: %u %s", u, resp); vtc_log(v->vl, 0, "CLI start command failed: %u %s", u, resp);
wait_running(v);
free(resp); free(resp);
u = varnish_ask_cli(v, "debug.xid 1000", &resp); u = varnish_ask_cli(v, "debug.xid 1000", &resp);
if (vtc_error) if (vtc_error)
...@@ -823,6 +873,14 @@ cmd_varnish(CMD_ARGS) ...@@ -823,6 +873,14 @@ cmd_varnish(CMD_ARGS)
varnish_stop(v); varnish_stop(v);
continue; continue;
} }
if (!strcmp(*av, "-wait-stopped")) {
wait_stopped(v);
continue;
}
if (!strcmp(*av, "-wait-running")) {
wait_running(v);
continue;
}
if (!strcmp(*av, "-wait")) { if (!strcmp(*av, "-wait")) {
varnish_wait(v); varnish_wait(v);
continue; continue;
......
...@@ -215,7 +215,6 @@ VSL_NextLog(const struct VSM_data *vd, uint32_t **pp, uint64_t *bits) ...@@ -215,7 +215,6 @@ VSL_NextLog(const struct VSM_data *vd, uint32_t **pp, uint64_t *bits)
struct vsl *vsl; struct vsl *vsl;
uint32_t *p; uint32_t *p;
unsigned char t; unsigned char t;
unsigned u;
int i; int i;
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
...@@ -226,7 +225,6 @@ VSL_NextLog(const struct VSM_data *vd, uint32_t **pp, uint64_t *bits) ...@@ -226,7 +225,6 @@ VSL_NextLog(const struct VSM_data *vd, uint32_t **pp, uint64_t *bits)
i = vsl_nextlog(vsl, &p); i = vsl_nextlog(vsl, &p);
if (i != 1) if (i != 1)
return (i); return (i);
u = VSL_ID(p);
t = VSL_TAG(p); t = VSL_TAG(p);
if (vsl->skip) { if (vsl->skip) {
--vsl->skip; --vsl->skip;
......
# #
if HAVE_RST2MAN
noinst_PROGRAMS = vsc2rst noinst_PROGRAMS = vsc2rst
endif
vsc2rst_SOURCES = vsc2rst.c \ vsc2rst_SOURCES = vsc2rst.c \
$(top_srcdir)/include/vsc_fields.h $(top_srcdir)/include/vsc_fields.h
...@@ -30,10 +32,11 @@ else ...@@ -30,10 +32,11 @@ else
@false @false
endif endif
varnish-counters.7: vsc2rst
if HAVE_RST2MAN if HAVE_RST2MAN
varnish-counters.7: vsc2rst
./vsc2rst | ${RST2MAN} - $@ ./vsc2rst | ${RST2MAN} - $@
else else
varnish-counters.7: $(top_srcdir)/include/vsc_fields.h
@echo "========================================" @echo "========================================"
@echo "You need rst2man installed to make dist" @echo "You need rst2man installed to make dist"
@echo "========================================" @echo "========================================"
......
%define v_rc
%define vd_rc %{?v_rc:-%{?v_rc}}
Summary: High-performance HTTP accelerator Summary: High-performance HTTP accelerator
Name: varnish Name: varnish
Version: 3.0.0 Version: 3.1.0
Release: 0.20110715%{?dist} Release: 0.20111006%{?v_rc}%{?dist}
License: BSD License: BSD
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://www.varnish-cache.org/ URL: http://www.varnish-cache.org/
#Source0: http://repo.varnish-cache.org/source/%{name}-%{version}.tar.gz #Source0: http://repo.varnish-cache.org/source/%{name}-%{version}.tar.gz
#Source0: %{name}-%{version}%{?vd_rc}.tar.gz
Source0: %{name}-trunk.tar.gz Source0: %{name}-trunk.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# To build from git, start with a make dist, see redhat/README.redhat # To build from git, start with a make dist, see redhat/README.redhat
...@@ -71,7 +75,7 @@ Documentation files for %name ...@@ -71,7 +75,7 @@ Documentation files for %name
#Varnish Cache is a high-performance HTTP accelerator #Varnish Cache is a high-performance HTTP accelerator
%prep %prep
#%setup -q #%setup -q -n varnish-%{version}%{?vd_rc}
%setup -q -n varnish-trunk %setup -q -n varnish-trunk
mkdir examples mkdir examples
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment