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

Need test for robust lists #125

Open
xemul opened this issue Mar 4, 2016 · 5 comments
Open

Need test for robust lists #125

xemul opened this issue Mar 4, 2016 · 5 comments
Labels

Comments

@xemul
Copy link
Member

xemul commented Mar 4, 2016

No description provided.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@mihalicyn mihalicyn added no-auto-close Don't auto-close as a stale issue and removed stale-issue labels Mar 13, 2023
@mihalicyn mihalicyn reopened this Mar 13, 2023
@mihalicyn
Copy link
Member

@linktorahulraj
Copy link

linktorahulraj commented Mar 26, 2023

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.

@mihalicyn
Copy link
Member

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?

@bhagyashree980
Copy link

Hi @mihalicyn , I’m interested in contributing to this project. Could you suggest a good first issue or an area where help is needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants