Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import contextlib | 5 import contextlib |
| 6 import imp | 6 import imp |
| 7 import inspect | 7 import inspect |
| 8 import logging | 8 import logging |
| 9 import multiprocessing | 9 import multiprocessing |
| 10 import os | 10 import os |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 This function is meant to be run as a dedicated process. Calling it twice | 392 This function is meant to be run as a dedicated process. Calling it twice |
| 393 in the same process is not supported. | 393 in the same process is not supported. |
| 394 | 394 |
| 395 Args: | 395 Args: |
| 396 cover_ctx: | 396 cover_ctx: |
| 397 kill_switch (multiprocessing.Event): | 397 kill_switch (multiprocessing.Event): |
| 398 result_queue (multiprocessing.Queue): | 398 result_queue (multiprocessing.Queue): |
| 399 opts: output of argparse.ArgumentParser.parse_args (see main.py) | 399 opts: output of argparse.ArgumentParser.parse_args (see main.py) |
| 400 processing_context (ProcessingContext): the task to perform. | 400 processing_context (ProcessingContext): the task to perform. |
| 401 """ | 401 """ |
| 402 pretest_filename = os.path.join(processing_context.cwd, '.expect_tests.py') | |
|
agable
2015/02/03 04:23:48
In the documentation you committed previously, you
agable
2015/02/03 04:27:59
Also, this implementation requires the same .expec
| |
| 403 if os.path.isfile(pretest_filename): | |
| 404 execfile(pretest_filename) | |
| 405 | |
| 402 sys.path.insert(0, processing_context.cwd) | 406 sys.path.insert(0, processing_context.cwd) |
| 403 | 407 |
| 404 # This flag is set when test generation has finished. | 408 # This flag is set when test generation has finished. |
| 405 test_gen_finished = multiprocessing.Event() | 409 test_gen_finished = multiprocessing.Event() |
| 406 test_queue = multiprocessing.Queue() | 410 test_queue = multiprocessing.Queue() |
| 407 | 411 |
| 408 with TempDir() as temp_dir: | 412 with TempDir() as temp_dir: |
| 409 test_gen_args = ( | 413 test_gen_args = ( |
| 410 processing_context.testing_contexts, test_queue, result_queue, opts, | 414 processing_context.testing_contexts, test_queue, result_queue, opts, |
| 411 kill_switch, cover_ctx, temp_dir | 415 kill_switch, cover_ctx, temp_dir |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 | 526 |
| 523 if procs: | 527 if procs: |
| 524 error = opts.handler.result_stage_loop(opts, generate_objects(procs)) | 528 error = opts.handler.result_stage_loop(opts, generate_objects(procs)) |
| 525 except ResultStageAbort: | 529 except ResultStageAbort: |
| 526 pass | 530 pass |
| 527 | 531 |
| 528 if not kill_switch.is_set() and not result_queue.empty(): | 532 if not kill_switch.is_set() and not result_queue.empty(): |
| 529 error = True | 533 error = True |
| 530 | 534 |
| 531 return error, kill_switch.is_set() | 535 return error, kill_switch.is_set() |
| OLD | NEW |