criu
criu copied to clipboard
Need test for robust lists
A friendly reminder that this issue had no activity for 30 days.
https://man7.org/linux/man-pages/man2/get_robust_list.2.html
Hello @mihalicyn
def test_robust_lists():
# Starting a process with a robust list
pid = os.fork()
if pid == 0:
# Child process
robust_list = [1, 2, 3]
prctl(PR_SET_NAME, "child")
set_robust_list(robust_list)
# Wait for a signal to terminate
signal.pause()
os._exit(0)
else:
# Parent process
prctl(PR_SET_NAME, "parent")
# Check that the child process has a robust list
child_list = get_robust_list(pid)
assert child_list == [1, 2, 3]
# Send a signal to the child process
os.kill(pid, signal.SIGUSR1)
os.waitpid(pid, 0)
This test case checks that the list exists using get_robust_list()
, sends a signal to the child process, and waits for it to terminate. This tests several code paths related to robust lists and can be used as a starting point for additional tests.
Hello @mihalicyn
def test_robust_lists(): # Starting a process with a robust list pid = os.fork() if pid == 0: # Child process robust_list = [1, 2, 3] prctl(PR_SET_NAME, "child") set_robust_list(robust_list) # Wait for a signal to terminate signal.pause() os._exit(0) else: # Parent process prctl(PR_SET_NAME, "parent") # Check that the child process has a robust list child_list = get_robust_list(pid) assert child_list == [1, 2, 3] # Send a signal to the child process os.kill(pid, signal.SIGUSR1) os.waitpid(pid, 0)
This test case checks that the list exists using
get_robust_list()
, sends a signal to the child process, and waits for it to terminate. This tests several code paths related to robust lists and can be used as a starting point for additional tests.
Have you tried to run this code?