New upstream release: varnish-2.0.
This commit is contained in:
parent
d728b8b77d
commit
0a4df0fec8
@ -1 +1 @@
|
||||
varnish-2.0-beta1.tar.gz
|
||||
varnish-2.0.tar.gz
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
66582fd4baa3f7fb91727fa27f41aa94 varnish-2.0-beta1.tar.gz
|
||||
4149b7220907ec90fd8047a90775ecac varnish-2.0.tar.gz
|
||||
|
24
varnish.ppc_pagesize.patch
Normal file
24
varnish.ppc_pagesize.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff -Naur ../varnish-2.0-beta2.orig/lib/libjemalloc/jemalloc_linux.c ./lib/libjemalloc/jemalloc_linux.c
|
||||
--- ../varnish-2.0-beta2.orig/lib/libjemalloc/jemalloc_linux.c 2008-09-24 20:05:19.000000000 +0200
|
||||
+++ ./lib/libjemalloc/jemalloc_linux.c 2008-10-06 14:13:28.950350627 +0200
|
||||
@@ -257,7 +257,7 @@
|
||||
# define NO_TLS
|
||||
#endif
|
||||
#ifdef __powerpc__
|
||||
-# define PAGESIZE_2POW 12
|
||||
+# define PAGESIZE_2POW 16
|
||||
# define QUANTUM_2POW 4
|
||||
# define SIZEOF_PTR_2POW 2
|
||||
#endif
|
||||
diff -Naur ../varnish-2.0-beta2.orig/lib/libjemalloc/malloc.c ./lib/libjemalloc/malloc.c
|
||||
--- ../varnish-2.0-beta2.orig/lib/libjemalloc/malloc.c 2008-09-24 20:05:19.000000000 +0200
|
||||
+++ ./lib/libjemalloc/malloc.c 2008-10-06 14:13:42.023005090 +0200
|
||||
@@ -261,7 +261,7 @@
|
||||
# define NO_TLS
|
||||
#endif
|
||||
#ifdef __powerpc__
|
||||
-# define PAGESIZE_2POW 12
|
||||
+# define PAGESIZE_2POW 16
|
||||
# define QUANTUM_2POW 4
|
||||
# define SIZEOF_PTR_2POW 2
|
||||
#endif
|
64
varnish.spec
64
varnish.spec
@ -1,18 +1,11 @@
|
||||
Summary: Varnish is a high-performance HTTP accelerator
|
||||
Name: varnish
|
||||
Version: 2.0
|
||||
Release: 0.8.beta1%{?dist}
|
||||
Release: 1%{?dist}
|
||||
License: BSD
|
||||
Group: System Environment/Daemons
|
||||
URL: http://www.varnish-cache.org/
|
||||
#Source0: http://varnish.projects.linpro.no/static/varnish-cache.tar.gz
|
||||
#Source0: http://downloads.sourceforge.net/varnish/varnish-%{version}.tar.gz
|
||||
Source0: http://downloads.sourceforge.net/varnish/varnish-2.0-beta1.tar.gz
|
||||
Patch0: varnish.lockfile.patch
|
||||
Patch1: varnish.coresize.patch
|
||||
Patch2: varnish.vcl_changes.patch
|
||||
Patch3: varnish.cs3157.patch
|
||||
Patch4: varnish.endianfix.cs3170-3071.patch
|
||||
Source0: http://downloads.sourceforge.net/varnish/varnish-%{version}.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
# The svn sources needs autoconf, automake and libtool to generate a suitable
|
||||
# configure script. Release tarballs would not need this
|
||||
@ -67,18 +60,12 @@ Varnish is a high-performance HTTP accelerator
|
||||
#Varnish is a high-performance HTTP accelerator
|
||||
|
||||
%prep
|
||||
#%setup -q
|
||||
%setup -q -n varnish-2.0-beta1
|
||||
|
||||
%patch0 -p0
|
||||
%patch1 -p0
|
||||
%patch2 -p0
|
||||
%patch3 -p0
|
||||
%patch4 -p0
|
||||
%setup -q
|
||||
#%setup -q -n varnish-cache
|
||||
|
||||
# The svn sources needs to generate a suitable configure script
|
||||
# Release tarballs would not need this
|
||||
# ./autogen.sh
|
||||
#./autogen.sh
|
||||
|
||||
# Hack to get 32- and 64-bits tests run concurrently on the same build machine
|
||||
case `uname -m` in
|
||||
@ -101,7 +88,12 @@ cp bin/varnishd/default.vcl etc/zope-plone.vcl examples
|
||||
%build
|
||||
|
||||
# Remove "--disable static" if you want to build static libraries
|
||||
# jemalloc is not compatible with Red Hat's ppc64 RHEL5 kernel koji server :-(
|
||||
%ifarch ppc64 ppc
|
||||
%configure --disable-static --localstatedir=/var/lib --disable-jemalloc
|
||||
%else
|
||||
%configure --disable-static --localstatedir=/var/lib
|
||||
%endif
|
||||
|
||||
# We have to remove rpath - not allowed in Fedora
|
||||
# (This problem only visible on 64 bit arches)
|
||||
@ -121,14 +113,16 @@ EOF
|
||||
|
||||
tail -n +11 etc/default.vcl >> redhat/default.vcl
|
||||
|
||||
%if "%dist" == "el4"
|
||||
%if 0%{?fedora}%{?rhel} == 0 || 0%{?rhel} <= 4 && 0%{?fedora} <= 8
|
||||
# Old style daemon function
|
||||
sed -i 's,--pidfile \$pidfile,,g;
|
||||
s,status -p \$pidfile,status,g;
|
||||
s,killproc -p \$pidfile,killproc,g' \
|
||||
redhat/varnish.initrc redhat/varnishlog.initrc
|
||||
redhat/varnish.initrc redhat/varnishlog.initrc redhat/varnishncsa.initrc
|
||||
%endif
|
||||
|
||||
%check
|
||||
LD_LIBRARY_PATH="lib/libvarnish/.libs:lib/libvarnishcompat/.libs:lib/libvarnishapi/.libs:lib/libvcl/.libs" bin/varnishd/varnishd -b 127.0.0.1:80 -C -n /tmp/foo
|
||||
%{__make} check LD_LIBRARY_PATH="../../lib/libvarnish/.libs:../../lib/libvarnishcompat/.libs:../../lib/libvarnishapi/.libs:../../lib/libvcl/.libs"
|
||||
|
||||
%install
|
||||
@ -149,6 +143,7 @@ mkdir -p %{buildroot}/var/run/varnish
|
||||
%{__install} -D -m 0644 redhat/varnish.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/varnish
|
||||
%{__install} -D -m 0755 redhat/varnish.initrc %{buildroot}%{_initrddir}/varnish
|
||||
%{__install} -D -m 0755 redhat/varnishlog.initrc %{buildroot}%{_initrddir}/varnishlog
|
||||
%{__install} -D -m 0755 redhat/varnishncsa.initrc %{buildroot}%{_initrddir}/varnishncsa
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
@ -169,6 +164,7 @@ rm -rf %{buildroot}
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/varnish
|
||||
%{_initrddir}/varnish
|
||||
%{_initrddir}/varnishlog
|
||||
%{_initrddir}/varnishncsa
|
||||
|
||||
%files libs
|
||||
%defattr(-,root,root,-)
|
||||
@ -207,19 +203,16 @@ exit 0
|
||||
%post
|
||||
/sbin/chkconfig --add varnish
|
||||
/sbin/chkconfig --add varnishlog
|
||||
/sbin/chkconfig --add varnishncsa
|
||||
|
||||
%preun
|
||||
if [ $1 -lt 1 ]; then
|
||||
/sbin/service varnish stop > /dev/null 2>&1
|
||||
/sbin/service varnishlog stop > /dev/null 2>&1
|
||||
/sbin/service varnishncsa stop > /dev/null 2>%1
|
||||
/sbin/chkconfig --del varnish
|
||||
/sbin/chkconfig --del varnishlog
|
||||
fi
|
||||
|
||||
%postun
|
||||
if [ $1 -ge 1 ]; then
|
||||
/sbin/service varnish condrestart > /dev/null 2>&1
|
||||
/sbin/service varnishlog condrestart > /dev/null 2>&1
|
||||
/sbin/chkconfig --del varnishncsa
|
||||
fi
|
||||
|
||||
%post libs -p /sbin/ldconfig
|
||||
@ -227,6 +220,25 @@ fi
|
||||
%postun libs -p /sbin/ldconfig
|
||||
|
||||
%changelog
|
||||
* Wed Oct 15 2008 Ingvar Hagelund <ingvar@linpro.no> - 2.0-1
|
||||
- 2.0 released. New upstream sources
|
||||
- Disabled jemalloc on ppc and ppc64. Added a note in README.redhat.
|
||||
- Synced to upstream again. No more patches needed.
|
||||
|
||||
* Wed Oct 08 2008 Ingvar Hagelund <ingvar@linpro.no> - 2.0-0.11.rc1
|
||||
- 2.0-rc1 released. New upstream sources
|
||||
- Added a patch for pagesize to match redhat's rhel5 ppc64 koji build boxes
|
||||
- Added a patch for test a00008, from r3269
|
||||
- Removed condrestart in postscript at upgrade. We don't want that.
|
||||
|
||||
* Fri Sep 26 2008 Ingvar Hagelund <ingvar@linpro.no> - 2.0-0.10.beta2
|
||||
- 2.0-beta2 released. New upstream sources
|
||||
- Whitespace changes to make rpmlint more happy
|
||||
|
||||
* Fri Sep 12 2008 Ingvar Hagelund <ingvar@linpro.no> - 2.0-0.9.20080912svn3184
|
||||
- Added varnisnsca init script (Colin Hill)
|
||||
- Corrected varnishlog init script (Colin Hill)
|
||||
|
||||
* Tue Sep 09 2008 Ingvar Hagelund <ingvar@linpro.no> - 2.0-0.8.beta1
|
||||
- Added a patch from r3171 that fixes an endian bug on ppc and ppc64
|
||||
- Added a hack that changes the varnishtest ports for 64bits builds,
|
||||
|
781
varnish.varnishtest_rc1-3273.patch
Normal file
781
varnish.varnishtest_rc1-3273.patch
Normal file
@ -0,0 +1,781 @@
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/Makefile.in bin/varnishtest/Makefile.in
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/Makefile.in 2008-10-08 13:39:45.000000000 +0200
|
||||
+++ bin/varnishtest/Makefile.in 2008-10-09 20:05:13.000000000 +0200
|
||||
@@ -96,7 +96,6 @@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DL_LIBS = @DL_LIBS@
|
||||
-DSYMUTIL = @DSYMUTIL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
@@ -123,7 +122,6 @@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NET_LIBS = @NET_LIBS@
|
||||
-NMEDIT = @NMEDIT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/tests/a00008.vtc bin/varnishtest/tests/a00008.vtc
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/tests/a00008.vtc 2008-10-08 13:18:24.000000000 +0200
|
||||
+++ bin/varnishtest/tests/a00008.vtc 2008-10-09 13:49:15.000000000 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-# $Id: a00008.vtc 3012 2008-07-24 12:22:35Z des $
|
||||
+# $Id: a00008.vtc 3272 2008-10-09 11:39:24Z phk $
|
||||
|
||||
test "Sema operations"
|
||||
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/vtc.c bin/varnishtest/vtc.c
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/vtc.c 2008-10-08 13:18:24.000000000 +0200
|
||||
+++ bin/varnishtest/vtc.c 2008-10-09 13:49:16.000000000 +0200
|
||||
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
- * $Id: vtc.c 3243 2008-10-05 10:22:21Z phk $
|
||||
+ * $Id: vtc.c 3272 2008-10-09 11:39:24Z phk $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -41,7 +41,8 @@
|
||||
#define MAX_FILESIZE (1024 * 1024)
|
||||
#define MAX_TOKENS 100
|
||||
|
||||
-static struct vtclog *vl;
|
||||
+const char *vtc_file;
|
||||
+char *vtc_desc;
|
||||
|
||||
/**********************************************************************
|
||||
* Read a file into memory
|
||||
@@ -80,7 +81,7 @@
|
||||
*/
|
||||
|
||||
void
|
||||
-parse_string(char *buf, const struct cmds *cmd, void *priv)
|
||||
+parse_string(char *buf, const struct cmds *cmd, void *priv, struct vtclog *vl)
|
||||
{
|
||||
char *token_s[MAX_TOKENS], *token_e[MAX_TOKENS];
|
||||
char *p, *q;
|
||||
@@ -183,7 +184,7 @@
|
||||
}
|
||||
|
||||
assert(cp->cmd != NULL);
|
||||
- cp->cmd(token_s, priv, cmd);
|
||||
+ cp->cmd(token_s, priv, cmd, vl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +197,7 @@
|
||||
{
|
||||
|
||||
for (; cmd->name != NULL; cmd++)
|
||||
- cmd->cmd(NULL, NULL, NULL);
|
||||
+ cmd->cmd(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
@@ -209,6 +210,7 @@
|
||||
|
||||
(void)priv;
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
|
||||
if (av == NULL)
|
||||
return;
|
||||
@@ -216,6 +218,7 @@
|
||||
|
||||
printf("# TEST %s\n", av[1]);
|
||||
AZ(av[2]);
|
||||
+ vtc_desc = strdup(av[1]);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
@@ -270,6 +273,7 @@
|
||||
{
|
||||
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
if (av == NULL)
|
||||
return;
|
||||
printf("cmd_dump(%p)\n", priv);
|
||||
@@ -293,16 +297,20 @@
|
||||
};
|
||||
|
||||
static void
|
||||
-exec_file(const char *fn)
|
||||
+exec_file(const char *fn, struct vtclog *vl)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
- printf("# TEST %s starting\n", fn);
|
||||
+ vtc_file = fn;
|
||||
+ vtc_desc = NULL;
|
||||
+ vtc_log(vl, 1, "TEST %s starting", fn);
|
||||
buf = read_file(fn);
|
||||
- parse_string(buf, cmds, NULL);
|
||||
- printf("# RESETTING after %s\n", fn);
|
||||
+ parse_string(buf, cmds, NULL, vl);
|
||||
+ vtc_log(vl, 1, "RESETTING after %s", fn);
|
||||
reset_cmds(cmds);
|
||||
- printf("# TEST %s completed\n", fn);
|
||||
+ vtc_log(vl, 1, "TEST %s completed", fn);
|
||||
+ vtc_file = NULL;
|
||||
+ free(vtc_desc);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
@@ -325,10 +333,11 @@
|
||||
{
|
||||
int ch;
|
||||
FILE *fok;
|
||||
+ static struct vtclog *vl;
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
setbuf(stderr, NULL);
|
||||
- vl = vtc_logopen("");
|
||||
+ vl = vtc_logopen("top");
|
||||
AN(vl);
|
||||
while ((ch = getopt(argc, argv, "qv")) != -1) {
|
||||
switch (ch) {
|
||||
@@ -350,7 +359,7 @@
|
||||
|
||||
init_sema();
|
||||
for (ch = 0; ch < argc; ch++)
|
||||
- exec_file(argv[ch]);
|
||||
+ exec_file(argv[ch], vl);
|
||||
fok = fopen("_.ok", "w");
|
||||
if (fok != NULL)
|
||||
fclose(fok);
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/vtc_client.c bin/varnishtest/vtc_client.c
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/vtc_client.c 2008-10-08 13:18:24.000000000 +0200
|
||||
+++ bin/varnishtest/vtc_client.c 2008-10-09 13:49:16.000000000 +0200
|
||||
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
- * $Id: vtc_client.c 3127 2008-08-26 07:51:12Z phk $
|
||||
+ * $Id: vtc_client.c 3272 2008-10-09 11:39:24Z phk $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
char *spec;
|
||||
|
||||
- const char *connect;
|
||||
+ char *connect;
|
||||
|
||||
pthread_t tp;
|
||||
};
|
||||
@@ -98,26 +98,42 @@
|
||||
*/
|
||||
|
||||
static struct client *
|
||||
-client_new(char *name)
|
||||
+client_new(const char *name)
|
||||
{
|
||||
struct client *c;
|
||||
|
||||
+ AN(name);
|
||||
ALLOC_OBJ(c, CLIENT_MAGIC);
|
||||
AN(c);
|
||||
- c->name = name;
|
||||
+ REPLACE(c->name, name);
|
||||
c->vl = vtc_logopen(name);
|
||||
AN(c->vl);
|
||||
- if (*name != 'c') {
|
||||
+ if (*c->name != 'c')
|
||||
vtc_log(c->vl, 0, "Client name must start with 'c'");
|
||||
- exit (1);
|
||||
- }
|
||||
|
||||
- c->connect = "127.0.0.1:9081";
|
||||
+ REPLACE(c->connect, "127.0.0.1:9081");
|
||||
VTAILQ_INSERT_TAIL(&clients, c, list);
|
||||
return (c);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
+ * Clean up client
|
||||
+ */
|
||||
+
|
||||
+static void
|
||||
+client_delete(struct client *c)
|
||||
+{
|
||||
+
|
||||
+ CHECK_OBJ_NOTNULL(c, CLIENT_MAGIC);
|
||||
+ vtc_logclose(c->vl);
|
||||
+ free(c->spec);
|
||||
+ free(c->name);
|
||||
+ free(c->connect);
|
||||
+ /* XXX: MEMLEAK (?)*/
|
||||
+ FREE_OBJ(c);
|
||||
+}
|
||||
+
|
||||
+/**********************************************************************
|
||||
* Start the client thread
|
||||
*/
|
||||
|
||||
@@ -173,6 +189,7 @@
|
||||
|
||||
(void)priv;
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
|
||||
if (av == NULL) {
|
||||
/* Reset and free */
|
||||
@@ -180,8 +197,7 @@
|
||||
VTAILQ_REMOVE(&clients, c, list);
|
||||
if (c->tp != 0)
|
||||
client_wait(c);
|
||||
- FREE_OBJ(c);
|
||||
- /* XXX: MEMLEAK */
|
||||
+ client_delete(c);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -198,7 +214,7 @@
|
||||
|
||||
for (; *av != NULL; av++) {
|
||||
if (!strcmp(*av, "-connect")) {
|
||||
- c->connect = av[1];
|
||||
+ REPLACE(c->connect, av[1]);
|
||||
av++;
|
||||
continue;
|
||||
}
|
||||
@@ -218,6 +234,6 @@
|
||||
vtc_log(c->vl, 0, "Unknown client argument: %s", *av);
|
||||
exit (1);
|
||||
}
|
||||
- c->spec = *av;
|
||||
+ REPLACE(c->spec, *av);
|
||||
}
|
||||
}
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/vtc.h bin/varnishtest/vtc.h
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/vtc.h 2008-10-08 13:18:24.000000000 +0200
|
||||
+++ bin/varnishtest/vtc.h 2008-10-09 13:49:15.000000000 +0200
|
||||
@@ -23,14 +23,14 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
- * $Id: vtc.h 3244 2008-10-05 10:22:53Z phk $
|
||||
+ * $Id: vtc.h 3272 2008-10-09 11:39:24Z phk $
|
||||
*/
|
||||
|
||||
struct vsb;
|
||||
struct vtclog;
|
||||
struct cmds;
|
||||
|
||||
-#define CMD_ARGS char * const *av, void *priv, const struct cmds *cmd
|
||||
+#define CMD_ARGS char * const *av, void *priv, const struct cmds *cmd, struct vtclog *vl
|
||||
typedef void cmd_f(CMD_ARGS);
|
||||
|
||||
struct cmds {
|
||||
@@ -38,7 +38,7 @@
|
||||
cmd_f *cmd;
|
||||
};
|
||||
|
||||
-void parse_string(char *buf, const struct cmds *cmd, void *priv);
|
||||
+void parse_string(char *buf, const struct cmds *cmd, void *priv, struct vtclog *vl);
|
||||
|
||||
cmd_f cmd_dump;
|
||||
cmd_f cmd_delay;
|
||||
@@ -47,13 +47,17 @@
|
||||
cmd_f cmd_varnish;
|
||||
cmd_f cmd_sema;
|
||||
|
||||
+extern const char *vtc_file;
|
||||
+extern char *vtc_desc;
|
||||
+extern int vtc_verbosity;
|
||||
+
|
||||
void init_sema(void);
|
||||
|
||||
void http_process(struct vtclog *vl, const char *spec, int sock, int client);
|
||||
|
||||
void cmd_server_genvcl(struct vsb *vsb);
|
||||
|
||||
-extern int vtc_verbosity;
|
||||
struct vtclog *vtc_logopen(const char *id);
|
||||
+void vtc_logclose(struct vtclog *vl);
|
||||
void vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...);
|
||||
void vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str);
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/vtc_http.c bin/varnishtest/vtc_http.c
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/vtc_http.c 2008-10-08 13:18:24.000000000 +0200
|
||||
+++ bin/varnishtest/vtc_http.c 2008-10-09 13:49:16.000000000 +0200
|
||||
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
- * $Id: vtc_http.c 3207 2008-09-21 06:47:37Z phk $
|
||||
+ * $Id: vtc_http.c 3272 2008-10-09 11:39:24Z phk $
|
||||
*/
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
* Generate a synthetic body
|
||||
*/
|
||||
|
||||
-static const char *
|
||||
+static char *
|
||||
synth_body(const char *len)
|
||||
{
|
||||
int i, j, k, l;
|
||||
@@ -185,6 +185,7 @@
|
||||
char *rhs;
|
||||
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
|
||||
assert(!strcmp(av[0], "expect"));
|
||||
av++;
|
||||
@@ -419,6 +420,7 @@
|
||||
struct http *hp;
|
||||
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
|
||||
AN(hp->client);
|
||||
assert(!strcmp(av[0], "rxresp"));
|
||||
@@ -445,9 +447,10 @@
|
||||
const char *proto = "HTTP/1.1";
|
||||
const char *status = "200";
|
||||
const char *msg = "Ok";
|
||||
- const char *body = NULL;
|
||||
+ char *body = NULL;
|
||||
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
|
||||
AZ(hp->client);
|
||||
assert(!strcmp(av[0], "txresp"));
|
||||
@@ -482,7 +485,7 @@
|
||||
for(; *av != NULL; av++) {
|
||||
if (!strcmp(*av, "-body")) {
|
||||
AZ(body);
|
||||
- body = av[1];
|
||||
+ REPLACE(body, av[1]);
|
||||
av++;
|
||||
} else if (!strcmp(*av, "-bodylen")) {
|
||||
AZ(body);
|
||||
@@ -515,6 +518,7 @@
|
||||
struct http *hp;
|
||||
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
|
||||
AZ(hp->client);
|
||||
assert(!strcmp(av[0], "rxreq"));
|
||||
@@ -544,6 +548,7 @@
|
||||
const char *body = NULL;
|
||||
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
|
||||
AN(hp->client);
|
||||
assert(!strcmp(av[0], "txreq"));
|
||||
@@ -609,6 +614,7 @@
|
||||
int i;
|
||||
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
|
||||
AN(av[1]);
|
||||
AZ(av[2]);
|
||||
@@ -628,6 +634,7 @@
|
||||
struct http *hp;
|
||||
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
|
||||
AN(av[1]);
|
||||
AZ(av[2]);
|
||||
@@ -646,6 +653,7 @@
|
||||
struct http *hp;
|
||||
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
|
||||
AN(av[1]);
|
||||
AZ(av[2]);
|
||||
@@ -692,7 +700,7 @@
|
||||
q = strchr(s, '\0');
|
||||
assert(q > s);
|
||||
AN(s);
|
||||
- parse_string(s, http_cmds, hp);
|
||||
+ parse_string(s, http_cmds, hp, vl);
|
||||
vsb_delete(hp->vsb);
|
||||
free(hp->rxbuf);
|
||||
free(hp);
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/vtc_log.c bin/varnishtest/vtc_log.c
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/vtc_log.c 2008-10-08 13:18:24.000000000 +0200
|
||||
+++ bin/varnishtest/vtc_log.c 2008-10-09 13:49:16.000000000 +0200
|
||||
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
- * $Id: vtc_log.c 3248 2008-10-05 10:40:46Z phk $
|
||||
+ * $Id: vtc_log.c 3272 2008-10-09 11:39:24Z phk $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -62,6 +62,15 @@
|
||||
return (vl);
|
||||
}
|
||||
|
||||
+void
|
||||
+vtc_logclose(struct vtclog *vl)
|
||||
+{
|
||||
+
|
||||
+ CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC);
|
||||
+ vsb_delete(vl->vsb);
|
||||
+ FREE_OBJ(vl);
|
||||
+}
|
||||
+
|
||||
static const char *lead[] = {
|
||||
"----",
|
||||
"# ",
|
||||
@@ -77,6 +86,7 @@
|
||||
vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...)
|
||||
{
|
||||
|
||||
+ CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC);
|
||||
assert(lvl < NLEAD);
|
||||
if (lvl > vtc_verbosity)
|
||||
return;
|
||||
@@ -91,8 +101,11 @@
|
||||
AZ(vsb_overflowed(vl->vsb));
|
||||
(void)fputs(vsb_data(vl->vsb), stdout);
|
||||
vsb_clear(vl->vsb);
|
||||
- if (lvl == 0)
|
||||
+ if (lvl == 0) {
|
||||
+ printf("---- TEST FILE: %s\n", vtc_file);
|
||||
+ printf("---- TEST DESCRIPTION: %s\n", vtc_desc);
|
||||
exit (1);
|
||||
+ }
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
@@ -105,6 +118,7 @@
|
||||
{
|
||||
int nl = 1;
|
||||
|
||||
+ CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC);
|
||||
assert(lvl < NLEAD);
|
||||
if (lvl > vtc_verbosity)
|
||||
return;
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/vtc_sema.c bin/varnishtest/vtc_sema.c
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/vtc_sema.c 2008-10-08 13:18:24.000000000 +0200
|
||||
+++ bin/varnishtest/vtc_sema.c 2008-10-09 13:49:16.000000000 +0200
|
||||
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
- * $Id: vtc_sema.c 3012 2008-07-24 12:22:35Z des $
|
||||
+ * $Id: vtc_sema.c 3272 2008-10-09 11:39:24Z phk $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -42,7 +42,6 @@
|
||||
unsigned magic;
|
||||
#define SEMA_MAGIC 0x29b64317
|
||||
char *name;
|
||||
- struct vtclog *vl;
|
||||
VTAILQ_ENTRY(sema) list;
|
||||
pthread_mutex_t mtx;
|
||||
pthread_cond_t cond;
|
||||
@@ -59,17 +58,15 @@
|
||||
*/
|
||||
|
||||
static struct sema *
|
||||
-sema_new(char *name)
|
||||
+sema_new(char *name, struct vtclog *vl)
|
||||
{
|
||||
struct sema *r;
|
||||
|
||||
ALLOC_OBJ(r, SEMA_MAGIC);
|
||||
AN(r);
|
||||
- r->vl = vtc_logopen(name);
|
||||
- AN(r->vl);
|
||||
r->name = name;
|
||||
if (*name != 'r')
|
||||
- vtc_log(r->vl, 0, "Sema name must start with 'r'");
|
||||
+ vtc_log(vl, 0, "Sema name must start with 'r' (%s)", *name);
|
||||
|
||||
AZ(pthread_mutex_init(&r->mtx, NULL));
|
||||
AZ(pthread_cond_init(&r->cond, NULL));
|
||||
@@ -84,24 +81,31 @@
|
||||
*/
|
||||
|
||||
static void
|
||||
-sema_sync(struct sema *r, const char *av)
|
||||
+sema_sync(struct sema *r, const char *av, struct vtclog *vl)
|
||||
{
|
||||
unsigned u;
|
||||
|
||||
+ CHECK_OBJ_NOTNULL(r, SEMA_MAGIC);
|
||||
u = strtoul(av, NULL, 0);
|
||||
|
||||
AZ(pthread_mutex_lock(&r->mtx));
|
||||
if (r->expected == 0)
|
||||
r->expected = u;
|
||||
- assert(r->expected == u);
|
||||
+ if (r->expected != u)
|
||||
+ vtc_log(vl, 0,
|
||||
+ "Sema(%s) use error: different expectations (%u vs %u)",
|
||||
+ r->name, r->expected, u);
|
||||
|
||||
if (++r->waiters == r->expected) {
|
||||
- vtc_log(r->vl, 4, "Wake %u", r->expected);
|
||||
+ vtc_log(vl, 4, "Sema(%s) wake %u", r->name, r->expected);
|
||||
AZ(pthread_cond_broadcast(&r->cond));
|
||||
r->waiters = 0;
|
||||
r->expected = 0;
|
||||
- } else
|
||||
+ } else {
|
||||
+ vtc_log(vl, 4, "Sema(%s) wait %u of %u",
|
||||
+ r->name, r->waiters, r->expected);
|
||||
AZ(pthread_cond_wait(&r->cond, &r->mtx));
|
||||
+ }
|
||||
AZ(pthread_mutex_unlock(&r->mtx));
|
||||
}
|
||||
|
||||
@@ -121,9 +125,10 @@
|
||||
AZ(pthread_mutex_lock(&sema_mtx));
|
||||
/* Reset and free */
|
||||
VTAILQ_FOREACH_SAFE(r, &semas, list, r2) {
|
||||
- VTAILQ_REMOVE(&semas, r, list);
|
||||
- FREE_OBJ(r);
|
||||
- /* XXX: MEMLEAK */
|
||||
+ AZ(pthread_mutex_lock(&r->mtx));
|
||||
+ AZ(r->waiters);
|
||||
+ AZ(r->expected);
|
||||
+ AZ(pthread_mutex_unlock(&r->mtx));
|
||||
}
|
||||
AZ(pthread_mutex_unlock(&sema_mtx));
|
||||
return;
|
||||
@@ -137,7 +142,7 @@
|
||||
if (!strcmp(r->name, av[0]))
|
||||
break;
|
||||
if (r == NULL)
|
||||
- r = sema_new(av[0]);
|
||||
+ r = sema_new(av[0], vl);
|
||||
AZ(pthread_mutex_unlock(&sema_mtx));
|
||||
av++;
|
||||
|
||||
@@ -145,10 +150,10 @@
|
||||
if (!strcmp(*av, "sync")) {
|
||||
av++;
|
||||
AN(*av);
|
||||
- sema_sync(r, *av);
|
||||
+ sema_sync(r, *av, vl);
|
||||
continue;
|
||||
}
|
||||
- vtc_log(r->vl, 0, "Unknown sema argument: %s", *av);
|
||||
+ vtc_log(vl, 0, "Unknown sema argument: %s", *av);
|
||||
}
|
||||
}
|
||||
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/vtc_server.c bin/varnishtest/vtc_server.c
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/vtc_server.c 2008-10-08 13:18:24.000000000 +0200
|
||||
+++ bin/varnishtest/vtc_server.c 2008-10-09 13:49:16.000000000 +0200
|
||||
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
- * $Id: vtc_server.c 3157 2008-09-02 20:20:48Z phk $
|
||||
+ * $Id: vtc_server.c 3272 2008-10-09 11:39:24Z phk $
|
||||
*/
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
int depth;
|
||||
int sock;
|
||||
- const char *listen;
|
||||
+ char *listen;
|
||||
struct vss_addr **vss_addr;
|
||||
char *addr;
|
||||
char *port;
|
||||
@@ -109,20 +109,20 @@
|
||||
*/
|
||||
|
||||
static struct server *
|
||||
-server_new(char *name)
|
||||
+server_new(const char *name)
|
||||
{
|
||||
struct server *s;
|
||||
|
||||
+ AN(name);
|
||||
ALLOC_OBJ(s, SERVER_MAGIC);
|
||||
AN(s);
|
||||
- s->name = name;
|
||||
+ REPLACE(s->name, name);
|
||||
s->vl = vtc_logopen(name);
|
||||
AN(s->vl);
|
||||
- if (*name != 's') {
|
||||
+ if (*s->name != 's')
|
||||
vtc_log(s->vl, 0, "Server name must start with 's'");
|
||||
- exit (1);
|
||||
- }
|
||||
- s->listen = "127.0.0.1:9080";
|
||||
+
|
||||
+ REPLACE(s->listen, "127.0.0.1:9080");
|
||||
AZ(VSS_parse(s->listen, &s->addr, &s->port));
|
||||
s->repeat = 1;
|
||||
s->depth = 1;
|
||||
@@ -132,6 +132,22 @@
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
+ * Clean up a server
|
||||
+ */
|
||||
+
|
||||
+static void
|
||||
+server_delete(struct server *s)
|
||||
+{
|
||||
+
|
||||
+ CHECK_OBJ_NOTNULL(s, SERVER_MAGIC);
|
||||
+ vtc_logclose(s->vl);
|
||||
+ free(s->listen);
|
||||
+ free(s->name);
|
||||
+ /* XXX: MEMLEAK (?) (VSS ??) */
|
||||
+ FREE_OBJ(s);
|
||||
+}
|
||||
+
|
||||
+/**********************************************************************
|
||||
* Start the server thread
|
||||
*/
|
||||
|
||||
@@ -211,6 +227,7 @@
|
||||
|
||||
(void)priv;
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
|
||||
if (av == NULL) {
|
||||
/* Reset and free */
|
||||
@@ -218,8 +235,7 @@
|
||||
VTAILQ_REMOVE(&servers, s, list);
|
||||
if (s->sock >= 0)
|
||||
server_wait(s);
|
||||
- FREE_OBJ(s);
|
||||
- /* XXX: MEMLEAK */
|
||||
+ server_delete(s);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -241,7 +257,7 @@
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(*av, "-listen")) {
|
||||
- s->listen = av[1];
|
||||
+ REPLACE(s->listen, av[1]);
|
||||
AZ(VSS_parse(s->listen, &s->addr, &s->port));
|
||||
av++;
|
||||
continue;
|
||||
diff -Naur ../varnish-2.0-rc1/bin/varnishtest/vtc_varnish.c bin/varnishtest/vtc_varnish.c
|
||||
--- ../varnish-2.0-rc1/bin/varnishtest/vtc_varnish.c 2008-10-08 13:18:24.000000000 +0200
|
||||
+++ bin/varnishtest/vtc_varnish.c 2008-10-09 13:49:16.000000000 +0200
|
||||
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
- * $Id: vtc_varnish.c 3242 2008-10-01 08:27:59Z phk $
|
||||
+ * $Id: vtc_varnish.c 3272 2008-10-09 11:39:24Z phk $
|
||||
*/
|
||||
|
||||
|
||||
@@ -131,21 +131,20 @@
|
||||
*/
|
||||
|
||||
static struct varnish *
|
||||
-varnish_new(char *name)
|
||||
+varnish_new(const char *name)
|
||||
{
|
||||
struct varnish *v;
|
||||
|
||||
+ AN(name);
|
||||
ALLOC_OBJ(v, VARNISH_MAGIC);
|
||||
AN(v);
|
||||
- v->name = name;
|
||||
+ REPLACE(v->name, name);
|
||||
v->vl = vtc_logopen(name);
|
||||
AN(v->vl);
|
||||
v->vl1 = vtc_logopen(name);
|
||||
AN(v->vl1);
|
||||
- if (*name != 'v') {
|
||||
+ if (*v->name != 'v')
|
||||
vtc_log(v->vl, 0, "Varnish name must start with 'v'");
|
||||
- exit (1);
|
||||
- }
|
||||
|
||||
v->args = "";
|
||||
v->telnet = "127.0.0.1:9001";
|
||||
@@ -156,6 +155,21 @@
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
+ * Delete a varnish instance
|
||||
+ */
|
||||
+
|
||||
+static void
|
||||
+varnish_delete(struct varnish *v)
|
||||
+{
|
||||
+
|
||||
+ CHECK_OBJ_NOTNULL(v, VARNISH_MAGIC);
|
||||
+ vtc_logclose(v->vl);
|
||||
+ free(v->name);
|
||||
+ /* XXX: MEMLEAK */
|
||||
+ FREE_OBJ(v);
|
||||
+}
|
||||
+
|
||||
+/**********************************************************************
|
||||
* Varnish listener
|
||||
*/
|
||||
|
||||
@@ -418,8 +432,8 @@
|
||||
*/
|
||||
|
||||
static void
|
||||
-varnish_expect(struct varnish *v, char * const *av) {
|
||||
- uint64_t val, ref;
|
||||
+varnish_expect(const struct varnish *v, char * const *av) {
|
||||
+ uint64_t val, ref;
|
||||
int good;
|
||||
char *p;
|
||||
int i;
|
||||
@@ -428,6 +442,7 @@
|
||||
|
||||
for (i = 0; i < 10; i++, usleep(100000)) {
|
||||
|
||||
+
|
||||
#define MAC_STAT(n, t, f, d) \
|
||||
if (!strcmp(av[0], #n)) { \
|
||||
val = v->stats->n; \
|
||||
@@ -435,6 +450,7 @@
|
||||
#include "stat_field.h"
|
||||
#undef MAC_STAT
|
||||
{
|
||||
+ val = 0;
|
||||
vtc_log(v->vl, 0, "stats field %s unknown", av[0]);
|
||||
}
|
||||
|
||||
@@ -472,6 +488,7 @@
|
||||
|
||||
(void)priv;
|
||||
(void)cmd;
|
||||
+ (void)vl;
|
||||
|
||||
if (av == NULL) {
|
||||
/* Reset and free */
|
||||
@@ -479,8 +496,7 @@
|
||||
if (v->cli_fd >= 0)
|
||||
varnish_wait(v);
|
||||
VTAILQ_REMOVE(&varnishes, v, list);
|
||||
- FREE_OBJ(v);
|
||||
- /* XXX: MEMLEAK */
|
||||
+ varnish_delete(v);
|
||||
}
|
||||
return;
|
||||
}
|
Loading…
Reference in New Issue
Block a user