@@ -1055,6 +1055,7 @@ def __init__(self, opts):
1055
1055
self .__user = bool (opts ['user' ])
1056
1056
self .__rootless = bool (opts ['rootless' ])
1057
1057
self .__leave_stopped = bool (opts ['stop' ])
1058
+ self .__stop_on_error = bool (opts ['stop_on_error' ])
1058
1059
self .__stream = bool (opts ['stream' ])
1059
1060
self .__show_stats = bool (opts ['show_stats' ])
1060
1061
self .__lazy_pages_p = None
@@ -1390,6 +1391,8 @@ def dump(self, action, opts=[]):
1390
1391
1391
1392
if self .__leave_stopped :
1392
1393
a_opts += ['--leave-stopped' ]
1394
+ if self .__stop_on_error :
1395
+ a_opts += ['--no-resume-on-error' ]
1393
1396
if self .__empty_ns :
1394
1397
a_opts += ['--empty-ns' , 'net' ]
1395
1398
if self .__pre_dump_mode :
@@ -1399,9 +1402,16 @@ def dump(self, action, opts=[]):
1399
1402
if self .__lazy_migrate and action == "dump" :
1400
1403
a_opts += ["--lazy-pages" , "--port" , "12345" ] + self .__tls
1401
1404
nowait = True
1402
- self .__dump_process = self .__criu_act (action ,
1403
- opts = a_opts + opts ,
1404
- nowait = nowait )
1405
+ try :
1406
+ self .__dump_process = self .__criu_act (action ,
1407
+ opts = a_opts + opts ,
1408
+ nowait = nowait )
1409
+ except test_fail_expected_exc :
1410
+ if self .__stop_on_error :
1411
+ pstree_check_stopped (self .__test .getpid (), "--no-resume-on-error" )
1412
+ pstree_signal (self .__test .getpid (), signal .SIGKILL )
1413
+ raise
1414
+
1405
1415
if self .__stream :
1406
1416
ret = self .wait_for_criu_image_streamer ()
1407
1417
if ret :
@@ -1888,10 +1898,10 @@ def is_thread_stopped(status):
1888
1898
return True
1889
1899
1890
1900
1891
- def pstree_check_stopped (root_pid ):
1901
+ def pstree_check_stopped (root_pid , test_flag = "--leave_stopped" ):
1892
1902
for pid in pstree_each_pid (root_pid ):
1893
1903
if not is_proc_stopped (pid ):
1894
- raise test_fail_exc ("CRIU --leave-stopped %s" % pid )
1904
+ raise test_fail_exc ("CRIU %s %s" % ( test_flag , pid ) )
1895
1905
1896
1906
1897
1907
def pstree_signal (root_pid , signal ):
@@ -2083,7 +2093,7 @@ def run_test(self, name, desc, flavor):
2083
2093
'dedup' , 'sbs' , 'freezecg' , 'user' , 'dry_run' , 'noauto_dedup' ,
2084
2094
'remote_lazy_pages' , 'show_stats' , 'lazy_migrate' , 'stream' ,
2085
2095
'tls' , 'criu_bin' , 'crit_bin' , 'pre_dump_mode' , 'mntns_compat_mode' ,
2086
- 'rootless' )
2096
+ 'rootless' , 'stop_on_error' )
2087
2097
arg = repr ((name , desc , flavor , {d : self .__opts [d ] for d in nd }))
2088
2098
2089
2099
if self .__use_log :
@@ -2706,6 +2716,9 @@ def get_cli_args():
2706
2716
rp .add_argument ("--stop" ,
2707
2717
help = "Check that --leave-stopped option stops ps tree." ,
2708
2718
action = 'store_true' )
2719
+ rp .add_argument ("--stop-on-error" ,
2720
+ help = "Check that --no-resume-on-error stops ps tree on dump error." ,
2721
+ action = 'store_true' )
2709
2722
rp .add_argument ("--iters" ,
2710
2723
help = "Do CR cycle several times before check (n[:pause])" )
2711
2724
rp .add_argument ("--fault" , help = "Test fault injection" )
0 commit comments