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
a209f528
Unverified
Commit
a209f528
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 snapshot.c
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
a9f4f9dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
snapshot.c
src/tests/snapshot.c
+17
-4
No files found.
src/tests/snapshot.c
View file @
a209f528
...
...
@@ -32,23 +32,28 @@
static
void
try_to_remove
(
void
)
{
struct
lxc_container
*
c
;
c
=
lxc_container_new
(
RESTNAME
,
NULL
);
if
(
c
)
{
c
->
snapshot_destroy_all
(
c
);
if
(
c
->
is_defined
(
c
))
c
->
destroy
(
c
);
lxc_container_put
(
c
);
}
c
=
lxc_container_new
(
MYNAME2
,
NULL
);
if
(
c
)
{
c
->
destroy_with_snapshots
(
c
);
lxc_container_put
(
c
);
}
c
=
lxc_container_new
(
MYNAME
,
NULL
);
if
(
c
)
{
c
->
snapshot_destroy_all
(
c
);
if
(
c
->
is_defined
(
c
))
c
->
destroy
(
c
);
lxc_container_put
(
c
);
}
}
...
...
@@ -66,6 +71,7 @@ int main(int argc, char *argv[])
template
=
argv
[
1
];
try_to_remove
();
c
=
lxc_container_new
(
MYNAME
,
NULL
);
if
(
!
c
)
{
fprintf
(
stderr
,
"%s: %d: failed to load first container
\n
"
,
__FILE__
,
__LINE__
);
...
...
@@ -76,15 +82,19 @@ int main(int argc, char *argv[])
fprintf
(
stderr
,
"%d: %s thought it was defined
\n
"
,
__LINE__
,
MYNAME
);
(
void
)
c
->
destroy_with_snapshots
(
c
);
}
if
(
!
c
->
set_config_item
(
c
,
"lxc.net.0.type"
,
"empty"
))
{
fprintf
(
stderr
,
"%s: %d: failed to set network type
\n
"
,
__FILE__
,
__LINE__
);
goto
err
;
}
c
->
save_config
(
c
,
NULL
);
if
(
!
c
->
createl
(
c
,
template
,
NULL
,
NULL
,
0
,
NULL
))
{
fprintf
(
stderr
,
"%s: %d: failed to create %s container
\n
"
,
__FILE__
,
__LINE__
,
template
);
goto
err
;
}
c
->
load_config
(
c
,
NULL
);
if
(
c
->
snapshot
(
c
,
NULL
)
!=
0
)
{
...
...
@@ -110,13 +120,14 @@ int main(int argc, char *argv[])
fprintf
(
stderr
,
"%s: %d: failed listing containers
\n
"
,
__FILE__
,
__LINE__
);
goto
err
;
}
if
(
strcmp
(
s
->
name
,
"snap0"
)
!=
0
)
{
fprintf
(
stderr
,
"%s: %d: snapshot had bad name
\n
"
,
__FILE__
,
__LINE__
);
goto
err
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
s
[
i
].
free
(
&
s
[
i
]);
}
free
(
s
);
if
(
!
c
->
snapshot_restore
(
c
,
"snap0"
,
RESTNAME
))
{
...
...
@@ -152,13 +163,14 @@ int main(int argc, char *argv[])
fprintf
(
stderr
,
"%s: %d: failed listing containers
\n
"
,
__FILE__
,
__LINE__
);
goto
err
;
}
if
(
strcmp
(
s
->
name
,
"snap0"
)
!=
0
)
{
fprintf
(
stderr
,
"%s: %d: snapshot had bad name
\n
"
,
__FILE__
,
__LINE__
);
goto
err
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
s
[
i
].
free
(
&
s
[
i
]);
}
free
(
s
);
if
(
!
c2
->
snapshot_restore
(
c2
,
"snap0"
,
NULL
))
{
...
...
@@ -177,6 +189,7 @@ good:
printf
(
"All tests passed
\n
"
);
exit
(
0
);
err:
lxc_container_put
(
c
);
try_to_remove
();
...
...
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