Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 78 additions & 12 deletions bin/varnishtest/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,34 @@ TESTS = @VTC_TESTS@

include $(top_srcdir)/vtc.am

DISTCLEANFILES = _.ok

AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_builddir)/include \
-I$(top_builddir) \
-I$(top_srcdir)/lib/libvgz \
-I$(srcdir)/vtest2/lib

EXTRA_DIST = \
$(top_srcdir)/bin/varnishtest/tests/*.vtc \
$(top_srcdir)/bin/varnishtest/tests/common.pem \
$(top_srcdir)/bin/varnishtest/tests/README

################################################################################
## BEGIN HAVE_VTEST_SUBMODULE
##
## not indendet on purpose
if HAVE_VTEST_SUBMODULE

EXTRA_DIST += \
$(srcdir)/vtest2/src/../tests/*.vtc \
vtest2/src/gensequences \
vtest2/src/sequences \
vtest2/src/teken.3 \
vtest2/src/huffman_gen.py \
vtest2/src/tbl/vhp_huffman.h

DISTCLEANFILES = _.ok

bin_PROGRAMS = varnishtest

# for -i invocation / a00000.vtc
Expand Down Expand Up @@ -80,16 +99,6 @@ varnishtest_CFLAGS = \
-DVTEST_WITH_VTC_VSM \
-DTOP_BUILDDIR='"${top_builddir}"'

EXTRA_DIST = $(srcdir)/vtest2/src/../tests/*.vtc \
$(top_srcdir)/bin/varnishtest/tests/*.vtc \
$(top_srcdir)/bin/varnishtest/tests/common.pem \
$(top_srcdir)/bin/varnishtest/tests/README \
vtest2/src/gensequences \
vtest2/src/sequences \
vtest2/src/teken.3 \
vtest2/src/huffman_gen.py \
vtest2/src/tbl/vhp_huffman.h

teken.c: teken_state.h

teken_state.h: $(srcdir)/vtest2/src/sequences $(srcdir)/vtest2/src/gensequences
Expand All @@ -110,3 +119,60 @@ BUILT_SOURCES = \
CLEANFILES = \
$(BUILT_SOURCES) \
vtest

##
## END HAVE_VTEST_SUBMODULE
################################################################################
else
################################################################################
## BEGIN vtc_varnish ext

lib_LTLIBRARIES = libvtc_varnish.la libvtc_builtwith.la libdummy.la

# XXX TODO
# - for actual move, the sources need to be relocated from VTest2 back to here
# - for actual move, remove -DVTEST_WITH_...
# - remove feature tests now in builtwith from Vtest2 core
# - remove pkg_version pkg_branch from Vtest2 core
# - add libvtc_builtwith to Vtest2 as an example
libvtc_varnish_la_SOURCES = \
vtest2/src/vtc_varnish.c \
vtest2/src/vtc_vsm.c \
vtest2/src/vtc_logexp.c \
vtc_ext_varnish.c

libvtc_varnish_la_CFLAGS = \
@VTEST_CFLAGS@ \
-DVTEST_WITH_VTC_LOGEXPECT \
-DVTEST_WITH_VTC_VARNISH \
-DVTEST_WITH_VTC_VSM

libvtc_varnish_la_LIBADD = \
$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
$(top_builddir)/lib/libvarnish/libvarnish.la \
$(top_builddir)/lib/libvgz/libvgz.la \
${PTHREAD_LIBS} ${NET_LIBS} ${LIBM}

libvtc_builtwith_la_SOURCES = vtc_ext_builtwith.c

libvtc_builtwith_la_CFLAGS = @VTEST_CFLAGS@

libdummy_la_SOURCES = libdummy.c

bin_PROGRAMS = varnishtest

varnishtest_SOURCES = varnishtest.c
# to get the libtool wrapper
varnishtest_LDADD = libdummy.la

# for the out-of-tree vtest mode, the vtest wrapper from in-tree mode must not
# exist, or else we get an infinit exec loop
clean-vtest:
rm -f vtest

all-local: clean-vtest

## END vtc_varnish ext
################################################################################
endif

Empty file added bin/varnishtest/libdummy.c
Empty file.
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/b00068.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Check timeout_linger"

feature !workspace_emulator
builtwith !workspace_emulator

# XXX this test exploits the fact that the struct waited is
# left near the free pointer of the session ws when a session
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/c00057.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ varnishtest "test sigsegv handler"

# Under ASAN, the stack layout is different and STACK OVERFLOW is
# never printed.
feature !asan
builtwith !asan

server s1 {
rxreq
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/e00029.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "ESI max_esi_depth"

feature !sanitizer
builtwith !sanitizer

# test that the default stack size is sufficient for hitting
# max_esi_depth
Expand Down
3 changes: 2 additions & 1 deletion bin/varnishtest/tests/o00006.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
varnishtest "SES_Reserve_proto_priv() overflow"

feature 64bit ipv4
builtwith 64bit
feature ipv4

server s1 {
rxreq
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/p00000.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Test Basic persistence"

feature persistent_storage
builtwith persistent_storage

process p1 -dump {
varnishd -spersistent -b ${localhost} -a :0 -d 2>&1
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/p00002.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Ban a persistent object"

feature persistent_storage
builtwith persistent_storage

shell "rm -f ${tmpdir}/_.per[12]"

Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/p00003.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Ban a persistent object"

feature persistent_storage
builtwith persistent_storage

shell "rm -f ${tmpdir}/_.per"

Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/p00004.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Check object references"

feature persistent_storage
builtwith persistent_storage

shell "rm -f ${tmpdir}/_.per"

Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/p00005.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Check expiry of non-instantiated object"

feature persistent_storage
builtwith persistent_storage

shell "rm -f ${tmpdir}/_.per"

Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/p00006.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Check that Vary headers are stored"

feature persistent_storage
builtwith persistent_storage

shell "rm -f ${tmpdir}/_.per"

Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/p00007.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "test reload of object spanning incomplete segment"

feature persistent_storage
builtwith persistent_storage
feature disable_aslr

barrier b1 cond 2
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/p00008.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Ban list sync across silos"

feature persistent_storage
builtwith persistent_storage

shell "rm -f ${tmpdir}/_.per[12]"

Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/p00009.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Check that reloaded bans with completed flag are really completed on restart"

feature persistent_storage
builtwith persistent_storage

shell "rm -f ${tmpdir}/_.per[12]"

Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/r00915.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "error object allocation with persistent"

feature persistent_storage
builtwith persistent_storage

server s1 {
rxreq
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/r00962.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Test address remapping"

feature persistent_storage
builtwith persistent_storage

# VM-remapping is too random on OSX
feature cmd {test $(uname) != "Darwin"}
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/r01225.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Test bans_req counter on persistent reload - #1225"

feature persistent_storage
builtwith persistent_storage

shell "rm -f ${tmpdir}/_.per"

Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/r01266.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "#1266 - Check persisted truncated completed bans"

feature persistent_storage
builtwith persistent_storage

# Test that bans which has been completed, truncated and persisted works

Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/r03308.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Unformattable VCL_TIME"

feature 64bit
builtwith 64bit

server s1 {
rxreq
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/r03353.vtc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
varnishtest "Test rollback and retry"

# ws_emu triggers #3550
feature !workspace_emulator
builtwith !workspace_emulator

server s1 {
rxreq
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/r04164.vtc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
varnishtest "pass, rollback, invalid range"

# ws_emu triggers #3550
feature !workspace_emulator
builtwith !workspace_emulator

server s1 {
rxreq
Expand Down
6 changes: 3 additions & 3 deletions bin/varnishtest/tests/v00004.vtc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
varnishtest "test if our default parameters make sense ..."

feature 64bit
feature !sanitizer
feature !coverage
builtwith 64bit
builtwith !sanitizer
builtwith !coverage

# ... for our definition of a standard use case:
# - 2019 header madness
Expand Down
2 changes: 1 addition & 1 deletion bin/varnishtest/tests/v00041.vtc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
varnishtest "Test priv_task"

feature !sanitizer
builtwith !sanitizer

server s1 {
rxreq
Expand Down
67 changes: 67 additions & 0 deletions bin/varnishtest/varnishtest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*-
* Copyright 2025 UPLEX - Nils Goroll Systemoptimierung
* All rights reserved.
*
* Author: Nils Goroll <nils.goroll@uplex.de>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* 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.
* 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 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.
*
* Wrapper to call vtest with additional extensions
*
* The problem solved by this code can easily also be solved with a two-liner
* shell script, except that we would need to implement all the mechanics to
* locate libvtc_varnish.so while it is still uninstalled. But for this simple
* program, libtool handles it all.
*/

#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include "vdef.h"

const char *addargs[]= {
"vtest",
"-E", "libvtc_varnish.so",
"-E", "libvtc_builtwith.so"
};

int
main(int argc, char **argv)
{
size_t n = vcountof(addargs);
char **narg = calloc(argc + n, sizeof *narg);
int r;

if (narg == NULL)
return (ENOMEM);
memcpy(&narg[0], &addargs[0], n * sizeof *narg);
memcpy(&narg[n], &argv[1], (argc - 1) * sizeof *narg);
r = execvp(narg[0], narg);
fprintf(stderr, "execvp(%s): %d (%s)\n", narg[0], errno,
strerror(errno));
return (r);
}
Loading