|
|
|
@ -70,16 +70,26 @@ class TestDygraphDataLoaderSingalHandler(unittest.TestCase):
|
|
|
|
|
core._set_process_signal_handler()
|
|
|
|
|
os.kill(os.getpid(), signal.SIGSEGV)
|
|
|
|
|
|
|
|
|
|
exception = None
|
|
|
|
|
try:
|
|
|
|
|
test_process = multiprocessing.Process(target=__test_process__)
|
|
|
|
|
test_process.start()
|
|
|
|
|
def try_except_exit():
|
|
|
|
|
exception = None
|
|
|
|
|
try:
|
|
|
|
|
test_process = multiprocessing.Process(target=__test_process__)
|
|
|
|
|
test_process.start()
|
|
|
|
|
|
|
|
|
|
set_child_signal_handler(id(self), test_process.pid)
|
|
|
|
|
time.sleep(10)
|
|
|
|
|
except SystemError as ex:
|
|
|
|
|
self.assertIn("Segmentation fault", cpt.get_exception_message(ex))
|
|
|
|
|
exception = ex
|
|
|
|
|
set_child_signal_handler(id(self), test_process.pid)
|
|
|
|
|
time.sleep(5)
|
|
|
|
|
except SystemError as ex:
|
|
|
|
|
self.assertIn("Segmentation fault",
|
|
|
|
|
cpt.get_exception_message(ex))
|
|
|
|
|
exception = ex
|
|
|
|
|
return exception
|
|
|
|
|
|
|
|
|
|
try_time = 10
|
|
|
|
|
exception = None
|
|
|
|
|
for i in range(try_time):
|
|
|
|
|
exception = try_except_exit()
|
|
|
|
|
if exception is not None:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
self.assertIsNotNone(exception)
|
|
|
|
|
|
|
|
|
@ -88,16 +98,25 @@ class TestDygraphDataLoaderSingalHandler(unittest.TestCase):
|
|
|
|
|
core._set_process_signal_handler()
|
|
|
|
|
os.kill(os.getpid(), signal.SIGBUS)
|
|
|
|
|
|
|
|
|
|
exception = None
|
|
|
|
|
try:
|
|
|
|
|
test_process = multiprocessing.Process(target=__test_process__)
|
|
|
|
|
test_process.start()
|
|
|
|
|
def try_except_exit():
|
|
|
|
|
exception = None
|
|
|
|
|
try:
|
|
|
|
|
test_process = multiprocessing.Process(target=__test_process__)
|
|
|
|
|
test_process.start()
|
|
|
|
|
|
|
|
|
|
set_child_signal_handler(id(self), test_process.pid)
|
|
|
|
|
time.sleep(10)
|
|
|
|
|
except SystemError as ex:
|
|
|
|
|
self.assertIn("Bus error", cpt.get_exception_message(ex))
|
|
|
|
|
exception = ex
|
|
|
|
|
set_child_signal_handler(id(self), test_process.pid)
|
|
|
|
|
time.sleep(5)
|
|
|
|
|
except SystemError as ex:
|
|
|
|
|
self.assertIn("Bus error", cpt.get_exception_message(ex))
|
|
|
|
|
exception = ex
|
|
|
|
|
return exception
|
|
|
|
|
|
|
|
|
|
try_time = 10
|
|
|
|
|
exception = None
|
|
|
|
|
for i in range(try_time):
|
|
|
|
|
exception = try_except_exit()
|
|
|
|
|
if exception is not None:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
self.assertIsNotNone(exception)
|
|
|
|
|
|
|
|
|
|