This repository was archived by the owner on Dec 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11AC_PREREQ ( 2.59 )
22AC_COPYRIGHT ( [ Copyright (c) 2011 Varnish Software AS] )
3- AC_INIT ( [ libvmod-example] , [ 0.1 ] )
3+ AC_INIT ( [ libvmod-example] , [ trunk ] )
44AC_CONFIG_MACRO_DIR ( [ m4] )
55AC_CONFIG_SRCDIR ( src/vmod_example.vcc )
66AM_CONFIG_HEADER(config.h)
@@ -43,6 +43,12 @@ AC_CHECK_FILE([$VARNISHSRC/include/varnishapi.h],
4343 [ AC_MSG_FAILURE ( [ "$VARNISHSRC" is not a Varnish source directory] ) ]
4444)
4545
46+ # Check that varnishtest is built in the varnish source directory
47+ AC_CHECK_FILE ( [ $VARNISHSRC/bin/varnishtest/varnishtest] ,
48+ [ ] ,
49+ [ AC_MSG_FAILURE ( [ Can't find "$VARNISHSRC/bin/varnishtest/varnishtest". Please build your varnish source directory] ) ]
50+ )
51+
4652# vmod installation dir
4753AC_ARG_VAR ( [ VMODDIR] , [ vmod installation directory @<:@ LIBDIR/varnish/vmods@:>@ ] )
4854if test "x$VMODDIR" = x; then
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ INCLUDES = -I$(VARNISHSRC)/include -I$(VARNISHSRC)
33vmoddir = $(VMODDIR )
44vmod_LTLIBRARIES = libvmod_example.la
55
6- libvmod_example_la_LDFLAGS = -version-info 1:0:0
6+ libvmod_example_la_LDFLAGS = -avoid-version
77
88libvmod_example_la_SOURCES = \
99 vcc_if.c \
@@ -13,6 +13,16 @@ libvmod_example_la_SOURCES = \
1313vcc_if.c vcc_if.h : $(VARNISHSRC ) /lib/libvmod_std/vmod.py $(top_srcdir ) /src/vmod_example.vcc
1414 @PYTHON@ $(VARNISHSRC ) /lib/libvmod_std/vmod.py $(top_srcdir ) /src/vmod_example.vcc
1515
16- EXTRA_DIST = vmod_example.vcc
16+ MYTESTS = tests/*.vtc
17+ .PHONY : $(MYTESTS )
18+
19+ tests/*.vtc :
20+ cd $(VARNISHSRC ) /bin/varnishtest && ./varnishtest -D vmod_topbuild=$(abs_top_builddir ) $(abs_srcdir ) /$@
21+
22+ check : $(MYTESTS )
23+
24+ EXTRA_DIST = \
25+ $(MYTESTS ) \
26+ vmod_example.vcc
1727
1828CLEANFILES = $(builddir ) /vcc_if.c $(builddir ) /vcc_if.h
Original file line number Diff line number Diff line change 1+ varnishtest "Test example vmod"
2+
3+ server s1 {
4+ rxreq
5+ txresp
6+ } -start
7+
8+ varnish v1 -vcl+backend {
9+ import example from "${vmod_topbuild}/src/.libs/libvmod_example.so";
10+
11+ sub vcl_deliver {
12+ set resp.http.val = example.abs(2-3);
13+ }
14+ } -start
15+
16+ client c1 {
17+ txreq -url "/"
18+ rxresp
19+ expect resp.http.val == "1"
20+ }
21+
22+ client c1 -run
You can’t perform that action at this time.
0 commit comments