Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We need test(s) for criu-ns script #1909

Closed
Snorch opened this issue Jun 2, 2022 · 14 comments · Fixed by #2114
Closed

We need test(s) for criu-ns script #1909

Snorch opened this issue Jun 2, 2022 · 14 comments · Fixed by #2114

Comments

@Snorch
Copy link
Member

Snorch commented Jun 2, 2022

We have quiet some reports about criu-ns problems, but we don't have tests to show that when we fix something we don't break everything else.

Links:
criu-ns script - https://github.com/checkpoint-restore/criu/blob/criu-dev/scripts/criu-ns
criu-ns documentation - https://github.com/checkpoint-restore/criu/blob/criu-dev/Documentation/criu-ns.txt

Examples of what the test should check:
#1893 (comment)
#232 (comment)

Notes:

We need to test criu-ns

  • with --shell-job and without it
  • with --restore-detached and without it

Meaning that you need separate testcases for

  • dumpee is init of pidns
  • dumpee is not init of pidns
  • dumpee to has own session and detached from ttys
  • dumpee inherited session from parent and is attached to same tty as parent

We need to have automatic tests integrated in criu CI.

@warusadura
Copy link
Member

Hi @Snorch, I'm interested in working on this issue. Can you please tell me a little bit about this issue.

@Snorch
Copy link
Member Author

Snorch commented Feb 24, 2023

Hi @Snorch, I'm interested in working on this issue. Can you please tell me a little bit about this issue.

I updated the description.

@warusadura
Copy link
Member

Thanks @Snorch! I'll let you know if I have any questions.

@warusadura
Copy link
Member

warusadura commented Feb 26, 2023

@Snorch I'm still not clear what to do here :)

I think I'll have to create a test case for def wrap_restore(). But, I'm not sure where. Also, I understand that criu usese ZDTM. But, I couldn't find any existing tests for criu-ns

Also, what do you meant by "dumpee"?

@Snorch
Copy link
Member Author

Snorch commented Feb 27, 2023

@Snorch I'm still not clear what to do here :)

I think I'll have to create a test case for def wrap_restore().

You can create a test case which runs criu-ns executable, not a function from it.

But, I'm not sure where. Also, I understand that criu usese ZDTM. But, I couldn't find any existing tests for criu-ns

ZDTM is a nice place for a test which checks that criu is able to dump/restore something, in your case you check the additional utility criu-ns, that's why I think the proper place for it would be in test/others/.

Also, what do you meant by "dumpee"?

By dumpee I mean the process which was dumped by criu. For instance, in the first example from header message dumpee was a sleep inf process.

@warusadura
Copy link
Member

@Snorch thanks for the reply.

You can create a test case which runs criu-ns executable, not a function from it.

Understood. But, is there an existing test implementation similar to this requirement? Is shell-job a similar implementation?

Also, how do I execute the previously mentioned shell-job test?

@Snorch
Copy link
Member Author

Snorch commented Feb 27, 2023

Understood. But, is there an existing test implementation similar to this requirement? Is shell-job a similar implementation?

Yes, I believe you can use shell-job test as a skeleton for your criu-ns test. It is really similar to what we need with criu-ns.

Also, how do I execute the previously mentioned shell-job test?

[ criu]# cd test/others/shell-job
[ shell-job]# python3 run.py

This should do the trick.

@warusadura
Copy link
Member

Understood, thank you @Snorch

@warusadura
Copy link
Member

@Snorch
When I executed the ./scripts/criu-ns without any arguments, it prints out the usage info. But, when I pass an argument to it as in ./scripts/criu-ns check or ./scripts/criu-ns dump -t 24445, I'm getting the following errors,

['./scripts/criu-ns', 'check']
Traceback (most recent call last):
  File "/..../criu/./scripts/criu-ns", line 268, in <module>
    run_criu(sys.argv[1:])
  File "/..../criu/./scripts/criu-ns", line 83, in run_criu
    os.execlp('criu', *['criu'] + args)
  File "<frozen os>", line 557, in execlp
  File "<frozen os>", line 574, in execvp
  File "<frozen os>", line 616, in _execvpe
  File "<frozen os>", line 607, in _execvpe
FileNotFoundError: [Errno 2] No such file or directory
['./scripts/criu-ns', 'dump', '-t', '24445']
Traceback (most recent call last):
  File "/..../criu/./scripts/criu-ns", line 266, in <module>
    res = wrap_dump()
          ^^^^^^^^^^^
  File "/..../criu/./scripts/criu-ns", line 240, in wrap_dump
    run_criu(sys.argv[1:])
  File "/..../criu/./scripts/criu-ns", line 83, in run_criu
    os.execlp('criu', *['criu'] + args)
  File "<frozen os>", line 557, in execlp
  File "<frozen os>", line 574, in execvp
  File "<frozen os>", line 616, in _execvpe
  File "<frozen os>", line 607, in _execvpe
FileNotFoundError: [Errno 2] No such file or directory

Any idea why?

@warusadura
Copy link
Member

cc @rppt

@Snorch
Copy link
Member Author

Snorch commented Mar 1, 2023

os.execlp('criu', *['criu'] + args)
FileNotFoundError: [Errno 2] No such file or directory

Error probably says that you don't have criu binary.

@warusadura
Copy link
Member

I see. But, I do have the criu binary.

./criu/criu check --unprivileged
Looks good.

@rst0git
Copy link
Member

rst0git commented Mar 1, 2023

@warusadura os.execlp() is using the PATH environment variable to locate criu.

@warusadura
Copy link
Member

Understood. Thanks @rst0git

warusadura added a commit to warusadura/criu that referenced this issue Mar 8, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 9, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 13, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 14, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 15, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 15, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 16, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 17, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 20, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 20, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 20, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 21, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Mar 21, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Apr 27, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Apr 27, 2023
These changes remove and update the changes introduced in
7177938 in favor of the
Python version in CI.

os.waitstatus_to_exitcode() function appeared in Python 3.9

Related to: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Apr 27, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue Apr 28, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue May 4, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue May 6, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue May 22, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue May 23, 2023
--criu-binary argument provides a way to supply the CRIU binary
location to run_criu().

Related to: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue May 23, 2023
These changes remove and update the changes introduced in
7177938 in favor of the
Python version in CI.

os.waitstatus_to_exitcode() function appeared in Python 3.9

Related to: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue May 23, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue May 24, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue May 25, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
warusadura added a commit to warusadura/criu that referenced this issue May 26, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
rst0git pushed a commit that referenced this issue May 28, 2023
--criu-binary argument provides a way to supply the CRIU binary
location to run_criu().

Related to: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
rst0git pushed a commit that referenced this issue May 28, 2023
These changes remove and update the changes introduced in
7177938 in favor of the
Python version in CI.

os.waitstatus_to_exitcode() function appeared in Python 3.9

Related to: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
rst0git pushed a commit that referenced this issue May 28, 2023
These changes add test implementations for criu-ns script.

Fixes: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit that referenced this issue Jun 12, 2023
--criu-binary argument provides a way to supply the CRIU binary
location to run_criu().

Related to: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit that referenced this issue Jun 12, 2023
These changes remove and update the changes introduced in
7177938 in favor of the
Python version in CI.

os.waitstatus_to_exitcode() function appeared in Python 3.9

Related to: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit that referenced this issue Jun 12, 2023
These changes add test implementations for criu-ns script.

Fixes: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit that referenced this issue Jun 12, 2023
--criu-binary argument provides a way to supply the CRIU binary
location to run_criu().

Related to: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit that referenced this issue Jun 12, 2023
These changes remove and update the changes introduced in
7177938 in favor of the
Python version in CI.

os.waitstatus_to_exitcode() function appeared in Python 3.9

Related to: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit that referenced this issue Jun 12, 2023
These changes add test implementations for criu-ns script.

Fixes: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit to avagin/criu that referenced this issue Oct 12, 2023
--criu-binary argument provides a way to supply the CRIU binary
location to run_criu().

Related to: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit to avagin/criu that referenced this issue Oct 12, 2023
These changes remove and update the changes introduced in
7177938 in favor of the
Python version in CI.

os.waitstatus_to_exitcode() function appeared in Python 3.9

Related to: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit to avagin/criu that referenced this issue Oct 12, 2023
These changes add test implementations for criu-ns script.

Fixes: checkpoint-restore#1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit that referenced this issue Oct 22, 2023
--criu-binary argument provides a way to supply the CRIU binary
location to run_criu().

Related to: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit that referenced this issue Oct 22, 2023
These changes remove and update the changes introduced in
7177938 in favor of the
Python version in CI.

os.waitstatus_to_exitcode() function appeared in Python 3.9

Related to: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
avagin pushed a commit that referenced this issue Oct 22, 2023
These changes add test implementations for criu-ns script.

Fixes: #1909

Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants