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