criu
criu copied to clipboard
Distinguish criu dump fail from criu dump crash in zdtm
In zdtm .desc files there can be a flag called "crfail". It means, that the dump of this test should fail, we know it and are willing to fix. Unfortunately, the zdtm.py script doesn't tell criu dump command failure from crash (for sigsegv, for example). While the former result is what's expected, the latter one should be reported as test failure.
A friendly reminder that this issue had no activity for 30 days.
A friendly reminder that this issue had no activity for 30 days.
I would like to take up this issue. Is the fix just adding a 'crfail' flag to every ZDTM ,desc file?
I would like to take up this issue. Is the fix just adding a 'crfail' flag to every ZDTM ,desc file?
nope. It's about distinguishing two cases when criu dump process exits with an error and when it crashes.
When crfail flag is set on test, and criu dump exits with an error that's correct (test is passed), but if criu dump crashes, currently, zdtm will report that test is passed, but in fact is should report a test failure.
In the do_run_tests() function in the zdtm.py script file, when the dump action fails but the crfail flag is set, then the test stops. Adding a try and except block in the cr(cr_api, test, opts) (CRIU API) function call to handle signal errors is where I'm currently at.
if opts['norst']:
try_run_hook(test, ["--pre-dump"])
try:
cr_api.dump("dump", opts=["--leave-running"])
except subprocess.CalledProcessError as e:
if e.returncode < 0:
raise test_fail_exc("'criu dump' crashed with signal %d" % -e.returncode)
else:
raise test_fail_exc("'criu dump' failed with return code %d" % e.returncode)
else:
try_run_hook(test, ["--pre-dump"])
try:
cr_api.dump("dump")
except subprocess.CalledProcessError as e:
if e.returncode < 0:
raise test_fail_exc("'criu dump' crashed with signal %d" % -e.returncode)
else:
raise test_fail_exc("'criu dump' failed with return code %d" % e.returncode)
Should this work?
@sankalp-12
you can easily test it by adding bug in CRIU code and run some crfail test ;-)
AFAIU you need to pay attention to this piece of code:
rst_succeeded = os.access(
os.path.join(__ddir, "restore-succeeded"), os.F_OK)
if self.__test.blocking() or (self.__sat and action == 'restore' and
rst_succeeded):
raise test_fail_expected_exc(action) # <--- here we "allow" criu fail if crfail is set. You need to modify this condition a little bit to distinguish the case of criu crash and criu fail.
else:
raise test_fail_exc("CRIU %s" % action)
hint: https://docs.python.org/3/library/subprocess.html#subprocess.Popen.returncode
Is this issue still up for grabs? I would like to take it up.