Fix unit test error due to program abort caused by limited resources (#1162)

* Fix unit test error due to program abort cause by limited resources

* clean the code
pull/1169/head
Mashiro 2023-05-25 16:22:17 +08:00 committed by GitHub
parent 49613414b2
commit 426a565908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1,10 +1,10 @@
# Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) https://github.com/pytorch/pytorch
# Modified from https://github.com/pytorch/pytorch/blob/master/torch/testing/_internal/common_distributed.py # noqa: E501
import faulthandler
import logging
import multiprocessing
import signal
import sys
import tempfile
import threading
@ -339,6 +339,9 @@ class MultiProcessTestCase(TestCase):
raise RuntimeError(
f'Process {i} terminated or timed out after '
'{elapsed_time} seconds')
if p.exitcode == signal.SIGABRT:
self.skipTest(f'Skip test {self._testMethodName} due to '
'the program abort')
self.assertEqual(
p.exitcode,
first_process.exitcode,