Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
fe35ee03
Commit
fe35ee03
authored
Aug 12, 2008
by
dinesh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test case for grab_file
parent
d2c982b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
ccan/string/test/run-grab.c
ccan/string/test/run-grab.c
+25
-0
ccan/string/test/run.c
ccan/string/test/run.c
+13
-2
tools/create_dep_tar
tools/create_dep_tar
+0
-0
No files found.
ccan/string/test/run-grab.c
0 → 100644
View file @
fe35ee03
/* This is test for grab_file() function */
/*
* Example:
*
* void *grab_file(const void *ctx, const char *filename)
* {
* int fd;
* char *buffer;
*
* if (streq(filename, "-"))
* fd = dup(STDIN_FILENO);
* else
* fd = open(filename, O_RDONLY, 0);
*
* if (fd < 0)
* return NULL;
*
* buffer = grab_fd(ctx, fd);
* close_noerr(fd);
* return buffer;
* }
*/
/* End of grab_file() test */
ccan/string/test/run.c
View file @
fe35ee03
...
...
@@ -27,6 +27,8 @@ int main(int argc, char *argv[])
char
**
split
,
*
str
;
void
*
ctx
;
char
*
strings
[
NUM_SUBSTRINGS
*
NUM_SUBSTRINGS
];
int
length
;
struct
stat
st
;
n
=
0
;
for
(
i
=
0
;
i
<
NUM_SUBSTRINGS
;
i
++
)
{
...
...
@@ -115,7 +117,16 @@ int main(int argc, char *argv[])
ok1
(
talloc_parent
(
str
)
==
ctx
);
talloc_free
(
ctx
);
str
=
grab_file
(
NULL
,
"ccan/string/test/run-grab.c"
);
split
=
strsplit
(
NULL
,
str
,
"
\n
"
,
NULL
);
length
=
strlen
(
split
[
0
]);
ok1
(
streq
(
split
[
0
],
"/* This is test for grab_file() function */"
));
for
(
i
=
1
;
split
[
i
];
i
++
)
length
+=
strlen
(
split
[
i
]);
ok1
(
streq
(
split
[
i
-
1
],
"/* End of grab_file() test */"
));
if
(
stat
(
"ccan/string/test/run-grab.c"
,
&
st
)
!=
0
)
err
(
1
,
"Could not stat self"
);
ok1
(
st
.
st_size
==
length
);
return
exit_status
();
}
tools/create_dep_tar
0 → 100755
View file @
fe35ee03
File added
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