try to fix reader and signal test failed (#30960)

revert-31068-fix_conv3d_windows
Chen Weihang 4 years ago committed by GitHub
parent 3ba69809bf
commit 010f2caa23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,7 +68,7 @@ TEST(BlockingQueue, SenderBlockingTest) {
++send_count;
}
});
std::this_thread::sleep_for(std::chrono::milliseconds(200));
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
q.Close();
sender.join();
EXPECT_EQ(send_count, queue_cap);

@ -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)

Loading…
Cancel
Save