diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-04-04 11:30:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-04-06 09:30:10 +0100 |
commit | f0c5a904d9ebe1e2ae4f691273e06e8dfd86cb56 (patch) | |
tree | 0f4f2566184ed0888a56c76d393ba6eabc4ab833 /meta/lib | |
parent | ef501020fb44c7f1984fc854d0a70d082aa9a5c1 (diff) | |
download | poky-f0c5a904d9ebe1e2ae4f691273e06e8dfd86cb56.tar.gz |
oeqa/concurrencytest: Rename variables to improve the code
Each time I look at this code I get confused about what the different
variables represent. Rename a few of them to better indicate what they
represent.
(From OE-Core rev: e39d97c0b191add9281bac463ca059685288c81a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/core/utils/concurrencytest.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/meta/lib/oeqa/core/utils/concurrencytest.py b/meta/lib/oeqa/core/utils/concurrencytest.py index b2eb68fb02..347dc89602 100644 --- a/meta/lib/oeqa/core/utils/concurrencytest.py +++ b/meta/lib/oeqa/core/utils/concurrencytest.py | |||
@@ -190,13 +190,13 @@ class ConcurrentTestSuite(unittest.TestSuite): | |||
190 | self.removefunc = removefunc | 190 | self.removefunc = removefunc |
191 | 191 | ||
192 | def run(self, result): | 192 | def run(self, result): |
193 | tests, totaltests = fork_for_tests(self.processes, self) | 193 | testservers, totaltests = fork_for_tests(self.processes, self) |
194 | try: | 194 | try: |
195 | threads = {} | 195 | threads = {} |
196 | queue = Queue() | 196 | queue = Queue() |
197 | semaphore = threading.Semaphore(1) | 197 | semaphore = threading.Semaphore(1) |
198 | result.threadprogress = {} | 198 | result.threadprogress = {} |
199 | for i, (test, testnum) in enumerate(tests): | 199 | for i, (testserver, testnum) in enumerate(testservers): |
200 | result.threadprogress[i] = [] | 200 | result.threadprogress[i] = [] |
201 | process_result = BBThreadsafeForwardingResult( | 201 | process_result = BBThreadsafeForwardingResult( |
202 | ExtraResultsDecoderTestResult(result), | 202 | ExtraResultsDecoderTestResult(result), |
@@ -210,8 +210,8 @@ class ConcurrentTestSuite(unittest.TestSuite): | |||
210 | process_result._stdout_buffer = io.StringIO() | 210 | process_result._stdout_buffer = io.StringIO() |
211 | process_result._stdout_buffer.buffer = dummybuf(process_result._stdout_buffer) | 211 | process_result._stdout_buffer.buffer = dummybuf(process_result._stdout_buffer) |
212 | reader_thread = threading.Thread( | 212 | reader_thread = threading.Thread( |
213 | target=self._run_test, args=(test, process_result, queue)) | 213 | target=self._run_test, args=(testserver, process_result, queue)) |
214 | threads[test] = reader_thread, process_result | 214 | threads[testserver] = reader_thread, process_result |
215 | reader_thread.start() | 215 | reader_thread.start() |
216 | while threads: | 216 | while threads: |
217 | finished_test = queue.get() | 217 | finished_test = queue.get() |
@@ -222,13 +222,13 @@ class ConcurrentTestSuite(unittest.TestSuite): | |||
222 | process_result.stop() | 222 | process_result.stop() |
223 | raise | 223 | raise |
224 | finally: | 224 | finally: |
225 | for test in tests: | 225 | for testserver in testservers: |
226 | test[0]._stream.close() | 226 | testserver[0]._stream.close() |
227 | 227 | ||
228 | def _run_test(self, test, process_result, queue): | 228 | def _run_test(self, testserver, process_result, queue): |
229 | try: | 229 | try: |
230 | try: | 230 | try: |
231 | test.run(process_result) | 231 | testserver.run(process_result) |
232 | except Exception: | 232 | except Exception: |
233 | # The run logic itself failed | 233 | # The run logic itself failed |
234 | case = testtools.ErrorHolder( | 234 | case = testtools.ErrorHolder( |
@@ -236,10 +236,10 @@ class ConcurrentTestSuite(unittest.TestSuite): | |||
236 | error=sys.exc_info()) | 236 | error=sys.exc_info()) |
237 | case.run(process_result) | 237 | case.run(process_result) |
238 | finally: | 238 | finally: |
239 | queue.put(test) | 239 | queue.put(testserver) |
240 | 240 | ||
241 | def fork_for_tests(concurrency_num, suite): | 241 | def fork_for_tests(concurrency_num, suite): |
242 | result = [] | 242 | testservers = [] |
243 | if 'BUILDDIR' in os.environ: | 243 | if 'BUILDDIR' in os.environ: |
244 | selftestdir = get_test_layer() | 244 | selftestdir = get_test_layer() |
245 | 245 | ||
@@ -306,9 +306,9 @@ def fork_for_tests(concurrency_num, suite): | |||
306 | else: | 306 | else: |
307 | os.close(c2pwrite) | 307 | os.close(c2pwrite) |
308 | stream = os.fdopen(c2pread, 'rb', 1) | 308 | stream = os.fdopen(c2pread, 'rb', 1) |
309 | test = ProtocolTestCase(stream) | 309 | testserver = ProtocolTestCase(stream) |
310 | result.append((test, numtests)) | 310 | testservers.append((testserver, numtests)) |
311 | return result, totaltests | 311 | return testservers, totaltests |
312 | 312 | ||
313 | def partition_tests(suite, count): | 313 | def partition_tests(suite, count): |
314 | # Keep tests from the same class together but allow tests from modules | 314 | # Keep tests from the same class together but allow tests from modules |