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()
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')
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")
def check_uninitialized(): try: sigutils.wait_for_signal() except RuntimeError: sys.stdout.write('exception\n')
def check_signal_timeout(timeout): sigutils.wait_for_signal(float(timeout))
def check_signal_received(): sigutils.wait_for_signal()
def check_uninitialized(): try: sigutils.wait_for_signal() except RuntimeError: sys.stdout.write("exception\n")