Exemplo n.º 1
0
def check_child_signal_to_thread():
    '''
    This test checks the following scenario:
    * main thread is waiting for signal
    * another thread is running a subprocess
    * the subprocess exits before another thread dies

    This leads to signal being sent to another thread but not the main thread.
    This test makes sure main thread is woken up.
    '''

    def thread_target():
        subprocess.Popen(['true'])
        time.sleep(1)  # sleep so SIGCHLD is delivered here.
    threading.Thread(target=thread_target).start()
    sigutils.wait_for_signal()
Exemplo n.º 2
0
def check_child_signal_to_thread():
    '''
    This test checks the following scenario:
    * main thread is waiting for signal
    * another thread is running a subprocess
    * the subprocess exits before another thread dies

    This leads to signal being sent to another thread but not the main thread.
    This test makes sure main thread is woken up.
    '''
    def thread_target():
        subprocess.Popen(['true'])
        time.sleep(1)  # sleep so SIGCHLD is delivered here.

    threading.Thread(target=thread_target).start()
    sigutils.wait_for_signal()
Exemplo n.º 3
0
def check_signal_times():
    sigutils.wait_for_signal()
    sys.stdout.write('woke up\n')
    sigutils.wait_for_signal()
    sys.stdout.write('woke up\n')
    sigutils.wait_for_signal()
    sys.stdout.write('woke up\n')
Exemplo n.º 4
0
def check_signal_times():
    sigutils.wait_for_signal()
    sys.stdout.write("woke up\n")
    sigutils.wait_for_signal()
    sys.stdout.write("woke up\n")
    sigutils.wait_for_signal()
    sys.stdout.write("woke up\n")
Exemplo n.º 5
0
def check_uninitialized():
    try:
        sigutils.wait_for_signal()
    except RuntimeError:
        sys.stdout.write('exception\n')
Exemplo n.º 6
0
def check_signal_timeout(timeout):
    sigutils.wait_for_signal(float(timeout))
Exemplo n.º 7
0
def check_signal_received():
    sigutils.wait_for_signal()
Exemplo n.º 8
0
def check_uninitialized():
    try:
        sigutils.wait_for_signal()
    except RuntimeError:
        sys.stdout.write("exception\n")
Exemplo n.º 9
0
def check_signal_timeout(timeout):
    sigutils.wait_for_signal(float(timeout))
Exemplo n.º 10
0
def check_signal_received():
    sigutils.wait_for_signal()