Commit a2c4b91e authored by Nils Goroll's avatar Nils Goroll

Merge branch 'master' into new_output_buffering

parents 08a624ee a00794a4
...@@ -32,6 +32,7 @@ src/test/test_writer ...@@ -32,6 +32,7 @@ src/test/test_writer
src/test/test_hdrtrie src/test/test_hdrtrie
src/test/output.log src/test/output.log
src/test/test.log src/test/test.log
src/test/vslarg.sh.trc.*
src/varnishevent src/varnishevent
src/vcs_version.h src/vcs_version.h
*.1 *.1
......
...@@ -375,7 +375,7 @@ void ...@@ -375,7 +375,7 @@ void
format_h_backend(const tx_t *tx, const arg_t *args, char **s, size_t *len) format_h_backend(const tx_t *tx, const arg_t *args, char **s, size_t *len)
{ {
(void) args; (void) args;
format_h(tx, SLT_Backend, 2, s, len); format_h(tx, SLT_BackendOpen, 2, s, len);
} }
static inline void static inline void
...@@ -1103,7 +1103,7 @@ compile_fmt(char * const format, compiled_fmt_t * const fmt, ...@@ -1103,7 +1103,7 @@ compile_fmt(char * const format, compiled_fmt_t * const fmt,
case 'h': case 'h':
add_formatter(fmt, os, n, FMT(type, format_h)); add_formatter(fmt, os, n, FMT(type, format_h));
add_cb_tag(type, SLT_ReqStart, SLT_Backend, NULL); add_cb_tag(type, SLT_ReqStart, SLT_BackendOpen, NULL);
n++; n++;
break; break;
......
...@@ -7,7 +7,15 @@ TESTS = test_data test_strfTIM test_hdrtrie test_format test_writer \ ...@@ -7,7 +7,15 @@ TESTS = test_data test_strfTIM test_hdrtrie test_format test_writer \
ncsa.sh vslarg.sh regress.sh ncsa.sh vslarg.sh regress.sh
# artifacts of the regression test # artifacts of the regression test
CLEANFILES = test.log output.log CLEANFILES = \
test.log \
output.log \
vslarg.sh.trc.dash-C \
vslarg.sh.trc.no \
vslarg.sh.trc.query \
vslarg.sh.trc.raw \
vslarg.sh.trc.request \
vslarg.sh.trc.vxid
check_PROGRAMS = test_data test_strfTIM test_format test_writer test_hdrtrie check_PROGRAMS = test_data test_strfTIM test_format test_writer test_hdrtrie
......
...@@ -16,7 +16,7 @@ rm -f $LOG $OUT ...@@ -16,7 +16,7 @@ rm -f $LOG $OUT
../varnishevent -f varnishevent.conf -r varnish-4.1.0-doc.log -w $OUT -v ../varnishevent -f varnishevent.conf -r varnish-4.1.0-doc.log -w $OUT -v
CKSUM=$( cksum $OUT ) CKSUM=$( cksum $OUT )
if [ "$CKSUM" != "54743924 442153 $OUT" ]; then if [ "$CKSUM" != "4160992159 443944 $OUT" ]; then
echo "ERROR: Regression test log output incorrect cksum: $CKSUM" echo "ERROR: Regression test log output incorrect cksum: $CKSUM"
exit 1 exit 1
fi fi
......
...@@ -709,7 +709,7 @@ static const char ...@@ -709,7 +709,7 @@ static const char
printf("... testing format_h_*()\n"); printf("... testing format_h_*()\n");
reset_tag2idx(NTAGS, SLT_ReqStart, SLT_Backend); reset_tag2idx(NTAGS, SLT_ReqStart, SLT_BackendOpen);
MASSERT(max_idx == NTAGS); MASSERT(max_idx == NTAGS);
init_tx_arg(&tx, node, nptr, &args); init_tx_arg(&tx, node, nptr, &args);
...@@ -719,11 +719,11 @@ static const char ...@@ -719,11 +719,11 @@ static const char
MASSERT(strncmp(str, "127.0.0.1", 9) == 0); MASSERT(strncmp(str, "127.0.0.1", 9) == 0);
MASSERT(len == 9); MASSERT(len == 9);
#define BACKEND_PAYLOAD "14 default default(127.0.0.1,,80)" #define BACKEND_PAYLOAD "14 default 127.0.0.1 80 127.0.0.1 1234"
add_record_data(&tx, SLT_Backend, &rec2, &c2, BACKEND_PAYLOAD); add_record_data(&tx, SLT_BackendOpen, &rec2, &c2, BACKEND_PAYLOAD);
format_h_backend(&tx, &args, &str, &len); format_h_backend(&tx, &args, &str, &len);
MASSERT(strncmp(str, "default(127.0.0.1,,80)", 22) == 0); MASSERT(strncmp(str, "127.0.0.1", 9) == 0);
MASSERT(len == 22); MASSERT(len == 9);
return NULL; return NULL;
#undef NTAGS #undef NTAGS
...@@ -1854,7 +1854,7 @@ setup_full_backend_tx(tx_t *tx, rec_node_t node[], rec_node_t *nptr[], ...@@ -1854,7 +1854,7 @@ setup_full_backend_tx(tx_t *tx, rec_node_t node[], rec_node_t *nptr[],
init_hdr_recs(tx, SLT_Timestamp); init_hdr_recs(tx, SLT_Timestamp);
set_hdr_data(tx, &rec[0], &c[0], get_hdr_idx(SLT_Timestamp, "Start:"), set_hdr_data(tx, &rec[0], &c[0], get_hdr_idx(SLT_Timestamp, "Start:"),
SLT_Timestamp, T1); SLT_Timestamp, T1);
add_record_data(tx, SLT_Backend, &rec[1], &c[1], BACKEND_PAYLOAD); add_record_data(tx, SLT_BackendOpen, &rec[1], &c[1], BACKEND_PAYLOAD);
add_record_data(tx, SLT_BereqMethod, &rec[2], &c[2], "GET"); add_record_data(tx, SLT_BereqMethod, &rec[2], &c[2], "GET");
add_record_data(tx, SLT_BereqURL, &rec[3], &c[3], URL_QUERY_PAYLOAD); add_record_data(tx, SLT_BereqURL, &rec[3], &c[3], URL_QUERY_PAYLOAD);
add_record_data(tx, SLT_BereqProtocol, &rec[4], &c[4], PROTOCOL_PAYLOAD); add_record_data(tx, SLT_BereqProtocol, &rec[4], &c[4], PROTOCOL_PAYLOAD);
...@@ -2103,7 +2103,7 @@ static const char ...@@ -2103,7 +2103,7 @@ static const char
case SLT_BerespStatus: case SLT_BerespStatus:
ASSERT_TAG_NOHDR(i); ASSERT_TAG_NOHDR(i);
break; break;
case SLT_Backend: case SLT_BackendOpen:
ASSERT_TAG_NOHDR(i); ASSERT_TAG_NOHDR(i);
break; break;
case SLT_BereqAcct: case SLT_BereqAcct:
...@@ -2135,7 +2135,7 @@ static const char ...@@ -2135,7 +2135,7 @@ static const char
setup_full_backend_tx(&tx, node, nptr, rec, c); setup_full_backend_tx(&tx, node, nptr, rec, c);
os = FMT_Format(&tx, &len); os = FMT_Format(&tx, &len);
#define EXP_FULL_BACKEND_OUTPUT "105 b 15703 HTTP/1.1 default(127.0.0.1,,80) "\ #define EXP_FULL_BACKEND_OUTPUT "105 b 15703 HTTP/1.1 127.0.0.1 "\
"60 foohdr barhdr - GET 283 bar=baz&quux=wilco GET "\ "60 foohdr barhdr - GET 283 bar=baz&quux=wilco GET "\
"http://foobar.com/foo?bar=baz&quux=wilco HTTP/1.1 200 "\ "http://foobar.com/foo?bar=baz&quux=wilco HTTP/1.1 200 "\
"[%d/%b/%Y:%T %z] 0 %F-%T.529143 /foo varnish 0.002837 logload "\ "[%d/%b/%Y:%T %z] 0 %F-%T.529143 /foo varnish 0.002837 logload "\
...@@ -2227,7 +2227,7 @@ static const char ...@@ -2227,7 +2227,7 @@ static const char
case SLT_BerespStatus: case SLT_BerespStatus:
ASSERT_TAG_NOHDR(i); ASSERT_TAG_NOHDR(i);
break; break;
case SLT_Backend: case SLT_BackendOpen:
ASSERT_TAG_NOHDR(i); ASSERT_TAG_NOHDR(i);
break; break;
case SLT_BereqAcct: case SLT_BereqAcct:
......
805680033 830 vslarg.sh.trc.dash-C
3453409010 443982 vslarg.sh.trc.no
805680033 830 vslarg.sh.trc.query
3267477005 21053 vslarg.sh.trc.raw
16969574 444977 vslarg.sh.trc.request
3453409010 443982 vslarg.sh.trc.vxid
...@@ -7,48 +7,27 @@ echo "... testing standard VSL args" ...@@ -7,48 +7,27 @@ echo "... testing standard VSL args"
IN=varnish-4.1.0-doc.log IN=varnish-4.1.0-doc.log
CONF=varnishevent.conf CONF=varnishevent.conf
LOG=/dev/null LOG=/dev/null
TRC=$(basename $0).trc
rm -rf ${TRC}.*
# Ensure that the local time date formatters produce the same output # Ensure that the local time date formatters produce the same output
# wherever the test is run. # wherever the test is run.
export TZ=UTC export TZ=UTC
echo "... no VSL args" echo "... no VSL args"
CKSUM=$( ../varnishevent -r ${IN} -f ${CONF} -l ${LOG} | cksum) ../varnishevent -r ${IN} -f ${CONF} -l ${LOG} > ${TRC}.no
if [ "$CKSUM" != '2542287168 442191' ]; then
echo "ERROR: no VSL args unexpected cksum: $CKSUM"
exit 1
fi
echo "... -g vxid" echo "... -g vxid"
CKSUM=$( ../varnishevent -g vxid -r ${IN} -f ${CONF} -l ${LOG} | cksum) ../varnishevent -g vxid -r ${IN} -f ${CONF} -l ${LOG} > ${TRC}.vxid
# Same as default (no -g arg)
if [ "$CKSUM" != '2542287168 442191' ]; then
echo "ERROR: -g vxid unexpected cksum: $CKSUM"
exit 1
fi
echo "... -g request" echo "... -g request"
CKSUM=$( ../varnishevent -g request -r ${IN} -f ${CONF} -l ${LOG} | cksum) ../varnishevent -g request -r ${IN} -f ${CONF} -l ${LOG} > ${TRC}.request
if [ "$CKSUM" != '3970366484 443186' ]; then
echo "ERROR: -g request unexpected cksum: $CKSUM"
exit 1
fi
echo "... -g raw" echo "... -g raw"
# Timestamps for raw grouping are always the time at which the tx was read, # Timestamps for raw grouping are always the time at which the tx was read,
# even for binary file reads. So we check against the last four columns. # even for binary file reads. So we check against the last four columns.
# The query restricts output to Begin records; the previous invocation # The query restricts output to Begin records; the previous invocation
# rendered every record with just the VXIDs. # rendered every record with just the VXIDs.
CKSUM=$( ../varnishevent -g raw -r ${IN} -f raw.conf -l ${LOG} -q 'Begin' | cut -d' ' -f4- | cksum) ../varnishevent -g raw -r ${IN} -f raw.conf -l ${LOG} -q 'Begin' |
cut -d' ' -f4- > ${TRC}.raw
if [ "$CKSUM" != '3267477005 21053' ]; then
echo "ERROR: -g raw with query unexpected cksum: $CKSUM"
exit 1
fi
# Cannot mix raw grouping with client and/or backend formats # Cannot mix raw grouping with client and/or backend formats
../varnishevent -g raw -f ${CONF} -l ${LOG} ../varnishevent -g raw -f ${CONF} -l ${LOG}
...@@ -66,12 +45,7 @@ if [ "$?" != "1" ]; then ...@@ -66,12 +45,7 @@ if [ "$?" != "1" ]; then
fi fi
echo "... -q query" echo "... -q query"
CKSUM=$( ../varnishevent -q 'ReqURL ~ "_static"' -r ${IN} -l ${LOG} | cksum) ../varnishevent -q 'ReqURL ~ "_static"' -r ${IN} -l ${LOG} > ${TRC}.query
if [ "$CKSUM" != '805680033 830' ]; then
echo "ERROR: -q query unexpected cksum: $CKSUM"
exit 1
fi
../varnishevent -q 'ReqURL ~' -l ${LOG} ../varnishevent -q 'ReqURL ~' -l ${LOG}
...@@ -81,11 +55,17 @@ if [ "$?" != "1" ]; then ...@@ -81,11 +55,17 @@ if [ "$?" != "1" ]; then
fi fi
echo "... -C" echo "... -C"
CKSUM=$( ../varnishevent -C -q 'ReqURL ~ "_STATIC"' -r ${IN} -l ${LOG} | cksum) ../varnishevent -C -q 'ReqURL ~ "_STATIC"' -r ${IN} -l ${LOG} > ${TRC}.dash-C
set -eu
if [ "$CKSUM" != '805680033 830' ]; then tmpf=/tmp/$(basename $0).cmp.$$
echo "ERROR: -q query unexpected cksum: $CKSUM" cksum ${TRC}.* >${tmpf}
if diff $(basename $0 .sh).cksum ${tmpf} ; then
rm -rf ${TRC}.*
else
echo "ERROR: checksum diff"
exit 1 exit 1
fi fi
exit 0 rm -f ${tmpf}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment