aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am27
-rw-r--r--NEWS15
-rw-r--r--README32
m---------acvmod0
-rw-r--r--configure.ac9
-rw-r--r--src/Makefile.am9
-rw-r--r--src/getla.c4
-rw-r--r--src/sleep.c4
-rw-r--r--src/tbf.h5
-rw-r--r--src/time.c6
-rw-r--r--tests/.gitignore8
-rw-r--r--tests/Makefile.am79
-rw-r--r--tests/atlocal.in7
-rw-r--r--tests/check.at (renamed from tests/test02.vtc)28
-rw-r--r--tests/checkf.at (renamed from tests/test03.vtc)28
-rw-r--r--tests/dump.at (renamed from tests/test05.vtc)76
-rw-r--r--tests/rate.at (renamed from tests/test00.vtc)29
-rw-r--r--tests/ratef.at (renamed from tests/test01.vtc)30
-rw-r--r--tests/strftime.at (renamed from tests/time00.vtc)25
-rw-r--r--tests/testsuite.at25
20 files changed, 221 insertions, 225 deletions
diff --git a/Makefile.am b/Makefile.am
index 62e3258..cf92536 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,30 +1,5 @@
-# This file is part of vmod-tbf
-# Copyright (C) 2013-2016 Sergey Poznyakoff
-#
-# Vmod-tbf is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# Vmod-tbf is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
ACLOCAL_AMFLAGS = -I m4 -I acvmod
SUBDIRS = src tests
-AM_DISTCHECK_CONFIGURE_FLAGS=--without-vmoddir
-
-EXTRA_DIST=git2chg.awk
-
-.PHONY: ChangeLog
-ChangeLog:
- $(AM_V_GEN)if test -d .git; then \
- git log --pretty='format:%ct %an <%ae>%n%n%s%n%n%b%n' | \
- awk -f $(top_srcdir)/git2chg.awk > ChangeLog; \
- fi
-
+include acvmod/top.am
diff --git a/NEWS b/NEWS
index 6a4036a..1833b00 100644
--- a/NEWS
+++ b/NEWS
@@ -1,19 +1,20 @@
-vmod-tbf -- history of user-visible changes. 2016-01-26
-Copyright (C) 2013-2016 Sergey Poznyakoff
+vmod-tbf -- history of user-visible changes. 2017-08-06
+Copyright (C) 2013-2017 Sergey Poznyakoff
See the end of file for copying conditions.
Please send vmod-tbf bug reports to <gray@gnu.org>
-Version 2.0.91-4.1.9, (git)
+Version 2.0.92, (git)
* Support for Varnish 4.1
-* Versioning changes
+* TBF data are stored in a binary tree instead of DBM database
-Starting with this release, the version number includes version
+* The --with-varnish-source option has been withdrawn
-* TBF data are stored in a binary tree instead of DBM database
+The configure script relies on pkg-config to determine the location of
+Varnish header files and libraries.
Version 2.0, 2014-11-13
@@ -28,7 +29,7 @@ Initial release
=========================================================================
Copyright information:
-Copyright (C) 2013-2016 Sergey Poznyakoff
+Copyright (C) 2013-2017 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
diff --git a/README b/README
index 31eed94..961edb9 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
Vmod-tbf README
-Copyright (C) 2013-2014 Sergey Poznyakoff
+Copyright (C) 2013-2017 Sergey Poznyakoff
See the end of file for copying conditions.
* Introduction
@@ -34,29 +34,35 @@ UNIX timestamps in human-readable form, etc.
* Installation
-In order to compile the package you need to have Varnish source tree
-configured and compiled, and the Berkeley DB library. The minimum
-prerequisites are Varnish 3.0.1 and BDB 4.2.
+In order to compile the package you need to have the
+varnishd and varnishapi packages installed.
-Supposing that the varnish source tree is available under
-/usr/src/varnish-3.0.1, run:
+Supposing that condition is met, run:
- ./configure --with-varnish-source=/usr/src/varnish-3.0.1
+ ./configure
-The `--with-varnish-source' option is mandatory: it tells configure
-where Varnish sources reside.
+It should be able to automatically find the necessary components. In case
+it doesn't, tweak the configuration variables as necessary. The most
+important one is PKG_CONFIG_PATH, which contains a path (in the UNIX sense)
+where the .pc files are located. It should contain a directory where the
+'varnishapi.pc' file lives. Example usage:
+
+ ./configure PKG_CONFIG_PATH=/usr/local/varnish/lib/pkgconfig:$PKG_CONFIG_PATH
+
+Please read the file INSTALL for a detailed discussion of available variables
+and command line options.
Once configured, do
-
+
make
This will build the module. After this step you can optionally run
'make test' to test the package.
Finally, run the following command as root:
-
- make install
+ make install
+
* Documentation
The manual page vmod-tbf(3) will be available after successful install.
@@ -73,7 +79,7 @@ Send bug reports and suggestions to <gray@gnu.org>
* Copyright information:
-Copyright (C) 2013 Sergey Poznyakoff
+Copyright (C) 2013-2017 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
diff --git a/acvmod b/acvmod
-Subproject f064cf4d7aa1ead1f8607b8b72baf883f015ffc
+Subproject ba32780019480b89cd9d796b93a76cae6afe99a
diff --git a/configure.ac b/configure.ac
index fc74a6d..0a71928 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
# This file is part of vmod-tbf -*- autoconf -*-
-# Copyright (C) 2013-2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-tbf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ(2.69)
-AC_INIT([vmod-tbf], 2.0.91-4.1.0, [gray@gnu.org])
+AC_INIT([vmod-tbf], 2.0.92, [gray@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/vmod_tbf.vcc)
@@ -47,10 +47,13 @@ AC_CHECK_FUNCS(sysinfo getloadavg)
AM_VARNISHAPI
+AC_CONFIG_TESTDIR(tests)
+AC_CONFIG_FILES([tests/Makefile tests/atlocal])
+AM_MISSING_PROG([AUTOM4TE], [autom4te])
+
AC_CONFIG_FILES([
Makefile
src/Makefile
- tests/Makefile
])
AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
index 0ccb3bf..dbadc03 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
# This file is part of vmod-tbf
-# Copyright (C) 2013-2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-tbf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,9 +15,7 @@
# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
AM_CPPFLAGS=\
- -I$(VARNISHSRC)/include\
- -I$(VARNISHSRC)/bin/varnishd\
- -I$(VARNISHSRC)\
+ $(VARNISHAPI_CFLAGS)\
-DLOCALSTATEDIR=\"$(localstatedir)\"
dist_man_MANS=vmod-tbf.3 vmod_tbf.3
@@ -41,12 +39,11 @@ tbf.lo: vcc_if.h
CLEANFILES = vcc_if.c vcc_if.h *.rst
-vmodtool = $(VARNISHSRC)/lib/libvcc/vmodtool.py
vmodtoolargs = --strict
vccfile = $(top_srcdir)/src/vmod_tbf.vcc
vcc_if.c vcc_if.h: $(vmodtool) $(vccfile)
- $(AM_V_GEN)$(PYTHON) $(vmodtool) $(vmodtoolargs) $(vccfile)
+ $(AM_V_GEN)$(PYTHON) $(VARNISHAPI_VMODTOOL) $(vmodtoolargs) $(vccfile)
EXTRA_DIST = \
vmod_tbf.vcc
diff --git a/src/getla.c b/src/getla.c
index f80b213..473cd01 100644
--- a/src/getla.c
+++ b/src/getla.c
@@ -1,5 +1,5 @@
/* This file is part of vmod-tbf
- Copyright (C) 2013-2014 Sergey Poznyakoff
+ Copyright (C) 2013-2017 Sergey Poznyakoff
Vmod-tbf is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ sys_getla(int what)
}
VCL_REAL
-vmod_getla(MOD_CTX ctx, VCL_INT what)
+vmod_getla(VRT_CTX, VCL_INT what)
{
switch (what) {
case 1:
diff --git a/src/sleep.c b/src/sleep.c
index 167e6aa..4b8c5bb 100644
--- a/src/sleep.c
+++ b/src/sleep.c
@@ -1,5 +1,5 @@
/* This file is part of vmod-tbf
- Copyright (C) 2013-2014 Sergey Poznyakoff
+ Copyright (C) 2013-2017 Sergey Poznyakoff
Vmod-tbf is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
#include <time.h>
VCL_VOID
-vmod_sleep(MOD_CTX ctx, VCL_REAL t)
+vmod_sleep(VRT_CTX, VCL_REAL t)
{
struct timespec ts, ret;
diff --git a/src/tbf.h b/src/tbf.h
index 69fd89d..06af4c7 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -1,5 +1,5 @@
/* This file is part of vmod-tbf
- Copyright (C) 2013-2016 Sergey Poznyakoff
+ Copyright (C) 2013-2017 Sergey Poznyakoff
Vmod-tbf is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,8 +29,7 @@
#include "vsha256.h"
#include "pthread.h"
-#include "bin/varnishd/cache/cache.h"
-#define MOD_CTX const struct vrt_ctx *
+#include "cache/cache.h"
#define WSPTR(s) ((s)->ws)
#ifndef USEC_PER_SEC
diff --git a/src/time.c b/src/time.c
index 32427af..b76a137 100644
--- a/src/time.c
+++ b/src/time.c
@@ -1,5 +1,5 @@
/* This file is part of vmod-tbf
- Copyright (C) 2013-2014 Sergey Poznyakoff
+ Copyright (C) 2013-2017 Sergey Poznyakoff
Vmod-tbf is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,13 +18,13 @@
#include <time.h>
VCL_INT
-vmod_systime(MOD_CTX ctx)
+vmod_systime(VRT_CTX)
{
return time(NULL);
}
VCL_STRING
-vmod_strftime(MOD_CTX ctx, VCL_STRING format, VCL_INT timestamp)
+vmod_strftime(VRT_CTX, VCL_STRING format, VCL_INT timestamp)
{
time_t ts = (time_t) timestamp;
size_t u, n;
diff --git a/tests/.gitignore b/tests/.gitignore
index 6f6760a..93f8f46 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,2 +1,6 @@
-test00.vtc
-test02.vtc
+atconfig
+atlocal
+package.m4
+testsuite
+testsuite.dir
+testsuite.log
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 413d176..30b0360 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,5 @@
# This file is part of vmod-tbf
-# Copyright (C) 2013-2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-tbf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,29 +14,64 @@
# You should have received a copy of the GNU General Public License
# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
-VMOD_TESTS = \
- test00.vtc\
- test01.vtc\
- test02.vtc\
- test03.vtc\
- test05.vtc\
- time00.vtc
+EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4
+DISTCLEANFILES = atconfig $(check_SCRIPTS)
+MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
+CLEANFILES = .TESTINIT FAILURE
-EXTRA_DIST=$(VMOD_TESTS)
+## ------------ ##
+## package.m4. ##
+## ------------ ##
+
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+ $(AM_V_GEN){ \
+ echo '# Signature of the current package.'; \
+ echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
+ echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
+ echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
+ echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
+ echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+ } >$(srcdir)/package.m4
+
+#
+
+## ------------ ##
+## Test suite. ##
+## ------------ ##
+
+TESTSUITE_AT = \
+ testsuite.at\
+ rate.at\
+ ratef.at\
+ check.at\
+ checkf.at\
+ dump.at\
+ strftime.at
+
+TESTSUITE = $(srcdir)/testsuite
+M4=m4
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): package.m4 $(TESTSUITE_AT)
+ $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
+ $(AM_V_at)mv $@.tmp $@
+
+atconfig: $(top_builddir)/config.status
+ @cd $(top_builddir) && ./config.status tests/$@
+
+clean-local:
+ @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
+
+check-local: atconfig atlocal $(TESTSUITE)
+ @$(SHELL) $(TESTSUITE)
+
+# Run the test suite on the *installed* tree.
+#installcheck-local:
+# $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
distclean-local:
$(AM_V_at)rm -fr tbf
-check: $(BUILT_TESTS)
- $(AM_V_at)for t in $(VMOD_TESTS); do \
- n=$${t%%.vti}; \
- if [ $$n != $$t ]; then \
- t=$(abs_builddir)/$${n}.vtc;\
- else \
- t=$(abs_srcdir)/$$t;\
- fi; \
- $(VARNISHSRC)/bin/varnishtest/varnishtest \
- -Dvarnishd=$(VARNISHSRC)/bin/varnishd/varnishd \
- -Dvmod_topsrc=$(abs_top_srcdir) \
- -Dvmod_topbuild=$(abs_top_builddir) $$t; \
- done
+
+
+
diff --git a/tests/atlocal.in b/tests/atlocal.in
new file mode 100644
index 0000000..9f80ebf
--- /dev/null
+++ b/tests/atlocal.in
@@ -0,0 +1,7 @@
+# @configure_input@ -*- shell-script -*-
+# Configurable variable values for vmod_tbf test suite.
+# Copyright (C) 2017 Sergey Poznyakoff
+
+PATH=@abs_builddir@:@abs_top_builddir@/src:@abs_top_srcdir@/build-aux:$top_srcdir:$srcdir:$PATH
+VARNISHTEST=@VARNISHTEST@
+VARNISHD=@VARNISHD@
diff --git a/tests/test02.vtc b/tests/check.at
index fe03d6b..f45c1b1 100644
--- a/tests/test02.vtc
+++ b/tests/check.at
@@ -1,5 +1,5 @@
# This file is part of vmod-tbf
-# Copyright (C) 2013-2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-tbf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,26 +13,16 @@
#
# You should have received a copy of the GNU General Public License
# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
-
-varnishtest "Test tbf overlimit"
-
-server s1 {
- rxreq
- txresp
-} -start
-
-varnish v1 -vcl+backend {
- import tbf from "${vmod_topbuild}/src/.libs/libvmod_tbf.so";
+AT_SETUP([check])
+AT_KEYWORDS([check])
+AT_VARNISHTEST([tbf],[
sub vcl_recv {
if (!tbf.check("url:"+req.url, "4 req/s")) {
return (synth(420, "Overlimit"));
}
- return (hash);
}
-} -start
-
-client c1 {
- txreq -url "/"
+],
+[ txreq -url "/"
rxresp
expect resp.status == 200
txreq -url "/"
@@ -50,8 +40,6 @@ client c1 {
txreq -url "/"
rxresp
expect resp.status == 420
-}
-
-client c1 -run
-
+])
+AT_CLEANUP
diff --git a/tests/test03.vtc b/tests/checkf.at
index 0a6cdea..c4155ba 100644
--- a/tests/test03.vtc
+++ b/tests/checkf.at
@@ -1,5 +1,5 @@
# This file is part of vmod-tbf
-# Copyright (C) 2013-2014 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-tbf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,23 +13,14 @@
#
# You should have received a copy of the GNU General Public License
# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
-
-varnishtest "Test tbf flow"
-
-server s1 {
- rxreq
- txresp
-} -start
-
-varnish v1 -vcl+backend {
- import tbf from "${vmod_topbuild}/src/.libs/libvmod_tbf.so";
+AT_SETUP([check flow])
+AT_KEYWORDS([checkf flow])
+AT_VARNISHTEST([tbf],[
sub vcl_deliver {
set resp.http.result = tbf.check("url:"+req.url, "4req/s");
}
-} -start
-
-client c1 {
- txreq -url "/"
+],
+[ txreq -url "/"
rxresp
expect resp.http.result == true
@@ -74,8 +65,5 @@ client c1 {
txreq -url "/"
rxresp
expect resp.http.result == false
-}
-
-client c1 -run
-
-
+])
+AT_CLEANUP
diff --git a/tests/test05.vtc b/tests/dump.at
index 485318e..b4230de 100644
--- a/tests/test05.vtc
+++ b/tests/dump.at
@@ -1,5 +1,5 @@
# This file is part of vmod-tbf
-# Copyright (C) 2013-2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-tbf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,40 +14,9 @@
# You should have received a copy of the GNU General Public License
# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
-varnishtest "Test dump/load facilities"
-
-server s1 {
- rxreq
- txresp
-
- rxreq
- txresp
-
- rxreq
- txresp
-
- rxreq
- txresp
-
- rxreq
- txresp
-
- rxreq
- txresp
-
- rxreq
- txresp
-
- rxreq
- txresp
-
- rxreq
- txresp
-} -start
-
-varnish v1 -vcl+backend {
- import std;
- import tbf from "${vmod_topbuild}/src/.libs/libvmod_tbf.so";
+AT_SETUP([dump/load facilities])
+AT_KEYWORDS([dump load])
+AT_VARNISHTEST([tbf],[
# sub vcl_init {
# tbf.debug(20);
# }
@@ -61,10 +30,8 @@ varnish v1 -vcl+backend {
}
return (hash);
}
-} -start
-
-client c1 {
- txreq -url "/seks"
+],
+[ txreq -url "/seks"
rxresp
expect resp.status == 200
txreq -url "/fire"
@@ -109,9 +76,34 @@ client c1 {
expect resp.status == 200
# delay
-
-}
+],
+[ rxreq
+ txresp
+
+ rxreq
+ txresp
-client c1 -run
+ rxreq
+ txresp
+
+ rxreq
+ txresp
+
+ rxreq
+ txresp
+
+ rxreq
+ txresp
+
+ rxreq
+ txresp
+
+ rxreq
+ txresp
+
+ rxreq
+ txresp
+])
+AT_CLEANUP
diff --git a/tests/test00.vtc b/tests/rate.at
index b41b882..75d9df4 100644
--- a/tests/test00.vtc
+++ b/tests/rate.at
@@ -1,5 +1,5 @@
# This file is part of vmod-tbf
-# Copyright (C) 2013-2016 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-tbf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,25 +14,17 @@
# You should have received a copy of the GNU General Public License
# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
-varnishtest "Test tbf overlimit"
-
-server s1 {
- rxreq
- txresp
-} -start
-
-varnish v1 -vcl+backend {
- import tbf from "${vmod_topbuild}/src/.libs/libvmod_tbf.so";
+AT_SETUP([rate])
+AT_KEYWORDS([rate])
+AT_VARNISHTEST([tbf],[
sub vcl_recv {
if (!tbf.rate("url:"+req.url, 1, 20 s, 5)) {
return (synth(420, "Overlimit"));
}
return (hash);
}
-} -start
-
-client c1 {
- txreq -url "/"
+],
+[ txreq -url "/"
rxresp
expect resp.status == 200
txreq -url "/"
@@ -50,8 +42,9 @@ client c1 {
txreq -url "/"
rxresp
expect resp.status == 420
-}
-
-client c1 -run
-
+],
+[ rxreq
+ txresp
+])
+AT_CLEANUP
diff --git a/tests/test01.vtc b/tests/ratef.at
index ba7fd10..d0dc7ea 100644
--- a/tests/test01.vtc
+++ b/tests/ratef.at
@@ -1,5 +1,5 @@
# This file is part of vmod-tbf
-# Copyright (C) 2013-2014 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-tbf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,22 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
-varnishtest "Test tbf flow"
-
-server s1 {
- rxreq
- txresp
-} -start
-
-varnish v1 -vcl+backend {
- import tbf from "${vmod_topbuild}/src/.libs/libvmod_tbf.so";
+AT_SETUP([rate flow])
+AT_KEYWORDS([ratef flow])
+AT_VARNISHTEST([tbf],[
sub vcl_deliver {
set resp.http.result = tbf.rate("url:"+req.url, 1, 1s, 5);
}
-} -start
-
-client c1 {
- txreq -url "/"
+],
+[ txreq -url "/"
rxresp
expect resp.http.result == true
@@ -62,8 +54,8 @@ client c1 {
txreq -url "/"
rxresp
expect resp.http.result == false
-}
-
-client c1 -run
-
-
+],
+[ rxreq
+ txresp
+])
+AT_CLEANUP
diff --git a/tests/time00.vtc b/tests/strftime.at
index 0cd85b5..58fc723 100644
--- a/tests/time00.vtc
+++ b/tests/strftime.at
@@ -1,5 +1,5 @@
# This file is part of vmod-tbf
-# Copyright (C) 2013-2014 Sergey Poznyakoff
+# Copyright (C) 2013-2017 Sergey Poznyakoff
#
# Vmod-tbf is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,26 +14,17 @@
# You should have received a copy of the GNU General Public License
# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
-varnishtest "Test strftime"
-
-server s1 {
- rxreq
- txresp
-} -start
-
-varnish v1 -vcl+backend {
- import tbf from "${vmod_topbuild}/src/.libs/libvmod_tbf.so";
+AT_SETUP([strftime])
+AT_KEYWORDS([strftime])
+AT_VARNISHTEST([tbf],[
sub vcl_deliver {
set resp.http.result = tbf.strftime("%Y-%m-%d", 26697600);
}
-} -start
-
-client c1 {
- txreq
+],
+[ txreq
rxresp
expect resp.http.result == 1970-11-06
-}
-
-client c1 -run
+])
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
new file mode 100644
index 0000000..ebca4be
--- /dev/null
+++ b/tests/testsuite.at
@@ -0,0 +1,25 @@
+# This file is part of vmod_tbf.
+# Copyright (C) 2017 Sergey Poznyakoff
+#
+# Vmod_tbf is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Vmod_tbf is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with vmod_tbf. If not, see <http://www.gnu.org/licenses/>.
+
+m4_include([../acvmod/testsuite.inc])
+AT_INIT
+m4_include([rate.at])
+m4_include([ratef.at])
+m4_include([check.at])
+m4_include([checkf.at])
+m4_include([dump.at])
+m4_include([strftime.at])
+

Return to:

Send suggestions and report system problems to the System administrator.