Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1349)

Side by Side Diff: appengine/swarming/swarming_bot/bot_code/task_runner_test.py

Issue 1949613002: task_runner: always use run_isolated (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Fix task_runner.py Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/task_runner.py ('k') | client/run_isolated.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding=utf-8 2 # coding=utf-8
3 # Copyright 2013 The LUCI Authors. All rights reserved. 3 # Copyright 2013 The LUCI Authors. All rights reserved.
4 # Use of this source code is governed by the Apache v2.0 license that can be 4 # Use of this source code is governed by the Apache v2.0 license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import base64 7 import base64
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
11 import re
11 import signal 12 import signal
12 import shutil
13 import sys 13 import sys
14 import tempfile 14 import tempfile
15 import time 15 import time
16 import unittest 16 import unittest
17 17
18 import test_env_bot_code 18 import test_env_bot_code
19 test_env_bot_code.setup_test_env() 19 test_env_bot_code.setup_test_env()
20 20
21 # Creates a server mock for functions in net.py. 21 # Creates a server mock for functions in net.py.
22 import net_utils 22 import net_utils
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 }, 113 },
114 kwargs) 114 kwargs)
115 return check_first 115 return check_first
116 116
117 117
118 class TestTaskRunner(TestTaskRunnerBase): 118 class TestTaskRunner(TestTaskRunnerBase):
119 def setUp(self): 119 def setUp(self):
120 super(TestTaskRunner, self).setUp() 120 super(TestTaskRunner, self).setUp()
121 self.mock(time, 'time', lambda: 1000000000.) 121 self.mock(time, 'time', lambda: 1000000000.)
122 122
123 def get_check_final(self, exit_code=0, output='hi\n', outputs_ref=None): 123 def get_check_final(self, exit_code=0, output_re=r'^hi\n$', outputs_ref=None):
124 def check_final(kwargs): 124 def check_final(kwargs):
125 # It makes the diffing easier. 125 # Ignore these values.
126 kwargs['data'].pop('bot_overhead', None)
127 kwargs['data'].pop('duration', None)
128
129 output = ''
126 if 'output' in kwargs['data']: 130 if 'output' in kwargs['data']:
127 kwargs['data']['output'] = base64.b64decode(kwargs['data']['output']) 131 output = base64.b64decode(kwargs['data'].pop('output'))
132 self.assertTrue(re.match(output_re, output))
133
128 expected = { 134 expected = {
129 'data': { 135 'data': {
130 'cost_usd': 10., 136 'cost_usd': 10.,
131 'duration': 0.,
132 'exit_code': exit_code, 137 'exit_code': exit_code,
133 'hard_timeout': False, 138 'hard_timeout': False,
134 'id': 'localhost', 139 'id': 'localhost',
135 'io_timeout': False, 140 'io_timeout': False,
136 'output': output,
137 'output_chunk_start': 0, 141 'output_chunk_start': 0,
138 'task_id': 23, 142 'task_id': 23,
139 }, 143 },
140 } 144 }
141 if outputs_ref: 145 if outputs_ref:
142 expected['data']['outputs_ref'] = outputs_ref 146 expected['data']['outputs_ref'] = outputs_ref
143 self.assertEqual(expected, kwargs) 147 self.assertEqual(expected, kwargs)
144 return check_final 148 return check_final
145 149
146 def _run_command(self, task_details): 150 def _run_command(self, task_details):
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 expected = { 324 expected = {
321 u'exit_code': 1, 325 u'exit_code': 1,
322 u'hard_timeout': False, 326 u'hard_timeout': False,
323 u'io_timeout': False, 327 u'io_timeout': False,
324 u'must_signal_internal_failure': None, 328 u'must_signal_internal_failure': None,
325 u'version': task_runner.OUT_VERSION, 329 u'version': task_runner.OUT_VERSION,
326 } 330 }
327 self.assertEqual(expected, self._run_command(task_details)) 331 self.assertEqual(expected, self._run_command(task_details))
328 332
329 def test_run_command_os_error(self): 333 def test_run_command_os_error(self):
330 # This runs the command for real. 334 self.requests(
331 # OS specific error, fix expectation for other OSes. 335 cost_usd=10.,
332 output = ( 336 exit_code=1,
333 'Command "executable_that_shouldnt_be_on_your_system ' 337 output_re=(
334 'thus_raising_OSError" failed to start.\n' 338 # This is a beginning of run_isolate.py's output if binary is not
335 'Error: [Error 2] The system cannot find the file specified' 339 # found.
336 ) if sys.platform == 'win32' else ( 340 r'^<The executable does not exist or a dependent library is '
337 'Command "executable_that_shouldnt_be_on_your_system ' 341 r'missing>'))
338 'thus_raising_OSError" failed to start.\n'
339 'Error: [Errno 2] No such file or directory')
340 self.requests(cost_usd=10., exit_code=1, output=output)
341 task_details = task_runner.TaskDetails( 342 task_details = task_runner.TaskDetails(
342 { 343 {
343 'bot_id': 'localhost', 344 'bot_id': 'localhost',
344 'command': [ 345 'command': [
345 'executable_that_shouldnt_be_on_your_system', 346 'executable_that_shouldnt_be_on_your_system',
346 'thus_raising_OSError', 347 'thus_raising_OSError',
347 ], 348 ],
348 'env': {}, 349 'env': {},
349 'extra_args': [], 350 'extra_args': [],
350 'grace_period': 30., 351 'grace_period': 30.,
351 'hard_timeout': 6, 352 'hard_timeout': 6,
352 'inputs_ref': None, 353 'inputs_ref': None,
353 'io_timeout': 6, 354 'io_timeout': 6,
354 'task_id': 23, 355 'task_id': 23,
355 }) 356 })
356 expected = { 357 expected = {
357 u'exit_code': 1, 358 u'exit_code': 1,
358 u'hard_timeout': False, 359 u'hard_timeout': False,
359 u'io_timeout': False, 360 u'io_timeout': False,
360 u'must_signal_internal_failure': None, 361 u'must_signal_internal_failure': None,
361 u'version': task_runner.OUT_VERSION, 362 u'version': task_runner.OUT_VERSION,
362 } 363 }
363 self.assertEqual(expected, self._run_command(task_details)) 364 self.assertEqual(expected, self._run_command(task_details))
364 365
365 def test_run_command_large(self): 366 def test_run_command_large(self):
366 # Method should have "self" as first argument - pylint: disable=E0213 367 # Method should have "self" as first argument - pylint: disable=E0213
367 class Popen(object): 368 class Popen(object):
368 """Mocks the process so we can control how data is returned.""" 369 """Mocks the process so we can control how data is returned."""
369 def __init__(self2, cmd, cwd, env, stdout, stderr, stdin, detached): 370 def __init__(self2, cmd, cwd, env, stdout, stderr, stdin, detached):
370 self.assertEqual(task_details.command, cmd)
nodir 2016/05/12 21:46:23 this test is not about checking command anyway
371 self.assertEqual(self.work_dir, cwd) 371 self.assertEqual(self.work_dir, cwd)
372 expected_env = os.environ.copy() 372 expected_env = os.environ.copy()
373 expected_env['foo'] = 'bar' 373 expected_env['foo'] = 'bar'
374 self.assertEqual(expected_env, env) 374 self.assertEqual(expected_env, env)
375 self.assertEqual(subprocess42.PIPE, stdout) 375 self.assertEqual(subprocess42.PIPE, stdout)
376 self.assertEqual(subprocess42.STDOUT, stderr) 376 self.assertEqual(subprocess42.STDOUT, stderr)
377 self.assertEqual(subprocess42.PIPE, stdin) 377 self.assertEqual(subprocess42.PIPE, stdin)
378 self.assertEqual(True, detached) 378 self.assertEqual(True, detached)
379 self2._out = [ 379 self2._out = [
380 'hi!\n', 380 'hi!\n',
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 ' except IOError:\n' 560 ' except IOError:\n'
561 ' pass;\n' 561 ' pass;\n'
562 'print(\'bye\');\n' 562 'print(\'bye\');\n'
563 'time.sleep(100)') % ( 563 'time.sleep(100)') % (
564 'signal.SIGBREAK' if sys.platform == 'win32' else 'signal.SIGTERM') 564 'signal.SIGBREAK' if sys.platform == 'win32' else 'signal.SIGTERM')
565 565
566 SCRIPT_HANG = 'import time; print(\'hi\'); time.sleep(100)' 566 SCRIPT_HANG = 'import time; print(\'hi\'); time.sleep(100)'
567 567
568 def get_check_final( 568 def get_check_final(
569 self, hard_timeout=False, io_timeout=False, exit_code=None, 569 self, hard_timeout=False, io_timeout=False, exit_code=None,
570 output='hi\n'): 570 output_re='^hi\n$'):
571 def check_final(kwargs): 571 def check_final(kwargs):
572 kwargs['data'].pop('bot_overhead', None)
572 if hard_timeout or io_timeout: 573 if hard_timeout or io_timeout:
573 self.assertLess(self.SHORT_TIME_OUT, kwargs['data'].pop('cost_usd')) 574 self.assertLess(self.SHORT_TIME_OUT, kwargs['data'].pop('cost_usd'))
574 self.assertLess(self.SHORT_TIME_OUT, kwargs['data'].pop('duration')) 575 self.assertLess(self.SHORT_TIME_OUT, kwargs['data'].pop('duration'))
575 else: 576 else:
576 self.assertLess(0., kwargs['data'].pop('cost_usd')) 577 self.assertLess(0., kwargs['data'].pop('cost_usd'))
577 self.assertLess(0., kwargs['data'].pop('duration')) 578 self.assertLess(0., kwargs['data'].pop('duration'))
578 # It makes the diffing easier. 579
579 kwargs['data']['output'] = base64.b64decode(kwargs['data']['output']) 580 output = ''
581 if 'output' in kwargs['data']:
582 output = base64.b64decode(kwargs['data'].pop('output'))
583 self.assertTrue(re.match(output_re, output))
584
580 self.assertEqual( 585 self.assertEqual(
581 { 586 {
582 'data': { 587 'data': {
583 'exit_code': exit_code, 588 'exit_code': exit_code,
584 'hard_timeout': hard_timeout, 589 'hard_timeout': hard_timeout,
585 'id': 'localhost', 590 'id': 'localhost',
586 'io_timeout': io_timeout, 591 'io_timeout': io_timeout,
587 'output': output,
588 'output_chunk_start': 0, 592 'output_chunk_start': 0,
589 'task_id': 23, 593 'task_id': 23,
590 }, 594 },
591 }, 595 },
592 kwargs) 596 kwargs)
593 return check_final 597 return check_final
594 598
595 def _load_and_run(self, manifest): 599 def _load_and_run(self, manifest):
596 # Dot not mock time since this test class is testing timeouts. 600 # Dot not mock time since this test class is testing timeouts.
597 server = 'https://localhost:1' 601 server = 'https://localhost:1'
(...skipping 17 matching lines...) Expand all
615 self.requests(hard_timeout=True, exit_code=sig) 619 self.requests(hard_timeout=True, exit_code=sig)
616 task_details = self.get_task_details( 620 task_details = self.get_task_details(
617 self.SCRIPT_HANG, hard_timeout=self.SHORT_TIME_OUT) 621 self.SCRIPT_HANG, hard_timeout=self.SHORT_TIME_OUT)
618 expected = { 622 expected = {
619 u'exit_code': sig, 623 u'exit_code': sig,
620 u'hard_timeout': True, 624 u'hard_timeout': True,
621 u'io_timeout': False, 625 u'io_timeout': False,
622 u'must_signal_internal_failure': None, 626 u'must_signal_internal_failure': None,
623 u'version': task_runner.OUT_VERSION, 627 u'version': task_runner.OUT_VERSION,
624 } 628 }
625 self.assertEqual(expected, self._run_command(task_details)) 629 actual = self._run_command(task_details)
630 actual.pop('bot_overhead', None)
631 self.assertEqual(expected, actual)
626 632
627 def test_io(self): 633 def test_io(self):
628 # Actually 0xc000013a 634 # Actually 0xc000013a
629 sig = -1073741510 if sys.platform == 'win32' else -signal.SIGTERM 635 sig = -1073741510 if sys.platform == 'win32' else -signal.SIGTERM
630 self.requests(io_timeout=True, exit_code=sig) 636 self.requests(io_timeout=True, exit_code=sig)
631 task_details = self.get_task_details( 637 task_details = self.get_task_details(
632 self.SCRIPT_HANG, io_timeout=self.SHORT_TIME_OUT) 638 self.SCRIPT_HANG, io_timeout=self.SHORT_TIME_OUT)
633 expected = { 639 expected = {
634 u'exit_code': sig, 640 u'exit_code': sig,
635 u'hard_timeout': False, 641 u'hard_timeout': False,
636 u'io_timeout': True, 642 u'io_timeout': True,
637 u'must_signal_internal_failure': None, 643 u'must_signal_internal_failure': None,
638 u'version': task_runner.OUT_VERSION, 644 u'version': task_runner.OUT_VERSION,
639 } 645 }
640 self.assertEqual(expected, self._run_command(task_details)) 646 self.assertEqual(expected, self._run_command(task_details))
641 647
642 def test_hard_signal(self): 648 def test_hard_signal(self):
643 self.requests( 649 self.requests(
644 hard_timeout=True, 650 hard_timeout=True,
645 exit_code=0, 651 exit_code=0,
646 output='hi\ngot signal %d\nbye\n' % task_runner.SIG_BREAK_OR_TERM) 652 output_re='^hi\ngot signal %d\nbye\n$' % task_runner.SIG_BREAK_OR_TERM)
647 task_details = self.get_task_details( 653 task_details = self.get_task_details(
648 self.SCRIPT_SIGNAL, hard_timeout=self.SHORT_TIME_OUT) 654 self.SCRIPT_SIGNAL, hard_timeout=self.SHORT_TIME_OUT)
649 # Returns 0 because the process cleaned up itself. 655 # Returns 0 because the process cleaned up itself.
650 expected = { 656 expected = {
651 u'exit_code': 0, 657 u'exit_code': 0,
652 u'hard_timeout': True, 658 u'hard_timeout': True,
653 u'io_timeout': False, 659 u'io_timeout': False,
654 u'must_signal_internal_failure': None, 660 u'must_signal_internal_failure': None,
655 u'version': task_runner.OUT_VERSION, 661 u'version': task_runner.OUT_VERSION,
656 } 662 }
657 self.assertEqual(expected, self._run_command(task_details)) 663 self.assertEqual(expected, self._run_command(task_details))
658 664
659 def test_io_signal(self): 665 def test_io_signal(self):
660 self.requests( 666 self.requests(
661 io_timeout=True, exit_code=0, 667 io_timeout=True, exit_code=0,
662 output='hi\ngot signal %d\nbye\n' % task_runner.SIG_BREAK_OR_TERM) 668 output_re='^hi\ngot signal %d\nbye\n$' % task_runner.SIG_BREAK_OR_TERM)
663 task_details = self.get_task_details( 669 task_details = self.get_task_details(
664 self.SCRIPT_SIGNAL, io_timeout=self.SHORT_TIME_OUT) 670 self.SCRIPT_SIGNAL, io_timeout=self.SHORT_TIME_OUT)
665 # Returns 0 because the process cleaned up itself. 671 # Returns 0 because the process cleaned up itself.
666 expected = { 672 expected = {
667 u'exit_code': 0, 673 u'exit_code': 0,
668 u'hard_timeout': False, 674 u'hard_timeout': False,
669 u'io_timeout': True, 675 u'io_timeout': True,
670 u'must_signal_internal_failure': None, 676 u'must_signal_internal_failure': None,
671 u'version': task_runner.OUT_VERSION, 677 u'version': task_runner.OUT_VERSION,
672 } 678 }
(...skipping 28 matching lines...) Expand all
701 u'io_timeout': True, 707 u'io_timeout': True,
702 u'must_signal_internal_failure': None, 708 u'must_signal_internal_failure': None,
703 u'version': task_runner.OUT_VERSION, 709 u'version': task_runner.OUT_VERSION,
704 } 710 }
705 self.assertEqual(expected, self._run_command(task_details)) 711 self.assertEqual(expected, self._run_command(task_details))
706 712
707 def test_hard_signal_no_grace(self): 713 def test_hard_signal_no_grace(self):
708 exit_code = 1 if sys.platform == 'win32' else -signal.SIGKILL 714 exit_code = 1 if sys.platform == 'win32' else -signal.SIGKILL
709 self.requests( 715 self.requests(
710 hard_timeout=True, exit_code=exit_code, 716 hard_timeout=True, exit_code=exit_code,
711 output='hi\ngot signal %d\nbye\n' % task_runner.SIG_BREAK_OR_TERM) 717 output_re='^hi\ngot signal %d\nbye\n$' % task_runner.SIG_BREAK_OR_TERM)
712 task_details = self.get_task_details( 718 task_details = self.get_task_details(
713 self.SCRIPT_SIGNAL_HANG, hard_timeout=self.SHORT_TIME_OUT, 719 self.SCRIPT_SIGNAL_HANG, hard_timeout=self.SHORT_TIME_OUT,
714 grace_period=self.SHORT_TIME_OUT) 720 grace_period=self.SHORT_TIME_OUT)
715 # Returns 0 because the process cleaned up itself. 721 # Returns 0 because the process cleaned up itself.
716 expected = { 722 expected = {
717 u'exit_code': exit_code, 723 u'exit_code': exit_code,
718 u'hard_timeout': True, 724 u'hard_timeout': True,
719 u'io_timeout': False, 725 u'io_timeout': False,
720 u'must_signal_internal_failure': None, 726 u'must_signal_internal_failure': None,
721 u'version': task_runner.OUT_VERSION, 727 u'version': task_runner.OUT_VERSION,
722 } 728 }
723 self.assertEqual(expected, self._run_command(task_details)) 729 self.assertEqual(expected, self._run_command(task_details))
724 730
725 def test_io_signal_no_grace(self): 731 def test_io_signal_no_grace(self):
726 exit_code = 1 if sys.platform == 'win32' else -signal.SIGKILL 732 exit_code = 1 if sys.platform == 'win32' else -signal.SIGKILL
727 self.requests( 733 self.requests(
728 io_timeout=True, exit_code=exit_code, 734 io_timeout=True, exit_code=exit_code,
729 output='hi\ngot signal %d\nbye\n' % task_runner.SIG_BREAK_OR_TERM) 735 output_re='^hi\ngot signal %d\nbye\n$' % task_runner.SIG_BREAK_OR_TERM)
730 task_details = self.get_task_details( 736 task_details = self.get_task_details(
731 self.SCRIPT_SIGNAL_HANG, io_timeout=self.SHORT_TIME_OUT, 737 self.SCRIPT_SIGNAL_HANG, io_timeout=self.SHORT_TIME_OUT,
732 grace_period=self.SHORT_TIME_OUT) 738 grace_period=self.SHORT_TIME_OUT)
733 # Returns 0 because the process cleaned up itself. 739 # Returns 0 because the process cleaned up itself.
734 expected = { 740 expected = {
735 u'exit_code': exit_code, 741 u'exit_code': exit_code,
736 u'hard_timeout': False, 742 u'hard_timeout': False,
737 u'io_timeout': True, 743 u'io_timeout': True,
738 u'must_signal_internal_failure': None, 744 u'must_signal_internal_failure': None,
739 u'version': task_runner.OUT_VERSION, 745 u'version': task_runner.OUT_VERSION,
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 while os.path.isfile(signal_file): 1037 while os.path.isfile(signal_file):
1032 time.sleep(0.01) 1038 time.sleep(0.01)
1033 # Send SIGTERM to task_runner itself. Ensure the right thing happen. 1039 # Send SIGTERM to task_runner itself. Ensure the right thing happen.
1034 # Note that on Windows, this is actually sending a SIGBREAK since there's no 1040 # Note that on Windows, this is actually sending a SIGBREAK since there's no
1035 # such thing as SIGTERM. 1041 # such thing as SIGTERM.
1036 proc.send_signal(signal.SIGTERM) 1042 proc.send_signal(signal.SIGTERM)
1037 proc.wait() 1043 proc.wait()
1038 task_runner_log = os.path.join(self.root_dir, 'logs', 'task_runner.log') 1044 task_runner_log = os.path.join(self.root_dir, 'logs', 'task_runner.log')
1039 with open(task_runner_log, 'rb') as f: 1045 with open(task_runner_log, 'rb') as f:
1040 logging.info('task_runner.log:\n---\n%s---', f.read()) 1046 logging.info('task_runner.log:\n---\n%s---', f.read())
1041 expected = {
nodir 2016/05/12 21:46:23 wasn't used
1042 u'exit_code': 0,
1043 u'hard_timeout': False,
1044 u'io_timeout': False,
1045 u'must_signal_internal_failure': None,
1046 u'version': task_runner.OUT_VERSION,
1047 }
1048 self.assertEqual([], self._server.get_events()) 1047 self.assertEqual([], self._server.get_events())
1049 tasks = self._server.get_tasks() 1048 tasks = self._server.get_tasks()
1050 for task in tasks.itervalues(): 1049 for task in tasks.itervalues():
1051 for event in task: 1050 for event in task:
1052 event.pop('cost_usd') 1051 event.pop('cost_usd')
1053 event.pop('duration', None) 1052 event.pop('duration', None)
1054 event.pop('bot_overhead', None) 1053 event.pop('bot_overhead', None)
1055 expected = { 1054 expected = {
1056 '23': [ 1055 '23': [
1057 { 1056 {
1058 u'id': u'localhost', 1057 u'id': u'localhost',
1059 u'task_id': 23, 1058 u'task_id': 23,
1060 }, 1059 },
1061 { 1060 {
1062 u'exit_code': exit_code, 1061 u'exit_code': exit_code,
1063 u'hard_timeout': False, 1062 u'hard_timeout': False,
1064 u'id': u'localhost', 1063 u'id': u'localhost',
1065 u'io_timeout': False, 1064 u'io_timeout': False,
1066 u'task_id': 23, 1065 u'task_id': 23,
1067 }, 1066 },
1068 ], 1067 ],
1069 } 1068 }
1070 self.assertEqual(expected, tasks) 1069 self.assertEqual(expected, tasks)
1071 expected = { 1070 expected = {
1072 'swarming_bot.1.zip', 1071 'swarming_bot.1.zip',
1073 '4e019f31778ba7191f965469dc673280386bbd60-cacert.pem', 1072 '4e019f31778ba7191f965469dc673280386bbd60-cacert.pem',
1074 'work', 1073 'work',
1075 'logs', 1074 'logs',
1075 'isolated',
1076 # TODO(maruel): Move inside work. 1076 # TODO(maruel): Move inside work.
1077 'task_runner_in.json', 1077 'task_runner_in.json',
1078 'task_runner_out.json', 1078 'task_runner_out.json',
1079 } 1079 }
1080 self.assertEqual(expected, set(os.listdir(self.root_dir))) 1080 self.assertEqual(expected, set(os.listdir(self.root_dir)))
1081 expected = { 1081 expected = {
1082 u'exit_code': exit_code, 1082 u'exit_code': exit_code,
1083 u'hard_timeout': False, 1083 u'hard_timeout': False,
1084 u'io_timeout': False, 1084 u'io_timeout': False,
1085 u'must_signal_internal_failure': 1085 u'must_signal_internal_failure':
1086 u'task_runner received signal %d' % task_runner.SIG_BREAK_OR_TERM, 1086 u'task_runner received signal %d' % task_runner.SIG_BREAK_OR_TERM,
1087 u'version': 3, 1087 u'version': 3,
1088 } 1088 }
1089 with open(task_result_file, 'rb') as f: 1089 with open(task_result_file, 'rb') as f:
1090 self.assertEqual(expected, json.load(f)) 1090 self.assertEqual(expected, json.load(f))
1091 self.assertEqual(0, proc.returncode) 1091 self.assertEqual(0, proc.returncode)
1092 1092
1093 1093
1094 if __name__ == '__main__': 1094 if __name__ == '__main__':
1095 fix_encoding.fix_encoding() 1095 fix_encoding.fix_encoding()
1096 if '-v' in sys.argv: 1096 if '-v' in sys.argv:
1097 unittest.TestCase.maxDiff = None 1097 unittest.TestCase.maxDiff = None
1098 logging_utils.prepare_logging(None) 1098 logging_utils.prepare_logging(None)
1099 logging_utils.set_console_level( 1099 logging_utils.set_console_level(
1100 logging.DEBUG if '-v' in sys.argv else logging.CRITICAL+1) 1100 logging.DEBUG if '-v' in sys.argv else logging.CRITICAL+1)
1101 # Fix litteral text expectation. 1101 # Fix litteral text expectation.
1102 os.environ['LANG'] = 'en_US.UTF-8' 1102 os.environ['LANG'] = 'en_US.UTF-8'
1103 os.environ['LANGUAGE'] = 'en_US.UTF-8' 1103 os.environ['LANGUAGE'] = 'en_US.UTF-8'
1104 unittest.main() 1104 unittest.main()
OLDNEW
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/task_runner.py ('k') | client/run_isolated.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698