| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 from datetime import datetime | 5 from datetime import datetime |
| 6 from datetime import timedelta | 6 from datetime import timedelta |
| 7 | 7 |
| 8 from common.waterfall import failure_type | 8 from common.waterfall import failure_type |
| 9 from model import analysis_status | 9 from model import analysis_status |
| 10 from model.wf_analysis import WfAnalysis | 10 from model.wf_analysis import WfAnalysis |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 | 796 |
| 797 WfAnalysis.Create(master_name_2, builder_name, build_number).put() | 797 WfAnalysis.Create(master_name_2, builder_name, build_number).put() |
| 798 # Run pipeline with signals that have different failed steps. | 798 # Run pipeline with signals that have different failed steps. |
| 799 # Observe new group creation. | 799 # Observe new group creation. |
| 800 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms( | 800 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms( |
| 801 master_name_2, builder_name, build_number, failure_type.TEST, | 801 master_name_2, builder_name, build_number, failure_type.TEST, |
| 802 blame_list, failed_steps_2, None, None)) | 802 blame_list, failed_steps_2, None, None)) |
| 803 self.assertTrue( | 803 self.assertTrue( |
| 804 WfFailureGroup.Get(master_name_2, builder_name, build_number)) | 804 WfFailureGroup.Get(master_name_2, builder_name, build_number)) |
| 805 | 805 |
| 806 def testNeedANewTryJobForFirstFailureInGroup(self): | |
| 807 master_name = 'm' | |
| 808 builder_name = 'b' | |
| 809 build_number = 223 | |
| 810 builds = { | |
| 811 str(build_number): { | |
| 812 'blame_list': ['a'] | |
| 813 } | |
| 814 } | |
| 815 failed_steps = { | |
| 816 'compile': { | |
| 817 'current_failure': 223, | |
| 818 'first_failure': 223, | |
| 819 'last_pass': 220 | |
| 820 } | |
| 821 } | |
| 822 signals = { | |
| 823 'compile': { | |
| 824 'failed_output_nodes': [ | |
| 825 'abc.obj' | |
| 826 ] | |
| 827 } | |
| 828 } | |
| 829 | |
| 830 # Run _NeedANewTryJob with signals that have certain failed output nodes. | |
| 831 # Observe a need for a new try job. | |
| 832 WfAnalysis.Create(master_name, builder_name, build_number).put() | |
| 833 need_try_job, _, _, _ = try_job_util._NeedANewTryJob( | |
| 834 master_name, builder_name, build_number, failure_type.COMPILE, | |
| 835 failed_steps, {}, builds, signals, None) | |
| 836 self.assertTrue(need_try_job) | |
| 837 | |
| 838 def testNotNeedANewTryJobForSecondFailureInGroup(self): | |
| 839 master_name = 'm' | |
| 840 master_name_2 = 'm2' | |
| 841 builder_name = 'b' | |
| 842 build_number = 223 | |
| 843 builds = { | |
| 844 str(build_number): { | |
| 845 'blame_list': ['a'] | |
| 846 } | |
| 847 } | |
| 848 failed_steps = { | |
| 849 'compile': { | |
| 850 'current_failure': 223, | |
| 851 'first_failure': 223, | |
| 852 'last_pass': 220 | |
| 853 } | |
| 854 } | |
| 855 | |
| 856 signals = { | |
| 857 'compile': { | |
| 858 'failed_output_nodes': [ | |
| 859 'abc.obj' | |
| 860 ] | |
| 861 } | |
| 862 } | |
| 863 | |
| 864 # Run _NeedANewTryJob with signals that have certain failed output nodes. | |
| 865 # This should create a new wf_failure_group. | |
| 866 WfAnalysis.Create(master_name, builder_name, build_number).put() | |
| 867 try_job_util._NeedANewTryJob( | |
| 868 master_name, builder_name, build_number, failure_type.COMPILE, | |
| 869 failed_steps, {}, builds, signals, None) | |
| 870 self.assertIsNotNone( | |
| 871 WfFailureGroup.Get(master_name, builder_name, build_number)) | |
| 872 | |
| 873 # Run _NeedANewTryJob with signals that have the same failed output nodes. | |
| 874 # Observe no need for a new try job. | |
| 875 WfAnalysis.Create(master_name_2, builder_name, build_number).put() | |
| 876 need_try_job, _, _, _ = try_job_util._NeedANewTryJob( | |
| 877 master_name_2, builder_name, build_number, failure_type.COMPILE, | |
| 878 failed_steps, {}, builds, signals, None) | |
| 879 self.assertFalse(need_try_job) | |
| 880 | |
| 881 def testNotNeedANewTryJobIfOneWithResultExists(self): | 806 def testNotNeedANewTryJobIfOneWithResultExists(self): |
| 882 master_name = 'm' | 807 master_name = 'm' |
| 883 builder_name = 'b' | 808 builder_name = 'b' |
| 884 build_number = 223 | 809 build_number = 223 |
| 885 failure_info = { | 810 failure_info = { |
| 886 'failed_steps': { | 811 'failed_steps': { |
| 887 'compile': { | 812 'compile': { |
| 888 'current_failure': 223, | 813 'current_failure': 223, |
| 889 'first_failure': 223, | 814 'first_failure': 223, |
| 890 'last_pass': 220 | 815 'last_pass': 220 |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 'failed_targets': [ | 1290 'failed_targets': [ |
| 1366 {'source': 'b.cc', 'target': 'b.o'}, | 1291 {'source': 'b.cc', 'target': 'b.o'}, |
| 1367 ] | 1292 ] |
| 1368 } | 1293 } |
| 1369 } | 1294 } |
| 1370 | 1295 |
| 1371 self.assertEqual( | 1296 self.assertEqual( |
| 1372 try_job_util.GetFailedTargetsFromSignals( | 1297 try_job_util.GetFailedTargetsFromSignals( |
| 1373 signals, 'master1', 'builder1'), | 1298 signals, 'master1', 'builder1'), |
| 1374 ['b.o']) | 1299 ['b.o']) |
| OLD | NEW |