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') | 402 assert os.path.isabs(processing_context.cwd) |
| 403 # pretest_filename can officially be accessed by .expect_tests_pretest.py to |
| 404 # get to this file's location. So no renaming! |
| 405 pretest_filename = os.path.join(processing_context.cwd, |
| 406 '.expect_tests_pretest.py') |
403 if os.path.isfile(pretest_filename): | 407 if os.path.isfile(pretest_filename): |
404 execfile(pretest_filename) | 408 execfile(pretest_filename) |
405 | 409 |
406 sys.path.insert(0, processing_context.cwd) | 410 sys.path.insert(0, processing_context.cwd) |
407 | 411 |
408 # This flag is set when test generation has finished. | 412 # This flag is set when test generation has finished. |
409 test_gen_finished = multiprocessing.Event() | 413 test_gen_finished = multiprocessing.Event() |
410 test_queue = multiprocessing.Queue() | 414 test_queue = multiprocessing.Queue() |
411 | 415 |
412 with TempDir() as temp_dir: | 416 with TempDir() as temp_dir: |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 530 |
527 if procs: | 531 if procs: |
528 error = opts.handler.result_stage_loop(opts, generate_objects(procs)) | 532 error = opts.handler.result_stage_loop(opts, generate_objects(procs)) |
529 except ResultStageAbort: | 533 except ResultStageAbort: |
530 pass | 534 pass |
531 | 535 |
532 if not kill_switch.is_set() and not result_queue.empty(): | 536 if not kill_switch.is_set() and not result_queue.empty(): |
533 error = True | 537 error = True |
534 | 538 |
535 return error, kill_switch.is_set() | 539 return error, kill_switch.is_set() |
OLD | NEW |