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

Side by Side Diff: appengine/findit/waterfall/test/try_job_util_test.py

Issue 1826633002: [Findit] Extract and pass failed targets from ninja to try-job. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase. 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
OLDNEW
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 common.waterfall import failure_type 5 from common.waterfall import failure_type
6 from model import analysis_status 6 from model import analysis_status
7 from model.wf_try_job import WfTryJob 7 from model.wf_try_job import WfTryJob
8 from waterfall import try_job_util 8 from waterfall import try_job_util
9 from waterfall.test import wf_testcase 9 from waterfall.test import wf_testcase
10 from waterfall.try_job_type import TryJobType 10 from waterfall.try_job_type import TryJobType
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 try_job_util.ScheduleTryJobIfNeeded(failure_info, None, None) 370 try_job_util.ScheduleTryJobIfNeeded(failure_info, None, None)
371 371
372 try_job = WfTryJob.Get(master_name, builder_name, build_number) 372 try_job = WfTryJob.Get(master_name, builder_name, build_number)
373 373
374 self.assertTrue(_MockRootPipeline.STARTED) 374 self.assertTrue(_MockRootPipeline.STARTED)
375 self.assertIsNotNone(try_job) 375 self.assertIsNotNone(try_job)
376 376
377 def testGetFailedTargetsFromSignals(self): 377 def testGetFailedTargetsFromSignals(self):
378 self.assertEqual( 378 self.assertEqual(
379 try_job_util._GetFailedTargetsFromSignals({}, 'm', 'b'), []) 379 try_job_util._GetFailedTargetsFromSignals(None, {}, 'm', 'b'), [])
380 380
381 self.assertEqual( 381 self.assertEqual(
382 try_job_util._GetFailedTargetsFromSignals({'compile': {}}, 'm', 'b'), 382 try_job_util._GetFailedTargetsFromSignals(
383 None, {'compile': {}}, 'm', 'b'),
383 []) 384 [])
384 385
385 signals = { 386 signals = {
386 'compile': { 387 'compile': {
387 'failed_targets': [ 388 'failed_targets': [
388 {'target': 'a.exe'}, 389 {'target': 'a.exe'},
389 {'source': 'b.cc', 390 {'source': 'b.cc',
390 'target': 'b.o'}] 391 'target': 'b.o'}]
391 } 392 }
392 } 393 }
393 394
394 self.assertEqual( 395 self.assertEqual(
395 try_job_util._GetFailedTargetsFromSignals(signals, 'm', 'b'), ['a.exe']) 396 try_job_util._GetFailedTargetsFromSignals(None, signals, 'm', 'b'),
397 ['a.exe'])
398
399 def testGetFailedTargetsFromSignalsUsingCompileFailruesInfo(self):
400 compile_failures = {
401 'unrecognized_format': False,
402 'failed_targets': ['obj/a.o'],
403 'unknown_targets': ['obj/b.o'],
404 }
405
406 self.assertEqual(
407 try_job_util._GetFailedTargetsFromSignals(
408 compile_failures, None, None, None),
409 ['obj/a.o', 'obj/b.o'])
396 410
397 def testUseObjectFilesAsFailedTargetIfStrictRegexUsed(self): 411 def testUseObjectFilesAsFailedTargetIfStrictRegexUsed(self):
398 signals = { 412 signals = {
399 'compile': { 413 'compile': {
400 'failed_targets': [ 414 'failed_targets': [
401 {'source': 'b.cc', 'target': 'b.o'}, 415 {'source': 'b.cc', 'target': 'b.o'},
402 ] 416 ]
403 } 417 }
404 } 418 }
405 419
406 self.assertEqual( 420 self.assertEqual(
407 try_job_util._GetFailedTargetsFromSignals( 421 try_job_util._GetFailedTargetsFromSignals(
408 signals, 'master1', 'builder1'), 422 None, signals, 'master1', 'builder1'),
409 ['b.o']) 423 ['b.o'])
410 424
411 def testGetSuspectsForCompileFailureFromHeuristicResult(self): 425 def testGetSuspectsForCompileFailureFromHeuristicResult(self):
412 heuristic_result = { 426 heuristic_result = {
413 'failures': [ 427 'failures': [
414 { 428 {
415 'step_name': 'compile', 429 'step_name': 'compile',
416 'suspected_cls': [ 430 'suspected_cls': [
417 { 431 {
418 'revision': 'r1', 432 'revision': 'r1',
419 }, 433 },
420 { 434 {
421 'revision': 'r2', 435 'revision': 'r2',
422 }, 436 },
423 ], 437 ],
424 }, 438 },
425 { 439 {
426 'step_name': 'steps' 440 'step_name': 'steps'
427 }, 441 },
428 ] 442 ]
429 } 443 }
430 expected_suspected_revisions = ['r1', 'r2'] 444 expected_suspected_revisions = ['r1', 'r2']
431 self.assertEqual( 445 self.assertEqual(
432 expected_suspected_revisions, 446 expected_suspected_revisions,
433 try_job_util._GetSuspectsForCompileFailureFromHeuristicResult( 447 try_job_util._GetSuspectsForCompileFailureFromHeuristicResult(
434 heuristic_result)) 448 heuristic_result))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698