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

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

Issue 1933013003: [Findit] Extract failed output nodes from stdio log of compile step. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Address comments. 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 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 textwrap 5 import textwrap
6 6
7 from waterfall import extractors 7 from waterfall import extractors
8 from waterfall.extractor import Extractor 8 from waterfall.extractor import Extractor
9 from waterfall.test import wf_testcase 9 from waterfall.test import wf_testcase
10 10
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 'keywords': {} 279 'keywords': {}
280 } 280 }
281 281
282 self._RunTest( 282 self._RunTest(
283 failure_log, extractors.GeneralExtractor, expected_signal_json) 283 failure_log, extractors.GeneralExtractor, expected_signal_json)
284 284
285 def testCompileStepExtractor(self): 285 def testCompileStepExtractor(self):
286 failure_log = textwrap.dedent(""" 286 failure_log = textwrap.dedent("""
287 [1832/2467 | 117.498] CXX obj/a/b/test.file.o 287 [1832/2467 | 117.498] CXX obj/a/b/test.file.o
288 blabla... 288 blabla...
289 FAILED: obj/a/b/test.c.o 289 FAILED: obj/a/b/test.c.o
290 /b/build/goma/gomacc blabla ... -c ../../a/b/c.cc -o obj/a/b/test.c.o 290 /b/build/goma/gomacc blabla ... -c ../../a/b/c.cc -o obj/a/b/test.c.o
291 ../../a/b/c.cc:307:44: error: no member 'kEnableExtensionInfoDialog' ... 291 ../../a/b/c.cc:307:44: error: no member 'kEnableExtensionInfoDialog' ...
292 1 error generated. 292 1 error generated.
293 x/y/not_in_signal.cc 293 x/y/not_in_signal.cc
294 FAILED: obj/a/b/test.d.o 294 FAILED: obj/a/b/test.d.o
295 /b/build/goma/gomacc blabla ... -c ../../a/b/d.cc -o obj/a/b/test.d.o 295 /b/build/goma/gomacc blabla ... -c ../../a/b/d.cc -o obj/a/b/test.d.o
296 ../../a/b/d.cc:123:44: error: no member 'kEnableExtensionInfoDialog' ... 296 ../../a/b/d.cc:123:44: error: no member 'kEnableExtensionInfoDialog' ...
297 blabla... 297 blabla...
298 1 error generated. 298 1 error generated.
299 FAILED: obj/a/b/test.e.o 299 FAILED: obj/a/b/test.e.o
300 /b/build/goma/gomacc ... ../../a/b/e.cc ... obj/a/b/test.e.o 300 /b/build/goma/gomacc ... ../../a/b/e.cc ... obj/a/b/test.e.o
301 ../../a/b/e.cc:79:44: error: no member 'kEnableExtensionInfoDialog' ... 301 ../../a/b/e.cc:79:44: error: no member 'kEnableExtensionInfoDialog' ...
302 blabla... 302 blabla...
303 ninja: build stopped: subcommand failed. 303 ninja: build stopped: subcommand failed.
304 304
305 /b/build/goma/goma_ctl.sh stat 305 /b/build/goma/goma_ctl.sh stat
306 blabla...""") 306 blabla...""")
307 expected_signal_json = { 307 expected_signal_json = {
308 'files': { 308 'files': {
309 'a/b/c.cc': [307], 309 'a/b/c.cc': [307],
310 'a/b/d.cc': [123], 310 'a/b/d.cc': [123],
311 'a/b/e.cc': [79] 311 'a/b/e.cc': [79]
312 }, 312 },
313 'keywords': {} 313 'keywords': {},
314 'failed_output_nodes': [
315 'obj/a/b/test.c.o',
316 'obj/a/b/test.d.o',
317 'obj/a/b/test.e.o',
318 ],
314 } 319 }
315 320
316 self._RunTest( 321 self._RunTest(
317 failure_log, extractors.CompileStepExtractor, expected_signal_json) 322 failure_log, extractors.CompileStepExtractor, expected_signal_json)
318 323
319 def testCompileStepExtractorExtractFailedCompileTargetsLinux(self): 324 def testCompileStepExtractorExtractFailedCompileTargetsLinux(self):
320 failure_log = textwrap.dedent(""" 325 failure_log = textwrap.dedent("""
321 [1832/2467 | 117.498] CXX obj/a/b/test.file.o 326 [1832/2467 | 117.498] CXX obj/a/b/test.file.o
322 blabla... 327 blabla...
323 FAILED: obj/a/b/c.o 328 FAILED: obj/a/b/c.o
(...skipping 29 matching lines...) Expand all
353 'source': '../../a/b/c.cc', 358 'source': '../../a/b/c.cc',
354 'target': 'obj/a/b/c.o', 359 'target': 'obj/a/b/c.o',
355 }, 360 },
356 { 361 {
357 'source': '../../a/b/x.cc', 362 'source': '../../a/b/x.cc',
358 'target': 'obj/a/b/x.o', 363 'target': 'obj/a/b/x.o',
359 }, 364 },
360 { 365 {
361 'target': 'target.exe' 366 'target': 'target.exe'
362 } 367 }
363 ] 368 ],
369 'failed_output_nodes': [
370 'notgoma.exe',
371 'obj/a/b/c.o',
372 'obj/a/b/x.o',
373 'target.exe',
374 ],
364 } 375 }
365 376
366 self._RunTest( 377 self._RunTest(
367 failure_log, extractors.CompileStepExtractor, expected_signal_json, 378 failure_log, extractors.CompileStepExtractor, expected_signal_json,
368 'builder2', 'master2') 379 'builder2', 'master2')
369 380
370 def testCompileStepExtractorExtractFailedTargetsLinuxOutsideFailure(self): 381 def testCompileStepExtractorExtractFailedTargetsLinuxOutsideFailure(self):
371 failure_log = textwrap.dedent(""" 382 failure_log = textwrap.dedent("""
372 [1780/30023] blabla 383 [1780/30023] blabla
373 FAILED: blabla 384 FAILED: blabla
374 blabla 385 blabla
375 1 error generated. 386 1 error generated.
376 FAILED with 1: blabla gomacc -c a/b.cc -o c/d.o blabla 387 FAILED with 1: blabla gomacc -c a/b.cc -o c/d.o blabla
377 blabla 388 blabla
378 Error: FAILED with 1: blabla 389 Error: FAILED with 1: blabla
379 ninja: build stopped: subcommand failed. 390 ninja: build stopped: subcommand failed.
380 blabla.""") 391 blabla.""")
381 expected_signal_json = { 392 expected_signal_json = {
382 'files': {}, 393 'files': {},
383 'keywords': {}, 394 'keywords': {},
384 'failed_targets': [ 395 'failed_targets': [
385 { 396 {
386 'source': 'a/b.cc', 397 'source': 'a/b.cc',
387 'target': 'c/d.o' 398 'target': 'c/d.o'
388 } 399 }
389 ] 400 ],
401 'failed_output_nodes': [
402 'blabla',
403 ],
390 } 404 }
391 405
392 self._RunTest( 406 self._RunTest(
393 failure_log, extractors.CompileStepExtractor, expected_signal_json, 407 failure_log, extractors.CompileStepExtractor, expected_signal_json,
394 'builder2', 'master2') 408 'builder2', 'master2')
395 409
396 def testCompileStepExtractorExtractFailedLinkTargetsLinux(self): 410 def testCompileStepExtractorExtractFailedLinkTargetsLinux(self):
397 failure_log = textwrap.dedent(""" 411 failure_log = textwrap.dedent("""
398 [5430/5600] blabla 412 [5430/5600] blabla
399 FAILED: a/b.nexe 413 FAILED: a/b.nexe
400 python blabla clang++ -o a/b.nexe blabla 414 python blabla clang++ -o a/b.nexe blabla
401 blabla 415 blabla
402 blabla.Error: FAILED with blabla 416 blabla.Error: FAILED with blabla
403 FAILED: "target with spaces and quotes" 417 FAILED: "target with spaces and quotes"
404 blabla gomacc -o "target with spaces and quotes" blabla 418 blabla gomacc -o "target with spaces and quotes" blabla
405 ninja: build stopped: subcommand failed.""") 419 ninja: build stopped: subcommand failed.""")
406 expected_signal_json = { 420 expected_signal_json = {
407 'files': {}, 421 'files': {},
408 'keywords': {}, 422 'keywords': {},
409 'failed_targets': [ 423 'failed_targets': [
410 { 424 {
411 'target': 'a/b.nexe' 425 'target': 'a/b.nexe'
412 }, 426 },
413 { 427 {
414 'target': '"target with spaces and quotes"' 428 'target': '"target with spaces and quotes"'
415 } 429 }
416 ] 430 ],
431 'failed_output_nodes': [
432 'a/b.nexe',
433 'target with spaces and quotes',
434 ],
417 } 435 }
418 436
419 self._RunTest( 437 self._RunTest(
420 failure_log, extractors.CompileStepExtractor, expected_signal_json, 438 failure_log, extractors.CompileStepExtractor, expected_signal_json,
421 'builder2', 'master2') 439 'builder2', 'master2')
422 440
423 def testCompileStepExtractorExtractFailedCompileTargetsWindows(self): 441 def testCompileStepExtractorExtractFailedCompileTargetsWindows(self):
424 failure_log = textwrap.dedent(""" 442 failure_log = textwrap.dedent("""
425 [4576/31353] blabla 443 [4576/31353] blabla
426 FAILED: a\\b.c.obj 444 FAILED: a\\b.c.obj
427 ninja blabla /c ..\\..\\a\\b\\c.cc /Foa\\b.c.obj blabla 445 ninja blabla /c ..\\..\\a\\b\\c.cc /Foa\\b.c.obj blabla
428 blabla 446 blabla
429 1 error generated. 447 1 error generated.
430 FAILED: d\\e\\f\\a.b.obj 448 FAILED: d\\e\\f\\a.b.obj
431 ninja blabla /c ..\\..\\d\\e\\f.cc /Fod\\e\\f\\a.b.obj blabla 449 ninja blabla /c ..\\..\\d\\e\\f.cc /Fod\\e\\f\\a.b.obj blabla
432 blabla 450 blabla
433 ninja: build stopped: subcommand failed.""") 451 ninja: build stopped: subcommand failed.""")
434 expected_signal_json = { 452 expected_signal_json = {
435 'files': {}, 453 'files': {},
436 'keywords': {}, 454 'keywords': {},
437 'failed_targets': [ 455 'failed_targets': [
438 { 456 {
439 'source': '..\\..\\a\\b\\c.cc', 457 'source': '..\\..\\a\\b\\c.cc',
440 'target': 'a\\b.c.obj', 458 'target': 'a\\b.c.obj',
441 }, 459 },
442 { 460 {
443 'source': '..\\..\\d\\e\\f.cc', 461 'source': '..\\..\\d\\e\\f.cc',
444 'target': 'd\\e\\f\\a.b.obj' 462 'target': 'd\\e\\f\\a.b.obj'
445 }, 463 },
446 ] 464 ],
465 'failed_output_nodes': [
466 'a\\b.c.obj',
467 'd\\e\\f\\a.b.obj',
468 ],
447 } 469 }
448 470
449 self._RunTest(failure_log, extractors.CompileStepExtractor, 471 self._RunTest(failure_log, extractors.CompileStepExtractor,
450 expected_signal_json, 'win_builder', 'win_master') 472 expected_signal_json, 'win_builder', 'win_master')
451 473
452 def testCompileStepExtractorExtractFailedLinkTargetsWindows(self): 474 def testCompileStepExtractorExtractFailedLinkTargetsWindows(self):
453 failure_log = textwrap.dedent(""" 475 failure_log = textwrap.dedent("""
454 [11428/27088] blabla 476 [11428/27088] blabla
455 FAILED: test.exe 477 FAILED: test.exe
456 blabla link.exe /OUT:test.exe @test.exe.rsp blabla 478 blabla link.exe /OUT:test.exe @test.exe.rsp blabla
457 ninja: build stopped: subcommand failed.""") 479 ninja: build stopped: subcommand failed.""")
458 expected_signal_json = { 480 expected_signal_json = {
459 'files': {}, 481 'files': {},
460 'keywords': {}, 482 'keywords': {},
461 'failed_targets': [ 483 'failed_targets': [
462 { 484 {
463 'target': 'test.exe' 485 'target': 'test.exe'
464 } 486 }
465 ] 487 ],
488 'failed_output_nodes': [
489 'test.exe',
490 ],
466 } 491 }
467 492
468 self._RunTest( 493 self._RunTest(
469 failure_log, extractors.CompileStepExtractor, expected_signal_json, 494 failure_log, extractors.CompileStepExtractor, expected_signal_json,
470 'builder2', 'master2') 495 'builder2', 'master2')
471 496
472 def testCompileStepNinjaErrorExtractor(self): 497 def testCompileStepNinjaErrorExtractor(self):
473 """Test ninja error extraction in compile step.""" 498 """Test ninja error extraction in compile step."""
474 failure_log = textwrap.dedent(""" 499 failure_log = textwrap.dedent("""
475 ninja -C /a/b/c/ all -j50 500 ninja -C /a/b/c/ all -j50
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 /b/build/goma/goma_ctl.sh stat 571 /b/build/goma/goma_ctl.sh stat
547 blabla...""" % (goma_clang_prefix, goma_clang_prefix)) 572 blabla...""" % (goma_clang_prefix, goma_clang_prefix))
548 expected_signal_json = { 573 expected_signal_json = {
549 'files': {}, 574 'files': {},
550 'keywords': {}, 575 'keywords': {},
551 'failed_targets': [ 576 'failed_targets': [
552 { 577 {
553 'source': 'a.c', 578 'source': 'a.c',
554 'target': 'obj/a.o', 579 'target': 'obj/a.o',
555 }, 580 },
556 ] 581 ],
582 'failed_output_nodes': [
583 'obj/a.o',
584 ],
557 } 585 }
558 586
559 self._RunTest( 587 self._RunTest(
560 failure_log, extractors.CompileStepExtractor, expected_signal_json) 588 failure_log, extractors.CompileStepExtractor, expected_signal_json)
561 589
562 def testCompileStepStrictRegexForLinkFailures(self): 590 def testCompileStepStrictRegexForLinkFailures(self):
563
564 goma_gcc_prefix = ( 591 goma_gcc_prefix = (
565 '/b/build/slave/Linux/build/src/build/goma/client/gomacc ' 592 '/b/build/slave/Linux/build/src/build/goma/client/gomacc '
566 '/bla/bla/.../bin/arm-linux-androideabi-gcc') 593 '/bla/bla/.../bin/arm-linux-androideabi-gcc')
567 failure_log = textwrap.dedent(""" 594 failure_log = textwrap.dedent("""
568 [1832/2467 | 117.498] CXX obj/a/b/test.file.o 595 [1832/2467 | 117.498] CXX obj/a/b/test.file.o
569 blabla... 596 blabla...
570 FAILED: obj/a.o 597 FAILED: obj/a.o
571 %s -Wl,-z,now ... -o exe -Wl,--start-group obj/a.o ... 598 %s -Wl,-z,now ... -o exe -Wl,--start-group obj/a.o ...
572 blalba... 599 blalba...
573 FAILED: cd a/b/c; python script.py a b c blabla.... 600 FAILED: action_output_name
601 cd a/b/c; python script.py a b c blabla....
574 blalba... 602 blalba...
575 ninja: build stopped: subcommand failed. 603 ninja: build stopped: subcommand failed.
576 604
605 /b/build/goma/goma_ctl.sh stat
606 blabla...""" % goma_gcc_prefix)
607 expected_signal_json = {
608 'files': {
609 },
610 'keywords': {},
611 'failed_targets': [
612 {
613 'target': 'exe',
614 },
615 ],
616 'failed_output_nodes': [
617 'action_output_name',
618 'obj/a.o',
619 ],
620 }
621
622 self._RunTest(
623 failure_log, extractors.CompileStepExtractor, expected_signal_json)
624
625 def testCompileStepNoMatchingQuote(self):
626 goma_gcc_prefix = (
627 '/b/build/slave/Linux/build/src/build/goma/client/gomacc '
628 '/bla/bla/.../bin/arm-linux-androideabi-gcc')
629 failure_log = textwrap.dedent("""
630 [1832/2467 | 117.498] CXX obj/a/b/test.file.o
631 blabla...
632 FAILED: a "b no matching quote
633 %s -Wl,-z,now ... -o exe -Wl,--start-group obj/a.o ...
634 blalba...
635 ninja: build stopped: subcommand failed.
636
577 /b/build/goma/goma_ctl.sh stat 637 /b/build/goma/goma_ctl.sh stat
578 blabla...""" % goma_gcc_prefix) 638 blabla...""" % goma_gcc_prefix)
579 expected_signal_json = { 639 expected_signal_json = {
580 'files': { 640 'files': {
581 }, 641 },
582 'keywords': {}, 642 'keywords': {},
583 'failed_targets': [ 643 'failed_targets': [
584 { 644 {
585 'target': 'exe', 645 'target': 'exe',
586 }, 646 },
587 ] 647 ],
588 } 648 }
589 649
590 self._RunTest( 650 self._RunTest(
591 failure_log, extractors.CompileStepExtractor, expected_signal_json) 651 failure_log, extractors.CompileStepExtractor, expected_signal_json)
592 652
593 def testCheckPermExtractor(self): 653 def testCheckPermExtractor(self):
594 failure_log = textwrap.dedent(""" 654 failure_log = textwrap.dedent("""
595 a/b/c.py 655 a/b/c.py
596 ... 656 ...
597 FAILED whitespace.txt 657 FAILED whitespace.txt
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 # step_name: result 890 # step_name: result
831 '1': '1', 891 '1': '1',
832 '2': '2', 892 '2': '2',
833 '32434': '0' 893 '32434': '0'
834 } 894 }
835 895
836 for step_name, expected_result in cases.iteritems(): 896 for step_name, expected_result in cases.iteritems():
837 result = extractors.ExtractSignal( 897 result = extractors.ExtractSignal(
838 'master', 'bot', step_name, 'test', '') 898 'master', 'bot', step_name, 'test', '')
839 self.assertEqual(expected_result, result) 899 self.assertEqual(expected_result, result)
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/failure_signal.py ('k') | appengine/findit/waterfall/test/failure_signal_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698