summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorNathan Rossi <nathan.rossi@xilinx.com>2015-04-16 18:29:24 +1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-21 07:20:25 +0100
commit71db5767a875ca2834eb2434ff67b4af56d77920 (patch)
tree20984c0df3a87a6c75a50698116aae612cccb2ce /meta/lib
parent72830226190b828854e3d27720711f9c147bfe28 (diff)
downloadpoky-71db5767a875ca2834eb2434ff67b4af56d77920.tar.gz
oeqa/utils/decorators: Fix up frame selection
Use threading to get the current threads ident to select the current executing frame to ensure that the scanned stack is the expected stack. This allows for the decorators to be used within a process that has multiple threads executing. (From OE-Core rev: a44d27b92baba4ab51f432ec01cdc473436ce406) Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/utils/decorators.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/decorators.py b/meta/lib/oeqa/utils/decorators.py
index 1e5a890fdd..61a1a739ea 100644
--- a/meta/lib/oeqa/utils/decorators.py
+++ b/meta/lib/oeqa/utils/decorators.py
@@ -10,12 +10,14 @@ import os
10import logging 10import logging
11import sys 11import sys
12import unittest 12import unittest
13import threading
13 14
14#get the "result" object from one of the upper frames provided that one of these upper frames is a unittest.case frame 15#get the "result" object from one of the upper frames provided that one of these upper frames is a unittest.case frame
15class getResults(object): 16class getResults(object):
16 def __init__(self): 17 def __init__(self):
17 #dynamically determine the unittest.case frame and use it to get the name of the test method 18 #dynamically determine the unittest.case frame and use it to get the name of the test method
18 upperf = sys._current_frames().values()[0] 19 ident = threading.current_thread().ident
20 upperf = sys._current_frames()[ident]
19 while (upperf.f_globals['__name__'] != 'unittest.case'): 21 while (upperf.f_globals['__name__'] != 'unittest.case'):
20 upperf = upperf.f_back 22 upperf = upperf.f_back
21 23