Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
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
zhul
criu
Commits
6d5635e3
Commit
6d5635e3
authored
Oct 08, 2015
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zdtm.py: Lower zdtm keyword usage
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
f698be0a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
18 deletions
+25
-18
zdtm.py
test/zdtm.py
+25
-18
No files found.
test/zdtm.py
View file @
6d5635e3
...
@@ -32,19 +32,19 @@ def traceit(f, e, a):
...
@@ -32,19 +32,19 @@ def traceit(f, e, a):
# Root dir for ns and uns flavors. All tests
# Root dir for ns and uns flavors. All tests
# sit in the same dir
# sit in the same dir
zdtm
_root
=
None
tests
_root
=
None
def
clean_
zdtm
_root
():
def
clean_
tests
_root
():
global
zdtm
_root
global
tests
_root
if
zdtm
_root
:
if
tests
_root
:
os
.
rmdir
(
zdtm
_root
)
os
.
rmdir
(
tests
_root
)
def
make_
zdtm
_root
():
def
make_
tests
_root
():
global
zdtm
_root
global
tests
_root
if
not
zdtm
_root
:
if
not
tests
_root
:
zdtm
_root
=
tempfile
.
mkdtemp
(
""
,
"criu-root-"
,
"/tmp"
)
tests
_root
=
tempfile
.
mkdtemp
(
""
,
"criu-root-"
,
"/tmp"
)
atexit
.
register
(
clean_
zdtm
_root
)
atexit
.
register
(
clean_
tests
_root
)
return
zdtm
_root
return
tests
_root
# Arch we run on
# Arch we run on
arch
=
os
.
uname
()[
4
]
arch
=
os
.
uname
()[
4
]
...
@@ -73,7 +73,7 @@ class ns_flavor:
...
@@ -73,7 +73,7 @@ class ns_flavor:
self
.
name
=
"ns"
self
.
name
=
"ns"
self
.
ns
=
True
self
.
ns
=
True
self
.
uns
=
False
self
.
uns
=
False
self
.
root
=
make_
zdtm
_root
()
self
.
root
=
make_
tests
_root
()
def
init
(
self
,
test_bin
):
def
init
(
self
,
test_bin
):
print
"Construct root for
%
s"
%
test_bin
print
"Construct root for
%
s"
%
test_bin
...
@@ -270,6 +270,8 @@ class zdtm_test:
...
@@ -270,6 +270,8 @@ class zdtm_test:
print
" <<< "
+
"="
*
32
print
" <<< "
+
"="
*
32
test_classes
=
{
'zdtm'
:
zdtm_test
}
#
#
# CRIU when launched using CLI
# CRIU when launched using CLI
#
#
...
@@ -390,11 +392,16 @@ def check_visible_state(test, state):
...
@@ -390,11 +392,16 @@ def check_visible_state(test, state):
raise
test_fail_exc
(
"maps compare"
)
raise
test_fail_exc
(
"maps compare"
)
def
do_run_test
(
tname
,
tdesc
,
flavs
,
opts
):
def
do_run_test
(
tname
,
tdesc
,
flavs
,
opts
):
print
"Run
%
s in
%
s"
%
(
tname
,
flavs
)
tcname
=
tname
.
split
(
'/'
)[
0
]
tclass
=
test_classes
.
get
(
tcname
,
None
)
if
not
tclass
:
print
"Unknown test class
%
s"
%
tcname
return
print
"Run
%
s in
%
s"
%
(
tname
,
flavs
)
for
f
in
flavs
:
for
f
in
flavs
:
flav
=
flavors
[
f
](
opts
)
flav
=
flavors
[
f
](
opts
)
t
=
zdtm_test
(
tname
,
tdesc
,
flav
)
t
=
tclass
(
tname
,
tdesc
,
flav
)
try
:
try
:
t
.
start
()
t
.
start
()
...
@@ -433,7 +440,7 @@ class launcher:
...
@@ -433,7 +440,7 @@ class launcher:
arg
=
repr
((
name
,
desc
,
flavor
,
{
d
:
self
.
__opts
[
d
]
for
d
in
nd
}))
arg
=
repr
((
name
,
desc
,
flavor
,
{
d
:
self
.
__opts
[
d
]
for
d
in
nd
}))
log
=
name
.
replace
(
'/'
,
'_'
)
+
".log"
log
=
name
.
replace
(
'/'
,
'_'
)
+
".log"
sub
=
subprocess
.
Popen
([
"./zdtm_ct"
,
"zdtm.py"
],
\
sub
=
subprocess
.
Popen
([
"./zdtm_ct"
,
"zdtm.py"
],
\
env
=
dict
(
os
.
environ
,
ZDTM
_CT_TEST_INFO
=
arg
),
\
env
=
dict
(
os
.
environ
,
CR
_CT_TEST_INFO
=
arg
),
\
stdout
=
open
(
log
,
"w"
),
stderr
=
subprocess
.
STDOUT
)
stdout
=
open
(
log
,
"w"
),
stderr
=
subprocess
.
STDOUT
)
self
.
__subs
[
sub
.
pid
]
=
{
'sub'
:
sub
,
'log'
:
log
}
self
.
__subs
[
sub
.
pid
]
=
{
'sub'
:
sub
,
'log'
:
log
}
...
@@ -577,12 +584,12 @@ def list_tests(opts):
...
@@ -577,12 +584,12 @@ def list_tests(opts):
# main() starts here
# main() starts here
#
#
if
os
.
environ
.
has_key
(
'
ZDTM
_CT_TEST_INFO'
):
if
os
.
environ
.
has_key
(
'
CR
_CT_TEST_INFO'
):
# Fork here, since we're new pidns init and are supposed to
# Fork here, since we're new pidns init and are supposed to
# collect this namespace's zombies
# collect this namespace's zombies
pid
=
os
.
fork
()
pid
=
os
.
fork
()
if
pid
==
0
:
if
pid
==
0
:
tinfo
=
eval
(
os
.
environ
[
'
ZDTM
_CT_TEST_INFO'
])
tinfo
=
eval
(
os
.
environ
[
'
CR
_CT_TEST_INFO'
])
do_run_test
(
tinfo
[
0
],
tinfo
[
1
],
tinfo
[
2
],
tinfo
[
3
])
do_run_test
(
tinfo
[
0
],
tinfo
[
1
],
tinfo
[
2
],
tinfo
[
3
])
else
:
else
:
while
True
:
while
True
:
...
@@ -592,7 +599,7 @@ if os.environ.has_key('ZDTM_CT_TEST_INFO'):
...
@@ -592,7 +599,7 @@ if os.environ.has_key('ZDTM_CT_TEST_INFO'):
sys
.
exit
(
0
)
sys
.
exit
(
0
)
p
=
argparse
.
ArgumentParser
(
"
ZDTM
test suite"
)
p
=
argparse
.
ArgumentParser
(
"
CRIU
test suite"
)
p
.
add_argument
(
"--debug"
,
help
=
"Print what's being executed"
,
action
=
'store_true'
)
p
.
add_argument
(
"--debug"
,
help
=
"Print what's being executed"
,
action
=
'store_true'
)
sp
=
p
.
add_subparsers
(
help
=
"Use --help for list of actions"
)
sp
=
p
.
add_subparsers
(
help
=
"Use --help for list of actions"
)
...
...
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