Ticket #346: 346-part1.patch
| File 346-part1.patch, 7.7 kB (added by nhemingway, 4 months ago) |
|---|
-
a/buildbot/steps/shell.py
old new 410 410 total = 0 411 411 412 412 def evaluateCommand(self, cmd): 413 lines = self.getLog('stdio').readlines() 413 # Get stdio, stripping pesky newlines etc. 414 lines = map( 415 lambda line : line.replace('\r\n','').replace('\r','').replace('\n',''), 416 self.getLog('stdio').readlines() 417 ) 418 419 total = 0 420 passed = 0 421 failed = 0 422 rc = cmd.rc 423 424 # New version of Test::Harness? 425 try: 426 test_summary_report_index = lines.index("Test Summary Report") 414 427 415 re_test_result = re.compile("^(All tests successful)|(\d+)/(\d+) subtests failed|Files=\d+, Tests=(\d+),")428 del lines[0:test_summary_report_index + 2] 416 429 417 mos = map(lambda line: re_test_result.search(line), lines) 418 test_result_lines = [mo.groups() for mo in mos if mo] 430 re_test_result = re.compile("^Result: (PASS|FAIL)$|Tests: (\d+) Failed: (\d+)\)") 419 431 420 if not test_result_lines:421 return cmd.rc432 mos = map(lambda line: re_test_result.search(line), lines) 433 test_result_lines = [mo.groups() for mo in mos if mo] 422 434 423 test_result_line = test_result_lines[0] 435 for line in test_result_lines: 436 if line[0] == 'PASS': 437 rc = SUCCESS 438 elif line[0] == 'FAIL': 439 rc = FAILURE 440 else: 441 total += int(line[1]) 442 failed += int(line[2]) 424 443 425 success = test_result_line[0] 444 except ValueError: # Nope, it's the old version 445 re_test_result = re.compile("^(All tests successful)|(\d+)/(\d+) subtests failed|Files=\d+, Tests=(\d+),") 426 446 427 if success:428 failed = 0447 mos = map(lambda line: re_test_result.search(line), lines) 448 test_result_lines = [mo.groups() for mo in mos if mo] 429 449 430 test_totals_line = test_result_lines[1]431 total_str = test_totals_line[3]450 if test_result_lines: 451 test_result_line = test_result_lines[0] 432 452 433 rc = SUCCESS 434 else: 435 failed_str = test_result_line[1] 436 failed = int(failed_str) 453 success = test_result_line[0] 454 455 if success: 456 failed = 0 457 458 test_totals_line = test_result_lines[1] 459 total_str = test_totals_line[3] 460 461 rc = SUCCESS 462 else: 463 failed_str = test_result_line[1] 464 failed = int(failed_str) 465 466 total_str = test_result_line[2] 437 467 438 total_str = test_result_line[2]468 rc = FAILURE 439 469 440 rc = FAILURE470 total = int(total_str) 441 471 442 total = int(total_str)443 passed = total - failed472 if total: 473 passed = total - failed 444 474 445 self.setTestResults(total=total, failed=failed, passed=passed)475 self.setTestResults(total=total, failed=failed, passed=passed) 446 476 447 477 return rc -
a/buildbot/test/test_steps.py
old new 640 640 d.addCallback(_check) 641 641 return d 642 642 643 class FakeCommand: 644 def __init__(self, rc): 645 self.rc = rc 646 643 647 class PerlModuleTest(StepTester, unittest.TestCase): 644 648 def testAllTestsPassed(self): 645 self.masterbase = " Warnings.testAllTestsPassed"649 self.masterbase = "PMT.testAllTestsPassed" 646 650 step = self.makeStep(shell.PerlModuleTest) 647 651 output = \ 648 652 """ok 1 … … 653 657 log = step.addLog("stdio") 654 658 log.addStdout(output) 655 659 log.finish() 656 step.evaluateCommand(log) 660 rc = step.evaluateCommand(FakeCommand(rc=241)) 661 self.failUnlessEqual(rc, SUCCESS) 657 662 ss = step.step_status 658 663 self.failUnlessEqual(ss.getStatistic('tests-failed'), 0) 659 664 self.failUnlessEqual(ss.getStatistic('tests-total'), 123) 660 665 self.failUnlessEqual(ss.getStatistic('tests-passed'), 123) 661 666 662 def testFailures (self):663 self.masterbase = " Warnings.testFailures"667 def testFailures_OldTestHarness(self): 668 self.masterbase = "PMT.testFailures_OldTestHarness" 664 669 step = self.makeStep(shell.PerlModuleTest) 665 670 output = \ 666 671 """ … … 671 676 log = step.addLog("stdio") 672 677 log.addStdout(output) 673 678 log.finish() 674 step.evaluateCommand(log) 679 rc = step.evaluateCommand(FakeCommand(rc = 123)) 680 self.failUnlessEqual(rc, FAILURE) 675 681 ss = step.step_status 676 682 self.failUnlessEqual(ss.getStatistic('tests-failed'), 3) 677 683 self.failUnlessEqual(ss.getStatistic('tests-total'), 7) 678 684 self.failUnlessEqual(ss.getStatistic('tests-passed'), 4) 685 686 def testFailures_UnparseableStdio(self): 687 self.masterbase = "PMT.testFailures_UnparseableStdio" 688 step = self.makeStep(shell.PerlModuleTest) 689 output = \ 690 """ 691 just some random stuff, you know 692 """ 693 log = step.addLog("stdio") 694 log.addStdout(output) 695 log.finish() 696 rc = step.evaluateCommand(FakeCommand(rc = 243)) 697 self.failUnlessEqual(rc, 243) 698 ss = step.step_status 699 self.failUnlessEqual(ss.getStatistic('tests-failed'), None) 700 self.failUnlessEqual(ss.getStatistic('tests-total'), None) 701 self.failUnlessEqual(ss.getStatistic('tests-passed'), None) 702 703 def testFailures_NewTestHarness(self): 704 self.masterbase = "PMT.testFailures_NewTestHarness" 705 step = self.makeStep(shell.PerlModuleTest) 706 output = \ 707 """ 708 # Looks like you failed 15 tests of 18. 709 tests/services.......................... Failed 265/30904 subtests 710 (less 16 skipped subtests: 30623 okay) 711 tests/simple_query_backend..............ok 712 tests/simple_query_middleware...........ok 713 tests/soap_globalcollect................ok 714 tests/three_d_me........................ok 715 tests/three_d_me_callback...............ok 716 tests/transaction_create................ok 717 tests/unique_txid.......................ok 718 719 Test Summary Report 720 ------------------- 721 tests/000policies (Wstat: 5632 Tests: 9078 Failed: 22) 722 Failed tests: 2409, 2896-2897, 2900-2901, 2940-2941, 2944-2945 723 2961-2962, 2965-2966, 2969-2970, 2997-2998 724 3262, 3281-3282, 3288-3289 725 Non-zero exit status: 22 726 tests/services (Wstat: 0 Tests: 30904 Failed: 265) 727 Failed tests: 14, 16-21, 64-69, 71-96, 98, 30157, 30159 728 30310, 30316, 30439-30543, 30564, 30566-30577 729 30602, 30604-30607, 30609-30612, 30655 730 30657-30668, 30675, 30697-30716, 30718-30720 731 30722-30736, 30773-30774, 30776-30777, 30786 732 30791, 30795, 30797, 30801, 30822-30827 733 30830-30831, 30848-30855, 30858-30859, 30888-30899 734 30901, 30903-30904 735 Files=68, Tests=264809, 1944 wallclock secs (17.59 usr 0.63 sys + 470.04 cusr 131.40 csys = 619.66 CPU) 736 Result: FAIL 737 """ 738 log = step.addLog("stdio") 739 log.addStdout(output) 740 log.finish() 741 rc = step.evaluateCommand(FakeCommand(rc=87)) 742 self.failUnlessEqual(rc, FAILURE) 743 ss = step.step_status 744 self.failUnlessEqual(ss.getStatistic('tests-failed'), 287) 745 self.failUnlessEqual(ss.getStatistic('tests-total'), 39982) 746 self.failUnlessEqual(ss.getStatistic('tests-passed'), 39695)
![[Buildbot Logo]](/trac/chrome/site/header-text-transparent.png)