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
8ce58ec9
Commit
8ce58ec9
authored
Oct 13, 2015
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zdtm.py: Ability to run tests with faults injected
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
68baf8e7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
9 deletions
+45
-9
zdtm.py
test/zdtm.py
+28
-9
cgroup00.hook
test/zdtm/live/static/cgroup00.hook
+2
-0
cgroup01.hook
test/zdtm/live/static/cgroup01.hook
+2
-0
cgroup02.hook
test/zdtm/live/static/cgroup02.hook
+2
-0
unlink_fstat00.hook
test/zdtm/live/static/unlink_fstat00.hook
+11
-0
No files found.
test/zdtm.py
View file @
8ce58ec9
...
@@ -164,6 +164,10 @@ class test_fail_exc:
...
@@ -164,6 +164,10 @@ class test_fail_exc:
def
__init__
(
self
,
step
):
def
__init__
(
self
,
step
):
self
.
step
=
step
self
.
step
=
step
class
test_fault_injected_exc
:
def
__init__
(
self
,
cr_action
):
self
.
cr_action
=
cr_action
#
#
# A test from zdtm/ directory.
# A test from zdtm/ directory.
#
#
...
@@ -375,6 +379,7 @@ class criu_cli:
...
@@ -375,6 +379,7 @@ class criu_cli:
self
.
__iter
=
0
self
.
__iter
=
0
self
.
__page_server
=
(
opts
[
'page_server'
]
and
True
or
False
)
self
.
__page_server
=
(
opts
[
'page_server'
]
and
True
or
False
)
self
.
__restore_sibling
=
(
opts
[
'sibling'
]
and
True
or
False
)
self
.
__restore_sibling
=
(
opts
[
'sibling'
]
and
True
or
False
)
self
.
__fault
=
(
opts
[
'fault'
])
def
set_test
(
self
,
test
):
def
set_test
(
self
,
test
):
self
.
__test
=
test
self
.
__test
=
test
...
@@ -390,8 +395,12 @@ class criu_cli:
...
@@ -390,8 +395,12 @@ class criu_cli:
return
os
.
path
.
join
(
self
.
__dump_path
,
"
%
d"
%
self
.
__iter
)
return
os
.
path
.
join
(
self
.
__dump_path
,
"
%
d"
%
self
.
__iter
)
@staticmethod
@staticmethod
def
__criu
(
action
,
args
):
def
__criu
(
action
,
args
,
fault
=
None
):
cr
=
subprocess
.
Popen
([
"../criu"
,
action
]
+
args
)
env
=
None
if
fault
:
print
"Forcing
%
s fault"
%
fault
env
=
dict
(
os
.
environ
,
CRIU_FAULT
=
fault
)
cr
=
subprocess
.
Popen
([
"../criu"
,
action
]
+
args
,
env
=
env
)
return
cr
.
wait
()
return
cr
.
wait
()
def
__criu_act
(
self
,
action
,
opts
,
log
=
None
):
def
__criu_act
(
self
,
action
,
opts
,
log
=
None
):
...
@@ -401,10 +410,13 @@ class criu_cli:
...
@@ -401,10 +410,13 @@ class criu_cli:
s_args
=
[
"-o"
,
log
,
"-D"
,
self
.
__ddir
(),
"-v4"
]
+
opts
s_args
=
[
"-o"
,
log
,
"-D"
,
self
.
__ddir
(),
"-v4"
]
+
opts
print
"Run CRIU: ["
+
action
+
" "
+
" "
.
join
(
s_args
)
+
"]"
print
"Run CRIU: ["
+
action
+
" "
+
" "
.
join
(
s_args
)
+
"]"
ret
=
self
.
__criu
(
action
,
s_args
)
ret
=
self
.
__criu
(
action
,
s_args
,
self
.
__fault
)
if
ret
!=
0
:
if
ret
!=
0
:
grep_errors
(
os
.
path
.
join
(
self
.
__ddir
(),
log
))
if
self
.
__fault
:
raise
test_fail_exc
(
"CRIU
%
s"
%
action
)
raise
test_fault_injected_exc
(
action
)
else
:
grep_errors
(
os
.
path
.
join
(
self
.
__ddir
(),
log
))
raise
test_fail_exc
(
"CRIU
%
s"
%
action
)
def
dump
(
self
,
action
,
opts
=
[]):
def
dump
(
self
,
action
,
opts
=
[]):
self
.
__iter
+=
1
self
.
__iter
+=
1
...
@@ -521,10 +533,16 @@ def do_run_test(tname, tdesc, flavs, opts):
...
@@ -521,10 +533,16 @@ def do_run_test(tname, tdesc, flavs, opts):
try
:
try
:
t
.
start
()
t
.
start
()
s
=
get_visible_state
(
t
)
s
=
get_visible_state
(
t
)
cr
(
cr_api
,
t
,
opts
)
try
:
check_visible_state
(
t
,
s
)
cr
(
cr_api
,
t
,
opts
)
t
.
stop
()
except
test_fault_injected_exc
as
e
:
try_run_hook
(
t
,
[
"--clean"
])
if
e
.
cr_action
==
"dump"
:
t
.
stop
()
try_run_hook
(
t
,
[
"--fault"
,
e
.
cr_action
])
else
:
check_visible_state
(
t
,
s
)
t
.
stop
()
try_run_hook
(
t
,
[
"--clean"
])
except
test_fail_exc
as
e
:
except
test_fail_exc
as
e
:
print
"Test
%
s FAIL at
%
s"
%
(
tname
,
e
.
step
)
print
"Test
%
s FAIL at
%
s"
%
(
tname
,
e
.
step
)
t
.
print_output
()
t
.
print_output
()
...
@@ -753,6 +771,7 @@ rp.add_argument("--pre", help = "Do some pre-dumps before dump")
...
@@ -753,6 +771,7 @@ rp.add_argument("--pre", help = "Do some pre-dumps before dump")
rp
.
add_argument
(
"--nocr"
,
help
=
"Do not CR anything, just check test works"
,
action
=
'store_true'
)
rp
.
add_argument
(
"--nocr"
,
help
=
"Do not CR anything, just check test works"
,
action
=
'store_true'
)
rp
.
add_argument
(
"--norst"
,
help
=
"Don't restore tasks, leave them running after dump"
,
action
=
'store_true'
)
rp
.
add_argument
(
"--norst"
,
help
=
"Don't restore tasks, leave them running after dump"
,
action
=
'store_true'
)
rp
.
add_argument
(
"--iters"
,
help
=
"Do CR cycle several times before check"
)
rp
.
add_argument
(
"--iters"
,
help
=
"Do CR cycle several times before check"
)
rp
.
add_argument
(
"--fault"
,
help
=
"Test fault injection"
)
rp
.
add_argument
(
"--page-server"
,
help
=
"Use page server dump"
,
action
=
'store_true'
)
rp
.
add_argument
(
"--page-server"
,
help
=
"Use page server dump"
,
action
=
'store_true'
)
rp
.
add_argument
(
"-p"
,
"--parallel"
,
help
=
"Run test in parallel"
)
rp
.
add_argument
(
"-p"
,
"--parallel"
,
help
=
"Run test in parallel"
)
...
...
test/zdtm/live/static/cgroup00.hook
View file @
8ce58ec9
#!/bin/bash
#!/bin/bash
[
"
$1
"
==
"--clean"
-o
"
$1
"
==
"--pre-restore"
]
||
exit
0
set
-e
set
-e
tname
=
$(
mktemp
-d
cgclean.XXXXXX
)
tname
=
$(
mktemp
-d
cgclean.XXXXXX
)
...
...
test/zdtm/live/static/cgroup01.hook
View file @
8ce58ec9
#!/bin/bash
#!/bin/bash
[
"
$1
"
==
"--clean"
-o
"
$1
"
==
"--pre-restore"
]
||
exit
0
set
-e
set
-e
tname
=
$(
mktemp
-d
cgclean.XXXXXX
)
tname
=
$(
mktemp
-d
cgclean.XXXXXX
)
...
...
test/zdtm/live/static/cgroup02.hook
View file @
8ce58ec9
#!/bin/bash
#!/bin/bash
[
"
$1
"
==
"--clean"
-o
"
$1
"
==
"--pre-restore"
]
||
exit
0
set
-e
set
-e
rmroots
()
{
rmroots
()
{
...
...
test/zdtm/live/static/unlink_fstat00.hook
0 → 100755
View file @
8ce58ec9
#!/bin/bash
[
"
$1
"
==
"--fault"
-a
"
$2
"
==
"restore"
]
||
exit
0
if
[
$(
find
-name
'unlink_fstat00*ghost'
|
wc
-l
)
-ne
0
]
;
then
echo
"Dangling ghost file"
exit
1
fi
echo
"Restore fault handled"
exit
0
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