Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishevent
Commits
c05ba7e6
Commit
c05ba7e6
authored
Mar 31, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement and test formatters for %s
parent
ec0c8a2c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
3 deletions
+35
-3
format.c
src/format.c
+3
-3
format.h
src/format.h
+3
-0
test_format.c
src/test/test_format.c
+29
-0
No files found.
src/format.c
View file @
c05ba7e6
...
...
@@ -406,10 +406,10 @@ format_r_##dir(tx_t *tx, char *name, enum VSL_tag_e tag, \
FORMAT_r
(
client
,
Req
)
FORMAT_r
(
backend
,
Bereq
)
#if 0
FORMAT
(
client
,
s
,
RespStatus
)
FORMAT
(
backend
,
s
,
BerespStatus
)
FORMAT(client, s, TxStatus)
FORMAT(backend, s, RxStatus)
#if 0
#define FORMAT_tim(ltr, fmt, extra) \
static void \
...
...
src/format.h
View file @
c05ba7e6
...
...
@@ -83,3 +83,6 @@ formatter_f format_q_backend;
formatter_f
format_r_client
;
formatter_f
format_r_backend
;
formatter_f
format_s_client
;
formatter_f
format_s_backend
;
src/test/test_format.c
View file @
c05ba7e6
...
...
@@ -766,6 +766,34 @@ static const char
return
NULL
;
}
static
const
char
*
test_format_s
(
void
)
{
tx_t
tx
;
logline_t
rec
;
chunk_t
chunk
;
char
*
str
;
size_t
len
;
printf
(
"... testing format_s_*()
\n
"
);
init_tx_rec_chunk
(
&
tx
,
&
rec
,
&
chunk
);
MAN
(
chunk
.
data
);
#define STATUS_PAYLOAD "200"
set_record_data
(
&
rec
,
&
chunk
,
STATUS_PAYLOAD
,
SLT_RespStatus
);
format_s_client
(
&
tx
,
NULL
,
SLT__Bogus
,
&
str
,
&
len
);
MASSERT
(
strcmp
(
str
,
STATUS_PAYLOAD
)
==
0
);
MASSERT
(
len
==
3
);
rec
.
tag
=
SLT_BerespStatus
;
format_s_backend
(
&
tx
,
NULL
,
SLT__Bogus
,
&
str
,
&
len
);
MASSERT
(
strcmp
(
str
,
STATUS_PAYLOAD
)
==
0
);
MASSERT
(
len
==
3
);
return
NULL
;
}
static
const
char
*
all_tests
(
void
)
{
...
...
@@ -785,6 +813,7 @@ static const char
mu_run_test
(
test_format_O
);
mu_run_test
(
test_format_q
);
mu_run_test
(
test_format_r
);
mu_run_test
(
test_format_s
);
return
NULL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment