[CRIU] [PATCHv2 2/2] test/others/leave-stopped: implement test for new --leave-stopped option

Pavel Emelyanov xemul at virtuozzo.com
Fri May 20 08:29:36 PDT 2016


On 05/20/2016 05:15 PM, Batalov Eugene wrote:
> 
> 
> 2016-05-20 16:50 GMT+03:00 Pavel Emelyanov <xemul at virtuozzo.com <mailto:xemul at virtuozzo.com>>:
> 
>     On 05/20/2016 04:31 PM, Batalov Eugene wrote:
>     >
>     > 2016-05-20 16:12 GMT+03:00 Pavel Emelyanov <xemul at virtuozzo.com <mailto:xemul at virtuozzo.com> <mailto:xemul at virtuozzo.com <mailto:xemul at virtuozzo.com>>>:
>     >
>     >     On 05/20/2016 02:31 PM, Batalov Eugene wrote:
>     >     >
>     >     >
>     >     > 2016-05-20 14:23 GMT+03:00 Pavel Emelyanov <xemul at virtuozzo.com <mailto:xemul at virtuozzo.com> <mailto:xemul at virtuozzo.com <mailto:xemul at virtuozzo.com>> <mailto:xemul at virtuozzo.com <mailto:xemul at virtuozzo.com> <mailto:xemul at virtuozzo.com <mailto:xemul at virtuozzo.com>>>>:
>     >     >
>     >     >     On 05/02/2016 06:46 PM, Eugene Batalov wrote:
>     >     >     > From: Kravchenko Dmitrii <equivalence1 at gmail.com <mailto:equivalence1 at gmail.com> <mailto:equivalence1 at gmail.com <mailto:equivalence1 at gmail.com>> <mailto:equivalence1 at gmail.com <mailto:equivalence1 at gmail.com> <mailto:equivalence1 at gmail.com <mailto:equivalence1 at gmail.com>>>>
>     >     >     >
>     >     >     > This patch implements a simple autotest for new --leave-stopped CRIU
>     >     >     > restorer option. Test creates ps tree then checkpoints it.
>     >     >     > Then test restores ps tree with --leave-stopped option.
>     >     >     > Then test checks that every process in restored ps tree is in
>     >     >     > stopped state.
>     >     >     >
>     >     >     > Signed-off-by: Kravchenko Dmitrii <equivalence1 at gmail.com <mailto:equivalence1 at gmail.com> <mailto:equivalence1 at gmail.com <mailto:equivalence1 at gmail.com>> <mailto:equivalence1 at gmail.com <mailto:equivalence1 at gmail.com> <mailto:equivalence1 at gmail.com <mailto:equivalence1 at gmail.com>>>>
>     >     >     > Signed-off-by: Eugene Batalov <eabatalov89 at gmail.com <mailto:eabatalov89 at gmail.com> <mailto:eabatalov89 at gmail.com <mailto:eabatalov89 at gmail.com>> <mailto:eabatalov89 at gmail.com <mailto:eabatalov89 at gmail.com> <mailto:eabatalov89 at gmail.com <mailto:eabatalov89 at gmail.com>>>>
>     >     >     > ---
>     >     >     >  test/others/leave-stopped/.gitignore      |  3 ++
>     >     >     >  test/others/leave-stopped/Makefile        |  7 +++++
>     >     >     >  test/others/leave-stopped/pstree.c        | 39 +++++++++++++++++++++++++
>     >     >     >  test/others/leave-stopped/run.sh          | 31 ++++++++++++++++++++
>     >     >     >  test/others/leave-stopped/tree_checker.py | 47 +++++++++++++++++++++++++++++++
>     >     >
>     >     >     Oh :( Is there any chance to have this as a part of zdtm.py suite?
>     >     >
>     >     >
>     >     > We need to restore the whole ps tree in stopped state so ps tree can't validate itself after restore.
>     >
>     >     Of course. This should be a mode when zdtm.py passes --leave-stopped to criu restore (and
>     >     criu dump actually too :) ) and before checking the results SIGCONTs the tree.
>     >
>     > We should check state of all the restored processes in ps tree before we SIGCONT them.
>     > Please read my comment below for continuation of my point.
>     >
>     >
>     >
>     >     > I think there should be some file in CRIU test suite where we can add new shell command to run our non-zdtm style test.
>     >     > But we haven't found such a file.
>     >     > Do you have such a shell script? Should we implement such a file?
>     >
>     >     Nope :( But this can be solved by calling "crit x ps" -- it will show all the pids
>     >     from the image file.
>     >
>     > In our test we traverse restored ps tree from root to children and check each process state to be stopped.
>     > So I don't see a big need to use additional component such as crit in our test (but crit ps based check is more strict).
>     >
>     > The question is how would we integrate our test/others/leave-stopped script into zdtm test suite?
> 
>     I thought that you don't :) Instead, you can take the zdtm/transition/fork test, C/R it
>     with --leave-stopped, check that it is stopped, SIGCONT the tree and check the result.
> 
>     The same can be done with any zdtm/ micro-test, but presumably it only makes sense to
>     regularly test only the fork one.
> 
> So will we need some special logic in zdtm.py for running and sigcont of zdtm/transition/fork test with --leave-stopped flag?

Not only the fork one, but any test. And in CI we'll use only the fork one. I think.

> If yes, do you have a similar test with special running logic in zdtm.py already?

Sure. Look at how --unshare or --sibling or --user options work. They all slightly
tune the way zdtm.py runs a test. The same should be done for --leave-stopped.

> Also is this really needed to use zdtm/transition/fork and integrate special logic into zdtm.py?
> Is there a big deal in it? :) Because it doesn't look like a problem for me but it would take some extra time.

Well, we tried to write individual tests for all new "environmental" changes we did.
Like for freezecg, iterations and alike. It turned out that having one place where
all possible ways of running criu are tested is better practice.

-- Pavel



More information about the CRIU mailing list