From knutroy at projects.linpro.no Tue Feb 6 21:55:04 2007 From: knutroy at projects.linpro.no (knutroy at projects.linpro.no) Date: Tue, 6 Feb 2007 22:55:04 +0100 (CET) Subject: r1241 - in trunk/varnish-tools/regress: . lib/Varnish lib/Varnish/Test Message-ID: <20070206215504.79BA81EC3D4@projects.linpro.no> Author: knutroy Date: 2007-02-06 22:55:03 +0100 (Tue, 06 Feb 2007) New Revision: 1241 Added: trunk/varnish-tools/regress/lib/Varnish/Test/Expression.pm trunk/varnish-tools/regress/lib/Varnish/Test/Invocation.pm trunk/varnish-tools/regress/lib/Varnish/Test/Message.pm trunk/varnish-tools/regress/lib/Varnish/Test/Parser.pm trunk/varnish-tools/regress/lib/Varnish/Test/Reference.pm trunk/varnish-tools/regress/lib/Varnish/Test/Statement.pm Removed: trunk/varnish-tools/regress/lib/Varnish/Test/Code.pm trunk/varnish-tools/regress/lib/Varnish/Test/Token.pm trunk/varnish-tools/regress/lib/Varnish/Test/Tokenizer.pm Modified: trunk/varnish-tools/regress/lib/Varnish/Test.pm trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm trunk/varnish-tools/regress/lib/Varnish/Test/Client.pm trunk/varnish-tools/regress/lib/Varnish/Test/Context.pm trunk/varnish-tools/regress/lib/Varnish/Test/Object.pm trunk/varnish-tools/regress/lib/Varnish/Test/Request.pm trunk/varnish-tools/regress/lib/Varnish/Test/Response.pm trunk/varnish-tools/regress/lib/Varnish/Test/Server.pm trunk/varnish-tools/regress/test1 trunk/varnish-tools/regress/varnish-regress.pl Log: Updated regression test framework, but more work is still needed. Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -33,4 +33,12 @@ use strict; use base 'Varnish::Test::Object'; +sub run($) { + my $self = shift; + + print "Running case \"$self->{name}\"...\n"; + + &Varnish::Test::Object::run($self); +} + 1; Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Client.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Client.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Client.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -35,21 +35,64 @@ use IO::Socket; use URI; -sub request($$$) { +sub _init($) { my $self = shift; - my $server = shift; - my $url = shift; + $self->set('protocol', '1.1'); + $self->set('request', \&request); +} + +sub request($$) { + my $self = shift; + my $invocation = shift; + + my $server = $invocation->{'args'}[0]->{'return'}; + my $uri = $invocation->{'args'}[1]->{'return'}; + (defined($server) && ($server->isa('Varnish::Test::Accelerator') || $server->isa('Varnish::Test::Server'))) or die("invalid server\n"); - $url = URI->new($url) - or die("invalid URL\n"); - # GET $uri->path_query HTTP/$self->{'protocol'} - # Host: $uri->host_port - # Connection: xxx + $uri = new URI($uri) + or die("invalid URI\n"); + + my $fh = new IO::Socket::INET(Proto => 'tcp', + PeerAddr => $server->get('address'), + PeerPort => $server->get('port')) + or die "socket: $@"; + + my $mux = $self->get_mux; + $mux->add($fh); + $mux->set_callback_object($self, $fh); + + $mux->write($fh, "Hello\r\n"); + print "Client sent: Hello\n"; + + $self->{'request'} = $invocation; } +sub mux_input($$$$) { + my $self = shift; + my $mux = shift; + my $fh = shift; + my $data = shift; + + $self->{'request'}->{'return'} = $$data; + print "Client got: $$data"; + $$data = ""; + $self->{'request'}->{'finished'} = 1; + delete $self->{'request'}; + $self->super_run; +} + +sub mux_eof($$$$) { + my $self = shift; + my $mux = shift; + my $fh = shift; + my $data = shift; + + $mux->close($fh); +} + 1; Deleted: trunk/varnish-tools/regress/lib/Varnish/Test/Code.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Code.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Code.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -1,67 +0,0 @@ -#!/usr/bin/perl -Tw -#- -# Copyright (c) 2006 Linpro AS -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer -# in this position and unchanged. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $Id$ -# - -package Varnish::Test::Code; - -use strict; - -sub new($$$) { - my $this = shift; - my $class = ref($this) || $this; - my $context = shift; - - my $self = { - 'context' => $context, - }; - bless($self, $class); - - $self->_parse(shift) - if (@_); - - return $self; -} - -sub _parse($$) { - my $self = shift; - my $t = shift; - - print STDERR "\t"; - while (!$t->peek()->is("SemiColon")) { - print STDERR " " . $t->peek()->value(); - $t->shift(); - } - $t->shift("SemiColon"); - print STDERR ";\n"; -} - -sub run($) { -} - -1; Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Context.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Context.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Context.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -38,21 +38,41 @@ # parent, from which it inherits variables and procedures. # -sub new($;$) { +sub new($$;$) { my $this = shift; my $class = ref($this) || $this; + my $name = shift; my $parent = shift; my $self = { - 'parent' => $parent, + 'name' => $name, 'vars' => { }, - 'procs' => { }, }; bless($self, $class); + $self->set_parent($parent); + return $self; } +sub set_parent($$) { + my $self = shift; + my $parent = shift; + + if (defined($self->{'name'})) { + if (defined($self->{'parent'})) { + # Unlink from old parent. + $self->{'parent'}->unset($self->{'name'}); + } + if (defined($parent)) { + # Link to new parent. + $parent->set($self->{'name'}, $self); + } + } + + $self->{'parent'} = $parent; +} + sub parent($) { my $self = shift; @@ -65,12 +85,6 @@ return $self->{'vars'}; } -sub procs($) { - my $self = shift; - - return $self->{'procs'}; -} - sub set($$$) { my $self = shift; my $key = shift; @@ -85,12 +99,19 @@ return $value; } +sub unset($$) { + my $self = shift; + my $key = shift; + + delete $self->vars->{$key} if exists($self->vars->{$key}); +} + sub has($$) { my $self = shift; my $key = shift; return exists($self->{'vars'}->{$key}) || - $self->parent->has($key); + $self->parent && $self->parent->has($key); } sub get($$) { Added: trunk/varnish-tools/regress/lib/Varnish/Test/Expression.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Expression.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Expression.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -0,0 +1,124 @@ +#!/usr/bin/perl -Tw +#- +# Copyright (c) 2006 Linpro AS +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer +# in this position and unchanged. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $Id$ +# + +package Varnish::Test::Expression; + +use strict; +use base 'Varnish::Test::Object'; +use Varnish::Test::Invocation; + +sub new($$;$) { + my $this = shift; + my $class = ref($this) || $this; + my $terms = shift; + my $force_create = shift; + + if (@$terms == 1 && (!$force_create || ref($$terms[0]) eq $class)) { + return $$terms[0]; + } + + my $children = []; + + if (@$terms == 2 + && ref($$terms[0]) eq 'Varnish::Test::Reference' + && ref($$terms[1]) eq 'ARRAY') { + my $invocation = new Varnish::Test::Invocation($$terms[0], $$terms[1]); + push (@$children, $invocation); + undef $terms; + } + else { + foreach my $term (@$terms) { + push (@$children, $term) if ref($term) eq 'Varnish::Test::Expression'; + } + } + + my $self = new Varnish::Test::Object(undef, $children); + bless($self, $class); + $self->{'terms'} = $terms; + + return $self; +} + +sub run($) { + my $self = shift; + + return if $self->{'finished'}; + + &Varnish::Test::Object::run($self); + + if ($self->{'finished'} && defined($self->{'terms'})) { + my $expr = ''; + my $return_as_string = 0; + + foreach my $term (@{$self->{'terms'}}) { + my $term_value; + if (ref($term) eq 'Varnish::Test::Expression') { + $term_value = $term->{'return'}; + } + elsif (ref($term) eq 'Varnish::Test::Reference') { + $term_value = $term->get_value($self); + if (!defined($term_value)) { + die '"' . $term->as_string . '"' . " not defined"; + } + } + else { + $term_value = $term; + } + + if (ref(\$term_value) eq 'REF') { + if (@{$self->{'terms'}} == 1) { + $self->{'return'} = $term_value; + return; + } + else { + die "Found object/context reference in complex expression."; + } + } + + if ($term_value =~ /^".*"$/s) { + $return_as_string = 1; + } + + $expr .= $term_value; + } + + ($expr) = $expr =~ /(.*)/s; + + $expr = eval $expr; + + if ($return_as_string) { + $expr = '"' . $expr . '"'; + } + + $self->{'return'} = $expr; + } +} + +1; Added: trunk/varnish-tools/regress/lib/Varnish/Test/Invocation.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Invocation.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Invocation.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -0,0 +1,69 @@ +#!/usr/bin/perl -Tw +#- +# Copyright (c) 2006 Linpro AS +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer +# in this position and unchanged. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $Id$ +# + +package Varnish::Test::Invocation; + +use strict; +use base 'Varnish::Test::Object'; + +sub new($$$) { + my $this = shift; + my $class = ref($this) || $this; + my $func_id = shift; + my $args = shift; + + my $self = new Varnish::Test::Object(undef, $args); + bless($self, $class); + + $self->{'func_id'} = $func_id; + $self->{'args'} = $args; + + return $self; +} + +sub run($) { + my $self = shift; + + return if $self->{'finished'}; + + &Varnish::Test::Object::run($self) unless $self->{'in_call'}; + + if ($self->{'finished'}) { + $self->{'finished'} = 0; + if (!$self->{'in_call'}) { + $self->{'in_call'} = 1; + my ($func_ptr, $func_context) = $self->{'func_id'}->get_function($self); + print "Calling " . $self->{'func_id'}->as_string, "\n"; + &$func_ptr($func_context, $self); + } + } +} + +1; Added: trunk/varnish-tools/regress/lib/Varnish/Test/Message.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Message.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Message.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -0,0 +1,36 @@ +#!/usr/bin/perl -Tw +#- +# Copyright (c) 2006 Linpro AS +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer +# in this position and unchanged. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $Id$ +# + +package Varnish::Test::Message; + +use strict; +use base 'Varnish::Test::Object'; + +1; Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Object.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Object.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Object.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -32,51 +32,67 @@ use strict; use base 'Varnish::Test::Context'; -use Varnish::Test::Code; -sub new($$;$) { +sub new($$$;$) { my $this = shift; my $class = ref($this) || $this; + my $name = shift; + my $children = shift; my $parent = shift; - my $self = Varnish::Test::Context->new($parent); - $self->{'code'} = []; + my $self = new Varnish::Test::Context($name, $parent); bless($self, $class); - $self->_init(); + for my $child (@$children) { + $child->set_parent($self); + } - $self->_parse($_[0]) - if (@_); + $self->{'children'} = $children; + $self->{'finished'} = 0; + $self->{'return'} = undef; + $self->_init; return $self; } sub _init($) { +} + +sub run($) { my $self = shift; - # nothing + return if $self->{'finished'}; + + foreach my $child (@{$self->{'children'}}) { + $child->run($self) unless $child->{'finished'}; + return unless $child->{'finished'}; + $self->{'return'} = $child->{'return'}; + } + + $self->{'finished'} = 1; } -sub _parse($$) { +sub shutdown($) { my $self = shift; - my $t = shift; - $t->shift_keyword(lc($self->type)); - $self->name($t->shift("Identifier")->value); - $t->shift("LeftBrace"); - while (!$t->peek()->is("RightBrace")) { - push(@{$self->{'code'}}, Varnish::Test::Code->new($self, $t)); -# $token = $t->shift("Identifier"); -# my $key = $token->value; -# $token = $t->shift("Assign"); -# $token = $t->shift("Integer", "Real", "String"); -# my $value = $token->value; -# $token = $t->shift("SemiColon"); -# $t->warn("multiple assignments to $self->{'name'}.$key") -# if ($self->has($key)); -# $self->set($key, $value); + foreach my $child (@{$self->{'children'}}) { + $child->shutdown; } - $t->shift("RightBrace"); } +sub get_mux($) { + my $self = shift; + return $self->{'mux'} || $self->{'parent'} && $self->{'parent'}->get_mux; +} + +sub super_run($) { + my $self = shift; + if (defined($self->{'parent'})) { + $self->{'parent'}->super_run; + } + else { + $self->run; + } +} + 1; Added: trunk/varnish-tools/regress/lib/Varnish/Test/Parser.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Parser.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Parser.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -0,0 +1,133 @@ +#!/usr/bin/perl -Tw +#- +# Copyright (c) 2007 Linpro AS +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer +# in this position and unchanged. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $Id$ +# + +package Varnish::Test::Parser; + +use strict; + +use Parse::RecDescent; +use Varnish::Test::Reference; +use Varnish::Test::Expression; +use Varnish::Test::Statement; +use Varnish::Test::Client; +use Varnish::Test::Server; +use Varnish::Test::Accelerator; +use Varnish::Test::Case; + +sub new { + return new Parse::RecDescent(<<'EOG'); + +STRING_LITERAL: + { extract_delimited($text, '"') } + +IDENTIFIER: + /[a-z]\w*/i + +CONSTANT: + /[+-]?(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?/ + +reference: + + { new Varnish::Test::Reference($item[1]) } + +argument_list: + + +call: + reference '(' argument_list(?) ')' + { new Varnish::Test::Expression([$item[1], (@{$item[3]}) ? $item[3][0] : []]) } + | + +primary_expression: + call + | reference + | STRING_LITERAL + | CONSTANT + | '(' expression ')' + { $item[2] } + +mul_op: + '*' | '/' | '%' + +multiplicative_expression: + + { new Varnish::Test::Expression($item[1]) } + +add_op: + '+' | '-' | '.' + +additive_expression: + + { new Varnish::Test::Expression($item[1]) } + +rel_op: + '==' | '!=' | '<=' | '>=' | '<' | '>' + +expression: + additive_expression rel_op additive_expression + { new Varnish::Test::Expression([@item[1..$#item]], 1) } + | additive_expression + { new Varnish::Test::Expression([$item[1]], 1) } + | + +statement: + reference '=' expression + { new Varnish::Test::Statement([@item[1..3]]) } + | call + { new Varnish::Test::Statement([$item[1]]) } + +block: + '{' statement(s? /;/) (';')(?) '}' + { $item[2] } + | + +object: + 'ticket' CONSTANT ';' + { [@item[1,2]] } + | 'client' IDENTIFIER block + { new Varnish::Test::Client(@item[2,3]) } + | 'server' IDENTIFIER block + { new Varnish::Test::Server(@item[2,3]) } + | 'accelerator' IDENTIFIER block + { new Varnish::Test::Accelerator(@item[2,3]) } + | 'case' IDENTIFIER block + { new Varnish::Test::Case(@item[2,3]) } + | + +module: + 'test' STRING_LITERAL(?) '{' object(s?) '}' /^\Z/ + { { 'id' => (@{$item[2]}) ? $item[2][0] : undef, + 'body' => $item[4] } } + | + +EOG +} + +1; Added: trunk/varnish-tools/regress/lib/Varnish/Test/Reference.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Reference.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Reference.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -0,0 +1,105 @@ +#!/usr/bin/perl -Tw +#- +# Copyright (c) 2006 Linpro AS +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer +# in this position and unchanged. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $Id$ +# + +package Varnish::Test::Reference; + +use strict; + +sub new($$) { + my $this = shift; + my $class = ref($this) || $this; + my $symbols = shift; + + my $self = { + 'symbols' => $symbols, + }; + bless($self, $class); + + return $self; +} + +sub as_string($) { + my $self = shift; + return join('.', @{$self->{'symbols'}}); +} + +sub _find_context($$) { + my $self = shift; + my $context = shift; + + foreach my $symbol (@{$self->{'symbols'}}[0..$#{$self->{'symbols'}}-1]) { + $context = $context->get($symbol); + if (!(ref($context) =~ /^Varnish::Test::\w+$/ + && $context->isa('Varnish::Test::Context'))) { + return undef; + } + } + + return $context; +} + +sub get_value($$) { + my $self = shift; + my $context = shift; + + $context = $self->_find_context($context); + if (defined($context)) { + return $context->get($self->{'symbols'}[$#{$self->{'symbols'}}]); + } + else { + return undef; + } +} + +sub set_value($$) { + my $self = shift; + my $context = shift; + my $value = shift; + + $context = $self->_find_context($context); + if (defined($context)) { + $context->set($self->{'symbols'}[$#{$self->{'symbols'}}], $value); + } + else { + die "Cannot find containing context for ", join('.', @{$self->{'symbols'}}), ".\n"; + } +} + +sub get_function($$) { + my $self = shift; + my $context = shift; + + $context = $self->_find_context($context); + if (defined($context)) { + return ($context->get($self->{'symbols'}[$#{$self->{'symbols'}}]), $context); + } +} + +1; Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Request.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Request.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Request.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -31,6 +31,6 @@ package Varnish::Test::Request; use strict; -use base 'Varnish::Test::Object'; +use base 'Varnish::Test::Message'; 1; Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Response.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Response.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Response.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -31,6 +31,6 @@ package Varnish::Test::Response; use strict; -use base 'Varnish::Test::Object'; +use base 'Varnish::Test::Message'; 1; Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Server.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Server.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Server.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -32,12 +32,60 @@ use strict; use base 'Varnish::Test::Object'; +use IO::Socket; sub _init($) { my $self = shift; - $self->vars->{'address'} = 'localhost'; - $self->vars->{'port'} = '9001'; + $self->set('address', 'localhost'); + $self->set('port', '9001'); } +sub run($) { + my $self = shift; + + return if $self->{'finished'}; + + &Varnish::Test::Object::run($self); + + my $fh = new IO::Socket::INET(Proto => 'tcp', + LocalAddr => $self->get('address'), + LocalPort => $self->get('port'), + Listen => 4) + or die "socket: $@"; + + $self->{'fh'} = $fh; + + my $mux = $self->get_mux; + $mux->listen($fh); + $mux->set_callback_object($self, $fh); +} + +sub shutdown($) { + my $self = shift; + + $self->get_mux->close($self->{'fh'}); +} + +sub mux_connection($$$) { + my $self = shift; + my $mux = shift; + my $fh = shift; + + $mux->set_callback_object($self, $fh); +} + +sub mux_input($$$$) { + my $self = shift; + my $mux = shift; + my $fh = shift; + my $data = shift; + + print "Server got: $$data"; + $$data = ""; + $mux->write($fh, "HTTP/1.1 200 OK\r\n"); + print "Server sent: HTTP/1.1 200 OK\n"; + $mux->shutdown($fh, 1); +} + 1; Added: trunk/varnish-tools/regress/lib/Varnish/Test/Statement.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Statement.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Statement.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -0,0 +1,68 @@ +#!/usr/bin/perl -Tw +#- +# Copyright (c) 2006 Linpro AS +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer +# in this position and unchanged. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $Id$ +# + +package Varnish::Test::Statement; + +use strict; +use base 'Varnish::Test::Object'; + +sub new($$) { + my $this = shift; + my $class = ref($this) || $this; + my $args = shift; + + my $children = []; + + if (@$args > 1 && $$args[1] eq '=') { + my $self = new Varnish::Test::Object(undef, [$$args[2]]); + bless($self, $class); + + $self->{'lhs'} = $$args[0]; + + return $self; + } + else { + return $$args[0]; + } +} + +sub run($$) { + my $self = shift; + + return if $self->{'finished'}; + + &Varnish::Test::Object::run($self); + + if ($self->{'finished'}) { + $self->{'lhs'}->set_value($self, $self->{'return'}); + } +} + +1; Deleted: trunk/varnish-tools/regress/lib/Varnish/Test/Token.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Token.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Token.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -1,168 +0,0 @@ -#!/usr/bin/perl -Tw -#- -# Copyright (c) 2006 Linpro AS -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer -# in this position and unchanged. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $Id$ -# - -package Varnish::Test::Token; - -use strict; - -# Common constructor -sub new { - my $this = shift; - my $class = ref($this) || $this; - my $pos = shift; - - my $self = { - 'pos' => $pos, - 'value' => '???', - }; - bless($self, $class); - - # hack: use eval to avoid clobbering @_ - eval { ($self->{'type'} = $class) =~ s/^(\w+::)*(\w+)$/$2/; }; - - $self->init(@_); - - return $self; -} - -# Default initializer -sub init($;$) { - my $self = shift; - - $self->value(@_); -} - -sub type($;$) { - my $self = shift; - - $self->{'type'} = shift - if (@_); - return $self->{'type'}; -} - -sub value($;$) { - my $self = shift; - - $self->{'value'} = shift - if (@_); - return $self->{'value'}; -} - -sub is($$) { - my $self = shift; - my $type = shift; - - return ($self->{'type'} eq $type); -} - -sub equals($$) { - my $self = shift; - my $other = shift; - - return ($self->type() eq $other->type() && - $self->value() eq $other->value()); -} - -package Varnish::Test::Token::Assign; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::Comma; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::Compare; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::EOF; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::Identifier; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::Integer; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::Keyword; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::LeftBrace; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::LeftParen; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::Period; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::Real; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::RightBrace; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::RightParen; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::SemiColon; - -use strict; -use base 'Varnish::Test::Token'; - -package Varnish::Test::Token::String; - -use strict; -use base 'Varnish::Test::Token'; - -1; Deleted: trunk/varnish-tools/regress/lib/Varnish/Test/Tokenizer.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Tokenizer.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Tokenizer.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -1,185 +0,0 @@ -#!/usr/bin/perl -Tw -#- -# Copyright (c) 2006 Linpro AS -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer -# in this position and unchanged. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $Id$ -# - -package Varnish::Test::Tokenizer; - -use strict; -use Varnish::Test::Token; - -sub new($$) { - my $this = shift; - my $class = ref($this) || $this; - - my $self = {}; - bless($self, $class); - $self->tokenize($_[0]) - if (@_); - - return $self; -} - -sub tokenize($$) { - my $self = shift; - my $fn = shift; - - local *FILE; - local $/; - - $self->{'fn'} = $fn; - $self->{'tokens'} = (); - - open(FILE, "<", $self->{'fn'}) - or die("$self->{'fn'}: $!\n"); - my $spec = ; - close(FILE); - - # tokenize - my @tokens = (); - for (;;) { - my $type = undef; - if ($spec =~ m/\G\s*$/gc) { - # EOF - push(@tokens, Varnish::Test::Token::EOF->new(pos($spec))); - last; - } elsif ($spec =~ m/\G\s*(\*\/\*([^\*]|\*[^\/])+\*\/)/gc) { - # multiline comment - } elsif ($spec =~ m/\G\s*((?:\/\/|\#).*?)\n/gc) { - # single-line comment - } elsif ($spec =~ m/\G\s*\b(\d+\.\d+)\b/gc) { - # real literal - push(@tokens, Varnish::Test::Token::Real->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*\b(\d+)\b/gc) { - # integer literal - push(@tokens, Varnish::Test::Token::Integer->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*\"((?:\\.|[^\"])*)\"/gc) { - # string literal - push(@tokens, Varnish::Test::Token::String->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*\b(accelerator|client|init|server|case|test|ticket)\b/gc) { - # keyword - push(@tokens, Varnish::Test::Token::Keyword->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*\b(\w+)\b/gc) { - # identifier - push(@tokens, Varnish::Test::Token::Identifier->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*(\{)/gc) { - # opening brace - push(@tokens, Varnish::Test::Token::LeftBrace->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*(\})/gc) { - # closing brace - push(@tokens, Varnish::Test::Token::RightBrace->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*(\()/gc) { - # opening paren - push(@tokens, Varnish::Test::Token::LeftParen->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*(\))/gc) { - # closing paren - push(@tokens, Varnish::Test::Token::RightParen->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*(\;)/gc) { - # semicolon - push(@tokens, Varnish::Test::Token::SemiColon->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*(\.)/gc) { - # period - push(@tokens, Varnish::Test::Token::Period->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*(\,)/gc) { - # comma - push(@tokens, Varnish::Test::Token::Comma->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*([\<\>\=\!]=)/gc) { - # comparison operator - push(@tokens, Varnish::Test::Token::Compare->new(pos($spec), $1)); - } elsif ($spec =~ m/\G\s*([\+\-\*\/]?=)/gc) { - # assignment operator - push(@tokens, Varnish::Test::Token::Assign->new(pos($spec), $1)); -# } elsif ($spec =~ m/\G\s*([\+\-\*\/])/gc) { -# # arithmetic operator -# push(@tokens, Varnish::Test::Token::ArOp->new(pos($spec), $1)); - } else { - die "$self->{'fn'}: syntax error\n" . substr($spec, pos($spec)) . "\n"; - } - } - - $self->{'tokens'} = \@tokens; - return @tokens; -} - -sub die($$) { - my $self = shift; - my $msg = shift; - - CORE::die("$self->{'fn'}: $msg\n"); -} - -sub warn($$) { - my $self = shift; - my $msg = shift; - - CORE::warn("$self->{'fn'}: $msg\n"); -} - - -# Return the next token from the input queue, but do not remove it -# from the queue. Fatal if the queue is empty. -sub peek($) { - my $self = shift; - - $self->die("premature end of input") - unless @{$self->{'tokens'}}; - return $self->{'tokens'}->[0]; -} - -# Remove the next token from the input queue and return it. -# Additional (optional) arguments are token types which the next token -# must match. Fatal if the queue is empty, or arguments were provided -# but none matched. -sub shift($;@) { - my $self = CORE::shift; - my @expect = @_; - - $self->die("premature end of input") - unless @{$self->{'tokens'}}; - my $token = shift @{$self->{'tokens'}}; - if (@expect) { - return $token - if grep({ $token->is($_) } @expect); - $self->die("expected " . join(", ", @expect) . ", got " . $token->type); - } - return $token; -} - -# As shift(), but next token must be a keyword and the arguments are -# matched against the token's value rather than its type. -sub shift_keyword($@) { - my $self = CORE::shift; - my @expect = @_; - - my $token = $self->shift("Keyword"); - return $token - if grep({ $token->value eq $_ } @expect); - $self->die("expected " . join(", ", @expect) . ", got " . $token->value); -} - -1; Modified: trunk/varnish-tools/regress/lib/Varnish/Test.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test.pm 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/lib/Varnish/Test.pm 2007-02-06 21:55:03 UTC (rev 1241) @@ -31,84 +31,89 @@ package Varnish::Test; use strict; -use base 'Varnish::Test::Context'; +use base 'Varnish::Test::Object'; use Varnish::Test::Accelerator; use Varnish::Test::Case; use Varnish::Test::Client; use Varnish::Test::Server; -use Varnish::Test::Tokenizer; +use Varnish::Test::Parser; +use IO::Multiplex; +use Data::Dumper; + sub new($;$) { my $this = shift; my $class = ref($this) || $this; + my $fn = shift; - my $self = Varnish::Test::Context->new(); + my $self = new Varnish::Test::Object; bless($self, $class); - $self->parse($_[0]) - if (@_); + $self->{'mux'} = new IO::Multiplex; + + if ($fn) { + $self->parse($fn); + } + return $self; } -sub _parse_ticket($$) { +sub parse($$) { my $self = shift; - my $t = shift; + my $fn = shift; - $t->shift_keyword("ticket"); - push(@{$self->{'ticket'}}, $t->shift("Integer")); - $t->shift("SemiColon"); -} + local $/; + open(SRC, "<", $fn) or die("$fn: $!\n"); + my $src = ; + close(SRC); -sub _parse_test($$) { - my $self = shift; - my $t = shift; + $::RD_HINT = 1; + my $parser = new Varnish::Test::Parser; + if (!defined($parser)) { + die("Error generating parser."); + } + my $tree = $parser->module($src); + if (!defined($tree)) { + die("Parsing error."); + } - my $token = $t->shift_keyword("test"); - $token = $t->shift("String"); - $self->{'descr'} = $token->value; - $token = $t->shift("LeftBrace"); - for (;;) { - $token = $t->peek(); - last if $token->is("RightBrace"); - if (!$token->is("Keyword")) { - $t->die("expected keyword, got " . ref($token)); - } elsif ($token->value eq 'ticket') { - $self->_parse_ticket($t); - } elsif ($token->value eq 'accelerator') { - my $x = Varnish::Test::Accelerator->new($self, $t); - $t->die("duplicate declaration of " . $x->name) - if exists($self->{'vars'}->{$x->name}); - $self->set($x->name, $x); - } elsif ($token->value eq 'client') { - my $x = Varnish::Test::Client->new($self, $t); - $t->die("duplicate declaration of " . $x->name) - if exists($self->{'vars'}->{$x->name}); - $self->set($x->name, $x); - } elsif ($token->value eq 'server') { - my $x = Varnish::Test::Server->new($self, $t); - $t->die("duplicate declaration of " . $x->name) - if exists($self->{'vars'}->{$x->name}); - $self->set($x->name, $x); - } elsif ($token->value eq 'case') { - my $x = Varnish::Test::Case->new($self, $t); - } else { - $t->die("unexpected keyword " . $token->value); + print "###### SYNTAX TREE BEGIN ######\n"; + print Dumper $tree if defined($tree->{'body'}); + print "###### SYNTAX TREE END ######\n"; + + $self->{'objects'} = []; + + foreach my $object (@{$tree->{'body'}}) { + if (ref($object) eq 'ARRAY') { + $self->{$$object[0]} = $$object[1]; } + elsif (ref($object)) { + push(@{$self->{'children'}}, $object); + $object->set_parent($self); + } } - $token = $t->shift("RightBrace"); } -sub parse($$) { +sub main($) { my $self = shift; - my $fn = shift; - my $t = Varnish::Test::Tokenizer->new($fn); - $self->_parse_test($t); + while (!$self->{'finished'}) { + &Varnish::Test::Object::run($self); + print "Entering IO::Multiplex loop.\n"; + $self->{'mux'}->loop; + } + + print "DONE.\n"; } sub run($) { my $self = shift; + return if $self->{'finished'}; + + &Varnish::Test::Object::run($self); + + $self->shutdown if $self->{'finished'}; } 1; Modified: trunk/varnish-tools/regress/test1 =================================================================== --- trunk/varnish-tools/regress/test1 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/test1 2007-02-06 21:55:03 UTC (rev 1241) @@ -21,31 +21,8 @@ comment = "client 1.0, server 1.0"; c1.protocol = "1.0"; s1.protocol = "1.0"; - c1.request(a1, "http://www.example.com/"); - assert(c1.response.protocol == "1.0"); + c1.request(s1, "http://www.example.com/"); + c1.request(s1, "http://www.example.com/"); + c1.request(s1, "http://www.example.com/"); } - - case c10_s11 { - comment = "client 1.0, server 1.1"; - c1.protocol = "1.0"; - s1.protocol = "1.1"; - c1.request(a1, "http://www.example.com/"); - assert(c1.response.protocol == "1.0"); - } - - case c11_s10 { - comment = "client 1.1, server 1.0"; - c1.protocol = "1.1"; - s1.protocol = "1.0"; - c1.request(a1, "http://www.example.com/"); - assert(c1.response.protocol == "1.1"); - } - - case c11_s11 { - comment = "client 1.1, server 1.1"; - c1.protocol = "1.1"; - s1.protocol = "1.1"; - c1.request(a1, "http://www.example.com/"); - assert(c1.response.protocol == "1.1"); - } } Modified: trunk/varnish-tools/regress/varnish-regress.pl =================================================================== --- trunk/varnish-tools/regress/varnish-regress.pl 2007-01-30 12:17:58 UTC (rev 1240) +++ trunk/varnish-tools/regress/varnish-regress.pl 2007-02-06 21:55:03 UTC (rev 1241) @@ -34,6 +34,7 @@ use Data::Dumper; MAIN:{ - my $test = Varnish::Test->new($ARGV[0]); + my $test = new Varnish::Test($ARGV[0]); #print STDERR Dumper($test); + $test->main; } From knutroy at projects.linpro.no Fri Feb 16 13:26:52 2007 From: knutroy at projects.linpro.no (knutroy at projects.linpro.no) Date: Fri, 16 Feb 2007 14:26:52 +0100 (CET) Subject: r1242 - in trunk/varnish-tools/regress: . lib/Varnish lib/Varnish/Test Message-ID: <20070216132652.D08E21EC3B9@projects.linpro.no> Author: knutroy Date: 2007-02-16 14:26:52 +0100 (Fri, 16 Feb 2007) New Revision: 1242 Added: trunk/varnish-tools/regress/README trunk/varnish-tools/regress/TODO Modified: trunk/varnish-tools/regress/lib/Varnish/Test.pm trunk/varnish-tools/regress/lib/Varnish/Test/Accelerator.pm trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm trunk/varnish-tools/regress/lib/Varnish/Test/Client.pm trunk/varnish-tools/regress/lib/Varnish/Test/Expression.pm trunk/varnish-tools/regress/lib/Varnish/Test/Invocation.pm trunk/varnish-tools/regress/lib/Varnish/Test/Server.pm trunk/varnish-tools/regress/lib/Varnish/Test/Statement.pm trunk/varnish-tools/regress/test1 Log: Updated regression test framework so that it runs "test1" sample code. See TODO-file for a (non-exhaustive) list of what remains to be done. Added: trunk/varnish-tools/regress/README =================================================================== --- trunk/varnish-tools/regress/README 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/README 2007-02-16 13:26:52 UTC (rev 1242) @@ -0,0 +1,60 @@ +VARNISH REGRESSION TEST FRAMEWORK + +This is a regression test framework written in Perl. It is being +tailored to the needs of the Varnish HTTP accelerator. + +The framework is based on interpreting a mini-language designed for +this specific purpose. The mini-language expresses test case setups +and conditions to be tested. + +The Perl-based interpreter sets up the run-time environment and +executes a "program" written in this mini-language. + +The mini-language's grammar can be found in lib/Varnish/Test/Parser.pm +which utilizes the Parse::RecDescent CPAN-module. + +The interpreter creates a run-time environment consisting of simulated +clients and servers which live in the main process. In addition, it +forks off a Varnish sub-process through which the clients and servers +send HTTP-traffic. The main process uses a global select(2)-based loop +(using IO::Multiplex) to which all the simulated clients and servers +must relate. Hence, no threading is needed, but disciplined use +sockets (to avoid blocking and other trouble) is required. + +When the mini-language is parsed, a tree of Perl-objects is created. +There are classes representing: + + * a server (Varnish::Test::Server) + * a client (Varnish::Test::Client) + * an accelerator/Varnish instance (Varnish::Test::Accelerator) + * a test-case (Varnish::Test::Case) + * a statement (Varnish::Test::Statement) + * an expression (Varnish::Test::Expression) + * a function invocation (Varnish::Test::Invocation) + +These classes share some properties which are found +Varnish::Test::Object, most notably the ability to be "executed" and +temporarily paused when the IO::Multiplex-loop needs to transfers +control to another object. + +To keep track of execution, all objects have an attribute, "finished", +which tells its parent whether execution has already terminated. In +addition an attribute "return" is used to hold any return value should +the object have a sensible return value to offer (which is the true +for statements, expressions, and function invocations). Before +"finished" is set to true, "return" has no meaning. + +The parent will execute its children sequentially, in the same order +as they are defined in the source code. + +However, some objects get control back after they are "finished". This +is the case for server objects when they serve requests, which happens +asynchronously to ordinary execution and is orchestrated by the +IO::Multiplex-loop. When the server object has handled the request, +control returns to the original point of execution. Finding that point +is done by skipping past all objects whose "finished"-attribute is +true. + +Finally, the notion of scope and variables is taken care of by +functionality provided in the super-class Varnish::Test::Context from +which Varnish::Test::Object inherits. Added: trunk/varnish-tools/regress/TODO =================================================================== --- trunk/varnish-tools/regress/TODO 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/TODO 2007-02-16 13:26:52 UTC (rev 1242) @@ -0,0 +1,23 @@ +* Revise class hierarchy, possibly switching around + Varnish::Test::Context and Varnish::Test::Object since we might like + to inherit the properties of Object without getting the properties + of Context, in classes like Varnish::Test::Statement, + Varnish::Test::Expression, and Varnish::Test::Invocation. + +* Actually handle HTTP by utilizing Varnish::Test::Message (and + the sub-classes Varnish::Test::Request and Varnish::Test::Response) + as variables that live inside server and client objects. + +* Extend the language (syntax and semantics), to make it more + expressive and useful. + +* POD-ify Perl-code. + +* Fix IO::Multiplex-related warnings: + + ? Use of uninitialized value in unpack at /usr/share/perl5/IO/Multiplex.pm line 351. + Use of uninitialized value in numeric eq (==) at /usr/share/perl5/IO/Multiplex.pm line 351. + + ? Use of freed value in iteration at /usr/share/perl5/IO/Multiplex.pm line 721. + + (Is this IO::Multiplex' or our fault?) Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Accelerator.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Accelerator.pm 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Accelerator.pm 2007-02-16 13:26:52 UTC (rev 1242) @@ -32,16 +32,21 @@ use strict; use base 'Varnish::Test::Object'; +use IO::Pipe; use POSIX; sub _init($) { my $self = shift; + &Varnish::Test::Object::_init($self); + # Default address / port $self->vars->{'address'} = 'localhost'; $self->vars->{'port'} = '8001'; } +use Data::Dumper; + sub start($) { my $self = shift; @@ -50,59 +55,129 @@ $backend->isa('Varnish::Test::Server')) or die("invalid server\n"); - my ($stdinx, $stdin) = POSIX::pipe() - or die("pipe(): $!\n"); - my ($stdout, $stdoutx) = POSIX::pipe() - or die("pipe(): $!\n"); - my ($stderr, $stderrx) = POSIX::pipe() - or die("pipe(): $!\n"); + my $stdin = new IO::Pipe; + my $stdout = new IO::Pipe; + my $stderr = new IO::Pipe; my $pid = fork(); if (!defined($pid)) { # fail die("fork(): $!\n"); } elsif ($pid == 0) { # child - POSIX::dup2($stdinx, 0); - POSIX::close($stdin); - POSIX::close($stdinx); - POSIX::dup2($stdoutx, 1); - POSIX::close($stdout); - POSIX::close($stdoutx); - POSIX::dup2($stderrx, 2); - POSIX::close($stderr); - POSIX::close($stderrx); + $stdin->reader; + $stdout->writer; + $stderr->writer; + + POSIX::dup2($stdin->fileno, 0); + $stdin->close; + POSIX::dup2($stdout->fileno, 1); + $stdout->close; + POSIX::dup2($stderr->fileno, 2); + $stderr->close; # XXX must be in path + $ENV{'PATH'} = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'; exec('varnishd', '-d', '-d', + '-a', $self->get('address') . ":" . $self->get('port'), '-b', $backend->get('address') . ":" . $backend->get('port')); exit(1); } # parent + + $stdin->writer; + $stdout->reader; + $stderr->reader; + $self->{'pid'} = $pid; $self->{'stdin'} = $stdin; - POSIX::close($stdinx); $self->{'stdout'} = $stdout; - POSIX::close($stdoutx); $self->{'stderr'} = $stderr; - POSIX::close($stderrx); + + # IO::Multiplex is going to issue some warnings here, because it + # does not handle non-socket file descriptors gently. + + my $mux = $self->get_mux; + $mux->add($stdin); + $mux->set_callback_object($self, $stdin); + $mux->add($stdout); + $mux->set_callback_object($self, $stdout); + $mux->add($stderr); + $mux->set_callback_object($self, $stderr); + + if ($self->has('vcl')) { + my $vcl = $self->get('vcl'); + $vcl =~ s/\n/ /g; + $mux->write($stdin, "vcl.inline main " . $vcl . "\n"); + } } sub stop($) { my $self = shift; - POSIX::close($self->{'stdin'}) - if ($self->{'stdin'}); - POSIX::close($self->{'stdout'}) - if ($self->{'stdout'}); - POSIX::close($self->{'stderr'}) - if ($self->{'stderr'}); + my $mux = $self->get_mux; + + foreach my $k ('stdin', 'stdout', 'stderr') { + if (defined($self->{$k})) { + $mux->close($self->{$k}); + delete $self->{$k}; + } + } sleep(1); kill(15, $self->{'pid'}) if ($self->{'pid'}); - delete($self->{'stdin'}); - delete($self->{'stdout'}); - delete($self->{'stderr'}); delete($self->{'pid'}); } +sub run($) { + my $self = shift; + + return if $self->{'finished'} or defined($self->{'pid'}); + + &Varnish::Test::Object::run($self); + + $self->start; + $self->{'finished'} = 0; +} + +sub shutdown($) { + my $self = shift; + + $self->stop; +} + +sub mux_input($$$$) { + my $self = shift; + my $mux = shift; + my $fh = shift; + my $data = shift; + + print STDERR $$data; + + if ($$data =~ /vcl.inline/) { + $mux->write($self->{'stdin'}, "start\n"); + } + + my $started = ($$data =~ /Child starts/); + $$data = ''; + + if ($started) { + $self->{'finished'} = 1; + $self->super_run; + } +} + +sub mux_eof($$$$) { + my $self = shift; + my $mux = shift; + my $fh = shift; + my $data = shift; + + $mux->close($fh); + foreach my $k ('stdin', 'stdout', 'stderr') { + if (defined($self->{$k}) && $self->{$k} == $fh) { + delete $self->{$k}; + } + } +} + 1; Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Case.pm 2007-02-16 13:26:52 UTC (rev 1242) @@ -33,12 +33,43 @@ use strict; use base 'Varnish::Test::Object'; +sub _init($) { + my $self = shift; + + &Varnish::Test::Object::_init($self); + + $self->set('assert', \&assert); +} + sub run($) { my $self = shift; - print "Running case \"$self->{name}\"...\n"; + if (!defined($self->{'started'})) { + print "Start of CASE \"$self->{name}\"...\n"; + $self->{'started'} = 1; + } &Varnish::Test::Object::run($self); + + if ($self->{'finished'}) { + print "End of CASE \"$self->{name}\".\n"; + } } +sub assert($$) { + my $self = shift; + my $invocation = shift; + + my $bool = $invocation->{'args'}[0]->{'return'}; + + if (!$bool) { + print " ASSERTION DOES NOT HOLD.\n"; + } + else { + print " Assertion holds.\n"; + } + + $invocation->{'finished'} = 1; +} + 1; Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Client.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Client.pm 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Client.pm 2007-02-16 13:26:52 UTC (rev 1242) @@ -38,6 +38,8 @@ sub _init($) { my $self = shift; + &Varnish::Test::Object::_init($self); + $self->set('protocol', '1.1'); $self->set('request', \&request); } @@ -66,8 +68,7 @@ $mux->add($fh); $mux->set_callback_object($self, $fh); - $mux->write($fh, "Hello\r\n"); - print "Client sent: Hello\n"; + $mux->write($fh, "GET / HTTP/" . eval($self->get('protocol')) . "\r\n\r\n"); $self->{'request'} = $invocation; } @@ -77,9 +78,16 @@ my $mux = shift; my $fh = shift; my $data = shift; + my $response = new Varnish::Test::Context('response', $self); $self->{'request'}->{'return'} = $$data; - print "Client got: $$data"; + if ($$data =~ 'HTTP/1.1') { + $response->set('protocol', '1.1'); + } + else { + $response->set('protocol', '1.0'); + } + print STDERR "Client got: $$data"; $$data = ""; $self->{'request'}->{'finished'} = 1; delete $self->{'request'}; Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Expression.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Expression.pm 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Expression.pm 2007-02-16 13:26:52 UTC (rev 1242) @@ -73,9 +73,11 @@ &Varnish::Test::Object::run($self); + my $expr = ''; + my $seen_string = 0; + my $relational = 0; + if ($self->{'finished'} && defined($self->{'terms'})) { - my $expr = ''; - my $return_as_string = 0; foreach my $term (@{$self->{'terms'}}) { my $term_value; @@ -89,6 +91,20 @@ } } else { + if ($term eq '==' || $term eq '!=' + || $term eq '<=' || $term eq '>=' + || $term eq '<' || $term eq '>') { + $relational = 1; + + if ($seen_string) { + if ($term eq '==') { + $term = 'eq'; + } + elsif ($term eq '!=') { + $term = 'ne'; + } + } + } $term_value = $term; } @@ -98,12 +114,12 @@ return; } else { - die "Found object/context reference in complex expression."; + $term_value = '"' . $term_value . '"'; } } if ($term_value =~ /^".*"$/s) { - $return_as_string = 1; + $seen_string = 1; } $expr .= $term_value; @@ -111,9 +127,11 @@ ($expr) = $expr =~ /(.*)/s; + # print STDERR "Evaling: $expr\n"; + $expr = eval $expr; - if ($return_as_string) { + if ($seen_string && !$relational) { $expr = '"' . $expr . '"'; } Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Invocation.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Invocation.pm 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Invocation.pm 2007-02-16 13:26:52 UTC (rev 1242) @@ -60,7 +60,7 @@ if (!$self->{'in_call'}) { $self->{'in_call'} = 1; my ($func_ptr, $func_context) = $self->{'func_id'}->get_function($self); - print "Calling " . $self->{'func_id'}->as_string, "\n"; + # print STDERR "Calling " . $self->{'func_id'}->as_string, "\n"; &$func_ptr($func_context, $self); } } Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Server.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Server.pm 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Server.pm 2007-02-16 13:26:52 UTC (rev 1242) @@ -37,6 +37,8 @@ sub _init($) { my $self = shift; + &Varnish::Test::Object::_init($self); + $self->set('address', 'localhost'); $self->set('port', '9001'); } @@ -81,10 +83,14 @@ my $fh = shift; my $data = shift; - print "Server got: $$data"; - $$data = ""; - $mux->write($fh, "HTTP/1.1 200 OK\r\n"); - print "Server sent: HTTP/1.1 200 OK\n"; + $$data = ""; # Pretend we read the data. + + my $response = "HTTP/" . eval($self->get('protocol')) . " 200 OK\r\n" + . "Content-Type: text/plain; charset=utf-8\r\n\r\n" + . eval($self->get('data')) . "\n"; + + $mux->write($fh, $response); + print STDERR "Server sent: " . $response; $mux->shutdown($fh, 1); } Modified: trunk/varnish-tools/regress/lib/Varnish/Test/Statement.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test/Statement.pm 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/lib/Varnish/Test/Statement.pm 2007-02-16 13:26:52 UTC (rev 1242) @@ -53,6 +53,8 @@ } } +use Data::Dumper; + sub run($$) { my $self = shift; @@ -61,7 +63,7 @@ &Varnish::Test::Object::run($self); if ($self->{'finished'}) { - $self->{'lhs'}->set_value($self, $self->{'return'}); + $self->{'lhs'}->set_value($self->{'parent'}, $self->{'return'}); } } Modified: trunk/varnish-tools/regress/lib/Varnish/Test.pm =================================================================== --- trunk/varnish-tools/regress/lib/Varnish/Test.pm 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/lib/Varnish/Test.pm 2007-02-16 13:26:52 UTC (rev 1242) @@ -77,9 +77,9 @@ die("Parsing error."); } - print "###### SYNTAX TREE BEGIN ######\n"; - print Dumper $tree if defined($tree->{'body'}); - print "###### SYNTAX TREE END ######\n"; + print STDERR "###### SYNTAX TREE BEGIN ######\n"; + print STDERR Dumper $tree if defined($tree->{'body'}); + print STDERR "###### SYNTAX TREE END ######\n"; $self->{'objects'} = []; @@ -99,11 +99,11 @@ while (!$self->{'finished'}) { &Varnish::Test::Object::run($self); - print "Entering IO::Multiplex loop.\n"; + print STDERR "Entering IO::Multiplex loop.\n"; $self->{'mux'}->loop; } - print "DONE.\n"; + print STDERR "DONE.\n"; } sub run($) { Modified: trunk/varnish-tools/regress/test1 =================================================================== --- trunk/varnish-tools/regress/test1 2007-02-06 21:55:03 UTC (rev 1241) +++ trunk/varnish-tools/regress/test1 2007-02-16 13:26:52 UTC (rev 1242) @@ -21,8 +21,31 @@ comment = "client 1.0, server 1.0"; c1.protocol = "1.0"; s1.protocol = "1.0"; - c1.request(s1, "http://www.example.com/"); - c1.request(s1, "http://www.example.com/"); - c1.request(s1, "http://www.example.com/"); + c1.request(a1, "http://www.example.com/"); + assert(c1.response.protocol == "1.0"); } + + case c10_s11 { + comment = "client 1.0, server 1.1"; + c1.protocol = "1.0"; + s1.protocol = "1.1"; + c1.request(a1, "http://www.example.com/"); + assert(c1.response.protocol == "1.0"); + } + + case c11_s10 { + comment = "client 1.1, server 1.0"; + c1.protocol = "1.1"; + s1.protocol = "1.0"; + c1.request(a1, "http://www.example.com/"); + assert(c1.response.protocol == "1.1"); + } + + case c11_s11 { + comment = "client 1.1, server 1.1"; + c1.protocol = "1.1"; + s1.protocol = "1.1"; + c1.request(a1, "http://www.example.com/"); + assert(c1.response.protocol == "1.1"); + } } From des at projects.linpro.no Tue Feb 20 08:46:24 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:24 +0100 (CET) Subject: r1243 - trunk/varnish-cache/redhat Message-ID: <20070220084624.96B601EC526@projects.linpro.no> Author: des Date: 2007-02-20 09:46:24 +0100 (Tue, 20 Feb 2007) New Revision: 1243 Modified: trunk/varnish-cache/redhat/varnish.initrc Log: Correct misunderstanding regarding -w. Modified: trunk/varnish-cache/redhat/varnish.initrc =================================================================== --- trunk/varnish-cache/redhat/varnish.initrc 2007-02-16 13:26:52 UTC (rev 1242) +++ trunk/varnish-cache/redhat/varnish.initrc 2007-02-20 08:46:24 UTC (rev 1243) @@ -21,11 +21,9 @@ -f ${VARNISH_VCL_CONF} \ -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ -t ${VARNISH_TTL} \ + -w ${VARNISH_MIN_WORKER_THREADS},${VARNISH_MAX_WORKER_THREADS},${VARNISH_WORKER_THREAD_TIMEOUT} \ -s ${VARNISH_BACKEND_STORAGE}" -# Note: The set of working threads is temporary broken in varnish-1.0.2. -# This will be fixed in an upcoming release -# -w ${VARNISH_MIN_WORKER_THREADS},${VARNISH_MAX_WORKER_THREADS},${VARNISH_WORKER_THREAD_TIMEOUT} \ mkdir -p /var/run/varnish 2>/dev/null From des at projects.linpro.no Tue Feb 20 08:46:41 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:41 +0100 (CET) Subject: r1244 - in branches/1.0: . bin/varnishd Message-ID: <20070220084641.8531E1EC41C@projects.linpro.no> Author: des Date: 2007-02-20 09:46:41 +0100 (Tue, 20 Feb 2007) New Revision: 1244 Modified: branches/1.0/ branches/1.0/bin/varnishd/varnishd.c Log: r33741 at cat (orig r1220): des | 2006-11-08 09:49:57 +0100 Remove printf() from signal handler. Make the pipe-juggling code slightly more readable. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1216 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1220 Modified: branches/1.0/bin/varnishd/varnishd.c =================================================================== --- branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:46:24 UTC (rev 1243) +++ branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:46:41 UTC (rev 1244) @@ -31,15 +31,16 @@ * The management process and CLI handling */ -#include +#include #include #include #include +#include #include #include -#include #include #include +#include #include #include @@ -238,15 +239,12 @@ static pid_t d_child; -#include static void DebugSigPass(int sig) { - int i; - i = kill(d_child, sig); - printf("sig %d i %d pid %d\n", sig, i, d_child); + kill(d_child, sig); } static void @@ -261,27 +259,33 @@ AZ(pipe(pipes[0])); AZ(pipe(pipes[1])); d_child = fork(); + xxxassert(d_child >= 0); if (!d_child) { - assert(dup2(pipes[0][0], 0) >= 0); - assert(dup2(pipes[1][1], 1) >= 0); - assert(dup2(pipes[1][1], 2) >= 0); + /* stdin from parent, std{out,err} to parent */ + assert(dup2(pipes[0][0], 0) == 0); + assert(dup2(pipes[1][1], 1) == 1); + assert(dup2(pipes[1][1], 2) == 2); AZ(close(pipes[0][0])); AZ(close(pipes[0][1])); AZ(close(pipes[1][0])); AZ(close(pipes[1][1])); return; } + + /* set up parent's end of pipe to child's stdin */ AZ(close(pipes[0][0])); - assert(dup2(pipes[0][1], 3) >= 0); pipes[0][0] = 0; + assert(dup2(pipes[0][1], 3) == 3); pipes[0][1] = 3; - assert(dup2(pipes[1][0], 4) >= 0); + /* set up parent's end of pipe from child's std{out,err} */ + assert(dup2(pipes[1][0], 4) == 4); + pipes[1][0] = 4; AZ(close(pipes[1][1])); - pipes[1][0] = 4; pipes[1][1] = 1; - for (i = 5; i < 100; i++) + /* close the rest */ + for (i = 5; i < getdtablesize(); i++) close(i); pfd[0].fd = pipes[0][0]; @@ -292,6 +296,7 @@ signal(SIGPIPE, SIG_IGN); signal(SIGINT, DebugSigPass); i = read(pipes[1][0], buf, sizeof buf - 1); + xxxassert(i >= 0); buf[i] = '\0'; d_child = strtoul(buf, &p, 0); xxxassert(p != NULL); From des at projects.linpro.no Tue Feb 20 08:46:42 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:42 +0100 (CET) Subject: r1245 - in branches/1.0: . bin/varnishd Message-ID: <20070220084642.C219B1EC52E@projects.linpro.no> Author: des Date: 2007-02-20 09:46:42 +0100 (Tue, 20 Feb 2007) New Revision: 1245 Modified: branches/1.0/ branches/1.0/bin/varnishd/varnishd.c Log: r33742 at cat (orig r1221): des | 2006-11-08 09:59:20 +0100 Rewrite tackle_warg(): don't override the default max or timeout unless the user asks; bail if max < min; fix usage string. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1220 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1221 Modified: branches/1.0/bin/varnishd/varnishd.c =================================================================== --- branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:46:41 UTC (rev 1244) +++ branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:46:42 UTC (rev 1245) @@ -194,7 +194,7 @@ fprintf(stderr, " %-28s # %s\n", "", " -w min,max"); fprintf(stderr, " %-28s # %s\n", "", - " -w min,max,timeout [default: -w1,INF,10]"); + " -w min,max,timeout [default: -w1,1000,120]"); #if 0 -c clusterid at cluster_controller -m memory_limit @@ -211,21 +211,23 @@ static void tackle_warg(const char *argv) { - int i; - unsigned ua, ub, uc; + unsigned int ua, ub, uc; - i = sscanf(argv, "%u,%u,%u", &ua, &ub, &uc); - if (i == 0) + switch (sscanf(argv, "%u,%u,%u", &ua, &ub, &uc)) { + case 3: + params->wthread_timeout = uc; + case 2: + if (ub < ua) + usage(); + params->wthread_max = ub; + case 1: + if (ua < 1) + usage(); + params->wthread_min = ua; + break; + default: usage(); - if (ua < 1) - usage(); - params->wthread_min = ua; - params->wthread_max = ua; - params->wthread_timeout = 10; - if (i >= 2) - params->wthread_max = ub; - if (i >= 3) - params->wthread_timeout = uc; + } } /*-------------------------------------------------------------------- From des at projects.linpro.no Tue Feb 20 08:46:43 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:43 +0100 (CET) Subject: r1246 - in branches/1.0: . redhat Message-ID: <20070220084643.F1EEF1EC52E@projects.linpro.no> Author: des Date: 2007-02-20 09:46:43 +0100 (Tue, 20 Feb 2007) New Revision: 1246 Modified: branches/1.0/ branches/1.0/redhat/varnish.initrc branches/1.0/redhat/varnish.sysconfig Log: r34107 at cat (orig r1222): ingvar | 2006-11-08 10:03:40 +0100 Removed the usage of -w in the initscript until that bug is fixed in varnishd Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1221 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1222 Modified: branches/1.0/redhat/varnish.initrc =================================================================== --- branches/1.0/redhat/varnish.initrc 2007-02-20 08:46:42 UTC (rev 1245) +++ branches/1.0/redhat/varnish.initrc 2007-02-20 08:46:43 UTC (rev 1246) @@ -21,9 +21,11 @@ -f ${VARNISH_VCL_CONF} \ -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ -t ${VARNISH_TTL} \ - -w ${VARNISH_MIN_WORKER_THREADS},${VARNISH_MAX_WORKER_THREADS},${VARNISH_WORKER_THREAD_TIMEOUT} \ -s ${VARNISH_BACKEND_STORAGE}" +# Note: The set of working threads is temporary broken in varnish-1.0.2. +# This will be fixed in an upcoming release +# -w ${VARNISH_MIN_WORKER_THREADS},${VARNISH_MAX_WORKER_THREADS},${VARNISH_WORKER_THREAD_TIMEOUT} \ mkdir -p /var/run/varnish 2>/dev/null Modified: branches/1.0/redhat/varnish.sysconfig =================================================================== --- branches/1.0/redhat/varnish.sysconfig 2007-02-20 08:46:42 UTC (rev 1245) +++ branches/1.0/redhat/varnish.sysconfig 2007-02-20 08:46:43 UTC (rev 1246) @@ -20,6 +20,9 @@ VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 VARNISH_ADMIN_LISTEN_PORT=6082 +# Note: The working set of threads is temporary broken in +# varnish-1.0.2. The following 3 entries will not be used. +# This will be fixed in an upcoming release # The minimum number of threads to start VARNISH_MIN_WORKER_THREADS=1 From des at projects.linpro.no Tue Feb 20 08:46:45 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:45 +0100 (CET) Subject: r1247 - in branches/1.0: . bin/varnishd Message-ID: <20070220084645.590801EC530@projects.linpro.no> Author: des Date: 2007-02-20 09:46:45 +0100 (Tue, 20 Feb 2007) New Revision: 1247 Modified: branches/1.0/ branches/1.0/bin/varnishd/storage_file.c branches/1.0/configure.ac Log: r34122 at cat (orig r1226): phk | 2006-12-05 09:47:43 +0100 NetBSD Portability fix: Starting with 3.1, NetBSD uses statvfs and not statfs. Submitted by: Juan RP Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1222 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1226 Modified: branches/1.0/bin/varnishd/storage_file.c =================================================================== --- branches/1.0/bin/varnishd/storage_file.c 2007-02-20 08:46:43 UTC (rev 1246) +++ branches/1.0/bin/varnishd/storage_file.c 2007-02-20 08:46:45 UTC (rev 1247) @@ -37,6 +37,11 @@ #include #include +#ifdef HAVE_SYS_STATVFS_H +#include +#define statfs statvfs +#endif + #ifdef HAVE_SYS_VFS_H #include #endif Modified: branches/1.0/configure.ac =================================================================== --- branches/1.0/configure.ac 2007-02-20 08:46:43 UTC (rev 1246) +++ branches/1.0/configure.ac 2007-02-20 08:46:45 UTC (rev 1247) @@ -45,6 +45,7 @@ AC_HEADER_SYS_WAIT AC_HEADER_TIME AC_CHECK_HEADERS([sys/socket.h]) +AC_CHECK_HEADERS([sys/statvfs.h]) AC_CHECK_HEADERS([sys/vfs.h]) AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([stddef.h]) From des at projects.linpro.no Tue Feb 20 08:46:46 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:46 +0100 (CET) Subject: r1248 - branches/1.0 Message-ID: <20070220084646.8C3431EC533@projects.linpro.no> Author: des Date: 2007-02-20 09:46:46 +0100 (Tue, 20 Feb 2007) New Revision: 1248 Modified: branches/1.0/ branches/1.0/autogen.sh Log: r34123 at cat (orig r1227): phk | 2006-12-05 09:48:27 +0100 Add a FreeBSD workaround while des@ tries to get autocrap to DTRT under FreeBSD also. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1226 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1227 Modified: branches/1.0/autogen.sh =================================================================== --- branches/1.0/autogen.sh 2007-02-20 08:46:45 UTC (rev 1247) +++ branches/1.0/autogen.sh 2007-02-20 08:46:46 UTC (rev 1248) @@ -26,7 +26,12 @@ set -ex -aclocal +if [ "x`uname -s`" = "xFreeBSD" ] ; then + # Ask DES + aclocal -I /usr/local/share/aclocal +else + aclocal +fi libtoolize --copy --force autoheader automake --add-missing --copy --foreign From des at projects.linpro.no Tue Feb 20 08:46:47 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:47 +0100 (CET) Subject: r1249 - in branches/1.0: . bin/varnishd Message-ID: <20070220084647.AF8DD1EC5BF@projects.linpro.no> Author: des Date: 2007-02-20 09:46:47 +0100 (Tue, 20 Feb 2007) New Revision: 1249 Modified: branches/1.0/ branches/1.0/bin/varnishd/storage_file.c Log: r34124 at cat (orig r1228): phk | 2006-12-05 10:41:16 +0100 Make the statfs(3)/statvfs(3) dictomy actually work. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1227 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1228 Modified: branches/1.0/bin/varnishd/storage_file.c =================================================================== --- branches/1.0/bin/varnishd/storage_file.c 2007-02-20 08:46:46 UTC (rev 1248) +++ branches/1.0/bin/varnishd/storage_file.c 2007-02-20 08:46:47 UTC (rev 1249) @@ -39,7 +39,6 @@ #ifdef HAVE_SYS_STATVFS_H #include -#define statfs statvfs #endif #ifdef HAVE_SYS_VFS_H @@ -122,12 +121,21 @@ char suff[2]; int i, expl; off_t o; - struct statfs fsst; struct stat st; + AN(sc != NULL); AZ(fstat(sc->fd, &st)); + +#ifdef HAVE_SYS_STATVFS_H + struct statfs fsst; AZ(fstatfs(sc->fd, &fsst)); +#endif +#ifdef HAVE_SYS_VFS_H + struct statfs fsst; + AZ(fstatfs(sc->fd, &fsst)); +#endif + /* We use units of the larger of filesystem blocksize and pagesize */ bs = sc->pagesize; if (bs < fsst.f_bsize) From des at projects.linpro.no Tue Feb 20 08:46:48 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:48 +0100 (CET) Subject: r1250 - branches/1.0 Message-ID: <20070220084648.F0C841EC2EE@projects.linpro.no> Author: des Date: 2007-02-20 09:46:48 +0100 (Tue, 20 Feb 2007) New Revision: 1250 Modified: branches/1.0/ branches/1.0/autogen.sh Log: r34125 at cat (orig r1229): des | 2006-12-05 12:42:39 +0100 Better workaround for FreeBSD autotools brokenness. Pointy hat to: {ade,portsmgr}@freebsd.org Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1228 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1229 Modified: branches/1.0/autogen.sh =================================================================== --- branches/1.0/autogen.sh 2007-02-20 08:46:47 UTC (rev 1249) +++ branches/1.0/autogen.sh 2007-02-20 08:46:48 UTC (rev 1250) @@ -6,6 +6,7 @@ if [ -d /usr/local/gnu-autotools/bin ] ; then PATH=/usr/local/gnu-autotools/bin:${PATH} export PATH + FIX_BROKEN_FREEBSD_PORTS="-I /usr/local/share/aclocal" fi automake_version=$(automake --version | tr ' ' '\n' | egrep '^[0-9]\.[0-9a-z.-]+') @@ -26,12 +27,7 @@ set -ex -if [ "x`uname -s`" = "xFreeBSD" ] ; then - # Ask DES - aclocal -I /usr/local/share/aclocal -else - aclocal -fi +aclocal ${FIX_BROKEN_FREEBSD_PORTS} libtoolize --copy --force autoheader automake --add-missing --copy --foreign From des at projects.linpro.no Tue Feb 20 08:46:50 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:50 +0100 (CET) Subject: r1251 - in branches/1.0: . bin/varnishd Message-ID: <20070220084650.2D6711EC643@projects.linpro.no> Author: des Date: 2007-02-20 09:46:50 +0100 (Tue, 20 Feb 2007) New Revision: 1251 Modified: branches/1.0/ branches/1.0/bin/varnishd/storage_file.c Log: r34126 at cat (orig r1230): knutroy | 2006-12-18 16:58:59 +0100 Fixed double declaraction error on systems having both HAVE_SYS_STATVFS_H and HAVE_SYS_VFS_H. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1229 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1230 Modified: branches/1.0/bin/varnishd/storage_file.c =================================================================== --- branches/1.0/bin/varnishd/storage_file.c 2007-02-20 08:46:48 UTC (rev 1250) +++ branches/1.0/bin/varnishd/storage_file.c 2007-02-20 08:46:50 UTC (rev 1251) @@ -126,16 +126,11 @@ AN(sc != NULL); AZ(fstat(sc->fd, &st)); -#ifdef HAVE_SYS_STATVFS_H +#if defined(HAVE_SYS_STATVFS_H) || defined(HAVE_SYS_VFS_H) struct statfs fsst; AZ(fstatfs(sc->fd, &fsst)); #endif -#ifdef HAVE_SYS_VFS_H - struct statfs fsst; - AZ(fstatfs(sc->fd, &fsst)); -#endif - /* We use units of the larger of filesystem blocksize and pagesize */ bs = sc->pagesize; if (bs < fsst.f_bsize) From des at projects.linpro.no Tue Feb 20 08:46:51 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:51 +0100 (CET) Subject: r1252 - in branches/1.0: . bin/varnishd Message-ID: <20070220084651.9E9341EC5C5@projects.linpro.no> Author: des Date: 2007-02-20 09:46:51 +0100 (Tue, 20 Feb 2007) New Revision: 1252 Modified: branches/1.0/ branches/1.0/bin/varnishd/cache_pass.c branches/1.0/bin/varnishd/common.h branches/1.0/bin/varnishd/storage_file.c branches/1.0/bin/varnishd/varnishd.c Log: r34127 at cat (orig r1231): phk | 2007-01-02 14:41:08 +0100 Polish as result of flexelint run and record a couple of thoughts. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1230 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1231 Modified: branches/1.0/bin/varnishd/cache_pass.c =================================================================== --- branches/1.0/bin/varnishd/cache_pass.c 2007-02-20 08:46:50 UTC (rev 1251) +++ branches/1.0/bin/varnishd/cache_pass.c 2007-02-20 08:46:51 UTC (rev 1252) @@ -29,6 +29,9 @@ * $Id$ * * XXX: charge bytes to srcaddr + * XXX: buffer to relieve backed ASAP. + * XXX: Check if response has any body + * XXX: Don't pass chunked to HTTP/1.0 client */ #include Modified: branches/1.0/bin/varnishd/common.h =================================================================== --- branches/1.0/bin/varnishd/common.h 2007-02-20 08:46:50 UTC (rev 1251) +++ branches/1.0/bin/varnishd/common.h 2007-02-20 08:46:51 UTC (rev 1252) @@ -46,4 +46,3 @@ int TCP_parse(const char *str, char **addr, char **port); int TCP_open(const char *addr, const char *port, int http); void TCP_check(struct cli *cli, const char *addr, const char *port); - Modified: branches/1.0/bin/varnishd/storage_file.c =================================================================== --- branches/1.0/bin/varnishd/storage_file.c 2007-02-20 08:46:50 UTC (rev 1251) +++ branches/1.0/bin/varnishd/storage_file.c 2007-02-20 08:46:51 UTC (rev 1252) @@ -123,7 +123,7 @@ off_t o; struct stat st; - AN(sc != NULL); + AN(sc); AZ(fstat(sc->fd, &st)); #if defined(HAVE_SYS_STATVFS_H) || defined(HAVE_SYS_VFS_H) Modified: branches/1.0/bin/varnishd/varnishd.c =================================================================== --- branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:46:50 UTC (rev 1251) +++ branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:46:51 UTC (rev 1252) @@ -216,10 +216,12 @@ switch (sscanf(argv, "%u,%u,%u", &ua, &ub, &uc)) { case 3: params->wthread_timeout = uc; + /* FALLTHROUGH */ case 2: if (ub < ua) usage(); params->wthread_max = ub; + /* FALLTHROUGH */ case 1: if (ua < 1) usage(); @@ -386,6 +388,21 @@ cli[0].result = CLIS_OK; heritage.socket = -1; + + /* + * Set up a temporary param block until VSL_MgtInit() can + * replace with shmem backed structure version. + * + * XXX: I wonder if it would be smarter to inform the child process + * XXX: about param changes via CLI rather than keeping the param + * XXX: block in shared memory. It would give us the advantage + * XXX: of having the CLI thread be able to take action on the + * XXX: change. + * XXX: For now live with the harmless flexelint warning this causes: + * XXX: varnishd.c 393 Info 789: Assigning address of auto variable + * XXX: 'param' to static + */ + memset(¶m, 0, sizeof param); params = ¶m; mgt_vcc_init(); From des at projects.linpro.no Tue Feb 20 08:46:52 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:52 +0100 (CET) Subject: r1253 - branches/1.0 Message-ID: <20070220084652.CD5FC1EC643@projects.linpro.no> Author: des Date: 2007-02-20 09:46:52 +0100 (Tue, 20 Feb 2007) New Revision: 1253 Modified: branches/1.0/ branches/1.0/autogen.sh Log: r34129 at cat (orig r1233): phk | 2007-01-22 09:43:30 +0100 Allow automake version 1.10 Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1231 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1233 Modified: branches/1.0/autogen.sh =================================================================== --- branches/1.0/autogen.sh 2007-02-20 08:46:51 UTC (rev 1252) +++ branches/1.0/autogen.sh 2007-02-20 08:46:52 UTC (rev 1253) @@ -15,13 +15,13 @@ exit 1 else case $automake_version in - 1.9*|[23456789].*) - ;; - *) + 0.*|1.[0-8]) echo "your version of automake ($automake_version) is too old;" \ "you need 1.9 or newer." exit 1 ;; + *) + ;; esac fi From des at projects.linpro.no Tue Feb 20 08:46:53 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:53 +0100 (CET) Subject: r1254 - in branches/1.0: . bin/varnishd Message-ID: <20070220084653.EAEAF1EC634@projects.linpro.no> Author: des Date: 2007-02-20 09:46:53 +0100 (Tue, 20 Feb 2007) New Revision: 1254 Modified: branches/1.0/ branches/1.0/bin/varnishd/heritage.h branches/1.0/bin/varnishd/varnishd.c Log: r34130 at cat (orig r1234): phk | 2007-01-22 12:15:27 +0100 Make params volatile so changes are discovered. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1233 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1234 Modified: branches/1.0/bin/varnishd/heritage.h =================================================================== --- branches/1.0/bin/varnishd/heritage.h 2007-02-20 08:46:52 UTC (rev 1253) +++ branches/1.0/bin/varnishd/heritage.h 2007-02-20 08:46:53 UTC (rev 1254) @@ -104,7 +104,7 @@ unsigned client_http11; }; -extern struct params *params; +extern volatile struct params *params; extern struct heritage heritage; void child_main(void); Modified: branches/1.0/bin/varnishd/varnishd.c =================================================================== --- branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:46:52 UTC (rev 1253) +++ branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:46:53 UTC (rev 1254) @@ -60,7 +60,7 @@ #endif struct heritage heritage; -struct params *params; +volatile struct params *params; /*--------------------------------------------------------------------*/ From des at projects.linpro.no Tue Feb 20 08:46:55 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:55 +0100 (CET) Subject: r1255 - in branches/1.0: . bin/varnishd Message-ID: <20070220084655.22D231EC6A5@projects.linpro.no> Author: des Date: 2007-02-20 09:46:54 +0100 (Tue, 20 Feb 2007) New Revision: 1255 Modified: branches/1.0/ branches/1.0/bin/varnishd/cache_backend.c Log: r34131 at cat (orig r1235): phk | 2007-01-22 12:15:57 +0100 Cache the workspace size from params so it doesn't change under us. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1234 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1235 Modified: branches/1.0/bin/varnishd/cache_backend.c =================================================================== --- branches/1.0/bin/varnishd/cache_backend.c 2007-02-20 08:46:53 UTC (rev 1254) +++ branches/1.0/bin/varnishd/cache_backend.c 2007-02-20 08:46:54 UTC (rev 1255) @@ -64,9 +64,10 @@ vbe_new_conn(void) { struct vbe_conn *vbc; - unsigned char *p; + unsigned char *p, space; - vbc = calloc(sizeof *vbc + params->mem_workspace * 2, 1); + space = params->mem_workspace; + vbc = calloc(sizeof *vbc + space * 2, 1); if (vbc == NULL) return (NULL); VSL_stats->n_vbe_conn++; @@ -75,9 +76,9 @@ vbc->http2 = &vbc->http_mem[1]; vbc->fd = -1; p = (void *)(vbc + 1); - http_Setup(vbc->http, p, params->mem_workspace); - p += params->mem_workspace; - http_Setup(vbc->http2, p, params->mem_workspace); + http_Setup(vbc->http, p, space); + p += space; + http_Setup(vbc->http2, p, space); return (vbc); } From des at projects.linpro.no Tue Feb 20 08:46:56 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:56 +0100 (CET) Subject: r1256 - in branches/1.0: . bin/varnishd Message-ID: <20070220084656.540DF1EC6AB@projects.linpro.no> Author: des Date: 2007-02-20 09:46:56 +0100 (Tue, 20 Feb 2007) New Revision: 1256 Modified: branches/1.0/ branches/1.0/bin/varnishd/shmlog.c Log: r34132 at cat (orig r1236): phk | 2007-01-22 12:46:25 +0100 Use struct assignment to overcome volatile poisoning. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1235 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1236 Modified: branches/1.0/bin/varnishd/shmlog.c =================================================================== --- branches/1.0/bin/varnishd/shmlog.c 2007-02-20 08:46:54 UTC (rev 1255) +++ branches/1.0/bin/varnishd/shmlog.c 2007-02-20 08:46:56 UTC (rev 1256) @@ -365,6 +365,6 @@ xxxassert(loghead != MAP_FAILED); VSL_stats = &loghead->stats; pp = (void *)(loghead + 1); - memcpy(pp, params, sizeof *pp); + *pp = *params; params = pp; } From des at projects.linpro.no Tue Feb 20 08:46:58 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:58 +0100 (CET) Subject: r1257 - in branches/1.0: . bin/varnishd include lib/libvcl Message-ID: <20070220084658.10DBD1EC6A2@projects.linpro.no> Author: des Date: 2007-02-20 09:46:57 +0100 (Tue, 20 Feb 2007) New Revision: 1257 Modified: branches/1.0/ branches/1.0/bin/varnishd/cache.h branches/1.0/bin/varnishd/cache_backend.c branches/1.0/bin/varnishd/cache_vrt.c branches/1.0/include/vrt_obj.h branches/1.0/lib/libvcl/flint.lnt branches/1.0/lib/libvcl/vcc_compile.c branches/1.0/lib/libvcl/vcc_gen_obj.tcl branches/1.0/lib/libvcl/vcc_obj.c Log: r34133 at cat (orig r1237): phk | 2007-01-22 13:31:52 +0100 The getaddrinfo(3) API does not tell us the TTL value learned from DNS so we have to add our own stuff for that. Without some kind of TTL, we would hit the DNS server once per failed attempt to connect to the backend. If the backend were down, we could hit it a LOT. In the VCL code: backend foobar { [...] set backend.dnsttl = 20s; } will assign a TTL for DNS lookups of this backends hostname+port combination, we will not hit the DNS server more often that this. The default is set at 30 seconds, short enough to make things are workable in a load-balancing-via-DNS setups, yet long enough to not pound the DNS server flat in case of backend failures. NOTE that as long as we succeed in connecting to the backend we do not perform new DNS lookups. That will have to be revisited along with possible load-balancing schemes for the backend(s). Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1236 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1237 Modified: branches/1.0/bin/varnishd/cache.h =================================================================== --- branches/1.0/bin/varnishd/cache.h 2007-02-20 08:46:56 UTC (rev 1256) +++ branches/1.0/bin/varnishd/cache.h 2007-02-20 08:46:57 UTC (rev 1257) @@ -302,6 +302,9 @@ struct addrinfo *last_addr; TAILQ_HEAD(,vbe_conn) connlist; + + double dnsttl; + double dnstime; #if 0 double responsetime; double timeout; Modified: branches/1.0/bin/varnishd/cache_backend.c =================================================================== --- branches/1.0/bin/varnishd/cache_backend.c 2007-02-20 08:46:56 UTC (rev 1256) +++ branches/1.0/bin/varnishd/cache_backend.c 2007-02-20 08:46:57 UTC (rev 1257) @@ -59,12 +59,25 @@ static MTX vbemtx; /*--------------------------------------------------------------------*/ +/* XXX: belongs a more general place */ +static double +Uptime(void) +{ + struct timespec ts; + + assert(clock_gettime(CLOCK_MONOTONIC, &ts) == 0); + return (ts.tv_sec + ts.tv_nsec * 1e-9); +} + +/*--------------------------------------------------------------------*/ + static struct vbe_conn * vbe_new_conn(void) { struct vbe_conn *vbc; - unsigned char *p, space; + unsigned char *p; + unsigned space; space = params->mem_workspace; vbc = calloc(sizeof *vbc + space * 2, 1); @@ -93,6 +106,7 @@ if (bp->addr != NULL) { freeaddrinfo(bp->addr); bp->addr = NULL; + bp->last_addr = NULL; } memset(&hint, 0, sizeof hint); @@ -102,13 +116,14 @@ error = getaddrinfo(bp->hostname, bp->portname == NULL ? "http" : bp->portname, &hint, &res); + bp->dnstime = Uptime(); if (error) { if (res != NULL) freeaddrinfo(res); printf("getaddrinfo: %s\n", gai_strerror(error)); /* XXX */ - bp->addr = NULL; return; } + bp->last_addr = res; bp->addr = res; } @@ -120,9 +135,7 @@ int s; s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); - if (s < 0) - return (s); - else if (connect(s, ai->ai_addr, ai->ai_addrlen)) { + if (s >= 0 && connect(s, ai->ai_addr, ai->ai_addrlen)) { AZ(close(s)); s = -1; } @@ -157,6 +170,9 @@ } } + if (bp->dnstime + bp->dnsttl >= Uptime()) + return (-1); + /* Then do another lookup to catch DNS changes */ vbe_lookup(bp); Modified: branches/1.0/bin/varnishd/cache_vrt.c =================================================================== --- branches/1.0/bin/varnishd/cache_vrt.c 2007-02-20 08:46:56 UTC (rev 1256) +++ branches/1.0/bin/varnishd/cache_vrt.c 2007-02-20 08:46:57 UTC (rev 1257) @@ -124,6 +124,7 @@ cp->backend[i] = calloc(sizeof *cp->backend[i], 1); XXXAN(cp->backend[i]); cp->backend[i]->magic = BACKEND_MAGIC; + cp->backend[i]->dnsttl = 30; TAILQ_INIT(&cp->backend[i]->connlist); } } @@ -160,6 +161,7 @@ VBACKEND(const char *, host, hostname) VBACKEND(const char *, port, portname) +VBACKEND(double, dnsttl, dnsttl) /*-------------------------------------------------------------------- * XXX: Working relative to t_req is maybe not the right thing, we could Modified: branches/1.0/include/vrt_obj.h =================================================================== --- branches/1.0/include/vrt_obj.h 2007-02-20 08:46:56 UTC (rev 1256) +++ branches/1.0/include/vrt_obj.h 2007-02-20 08:46:57 UTC (rev 1257) @@ -10,6 +10,8 @@ void VRT_l_backend_host(struct backend *, const char *); const char * VRT_r_backend_port(struct backend *); void VRT_l_backend_port(struct backend *, const char *); +double VRT_r_backend_dnsttl(struct backend *); +void VRT_l_backend_dnsttl(struct backend *, double); const unsigned char * VRT_r_client_ip(struct sess *); void VRT_l_client_ip(struct sess *, const unsigned char *); const char * VRT_r_req_request(struct sess *); Modified: branches/1.0/lib/libvcl/flint.lnt =================================================================== --- branches/1.0/lib/libvcl/flint.lnt 2007-02-20 08:46:56 UTC (rev 1256) +++ branches/1.0/lib/libvcl/flint.lnt 2007-02-20 08:46:57 UTC (rev 1257) @@ -6,6 +6,7 @@ -printf_code( ju, long long unsigned) -printf_code( jx, long long unsigned) ++libh ../../config.h -header(../../config.h) -sem(lbv_assert, r_no) -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) Modified: branches/1.0/lib/libvcl/vcc_compile.c =================================================================== --- branches/1.0/lib/libvcl/vcc_compile.c 2007-02-20 08:46:56 UTC (rev 1256) +++ branches/1.0/lib/libvcl/vcc_compile.c 2007-02-20 08:46:57 UTC (rev 1257) @@ -258,6 +258,7 @@ t->e = strchr(s, '\0'); t->tok = METHOD; AddRef(tl, t, type); + /* XXX: possibly leaking t */ } void @@ -931,6 +932,7 @@ static void Backend(struct tokenlist *tl) { + unsigned a; struct var *vp; struct token *t_be = NULL; struct token *t_host = NULL; @@ -984,6 +986,27 @@ Fc(tl, 0, ");\n"); vcc_NextToken(tl); break; +#if 0 + case INT: + case SIZE: + case RATE: + case FLOAT: +#endif + case TIME: + Fc(tl, 1, "\t%s ", vp->lname); + a = tl->t->tok; + if (a == T_MUL || a == T_DIV) + Fc(tl, 0, "%g", DoubleVal(tl)); + else if (vp->fmt == TIME) + TimeVal(tl); + else if (vp->fmt == SIZE) + SizeVal(tl); + else if (vp->fmt == RATE) + RateVal(tl); + else + Fc(tl, 0, "%g", DoubleVal(tl)); + Fc(tl, 0, ");\n"); + break; default: vsb_printf(tl->sb, "Assignments not possible for '%s'\n", vp->name); Modified: branches/1.0/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- branches/1.0/lib/libvcl/vcc_gen_obj.tcl 2007-02-20 08:46:56 UTC (rev 1256) +++ branches/1.0/lib/libvcl/vcc_gen_obj.tcl 2007-02-20 08:46:57 UTC (rev 1257) @@ -32,24 +32,25 @@ # Objects which operate on backends set beobj { - { backend.host HOSTNAME } - { backend.port PORTNAME } + { backend.host HOSTNAME } + { backend.port PORTNAME } + { backend.dnsttl TIME } } # Objects which operate on sessions set spobj { - { client.ip IP } - { req.request STRING } - { req.host STRING } - { req.url STRING } - { req.proto STRING } - { req.backend BACKEND } - { obj.valid BOOL } - { obj.cacheable BOOL } - { obj.ttl TIME } - { req.http. HEADER } - { resp.http. HEADER } + { client.ip IP } + { req.request STRING } + { req.host STRING } + { req.url STRING } + { req.proto STRING } + { req.backend BACKEND } + { obj.valid BOOL } + { obj.cacheable BOOL } + { obj.ttl TIME } + { req.http. HEADER } + { resp.http. HEADER } } set tt(IP) "const unsigned char *" Modified: branches/1.0/lib/libvcl/vcc_obj.c =================================================================== --- branches/1.0/lib/libvcl/vcc_obj.c 2007-02-20 08:46:56 UTC (rev 1256) +++ branches/1.0/lib/libvcl/vcc_obj.c 2007-02-20 08:46:57 UTC (rev 1257) @@ -18,6 +18,10 @@ "VRT_r_backend_port(backend)", "VRT_l_backend_port(backend, ", }, + { "backend.dnsttl", TIME, 14, + "VRT_r_backend_dnsttl(backend)", + "VRT_l_backend_dnsttl(backend, ", + }, { NULL } }; @@ -82,6 +86,8 @@ "void VRT_l_backend_host(struct backend *, const char *);\n" "const char * VRT_r_backend_port(struct backend *);\n" "void VRT_l_backend_port(struct backend *, const char *);\n" + "double VRT_r_backend_dnsttl(struct backend *);\n" + "void VRT_l_backend_dnsttl(struct backend *, double);\n" "const unsigned char * VRT_r_client_ip(struct sess *);\n" "void VRT_l_client_ip(struct sess *, const unsigned char *);\n" "const char * VRT_r_req_request(struct sess *);\n" From des at projects.linpro.no Tue Feb 20 08:46:59 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:46:59 +0100 (CET) Subject: r1258 - in branches/1.0: . bin/varnishd Message-ID: <20070220084659.5A5231EC6AA@projects.linpro.no> Author: des Date: 2007-02-20 09:46:59 +0100 (Tue, 20 Feb 2007) New Revision: 1258 Modified: branches/1.0/ branches/1.0/bin/varnishd/cache_backend.c branches/1.0/bin/varnishd/cache_vrt.c Log: r34134 at cat (orig r1238): phk | 2007-01-22 14:24:42 +0100 Expend a lock on keeping the backend statistics consistent. Rename the fields to make more sense Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1237 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1238 Modified: branches/1.0/bin/varnishd/cache_backend.c =================================================================== --- branches/1.0/bin/varnishd/cache_backend.c 2007-02-20 08:46:57 UTC (rev 1257) +++ branches/1.0/bin/varnishd/cache_backend.c 2007-02-20 08:46:59 UTC (rev 1258) @@ -214,9 +214,12 @@ /* Get a backend connection ------------------------------------------ * - * First locate the backend shadow, if necessary by creating one. - * If there are free connections, use the first, otherwise build a - * new connection. + * Try all cached backend connections for this backend, and use the + * first one that is looks like it is still connected. + * If that fails to get us a connection, create a new one, reusing a + * connection from the freelist, if possible. + * + * This function is slightly complicated by optimizations on vbemtx. */ static struct vbe_conn * @@ -225,20 +228,17 @@ struct vbe_conn *vc, *vc2; struct pollfd pfd; struct backend *bp; + int reuse = 0; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); bp = sp->backend; CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC); + vc2 = NULL; while (1) { - /* - * Try all connections on this backend until we find one - * that works. If that fails, grab a free connection - * (if any) while we have the lock anyway. - */ - vc2 = NULL; LOCK(&vbemtx); vc = TAILQ_FIRST(&bp->connlist); if (vc != NULL) { + assert(vc->backend == bp); assert(vc->fd >= 0); TAILQ_REMOVE(&bp->connlist, vc, list); } else { @@ -256,8 +256,10 @@ pfd.fd = vc->fd; pfd.events = POLLIN; pfd.revents = 0; - if (!poll(&pfd, 1, 0)) + if (!poll(&pfd, 1, 0)) { + reuse = 1; break; + } VBE_ClosedFd(sp->wrk, vc, 0); } @@ -266,34 +268,33 @@ vc = vbe_new_conn(); else vc = vc2; - AN(vc); - assert(vc->fd == -1); - AZ(vc->backend); + if (vc != NULL) { + assert(vc->fd == -1); + AZ(vc->backend); + vc->fd = vbe_connect(sp, bp); + if (vc->fd < 0) { + LOCK(&vbemtx); + TAILQ_INSERT_HEAD(&vbe_head, vc, list); + VSL_stats->backend_unused++; + UNLOCK(&vbemtx); + vc = NULL; + } else { + vc->backend = bp; + } + } } - - /* If not connected yet, do so */ - if (vc->fd < 0) { - AZ(vc->backend); - vc->fd = vbe_connect(sp, bp); - LOCK(&vbemtx); - if (vc->fd < 0) { - vc->backend = NULL; - TAILQ_INSERT_HEAD(&vbe_head, vc, list); - VSL_stats->backend_unused++; - vc = NULL; - } else { - vc->backend = bp; - } - UNLOCK(&vbemtx); + LOCK(&vbemtx); + if (vc != NULL ) { + VSL_stats->backend_reuse += reuse; + VSL_stats->backend_conn++; } else { - assert(vc->fd >= 0); - assert(vc->backend == bp); + VSL_stats->backend_fail++; } + UNLOCK(&vbemtx); if (vc != NULL ) { + WSL(sp->wrk, SLT_BackendXID, vc->fd, "%u", sp->xid); assert(vc->fd >= 0); - VSL_stats->backend_conn++; - WSL(sp->wrk, SLT_BackendXID, vc->fd, "%u", sp->xid); - AN(vc->backend); + assert(vc->backend == bp); } return (vc); } @@ -348,9 +349,9 @@ CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); assert(vc->fd >= 0); AN(vc->backend); - VSL_stats->backend_recycle++; WSL(w, SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name); LOCK(&vbemtx); + VSL_stats->backend_recycle++; TAILQ_INSERT_HEAD(&vc->backend->connlist, vc, list); UNLOCK(&vbemtx); } Modified: branches/1.0/bin/varnishd/cache_vrt.c =================================================================== --- branches/1.0/bin/varnishd/cache_vrt.c 2007-02-20 08:46:57 UTC (rev 1257) +++ branches/1.0/bin/varnishd/cache_vrt.c 2007-02-20 08:46:59 UTC (rev 1258) @@ -133,13 +133,14 @@ VRT_free_backends(struct VCL_conf *cp) { - (void)cp; + (void)cp; /* XXX */ } void VRT_fini_backend(struct backend *be) { - (void)be; + + (void)be; /* XXX */ } /*--------------------------------------------------------------------*/ From des at projects.linpro.no Tue Feb 20 08:47:00 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:47:00 +0100 (CET) Subject: r1259 - in branches/1.0: . bin/varnishd Message-ID: <20070220084700.834131EC6A2@projects.linpro.no> Author: des Date: 2007-02-20 09:47:00 +0100 (Tue, 20 Feb 2007) New Revision: 1259 Modified: branches/1.0/ branches/1.0/bin/varnishd/varnishd.c Log: r35539 at cat (orig r1239): phk | 2007-01-29 23:06:33 +0100 Things you didn't know about C, #7212: There is no sane way to get sscanf to tell you how many characters were consumed, if you want to allow a variable number of arguments. The special format %n is patently useless for this, because you have to insert it at every conceiveable point in the string and that presumes full explicit whitespace markup. Parse -w argument "by hand", to catch illegal input like "1,INF,15" Tripped over by: Stein Ove Rosseland Fixes: ticket #82 Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1238 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1239 Modified: branches/1.0/bin/varnishd/varnishd.c =================================================================== --- branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:46:59 UTC (rev 1258) +++ branches/1.0/bin/varnishd/varnishd.c 2007-02-20 08:47:00 UTC (rev 1259) @@ -32,6 +32,7 @@ */ #include +#include #include #include #include @@ -211,25 +212,47 @@ static void tackle_warg(const char *argv) { - unsigned int ua, ub, uc; + unsigned int u; + char *ep, *eq; - switch (sscanf(argv, "%u,%u,%u", &ua, &ub, &uc)) { - case 3: - params->wthread_timeout = uc; - /* FALLTHROUGH */ - case 2: - if (ub < ua) - usage(); - params->wthread_max = ub; - /* FALLTHROUGH */ - case 1: - if (ua < 1) - usage(); - params->wthread_min = ua; - break; - default: + u = strtoul(argv, &ep, 0); + if (ep == argv) usage(); + while (isspace(*ep)) + ep++; + if (u < 1) + usage(); + params->wthread_min = u; + + if (*ep == '\0') { + params->wthread_max = params->wthread_min; + return; } + + if (*ep != ',') + usage(); + u = strtoul(++ep, &eq, 0); + if (eq == ep) + usage(); + if (u < params->wthread_min) + usage(); + while (isspace(*eq)) + eq++; + params->wthread_max = u; + + if (*eq == '\0') + return; + + if (*eq != ',') + usage(); + u = strtoul(++eq, &ep, 0); + if (ep == eq) + usage(); + while (isspace(*ep)) + ep++; + if (*ep != '\0') + usage(); + params->wthread_timeout = u; } /*-------------------------------------------------------------------- From des at projects.linpro.no Tue Feb 20 08:47:01 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:47:01 +0100 (CET) Subject: r1260 - in branches/1.0: . include Message-ID: <20070220084701.D16821EC6A8@projects.linpro.no> Author: des Date: 2007-02-20 09:47:01 +0100 (Tue, 20 Feb 2007) New Revision: 1260 Modified: branches/1.0/ branches/1.0/include/stat_field.h Log: r35540 at cat (orig r1240): phk | 2007-01-30 13:17:58 +0100 Forgotten commit: Update backend stats fields Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1239 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1240 Modified: branches/1.0/include/stat_field.h =================================================================== --- branches/1.0/include/stat_field.h 2007-02-20 08:47:00 UTC (rev 1259) +++ branches/1.0/include/stat_field.h 2007-02-20 08:47:01 UTC (rev 1260) @@ -36,7 +36,9 @@ MAC_STAT(cache_hitpass, uint64_t, "u", "Cache hits for pass") MAC_STAT(cache_miss, uint64_t, "u", "Cache misses") -MAC_STAT(backend_conn, uint64_t, "u", "Backend connections initiated") +MAC_STAT(backend_conn, uint64_t, "u", "Backend connections success") +MAC_STAT(backend_fail, uint64_t, "u", "Backend connections failures") +MAC_STAT(backend_reuse, uint64_t, "u", "Backend connections reuses") MAC_STAT(backend_recycle, uint64_t, "u", "Backend connections recycles") MAC_STAT(backend_unused, uint64_t, "u", "Backend connections unused") From des at projects.linpro.no Tue Feb 20 08:47:02 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:47:02 +0100 (CET) Subject: r1261 - in branches/1.0: . redhat Message-ID: <20070220084702.EF6B01EC6AB@projects.linpro.no> Author: des Date: 2007-02-20 09:47:02 +0100 (Tue, 20 Feb 2007) New Revision: 1261 Modified: branches/1.0/ branches/1.0/redhat/varnish.initrc Log: r36059 at cat (orig r1243): des | 2007-02-20 09:46:24 +0100 Correct misunderstanding regarding -w. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1240 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1243 Modified: branches/1.0/redhat/varnish.initrc =================================================================== --- branches/1.0/redhat/varnish.initrc 2007-02-20 08:47:01 UTC (rev 1260) +++ branches/1.0/redhat/varnish.initrc 2007-02-20 08:47:02 UTC (rev 1261) @@ -21,11 +21,9 @@ -f ${VARNISH_VCL_CONF} \ -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ -t ${VARNISH_TTL} \ + -w ${VARNISH_MIN_WORKER_THREADS},${VARNISH_MAX_WORKER_THREADS},${VARNISH_WORKER_THREAD_TIMEOUT} \ -s ${VARNISH_BACKEND_STORAGE}" -# Note: The set of working threads is temporary broken in varnish-1.0.2. -# This will be fixed in an upcoming release -# -w ${VARNISH_MIN_WORKER_THREADS},${VARNISH_MAX_WORKER_THREADS},${VARNISH_WORKER_THREAD_TIMEOUT} \ mkdir -p /var/run/varnish 2>/dev/null From des at projects.linpro.no Tue Feb 20 08:47:59 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:47:59 +0100 (CET) Subject: r1262 - branches/1.0 Message-ID: <20070220084759.1D5AE1EC6AB@projects.linpro.no> Author: des Date: 2007-02-20 09:47:58 +0100 (Tue, 20 Feb 2007) New Revision: 1262 Modified: branches/1.0/ChangeLog Log: Regenerate Modified: branches/1.0/ChangeLog =================================================================== --- branches/1.0/ChangeLog 2007-02-20 08:47:02 UTC (rev 1261) +++ branches/1.0/ChangeLog 2007-02-20 08:47:58 UTC (rev 1262) @@ -1,3 +1,224 @@ +2007-02-20 08:47 des + + * branches/1.0, branches/1.0/redhat/varnish.initrc: + + r36059 at cat (orig r1243): des | 2007-02-20 09:46:24 +0100 + Correct misunderstanding regarding -w. + +2007-02-20 08:47 des + + * branches/1.0, branches/1.0/include/stat_field.h: + + r35540 at cat (orig r1240): phk | 2007-01-30 13:17:58 +0100 + Forgotten commit: + + Update backend stats fields + + +2007-02-20 08:47 des + + * branches/1.0, branches/1.0/bin/varnishd/varnishd.c: + + r35539 at cat (orig r1239): phk | 2007-01-29 23:06:33 +0100 + Things you didn't know about C, #7212: + + There is no sane way to get sscanf to tell you how many characters + were consumed, if you want to allow a variable number of arguments. + + The special format %n is patently useless for this, because you + have to insert it at every conceiveable point in the string and + that presumes full explicit whitespace markup. + + Parse -w argument "by hand", to catch illegal input like "1,INF,15" + + Tripped over by: Stein Ove Rosseland + + Fixes: ticket #82 + + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/cache_backend.c, + branches/1.0/bin/varnishd/cache_vrt.c: + + r34134 at cat (orig r1238): phk | 2007-01-22 14:24:42 +0100 + Expend a lock on keeping the backend statistics consistent. + Rename the fields to make more sense + + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/cache.h, + branches/1.0/bin/varnishd/cache_backend.c, + branches/1.0/bin/varnishd/cache_vrt.c, branches/1.0/include/vrt_obj.h, + branches/1.0/lib/libvcl/flint.lnt, + branches/1.0/lib/libvcl/vcc_compile.c, + branches/1.0/lib/libvcl/vcc_gen_obj.tcl, + branches/1.0/lib/libvcl/vcc_obj.c: + + r34133 at cat (orig r1237): phk | 2007-01-22 13:31:52 +0100 + The getaddrinfo(3) API does not tell us the TTL value learned from DNS + so we have to add our own stuff for that. + + Without some kind of TTL, we would hit the DNS server once per failed + attempt to connect to the backend. + + If the backend were down, we could hit it a LOT. + + In the VCL code: + + backend foobar { + [...] + set backend.dnsttl = 20s; + } + + will assign a TTL for DNS lookups of this backends hostname+port + combination, we will not hit the DNS server more often that this. + + The default is set at 30 seconds, short enough to make things are + workable in a load-balancing-via-DNS setups, yet long enough to not + pound the DNS server flat in case of backend failures. + + NOTE that as long as we succeed in connecting to the backend we + do not perform new DNS lookups. That will have to be revisited + along with possible load-balancing schemes for the backend(s). + + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/shmlog.c: + + r34132 at cat (orig r1236): phk | 2007-01-22 12:46:25 +0100 + Use struct assignment to overcome volatile poisoning. + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/cache_backend.c: + + r34131 at cat (orig r1235): phk | 2007-01-22 12:15:57 +0100 + Cache the workspace size from params so it doesn't change under us. + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/heritage.h, + branches/1.0/bin/varnishd/varnishd.c: + + r34130 at cat (orig r1234): phk | 2007-01-22 12:15:27 +0100 + Make params volatile so changes are discovered. + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/autogen.sh: + + r34129 at cat (orig r1233): phk | 2007-01-22 09:43:30 +0100 + Allow automake version 1.10 + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/cache_pass.c, + branches/1.0/bin/varnishd/common.h, + branches/1.0/bin/varnishd/storage_file.c, + branches/1.0/bin/varnishd/varnishd.c: + + r34127 at cat (orig r1231): phk | 2007-01-02 14:41:08 +0100 + Polish as result of flexelint run and record a couple of thoughts. + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/storage_file.c: + + r34126 at cat (orig r1230): knutroy | 2006-12-18 16:58:59 +0100 + Fixed double declaraction error on systems having both + HAVE_SYS_STATVFS_H and HAVE_SYS_VFS_H. + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/autogen.sh: + + r34125 at cat (orig r1229): des | 2006-12-05 12:42:39 +0100 + Better workaround for FreeBSD autotools brokenness. + + Pointy hat to: {ade,portsmgr}@freebsd.org + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/storage_file.c: + + r34124 at cat (orig r1228): phk | 2006-12-05 10:41:16 +0100 + Make the statfs(3)/statvfs(3) dictomy actually work. + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/autogen.sh: + + r34123 at cat (orig r1227): phk | 2006-12-05 09:48:27 +0100 + Add a FreeBSD workaround while des@ tries to get autocrap to DTRT under + FreeBSD also. + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/storage_file.c, + branches/1.0/configure.ac: + + r34122 at cat (orig r1226): phk | 2006-12-05 09:47:43 +0100 + NetBSD Portability fix: + + Starting with 3.1, NetBSD uses statvfs and not statfs. + + Submitted by: Juan RP + + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/redhat/varnish.initrc, + branches/1.0/redhat/varnish.sysconfig: + + r34107 at cat (orig r1222): ingvar | 2006-11-08 10:03:40 +0100 + Removed the usage of -w in the initscript until that bug is fixed in + varnishd + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/varnishd.c: + + r33742 at cat (orig r1221): des | 2006-11-08 09:59:20 +0100 + Rewrite tackle_warg(): don't override the default max or timeout unless + the user asks; bail if max < min; fix usage string. + +2007-02-20 08:46 des + + * branches/1.0, branches/1.0/bin/varnishd/varnishd.c: + + r33741 at cat (orig r1220): des | 2006-11-08 09:49:57 +0100 + Remove printf() from signal handler. + Make the pipe-juggling code slightly more readable. + +2006-11-06 12:19 des + + * branches/1.0/ChangeLog: + + Regenerate. + +2006-11-06 12:07 des + + * branches/1.0, branches/1.0/debian/lintian-override: + + r33659 at cat (orig r1216): bahner | 2006-11-03 10:37:47 +0100 + Adding lintian-overrides for debian acceptance + + 2006-11-02 12:57 des * branches/1.0, branches/1.0/include/compat/vis.h, From des at projects.linpro.no Tue Feb 20 08:49:14 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:49:14 +0100 (CET) Subject: r1263 - branches/1.0 Message-ID: <20070220084914.1E1091EC6A6@projects.linpro.no> Author: des Date: 2007-02-20 09:49:14 +0100 (Tue, 20 Feb 2007) New Revision: 1263 Modified: branches/1.0/configure.ac Log: Bump version number. Modified: branches/1.0/configure.ac =================================================================== --- branches/1.0/configure.ac 2007-02-20 08:47:58 UTC (rev 1262) +++ branches/1.0/configure.ac 2007-02-20 08:49:14 UTC (rev 1263) @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [1.0.2], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [1.0.3], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From des at projects.linpro.no Tue Feb 20 08:49:54 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 09:49:54 +0100 (CET) Subject: r1264 - branches/1.0 Message-ID: <20070220084954.841931EC6A6@projects.linpro.no> Author: des Date: 2007-02-20 09:49:54 +0100 (Tue, 20 Feb 2007) New Revision: 1264 Modified: branches/1.0/ChangeLog Log: Regenerate Modified: branches/1.0/ChangeLog =================================================================== --- branches/1.0/ChangeLog 2007-02-20 08:49:14 UTC (rev 1263) +++ branches/1.0/ChangeLog 2007-02-20 08:49:54 UTC (rev 1264) @@ -1,5 +1,17 @@ +2007-02-20 08:49 des + + * branches/1.0/configure.ac: + + Bump version number. + 2007-02-20 08:47 des + * branches/1.0/ChangeLog: + + Regenerate + +2007-02-20 08:47 des + * branches/1.0, branches/1.0/redhat/varnish.initrc: r36059 at cat (orig r1243): des | 2007-02-20 09:46:24 +0100 From des at projects.linpro.no Tue Feb 20 09:47:06 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 10:47:06 +0100 (CET) Subject: r1265 - tags Message-ID: <20070220094706.CCB3D1EC52D@projects.linpro.no> Author: des Date: 2007-02-20 10:47:06 +0100 (Tue, 20 Feb 2007) New Revision: 1265 Added: tags/varnish-1.0.3/ Log: Tag 1.0.3. Copied: tags/varnish-1.0.3 (from rev 1264, branches/1.0) From des at projects.linpro.no Tue Feb 20 13:22:33 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 14:22:33 +0100 (CET) Subject: r1266 - trunk/varnish-cache/redhat Message-ID: <20070220132233.3C6091EC528@projects.linpro.no> Author: des Date: 2007-02-20 14:22:33 +0100 (Tue, 20 Feb 2007) New Revision: 1266 Modified: trunk/varnish-cache/redhat/varnish.spec trunk/varnish-cache/redhat/varnish.sysconfig Log: Doh! Fix more -w lossage. Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2007-02-20 09:47:06 UTC (rev 1265) +++ trunk/varnish-cache/redhat/varnish.spec 2007-02-20 13:22:33 UTC (rev 1266) @@ -1,6 +1,6 @@ Summary: Varnish is a high-performance HTTP accelerator. Name: varnish -Version: 1.0.2 +Version: 1.0.3 Release: 7 License: BSD-like Group: System Environment/Daemons Modified: trunk/varnish-cache/redhat/varnish.sysconfig =================================================================== --- trunk/varnish-cache/redhat/varnish.sysconfig 2007-02-20 09:47:06 UTC (rev 1265) +++ trunk/varnish-cache/redhat/varnish.sysconfig 2007-02-20 13:22:33 UTC (rev 1266) @@ -20,16 +20,13 @@ VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 VARNISH_ADMIN_LISTEN_PORT=6082 -# Note: The working set of threads is temporary broken in -# varnish-1.0.2. The following 3 entries will not be used. -# This will be fixed in an upcoming release # The minimum number of threads to start VARNISH_MIN_WORKER_THREADS=1 -# Maximum number of worker threads or INF for unlimited -VARNISH_MAX_WORKER_THREADS=INF +# Maximum number of worker threads +VARNISH_MAX_WORKER_THREADS=1000 # Timeout value in seconds for threads to return From des at projects.linpro.no Tue Feb 20 13:22:43 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Tue, 20 Feb 2007 14:22:43 +0100 (CET) Subject: r1267 - in branches/1.0: . redhat Message-ID: <20070220132243.5B92A1EC533@projects.linpro.no> Author: des Date: 2007-02-20 14:22:43 +0100 (Tue, 20 Feb 2007) New Revision: 1267 Modified: branches/1.0/ branches/1.0/redhat/varnish.spec branches/1.0/redhat/varnish.sysconfig Log: r36082 at cat (orig r1266): des | 2007-02-20 14:22:33 +0100 Doh! Fix more -w lossage. Property changes on: branches/1.0 ___________________________________________________________________ Name: svk:merge - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1243 + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1266 Modified: branches/1.0/redhat/varnish.spec =================================================================== --- branches/1.0/redhat/varnish.spec 2007-02-20 13:22:33 UTC (rev 1266) +++ branches/1.0/redhat/varnish.spec 2007-02-20 13:22:43 UTC (rev 1267) @@ -1,6 +1,6 @@ Summary: Varnish is a high-performance HTTP accelerator. Name: varnish -Version: 1.0.2 +Version: 1.0.3 Release: 7 License: BSD-like Group: System Environment/Daemons Modified: branches/1.0/redhat/varnish.sysconfig =================================================================== --- branches/1.0/redhat/varnish.sysconfig 2007-02-20 13:22:33 UTC (rev 1266) +++ branches/1.0/redhat/varnish.sysconfig 2007-02-20 13:22:43 UTC (rev 1267) @@ -20,16 +20,13 @@ VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 VARNISH_ADMIN_LISTEN_PORT=6082 -# Note: The working set of threads is temporary broken in -# varnish-1.0.2. The following 3 entries will not be used. -# This will be fixed in an upcoming release # The minimum number of threads to start VARNISH_MIN_WORKER_THREADS=1 -# Maximum number of worker threads or INF for unlimited -VARNISH_MAX_WORKER_THREADS=INF +# Maximum number of worker threads +VARNISH_MAX_WORKER_THREADS=1000 # Timeout value in seconds for threads to return From ingvar at projects.linpro.no Thu Feb 22 23:01:29 2007 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Fri, 23 Feb 2007 00:01:29 +0100 (CET) Subject: r1268 - branches/1.0/redhat Message-ID: <20070222230129.6F5F81EC6A3@projects.linpro.no> Author: ingvar Date: 2007-02-23 00:01:29 +0100 (Fri, 23 Feb 2007) New Revision: 1268 Modified: branches/1.0/redhat/varnish.initrc branches/1.0/redhat/varnish.spec Log: rpmlint cleanups Modified: branches/1.0/redhat/varnish.initrc =================================================================== --- branches/1.0/redhat/varnish.initrc 2007-02-20 13:22:43 UTC (rev 1267) +++ branches/1.0/redhat/varnish.initrc 2007-02-22 23:01:29 UTC (rev 1268) @@ -38,7 +38,7 @@ if [ $RETVAL -eq 0 ] then echo_success - touch /var/lock/subsys/varnishd + touch /var/lock/subsys/varnish else echo_failure fi @@ -51,7 +51,7 @@ if [ $RETVAL -eq 0 ] then echo_success - rm -f /var/lock/subsys/varnishd + rm -f /var/lock/subsys/varnish else echo_failure fi Modified: branches/1.0/redhat/varnish.spec =================================================================== --- branches/1.0/redhat/varnish.spec 2007-02-20 13:22:43 UTC (rev 1267) +++ branches/1.0/redhat/varnish.spec 2007-02-22 23:01:29 UTC (rev 1268) @@ -1,21 +1,55 @@ -Summary: Varnish is a high-performance HTTP accelerator. +# Strange rpmlint needs... +%define api 1.0 +%define major 1 +#%define lib_name %{name}%{api}_%{major} +%define lib_name lib%{name}%{major} + +Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 1.0.3 -Release: 7 +Release: 1 License: BSD-like Group: System Environment/Daemons URL: http://www.varnish-cache.org/ -Packager: Ingvar Hagelund +#Packager: Ingvar Hagelund Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gcc gcc-c++ ncurses-devel libtool autoconf automake -Requires: gcc ncurses kernel >= 2.6.0 +Requires: gcc ncurses kernel >= 2.6.0 %{lib_name} = %version-%{release} Vendor: Linpro AS, http://www.linpro.no/ %description -This is the Varnish high-performance HTTP accelerator. +This is the Varnish high-performance HTTP accelerator. Documentation +and additional information about Varnish is available on the following +web sites: + + http://www.varnish-cache.org/ Official web site + http://varnish.projects.linpro.no/ Developer site and wiki + +Technical questions about Varnish and this release should be addressed +to . + +Questions about commercial support and services related to Varnish +should be addressed to . + +Copyright (c) 2006 Verdens Gang AS +Copyright (c) 2006 Linpro AS +All rights reserved. +Author: Poul-Henning Kamp + +%package -n %{lib_name} +Summary: Varnish is a high-performance HTTP accelerator +Group: System Environment/Daemons +URL: http://www.varnish-cache.org/ +BuildRequires: gcc gcc-c++ ncurses-devel libtool autoconf automake +Requires: ncurses kernel >= 2.6.0 +Vendor: Linpro AS, http://www.linpro.no/ + +%description -n %{lib_name} +The libraries of Varnish, the high-performance HTTP accelerator. Documentation and additional information about Varnish is available on the following web sites: + http://www.varnish-cache.org/ Official web site http://varnish.projects.linpro.no/ Developer site and wiki @@ -30,21 +64,66 @@ All rights reserved. Author: Poul-Henning Kamp +%package -n %{lib_name}-devel +Summary: Varnish is a high-performance HTTP accelerator +Group: System Environment/Daemons +URL: http://www.varnish-cache.org/ +BuildRequires: gcc gcc-c++ ncurses-devel libtool autoconf automake +Requires: ncurses kernel >= 2.6.0 %{lib_name} = %version-%{release} +Vendor: Linpro AS, http://www.linpro.no/ + +%description -n %{lib_name}-devel +Development files of Varnish, the high-performance HTTP accelerator. +Documentation and additional information about Varnish is available on +the following web sites: + + http://www.varnish-cache.org/ Official web site + http://varnish.projects.linpro.no/ Developer site and wiki + +Technical questions about Varnish and this release should be addressed +to . + +Questions about commercial support and services related to Varnish +should be addressed to . + +Copyright (c) 2006 Verdens Gang AS +Copyright (c) 2006 Linpro AS +All rights reserved. +Author: Poul-Henning Kamp + %prep %setup -q +for i in varnishlog varnishtop varnishd varnishstat varnishhist varnishncsa +do + iconv -f iso-8859-1 -t utf-8 < bin/$i/$i.1 > bin/$i/$i.1.utf8 + rm -f bin/$i/$i.1 + mv bin/$i/$i.1.utf8 bin/$i/$i.1 +done +iconv -f iso-8859-1 -t utf-8 < man/vcl.7 > man/vcl.7.utf8 +rm -f man/vcl.7 +mv man/vcl.7.utf8 man/vcl.7 %build -rm -rf $RPM_BUILD_ROOT - ./autogen.sh %configure --sbindir=/usr/sbin -%{__make} +%{__make} -j2 sed -e ' s/8080/80/g ' etc/vcl.conf > redhat/vcl.conf %install +rm -rf $RPM_BUILD_ROOT %{makeinstall} -mkdir -p %{buildroot}%{_sbindir} +strip %{buildroot}%{_sbindir}/varnishd +strip %{buildroot}%{_bindir}/varnishhist +strip %{buildroot}%{_bindir}/varnishlog +strip %{buildroot}%{_bindir}/varnishncsa +strip %{buildroot}%{_bindir}/varnishstat +strip %{buildroot}%{_bindir}/varnishtop + +strip %{buildroot}%{_libdir}/libvarnish.so.0.0.0 +strip %{buildroot}%{_libdir}/libvarnishapi.so.0.0.0 +strip %{buildroot}%{_libdir}/libvcl.so.0.0.0 + mkdir -p %{buildroot}%{_docdir}/%{name}-%{version} mkdir -p %{buildroot}/etc/varnish mkdir -p %{buildroot}/etc/init.d @@ -72,18 +151,6 @@ %{_bindir}/varnishncsa %{_bindir}/varnishstat %{_bindir}/varnishtop -%{_libdir}/libvarnish.a -%{_libdir}/libvarnish.la -%{_libdir}/libvarnish.so.0.0.0 -%{_libdir}/libvarnish.so.0 -%{_libdir}/libvarnishapi.a -%{_libdir}/libvarnishapi.la -%{_libdir}/libvarnishapi.so.0.0.0 -%{_libdir}/libvarnishapi.so.0 -%{_libdir}/libvcl.a -%{_libdir}/libvcl.la -%{_libdir}/libvcl.so.0.0.0 -%{_libdir}/libvcl.so.0 %{_var}/lib/varnish %{_mandir}/man1/varnishd.1.gz %{_mandir}/man1/varnishhist.1.gz @@ -92,7 +159,6 @@ %{_mandir}/man1/varnishstat.1.gz %{_mandir}/man1/varnishtop.1.gz %{_mandir}/man7/vcl.7.gz - %doc %{_docdir}/%{name}-%{version}/INSTALL %doc %{_docdir}/%{name}-%{version}/LICENSE %doc %{_docdir}/%{name}-%{version}/README @@ -100,14 +166,59 @@ %doc %{_docdir}/%{name}-%{version}/ChangeLog %doc %{_docdir}/%{name}-%{version}/vcl.example.conf %config(noreplace) /etc/varnish/vcl.conf -%config /etc/init.d/varnish -%config /etc/sysconfig/varnish +%config(noreplace) /etc/sysconfig/varnish +/etc/init.d/varnish +%files -n %{lib_name} +%defattr(-,root,root,-) +%{_libdir}/libvarnish.so.0.0.0 +%{_libdir}/libvarnish.so.0 +%{_libdir}/libvarnishapi.so.0.0.0 +%{_libdir}/libvarnishapi.so.0 +%{_libdir}/libvcl.so.0.0.0 +%{_libdir}/libvcl.so.0 +%doc %{_docdir}/%{name}-%{version}/INSTALL +%doc %{_docdir}/%{name}-%{version}/LICENSE +%doc %{_docdir}/%{name}-%{version}/README +%doc %{_docdir}/%{name}-%{version}/README.redhat +%doc %{_docdir}/%{name}-%{version}/ChangeLog + +%files -n %{lib_name}-devel +%defattr(-,root,root,-) +%{_libdir}/libvarnish.a +%{_libdir}/libvarnish.la +%{_libdir}/libvarnish.so +%{_libdir}/libvarnishapi.a +%{_libdir}/libvarnishapi.la +%{_libdir}/libvarnishapi.so +%{_libdir}/libvcl.a +%{_libdir}/libvcl.la +%{_libdir}/libvcl.so +%doc %{_docdir}/%{name}-%{version}/INSTALL +%doc %{_docdir}/%{name}-%{version}/LICENSE +%doc %{_docdir}/%{name}-%{version}/README +%doc %{_docdir}/%{name}-%{version}/README.redhat +%doc %{_docdir}/%{name}-%{version}/ChangeLog + %post /sbin/chkconfig --add varnish /sbin/chkconfig --list varnish +%preun +/sbin/service varnish stop +/sbin/chkconfig --del varnish + +%post -n %{lib_name} +/sbin/ldconfig + +%postun -n %{lib_name} +/sbin/ldconfig + %changelog +* Thu Feb 22 2007 Ingvar Hagelund - 1.0.3-1 +- New release 1.0.3. See the general ChangeLog. +- Splitted the package into varnish, libvarnish1 and + libvarnish1-devel, to make rpmlint happy * Thu Oct 19 2006 Ingvar Hagelund - 1.02-7 - Added a Vendor tag * Thu Oct 19 2006 Ingvar Hagelund - 1.02-6 From ingvar at projects.linpro.no Fri Feb 23 08:54:51 2007 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Fri, 23 Feb 2007 09:54:51 +0100 (CET) Subject: r1269 - branches/1.0/redhat Message-ID: <20070223085451.F0BD71EC6AF@projects.linpro.no> Author: ingvar Date: 2007-02-23 09:54:51 +0100 (Fri, 23 Feb 2007) New Revision: 1269 Modified: branches/1.0/redhat/varnish.spec Log: Fixed some typos in the specfile changelog. More small rpmlint fixes. Modified: branches/1.0/redhat/varnish.spec =================================================================== --- branches/1.0/redhat/varnish.spec 2007-02-22 23:01:29 UTC (rev 1268) +++ branches/1.0/redhat/varnish.spec 2007-02-23 08:54:51 UTC (rev 1269) @@ -7,7 +7,7 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 1.0.3 -Release: 1 +Release: 2 License: BSD-like Group: System Environment/Daemons URL: http://www.varnish-cache.org/ @@ -106,7 +106,7 @@ %build ./autogen.sh %configure --sbindir=/usr/sbin -%{__make} -j2 +%{__make} sed -e ' s/8080/80/g ' etc/vcl.conf > redhat/vcl.conf @@ -208,20 +208,20 @@ /sbin/service varnish stop /sbin/chkconfig --del varnish -%post -n %{lib_name} -/sbin/ldconfig +%post -n %{lib_name} -p /sbin/ldconfig -%postun -n %{lib_name} -/sbin/ldconfig +%postun -n %{lib_name} -p /sbin/ldconfig %changelog +* Fri Feb 23 2007 Ingvar Hagelund - 1.0.3-2 +- A few other small changes to make rpmlint happy * Thu Feb 22 2007 Ingvar Hagelund - 1.0.3-1 -- New release 1.0.3. See the general ChangeLog. +- New release 1.0.3. See the general ChangeLog - Splitted the package into varnish, libvarnish1 and - libvarnish1-devel, to make rpmlint happy -* Thu Oct 19 2006 Ingvar Hagelund - 1.02-7 + libvarnish1-devel +* Thu Oct 19 2006 Ingvar Hagelund - 1.0.2-7 - Added a Vendor tag -* Thu Oct 19 2006 Ingvar Hagelund - 1.02-6 +* Thu Oct 19 2006 Ingvar Hagelund - 1.0.2-6 - Added redhat subdir to svn - Removed default vcl config file. Used the new upstream variant instead. - Based build on svn. Running autogen.sh as start of build. Also added @@ -230,7 +230,7 @@ - Changed the sysconfig script to include a lot more nice features. Most of these were ripped from the Debian package. Updated initscript to reflect this. -* Tue Oct 10 2006 Ingvar Hagelund - 1.01-3 +* Tue Oct 10 2006 Ingvar Hagelund - 1.0.1-3 - Moved Red Hat specific files to its own subdirectory * Tue Sep 26 2006 Ingvar Hagelund - 1.0.1-2 - Added gcc requirement. From des at projects.linpro.no Fri Feb 23 10:06:53 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 23 Feb 2007 11:06:53 +0100 (CET) Subject: r1270 - in trunk/varnish-cache: bin/varnishd bin/varnishhist bin/varnishlog bin/varnishncsa bin/varnishstat bin/varnishtop include include/compat lib/libcompat lib/libvarnish man Message-ID: <20070223100653.B76C91EC6AB@projects.linpro.no> Author: des Date: 2007-02-23 11:06:53 +0100 (Fri, 23 Feb 2007) New Revision: 1270 Modified: trunk/varnish-cache/bin/varnishd/varnishd.1 trunk/varnish-cache/bin/varnishhist/varnishhist.1 trunk/varnish-cache/bin/varnishlog/varnishlog.1 trunk/varnish-cache/bin/varnishncsa/varnishncsa.1 trunk/varnish-cache/bin/varnishstat/varnishstat.1 trunk/varnish-cache/bin/varnishtop/varnishtop.1 trunk/varnish-cache/include/compat/asprintf.h trunk/varnish-cache/include/compat/clock_gettime.h trunk/varnish-cache/include/compat/setproctitle.h trunk/varnish-cache/include/compat/srandomdev.h trunk/varnish-cache/include/compat/strlcat.h trunk/varnish-cache/include/compat/strlcpy.h trunk/varnish-cache/include/compat/strndup.h trunk/varnish-cache/include/compat/vasprintf.h trunk/varnish-cache/include/vsb.h trunk/varnish-cache/lib/libcompat/asprintf.c trunk/varnish-cache/lib/libcompat/clock_gettime.c trunk/varnish-cache/lib/libcompat/setproctitle.c trunk/varnish-cache/lib/libcompat/srandomdev.c trunk/varnish-cache/lib/libcompat/strndup.c trunk/varnish-cache/lib/libcompat/vasprintf.c trunk/varnish-cache/lib/libvarnish/version.c trunk/varnish-cache/lib/libvarnish/vsb.3 trunk/varnish-cache/lib/libvarnish/vsb.c trunk/varnish-cache/man/vcl.7 Log: Consistently use UTF-8 for non-ASCII characters. Modified: trunk/varnish-cache/bin/varnishd/varnishd.1 =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.1 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/bin/varnishd/varnishd.1 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ .\" Copyright (c) 2006 Linpro AS .\" All rights reserved. .\" -.\" Author: Dag-Erling Sm?rgrav +.\" Author: Dag-Erling Sm??rgrav .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.1 =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.1 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.1 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ .\" Copyright (c) 2006 Linpro AS .\" All rights reserved. .\" -.\" Author: Dag-Erling Sm?rgrav +.\" Author: Dag-Erling Sm??rgrav .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.1 =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.1 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.1 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ .\" Copyright (c) 2006 Linpro AS .\" All rights reserved. .\" -.\" Author: Dag-Erling Sm?rgrav +.\" Author: Dag-Erling Sm??rgrav .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.1 =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.1 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.1 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ .\" Copyright (c) 2006 Linpro AS .\" All rights reserved. .\" -.\" Author: Dag-Erling Sm?rgrav +.\" Author: Dag-Erling Sm??rgrav .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.1 =================================================================== --- trunk/varnish-cache/bin/varnishstat/varnishstat.1 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/bin/varnishstat/varnishstat.1 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ .\" Copyright (c) 2006 Linpro AS .\" All rights reserved. .\" -.\" Author: Dag-Erling Sm?rgrav +.\" Author: Dag-Erling Sm??rgrav .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.1 =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.1 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.1 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ .\" Copyright (c) 2006 Linpro AS .\" All rights reserved. .\" -.\" Author: Dag-Erling Sm?rgrav +.\" Author: Dag-Erling Sm??rgrav .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/include/compat/asprintf.h =================================================================== --- trunk/varnish-cache/include/compat/asprintf.h 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/include/compat/asprintf.h 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/include/compat/clock_gettime.h =================================================================== --- trunk/varnish-cache/include/compat/clock_gettime.h 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/include/compat/clock_gettime.h 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/include/compat/setproctitle.h =================================================================== --- trunk/varnish-cache/include/compat/setproctitle.h 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/include/compat/setproctitle.h 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/include/compat/srandomdev.h =================================================================== --- trunk/varnish-cache/include/compat/srandomdev.h 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/include/compat/srandomdev.h 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/include/compat/strlcat.h =================================================================== --- trunk/varnish-cache/include/compat/strlcat.h 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/include/compat/strlcat.h 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/include/compat/strlcpy.h =================================================================== --- trunk/varnish-cache/include/compat/strlcpy.h 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/include/compat/strlcpy.h 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/include/compat/strndup.h =================================================================== --- trunk/varnish-cache/include/compat/strndup.h 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/include/compat/strndup.h 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/include/compat/vasprintf.h =================================================================== --- trunk/varnish-cache/include/compat/vasprintf.h 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/include/compat/vasprintf.h 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/include/vsb.h =================================================================== --- trunk/varnish-cache/include/vsb.h 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/include/vsb.h 2007-02-23 10:06:53 UTC (rev 1270) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Co?dan Sm?rgrav + * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Sm??rgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: trunk/varnish-cache/lib/libcompat/asprintf.c =================================================================== --- trunk/varnish-cache/lib/libcompat/asprintf.c 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/lib/libcompat/asprintf.c 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/lib/libcompat/clock_gettime.c =================================================================== --- trunk/varnish-cache/lib/libcompat/clock_gettime.c 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/lib/libcompat/clock_gettime.c 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/lib/libcompat/setproctitle.c =================================================================== --- trunk/varnish-cache/lib/libcompat/setproctitle.c 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/lib/libcompat/setproctitle.c 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/lib/libcompat/srandomdev.c =================================================================== --- trunk/varnish-cache/lib/libcompat/srandomdev.c 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/lib/libcompat/srandomdev.c 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/lib/libcompat/strndup.c =================================================================== --- trunk/varnish-cache/lib/libcompat/strndup.c 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/lib/libcompat/strndup.c 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/lib/libcompat/vasprintf.c =================================================================== --- trunk/varnish-cache/lib/libcompat/vasprintf.c 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/lib/libcompat/vasprintf.c 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/lib/libvarnish/version.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/version.c 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/lib/libvarnish/version.c 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Linpro AS * All rights reserved. * - * Author: Dag-Erling Sm?rgrav + * Author: Dag-Erling Sm??rgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/varnish-cache/lib/libvarnish/vsb.3 =================================================================== --- trunk/varnish-cache/lib/libvarnish/vsb.3 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/lib/libvarnish/vsb.3 2007-02-23 10:06:53 UTC (rev 1270) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2000 Poul Henning Kamp and Dag-Erling Co?dan Sm?rgrav +.\" Copyright (c) 2000 Poul Henning Kamp and Dag-Erling Sm??rgrav .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without Modified: trunk/varnish-cache/lib/libvarnish/vsb.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vsb.c 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/lib/libvarnish/vsb.c 2007-02-23 10:06:53 UTC (rev 1270) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Co?dan Sm?rgrav + * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Sm??rgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: trunk/varnish-cache/man/vcl.7 =================================================================== --- trunk/varnish-cache/man/vcl.7 2007-02-23 08:54:51 UTC (rev 1269) +++ trunk/varnish-cache/man/vcl.7 2007-02-23 10:06:53 UTC (rev 1270) @@ -3,7 +3,7 @@ .\" Copyright (c) 2006 Linpro AS .\" All rights reserved. .\" -.\" Author: Dag-Erling Sm?rgrav +.\" Author: Dag-Erling Sm??rgrav .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions From des at projects.linpro.no Fri Feb 23 10:12:29 2007 From: des at projects.linpro.no (des at projects.linpro.no) Date: Fri, 23 Feb 2007 11:12:29 +0100 (CET) Subject: r1271 - trunk/varnish-cache Message-ID: <20070223101229.697591EC6AB@projects.linpro.no> Author: des Date: 2007-02-23 11:12:29 +0100 (Fri, 23 Feb 2007) New Revision: 1271 Modified: trunk/varnish-cache/Makefile.am Log: Include Debian and RedHat package metadata in the tarball. This makes life a lot easier for our packagers. Modified: trunk/varnish-cache/Makefile.am =================================================================== --- trunk/varnish-cache/Makefile.am 2007-02-23 10:06:53 UTC (rev 1270) +++ trunk/varnish-cache/Makefile.am 2007-02-23 10:12:29 UTC (rev 1271) @@ -2,4 +2,4 @@ SUBDIRS = include lib bin man -EXTRA_DIST = LICENSE autogen.sh +EXTRA_DIST = LICENSE autogen.sh debian redhat From bahner at projects.linpro.no Tue Feb 27 19:26:02 2007 From: bahner at projects.linpro.no (bahner at projects.linpro.no) Date: Tue, 27 Feb 2007 20:26:02 +0100 (CET) Subject: r1272 - tags/varnish-1.0.3/debian Message-ID: <20070227192602.CA4921EC41B@projects.linpro.no> Author: bahner Date: 2007-02-27 20:26:02 +0100 (Tue, 27 Feb 2007) New Revision: 1272 Modified: tags/varnish-1.0.3/debian/changelog tags/varnish-1.0.3/debian/varnish.default Log: bumped version number, new default for VARNISH_MAX_WORKER_THREADS Modified: tags/varnish-1.0.3/debian/changelog =================================================================== --- tags/varnish-1.0.3/debian/changelog 2007-02-23 10:12:29 UTC (rev 1271) +++ tags/varnish-1.0.3/debian/changelog 2007-02-27 19:26:02 UTC (rev 1272) @@ -1,3 +1,11 @@ +varnish (1.0.3-1) unstable; urgency=low + + * new upstream release + * set VARNISH_MAX_WORKER_THREADS to 2048 instead of INF. + (closes: #412004) + + -- Lars Bahner Tue, 27 Feb 2007 20:16:38 +0100 + varnish (1.0.2-2) unstable; urgency=low * Preliminary LSB compliabnce in init-script Modified: tags/varnish-1.0.3/debian/varnish.default =================================================================== --- tags/varnish-1.0.3/debian/varnish.default 2007-02-23 10:12:29 UTC (rev 1271) +++ tags/varnish-1.0.3/debian/varnish.default 2007-02-27 19:26:02 UTC (rev 1272) @@ -19,7 +19,7 @@ # Maximum number of worker threads or INF for unlimited -VARNISH_MAX_WORKER_THREADS=INF +VARNISH_MAX_WORKER_THREADS=2048 # Timeout value in seconds for threads to return From bahner at projects.linpro.no Tue Feb 27 19:32:19 2007 From: bahner at projects.linpro.no (bahner at projects.linpro.no) Date: Tue, 27 Feb 2007 20:32:19 +0100 (CET) Subject: r1273 - trunk/varnish-cache/debian Message-ID: <20070227193219.E6CBC1EC41D@projects.linpro.no> Author: bahner Date: 2007-02-27 20:32:19 +0100 (Tue, 27 Feb 2007) New Revision: 1273 Modified: trunk/varnish-cache/debian/changelog trunk/varnish-cache/debian/varnish.default Log: numeric value for VARNISH_MAX_WORKER_THREADS Modified: trunk/varnish-cache/debian/changelog =================================================================== --- trunk/varnish-cache/debian/changelog 2007-02-27 19:26:02 UTC (rev 1272) +++ trunk/varnish-cache/debian/changelog 2007-02-27 19:32:19 UTC (rev 1273) @@ -1,3 +1,11 @@ +varnish (1.0.3-1) unstable; urgency=low + + * new upstream release + * set VARNISH_MAX_WORKER_THREADS to 2048 instead of INF. + (closes: #412004) + + -- Lars Bahner Tue, 27 Feb 2007 20:16:38 +0100 + varnish (1.0.2-2) unstable; urgency=low * Preliminary LSB compliabnce in init-script Modified: trunk/varnish-cache/debian/varnish.default =================================================================== --- trunk/varnish-cache/debian/varnish.default 2007-02-27 19:26:02 UTC (rev 1272) +++ trunk/varnish-cache/debian/varnish.default 2007-02-27 19:32:19 UTC (rev 1273) @@ -19,7 +19,7 @@ # Maximum number of worker threads or INF for unlimited -VARNISH_MAX_WORKER_THREADS=INF +VARNISH_MAX_WORKER_THREADS=2048 # Timeout value in seconds for threads to return From bahner at projects.linpro.no Tue Feb 27 19:42:10 2007 From: bahner at projects.linpro.no (bahner at projects.linpro.no) Date: Tue, 27 Feb 2007 20:42:10 +0100 (CET) Subject: r1274 - tags/varnish-1.0.3/debian Message-ID: <20070227194210.E15141EC41D@projects.linpro.no> Author: bahner Date: 2007-02-27 20:42:10 +0100 (Tue, 27 Feb 2007) New Revision: 1274 Added: tags/varnish-1.0.3/debian/postrm Modified: tags/varnish-1.0.3/debian/changelog Log: Added post-remove script for debian. Modified: tags/varnish-1.0.3/debian/changelog =================================================================== --- tags/varnish-1.0.3/debian/changelog 2007-02-27 19:32:19 UTC (rev 1273) +++ tags/varnish-1.0.3/debian/changelog 2007-02-27 19:42:10 UTC (rev 1274) @@ -1,3 +1,9 @@ +varnish (1.0.3-2) unstable; urgency=low + + * Added postrm to partially solve 400384 + + -- Lars Bahner Tue, 27 Feb 2007 20:41:10 +0100 + varnish (1.0.3-1) unstable; urgency=low * new upstream release Added: tags/varnish-1.0.3/debian/postrm =================================================================== --- tags/varnish-1.0.3/debian/postrm 2007-02-27 19:32:19 UTC (rev 1273) +++ tags/varnish-1.0.3/debian/postrm 2007-02-27 19:42:10 UTC (rev 1274) @@ -0,0 +1,44 @@ +#! /bin/sh -e + +set -e + +case "$1" in + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + + if test -e /var/log/varnish && ! [ "$1" = upgrade ]; then + + rm -rf /var/log/varnish 2>&1 > /dev/null || exit 78 + + fi + + if test -e /var/lib/varnish; then + + rm -rf /var/lib/varnish 2>&1 > /dev/null || exit 78 + fi + + ;; + + purge) + + if test -e /var/log/varnish; then + + rm -rf /var/log/varnish 2>&1 > /dev/null || exit 78 + + fi + + if test -e /var/lib/varnish; then + + rm -rf /var/lib/varnish 2>&1 > /dev/null || exit 78 + fi + + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 64 + +esac + +#DEBHELPER# + +exit 0 From bahner at projects.linpro.no Tue Feb 27 19:54:05 2007 From: bahner at projects.linpro.no (bahner at projects.linpro.no) Date: Tue, 27 Feb 2007 20:54:05 +0100 (CET) Subject: r1275 - trunk/varnish-cache/debian Message-ID: <20070227195405.EE2DF1EC406@projects.linpro.no> Author: bahner Date: 2007-02-27 20:54:05 +0100 (Tue, 27 Feb 2007) New Revision: 1275 Added: trunk/varnish-cache/debian/postrm Modified: trunk/varnish-cache/debian/changelog Log: Postremove for debian Modified: trunk/varnish-cache/debian/changelog =================================================================== --- trunk/varnish-cache/debian/changelog 2007-02-27 19:42:10 UTC (rev 1274) +++ trunk/varnish-cache/debian/changelog 2007-02-27 19:54:05 UTC (rev 1275) @@ -1,3 +1,9 @@ +varnish (1.0.3-2) unstable; urgency=low + + * Added postrm to partially solve 400384 + + -- Lars Bahner Tue, 27 Feb 2007 20:41:10 +0100 + varnish (1.0.3-1) unstable; urgency=low * new upstream release Added: trunk/varnish-cache/debian/postrm =================================================================== --- trunk/varnish-cache/debian/postrm 2007-02-27 19:42:10 UTC (rev 1274) +++ trunk/varnish-cache/debian/postrm 2007-02-27 19:54:05 UTC (rev 1275) @@ -0,0 +1,44 @@ +#! /bin/sh -e + +set -e + +case "$1" in + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + + if test -e /var/log/varnish && ! [ "$1" = upgrade ]; then + + rm -rf /var/log/varnish 2>&1 > /dev/null || exit 78 + + fi + + if test -e /var/lib/varnish; then + + rm -rf /var/lib/varnish 2>&1 > /dev/null || exit 78 + fi + + ;; + + purge) + + if test -e /var/log/varnish; then + + rm -rf /var/log/varnish 2>&1 > /dev/null || exit 78 + + fi + + if test -e /var/lib/varnish; then + + rm -rf /var/lib/varnish 2>&1 > /dev/null || exit 78 + fi + + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 64 + +esac + +#DEBHELPER# + +exit 0 From ingvar at projects.linpro.no Tue Feb 27 20:33:42 2007 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Tue, 27 Feb 2007 21:33:42 +0100 (CET) Subject: r1276 - branches/1.0/redhat Message-ID: <20070227203342.33FBD1EC41D@projects.linpro.no> Author: ingvar Date: 2007-02-27 21:33:42 +0100 (Tue, 27 Feb 2007) New Revision: 1276 Modified: branches/1.0/redhat/varnish.spec Log: RedHat-like names. Not Mandrake-like. Modified: branches/1.0/redhat/varnish.spec =================================================================== --- branches/1.0/redhat/varnish.spec 2007-02-27 19:54:05 UTC (rev 1275) +++ branches/1.0/redhat/varnish.spec 2007-02-27 20:33:42 UTC (rev 1276) @@ -1,8 +1,4 @@ -# Strange rpmlint needs... -%define api 1.0 -%define major 1 -#%define lib_name %{name}%{api}_%{major} -%define lib_name lib%{name}%{major} +%define lib_name %{name}-libs Summary: Varnish is a high-performance HTTP accelerator Name: varnish