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
b4f67315
Commit
b4f67315
authored
Mar 30, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test for format.c/get_payload() for a payload that fills out
max_reclen
parent
631849c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
test_format.c
src/test/test_format.c
+24
-1
No files found.
src/test/test_format.c
View file @
b4f67315
...
...
@@ -73,7 +73,7 @@ static const char
rec
.
magic
=
LOGLINE_MAGIC
;
VSTAILQ_INIT
(
&
rec
.
chunks
);
chunk
.
magic
=
CHUNK_MAGIC
;
chunk
.
data
=
(
char
*
)
calloc
(
1
,
DEFAULT_CHUNK_SIZE
);
chunk
.
data
=
(
char
*
)
calloc
(
1
,
config
.
chunk_size
);
MAN
(
chunk
.
data
);
/* Record with one chunk */
...
...
@@ -84,6 +84,29 @@ static const char
get_payload
(
&
rec
);
MASSERT
(
strcmp
(
VSB_data
(
payload
),
SHORT_STRING
)
==
0
);
/* Record with chunks that fill out shm_reclen */
rec
.
len
=
config
.
max_reclen
;
int
n
=
config
.
max_reclen
;
sprintf
(
chunk
.
data
,
"%0*d"
,
config
.
chunk_size
,
0
);
n
-=
config
.
chunk_size
;
while
(
n
>
0
)
{
int
cp
=
n
;
if
(
cp
>
config
.
chunk_size
)
cp
=
config
.
chunk_size
;
chunk_t
*
c
=
(
chunk_t
*
)
malloc
(
sizeof
(
chunk_t
));
MAN
(
c
);
c
->
magic
=
CHUNK_MAGIC
;
c
->
data
=
(
char
*
)
calloc
(
1
,
config
.
chunk_size
);
sprintf
(
c
->
data
,
"%0*d"
,
cp
,
0
);
VSTAILQ_INSERT_TAIL
(
&
rec
.
chunks
,
c
,
chunklist
);
n
-=
cp
;
}
char
*
str
=
(
char
*
)
malloc
(
config
.
max_reclen
);
MAN
(
str
);
sprintf
(
str
,
"%0*d"
,
config
.
max_reclen
-
1
,
0
);
get_payload
(
&
rec
);
MASSERT
(
strcmp
(
VSB_data
(
payload
),
str
)
==
0
);
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