Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
49618f92
Unverified
Commit
49618f92
authored
Jul 03, 2018
by
2xsec
Committed by
Christian Brauner
Jul 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: cleanup list.c
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
44cd7fb6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
list.c
src/tests/list.c
+10
-0
No files found.
src/tests/list.c
View file @
49618f92
...
@@ -31,17 +31,21 @@ static void test_list_func(const char *lxcpath, const char *type,
...
@@ -31,17 +31,21 @@ static void test_list_func(const char *lxcpath, const char *type,
char
**
names
;
char
**
names
;
printf
(
"%-10s Counting containers
\n
"
,
type
);
printf
(
"%-10s Counting containers
\n
"
,
type
);
n
=
func
(
lxcpath
,
NULL
,
NULL
);
n
=
func
(
lxcpath
,
NULL
,
NULL
);
printf
(
"%-10s Counted %d containers
\n
"
,
type
,
n
);
printf
(
"%-10s Counted %d containers
\n
"
,
type
,
n
);
printf
(
"%-10s Get container struct only
\n
"
,
type
);
printf
(
"%-10s Get container struct only
\n
"
,
type
);
n2
=
func
(
lxcpath
,
NULL
,
&
clist
);
n2
=
func
(
lxcpath
,
NULL
,
&
clist
);
if
(
n2
!=
n
)
if
(
n2
!=
n
)
printf
(
"Warning: first call returned %d, second %d
\n
"
,
n
,
n2
);
printf
(
"Warning: first call returned %d, second %d
\n
"
,
n
,
n2
);
for
(
i
=
0
;
i
<
n2
;
i
++
)
{
for
(
i
=
0
;
i
<
n2
;
i
++
)
{
struct
lxc_container
*
c
=
clist
[
i
];
struct
lxc_container
*
c
=
clist
[
i
];
printf
(
"%-10s Got container struct %s
\n
"
,
type
,
c
->
name
);
printf
(
"%-10s Got container struct %s
\n
"
,
type
,
c
->
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
}
}
if
(
n2
>
0
)
{
if
(
n2
>
0
)
{
free
(
clist
);
free
(
clist
);
clist
=
NULL
;
clist
=
NULL
;
...
@@ -51,10 +55,12 @@ static void test_list_func(const char *lxcpath, const char *type,
...
@@ -51,10 +55,12 @@ static void test_list_func(const char *lxcpath, const char *type,
n2
=
func
(
lxcpath
,
&
names
,
NULL
);
n2
=
func
(
lxcpath
,
&
names
,
NULL
);
if
(
n2
!=
n
)
if
(
n2
!=
n
)
printf
(
"Warning: first call returned %d, second %d
\n
"
,
n
,
n2
);
printf
(
"Warning: first call returned %d, second %d
\n
"
,
n
,
n2
);
for
(
i
=
0
;
i
<
n2
;
i
++
)
{
for
(
i
=
0
;
i
<
n2
;
i
++
)
{
printf
(
"%-10s Got container name %s
\n
"
,
type
,
names
[
i
]);
printf
(
"%-10s Got container name %s
\n
"
,
type
,
names
[
i
]);
free
(
names
[
i
]);
free
(
names
[
i
]);
}
}
if
(
n2
>
0
)
{
if
(
n2
>
0
)
{
free
(
names
);
free
(
names
);
names
=
NULL
;
names
=
NULL
;
...
@@ -64,14 +70,18 @@ static void test_list_func(const char *lxcpath, const char *type,
...
@@ -64,14 +70,18 @@ static void test_list_func(const char *lxcpath, const char *type,
n2
=
func
(
lxcpath
,
&
names
,
&
clist
);
n2
=
func
(
lxcpath
,
&
names
,
&
clist
);
if
(
n2
!=
n
)
if
(
n2
!=
n
)
printf
(
"Warning: first call returned %d, second %d
\n
"
,
n
,
n2
);
printf
(
"Warning: first call returned %d, second %d
\n
"
,
n
,
n2
);
for
(
i
=
0
;
i
<
n2
;
i
++
)
{
for
(
i
=
0
;
i
<
n2
;
i
++
)
{
struct
lxc_container
*
c
=
clist
[
i
];
struct
lxc_container
*
c
=
clist
[
i
];
printf
(
"%-10s Got container struct %s, name %s
\n
"
,
type
,
c
->
name
,
names
[
i
]);
printf
(
"%-10s Got container struct %s, name %s
\n
"
,
type
,
c
->
name
,
names
[
i
]);
if
(
strcmp
(
c
->
name
,
names
[
i
]))
if
(
strcmp
(
c
->
name
,
names
[
i
]))
fprintf
(
stderr
,
"ERROR: name mismatch!
\n
"
);
fprintf
(
stderr
,
"ERROR: name mismatch!
\n
"
);
free
(
names
[
i
]);
free
(
names
[
i
]);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
}
}
if
(
n2
>
0
)
{
if
(
n2
>
0
)
{
free
(
names
);
free
(
names
);
free
(
clist
);
free
(
clist
);
...
...
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