mirror of
https://git.yoctoproject.org/poky
synced 2026-09-20 03:49:32 +02:00
oeqa: tear down oeqa decorators if one of them raises an exception in setup
Some of the decorators need proper cleanup, such as OETimeout which sets a signal handler that needs to be cleared via teardown. If this is not done then the signal gets called later with unpredictable effects. This can be seen if there's a test that is skipped via a decorator and sets a timeout at the same time: the timeout isn't cleared, and is invoked later in a completely unrelated context. The test case for this is added in the next commit. (From OE-Core rev: be45a8271c06ffbb5d97afd33bb15b1143b6cf8d) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit f42a08e1aabf1ca57e0c09d69fb69cc717c7f156) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
509dd69bad
commit
1ecf10dc33
@@ -43,8 +43,13 @@ class OETestCase(unittest.TestCase):
|
|||||||
clss.tearDownClassMethod()
|
clss.tearDownClassMethod()
|
||||||
|
|
||||||
def _oeSetUp(self):
|
def _oeSetUp(self):
|
||||||
for d in self.decorators:
|
try:
|
||||||
d.setUpDecorator()
|
for d in self.decorators:
|
||||||
|
d.setUpDecorator()
|
||||||
|
except:
|
||||||
|
for d in self.decorators:
|
||||||
|
d.tearDownDecorator()
|
||||||
|
raise
|
||||||
self.setUpMethod()
|
self.setUpMethod()
|
||||||
|
|
||||||
def _oeTearDown(self):
|
def _oeTearDown(self):
|
||||||
|
|||||||
@@ -24,5 +24,6 @@ class OETimeout(OETestDecorator):
|
|||||||
|
|
||||||
def tearDownDecorator(self):
|
def tearDownDecorator(self):
|
||||||
signal.alarm(0)
|
signal.alarm(0)
|
||||||
signal.signal(signal.SIGALRM, self.alarmSignal)
|
if hasattr(self, 'alarmSignal'):
|
||||||
self.logger.debug("Removed SIGALRM handler")
|
signal.signal(signal.SIGALRM, self.alarmSignal)
|
||||||
|
self.logger.debug("Removed SIGALRM handler")
|
||||||
|
|||||||
Reference in New Issue
Block a user