Example #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()
Example #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()
Example #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')
Example #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")
Example #5
0
def check_uninitialized():
    try:
        sigutils.wait_for_signal()
    except RuntimeError:
        sys.stdout.write('exception\n')
Example #6
0
def check_signal_timeout(timeout):
    sigutils.wait_for_signal(float(timeout))
Example #7
0
def check_signal_received():
    sigutils.wait_for_signal()
Example #8
0
def check_uninitialized():
    try:
        sigutils.wait_for_signal()
    except RuntimeError:
        sys.stdout.write("exception\n")
Example #9
0
def check_signal_timeout(timeout):
    sigutils.wait_for_signal(float(timeout))
Example #10
0
def check_signal_received():
    sigutils.wait_for_signal()