MINOR: tests: First regression testing file.
Add a makefile target 'reg-tests' to run all regression testing file
found in 'reg-tests' directory.
Add reg-tests/lua/h00000.vtc first regression testing file for a LUA
fixed by f874a83
commit.
This commit is contained in:
parent
3448c490ca
commit
153b2b68bf
|
@ -22,6 +22,7 @@
|
|||
!/tests
|
||||
!/debian
|
||||
!/scripts
|
||||
!/reg-tests
|
||||
# Reject some generic files
|
||||
*.o
|
||||
*~
|
||||
|
|
11
Makefile
11
Makefile
|
@ -91,6 +91,8 @@
|
|||
# VERSION : force haproxy version reporting.
|
||||
# SUBVERS : add a sub-version (eg: platform, model, ...).
|
||||
# VERDATE : force haproxy's release date.
|
||||
#
|
||||
# VARNISHTEST_PROGRAM : location of the varnishtest program to run reg-tests.
|
||||
|
||||
# Function used to detect support of a given option by the compiler.
|
||||
# Usage: CFLAGS += $(call cc-opt,option). Eg: $(call cc-opt,-fwrapv)
|
||||
|
@ -996,3 +998,12 @@ update-version:
|
|||
echo "$(VERSION)" > VERSION
|
||||
echo "$(SUBVERS)" > SUBVERS
|
||||
echo "$(VERDATE)" > VERDATE
|
||||
|
||||
reg-tests:
|
||||
@if [ ! -x "$(VARNISHTEST_PROGRAM)" ]; then \
|
||||
echo "Please make the VARNISHTEST_PROGRAM variable point to the location of the varnishtest program."; \
|
||||
exit 1; \
|
||||
fi
|
||||
@find reg-tests -type f -name "*.vtc" -print0 | \
|
||||
xargs -0 $(VARNISHTEST_PROGRAM) -l -t5
|
||||
.PHONY: reg-tests
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
core.register_action("foo", { "http-req" }, function(txn)
|
||||
txn.sc:ipmask(txn.f:src(), 24, 112)
|
||||
end)
|
|
@ -0,0 +1,74 @@
|
|||
# commit f874a83
|
||||
# BUG/MINOR: lua: Segfaults with wrong usage of types.
|
||||
#
|
||||
# Patrick reported that this simple configuration made haproxy segfaults:
|
||||
#
|
||||
# global
|
||||
# lua-load /tmp/haproxy.lua
|
||||
#
|
||||
# frontend f1
|
||||
# mode http
|
||||
# bind :8000
|
||||
# default_backend b1
|
||||
#
|
||||
# http-request lua.foo
|
||||
#
|
||||
# backend b1
|
||||
# mode http
|
||||
# server s1 127.0.0.1:8080
|
||||
#
|
||||
# with this '/tmp/haproxy.lua' script:
|
||||
#
|
||||
# core.register_action("foo", { "http-req" }, function(txn)
|
||||
# txn.sc:ipmask(txn.f:src(), 24, 112)
|
||||
# end)
|
||||
#
|
||||
# This is due to missing initialization of the array of arguments
|
||||
# passed to hlua_lua2arg_check() which makes it enter code with
|
||||
# corrupted arguments.
|
||||
#
|
||||
# Thanks a lot to Patrick Hemmer for having reported this issue.
|
||||
|
||||
|
||||
varnishtest "Basic LUA test h00000"
|
||||
feature ignore_unknown_macro
|
||||
|
||||
server s1 -repeat 2 {
|
||||
rxreq
|
||||
txresp
|
||||
} -start
|
||||
|
||||
haproxy h1 -conf {
|
||||
global
|
||||
lua-load ${testdir}/h00000.lua
|
||||
|
||||
frontend fe1
|
||||
mode http
|
||||
bind "fd@${fe1}"
|
||||
default_backend b1
|
||||
|
||||
http-request lua.foo
|
||||
|
||||
backend b1
|
||||
mode http
|
||||
server s1 ${s1_addr}:${s1_port}
|
||||
|
||||
} -start
|
||||
|
||||
client c0 -connect ${h1_fe1_sock} {
|
||||
txreq -url "/foo"
|
||||
rxresp
|
||||
expect resp.status == 200
|
||||
}
|
||||
|
||||
client c1 -connect ${h1_fe1_sock} {
|
||||
txreq -url "/foo"
|
||||
rxresp
|
||||
expect resp.status == 200
|
||||
}
|
||||
|
||||
client c0 -start
|
||||
client c1 -start
|
||||
|
||||
client c0 -wait
|
||||
client c1 -wait
|
Loading…
Reference in New Issue