From b9432cef96d7aa799473fb049e239521e01cb85e Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Tue, 21 Feb 2012 14:32:49 +0000 Subject: [PATCH] Added simple wrapping for waterfall display. This is done by adding a whitespace before the last underscore on strings above length 25, which should only affect the _unittest and _integrationtest suffixes for our tests, that are the widest unwrappable strings in our waterfall display. I also removed all reduntant use of ShellCommand in favour for the AddCommonStep function (that wraps the description text). Also fixed so Mac tests are not halting the build. Cleaned up some code style formatting. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/400005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1735 4adac7df-926f-26a2-2b94-8c16560cd09d --- tools/continuous_build/public_html/README | 18 +++ .../continuous_build/public_html/favicon.ico | Bin 0 -> 1150 bytes .../continuous_build/webrtc_buildbot/utils.py | 141 ++++++++++-------- .../webrtc_buildbot/utils_test.py | 52 ++++++- 4 files changed, 143 insertions(+), 68 deletions(-) create mode 100644 tools/continuous_build/public_html/README create mode 100644 tools/continuous_build/public_html/favicon.ico diff --git a/tools/continuous_build/public_html/README b/tools/continuous_build/public_html/README new file mode 100644 index 0000000000..5f59005669 --- /dev/null +++ b/tools/continuous_build/public_html/README @@ -0,0 +1,18 @@ +Modify the look of the buildbot master's waterfall page +------------------------------------------------------- + +To deploy these changes, follow these instructions: + +* Copy the favicon.ico file to master/public_html/ on the buildbot master + machine. + +* Edit the master/public_html/index.html and add the following to the + element: + + + +* Edit the master/public_html/buildbot.css and change the section with + .LastBuild, .Activity { + width: 230px; + + to be 160px instead. Save the file and exit. diff --git a/tools/continuous_build/public_html/favicon.ico b/tools/continuous_build/public_html/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..324a6caf6fec8b7791ccd1484561b60818ac6c3c GIT binary patch literal 1150 zcmb7@T}YEr7{{Nv$ei0+Vp(o`9r>{l1VVv@xlJvl?8=LXpxV?6t>{MRDj^8k+)zUh z+$=JPx-tl&FVaagbMD;~LyT~viwr7aNu^77&eQYmL$XZhy!_w)InR53|8w3i02v(` z4ba&Dt(yRL0Dy@^C90(AWdCfMW=vjF+gP^Jo+u}sP&RXm!j5Wd|2DbR3&mzHG+MlH zw5mTDpPYZt1E5Q@xu;_}swO_5Y+{M*GYrX5)f6Az*R{8cxUbd$KyoCHn7y)^KR2Va zvko;ejolpEZgR}EB`~+ehh1Sa*%#wT#vW?a!&?a*OwA2cx-$R?thy9p?s*XMB@E!eU|9b zT?jg~i;vt#kgrRoigC7#^>57F6r4a~2uDi-%bH-PAdo%<96FpCY}g3LI9tKm=>;qc zBAP-BO(JWXaO&!aM~Q!Zt6_uHIq^t5CqBWABJm+M6mSZML|4&&@GQwE*AFqzD~B#G z=n}#cP5~$TDlj(x7NgORI5!u=xya(Gq7lvm?>SaXCNRDB&(bifjCc$nb_xeXx9~!A z3G8-zEtVF$P_KWCdSQ&@Pr9Iu;O^GNWn+-VjbT1h7G`I622d`&gVBpx2zD1LrriaF zm8H((0MEVv4096w7#WRVmeTJq4FA|w9Of#6xFVBSsRerTQk~>k%%Q|503&Ny0N-b- zS7jz@1F3&5Gfw$L$#1xSzYcwC=PP*<} jLm_SBT{elH#OUv$ySpNZW+z2`>3V!CiBc050Eztt$}btn literal 0 HcmV?d00001 diff --git a/tools/continuous_build/webrtc_buildbot/utils.py b/tools/continuous_build/webrtc_buildbot/utils.py index 157cf027ed..438dbdd617 100755 --- a/tools/continuous_build/webrtc_buildbot/utils.py +++ b/tools/continuous_build/webrtc_buildbot/utils.py @@ -9,14 +9,14 @@ __author__ = 'ivinnichenko@webrtc.org (Illya Vinnichenko)' -from buildbot.process import factory -from buildbot.steps import shell -from buildbot.steps.shell import ShellCommand -from buildbot.process import properties -from buildbot.process.properties import WithProperties import os import sys import urlparse +from buildbot.process import factory +from buildbot.process import properties +from buildbot.process.properties import WithProperties +from buildbot.steps import shell +from buildbot.steps.shell import ShellCommand # Defines the order of the booleans of the supported platforms in the test # dictionaries in master.cfg. @@ -35,28 +35,29 @@ DEFAULT_COVERAGE_DIR = '/var/www/coverage/' # much and make the stacks harder to figure out. Use the same settings # on all buildbot masters to make it easier to move bots. MEMORY_TOOLS_GYP_DEFINES = [ - # GCC flags - 'mac_debug_optimization=1 ', - 'mac_release_optimization=1 ', - 'release_optimize=1 ', - 'no_gc_sections=1 ', - 'debug_extra_cflags="-g -fno-inline -fno-omit-frame-pointer ' - '-fno-builtin -fno-optimize-sibling-calls" ', - 'release_extra_cflags="-g -fno-inline -fno-omit-frame-pointer ' - '-fno-builtin -fno-optimize-sibling-calls" ', - # MSVS flags - 'win_debug_RuntimeChecks=0 ', - 'win_debug_disable_iterator_debugging=1 ', - 'win_debug_Optimization=1 ', - 'win_debug_InlineFunctionExpansion=0 ', - 'win_release_InlineFunctionExpansion=0 ', - 'win_release_OmitFramePointers=0 ', + # GCC flags + 'mac_debug_optimization=1 ', + 'mac_release_optimization=1 ', + 'release_optimize=1 ', + 'no_gc_sections=1 ', + 'debug_extra_cflags="-g -fno-inline -fno-omit-frame-pointer ' + '-fno-builtin -fno-optimize-sibling-calls" ', + 'release_extra_cflags="-g -fno-inline -fno-omit-frame-pointer ' + '-fno-builtin -fno-optimize-sibling-calls" ', + # MSVS flags + 'win_debug_RuntimeChecks=0 ', + 'win_debug_disable_iterator_debugging=1 ', + 'win_debug_Optimization=1 ', + 'win_debug_InlineFunctionExpansion=0 ', + 'win_release_InlineFunctionExpansion=0 ', + 'win_release_OmitFramePointers=0 ', - 'linux_use_tcmalloc=1 ', - 'release_valgrind_build=1 ', - 'werror= ', + 'linux_use_tcmalloc=1 ', + 'release_valgrind_build=1 ', + 'werror= ', ] + class WebRTCFactory(factory.BuildFactory): """Abstract superclass for all build factories. @@ -116,12 +117,16 @@ class WebRTCFactory(factory.BuildFactory): warn_on_failure: If true, this step isn't that important and will not cause a failed build on failure. """ + flunk_on_failure = not warn_on_failure + if type(descriptor) is str: descriptor = [descriptor] - flunk_on_failure = not warn_on_failure + # Add spaces to wrap long test names to make waterfall output more compact. + wrapped_text = self._WrapLongLines(descriptor) + self.addStep(shell.ShellCommand(command=cmd, workdir=workdir, - description=descriptor + ['running...'], - descriptionDone=descriptor, + description=wrapped_text + ['running...'], + descriptionDone=wrapped_text, warnOnFailure=warn_on_failure, flunkOnFailure=flunk_on_failure, haltOnFailure=halt_build_on_failure, @@ -177,11 +182,38 @@ class WebRTCFactory(factory.BuildFactory): """ cmd = ['./build/gyp_chromium', '--depth=.', gyp_file] cmd += gyp_params + self.gyp_params - self.addStep(shell.ShellCommand(command=cmd, workdir='build/trunk', - description=[descriptor, 'running...'], - descriptionDone=[descriptor], - haltOnFailure=True, - name='gyp_%s' % descriptor)) + self.AddCommonStep(cmd=cmd, workdir='build/trunk', descriptor=descriptor) + + def _WrapLongLines(self, string_list, max_line_length=25, wrap_character='_'): + """ Creates a list with wrapped strings for lines that are too long. + + This is done by inserting spaces to long lines with the wrap character + in. It's a simple way to make long test targets wrap nicer in the + waterfall display. + + This method should only be used for lists that are displayed in the web + interface! + + Args: + string_list: List of strings where each string represents one line. + max_line_length: Number of characters a line may have to avoid + getting wrapped. + wrap_character: The character we're looking for when inserting a + space if a string is larger than max_line_length. If no such + character is found, no space will be inserted. + Returns: + A new list of the same length as the input list, but with strings + that may contain extra spaces in them, if longer than the max + length. + """ + result = [] + for line in string_list: + if len(line) > max_line_length: + index = line.rfind(wrap_character) + if index != -1: + line = line[:index] + ' ' + line[index:] + result.append(line) + return result class GenerateCodeCoverage(ShellCommand): """This custom shell command generates coverage HTML using genhtml. @@ -239,11 +271,11 @@ class WebRTCAndroidFactory(WebRTCFactory): def EnableBuild(self, product='toro'): prefix = 'rm -rf out/target/product/%s/obj/' % product cleanup_list = [ - 'rm -rf external/webrtc', - prefix + 'STATIC_LIBRARIES/libwebrtc_*', - prefix + 'SHARE_LIBRARIES/libwebrtc_*', - prefix + 'EXECUTABLES/webrtc_*' - ] + 'rm -rf external/webrtc', + prefix + 'STATIC_LIBRARIES/libwebrtc_*', + prefix + 'SHARE_LIBRARIES/libwebrtc_*', + prefix + 'EXECUTABLES/webrtc_*' + ] cmd = ' ; '.join(cleanup_list) self.addStep(shell.Compile(command=(cmd), workdir='build/trunk', description=['cleanup', 'running...'], @@ -276,11 +308,7 @@ class WebRTCChromeFactory(WebRTCFactory): cmd = ['make', target, '-j100'] if make_extra is not None: cmd.append(make_extra) - self.addStep(shell.ShellCommand(command=cmd, - workdir='build/src', description=descriptor + ['running...'], - descriptionDone=descriptor, - haltOnFailure=True, - name='_'.join(descriptor))) + self.AddCommonStep(cmd=cmd, descriptor=descriptor, workdir='build/src') class WebRTCLinuxFactory(WebRTCFactory): @@ -365,10 +393,8 @@ class WebRTCLinuxFactory(WebRTCFactory): cmd = ['out/%s/%s' % (test_folder, test)] if self.valgrind_enabled: cmd = VALGRIND_CMD + cmd - self.addStep(shell.ShellCommand(command=cmd, - workdir=workdir, description=['Running'] + descriptor, - descriptionDone=descriptor, - name='_'.join(descriptor))) + self.AddCommonStep(cmd, descriptor=descriptor, workdir=workdir, + halt_build_on_failure=False) def AddXvfbTestRunStep(self, test_name, test_binary, test_arguments=''): """ Adds a test to be run inside a XVFB window manager.""" @@ -383,11 +409,7 @@ class WebRTCLinuxFactory(WebRTCFactory): cmd = ['make', target, '-j100'] if make_extra: cmd.append(make_extra) - self.addStep(shell.ShellCommand(command=cmd, - workdir='build/trunk', description=descriptor + ['running...'], - haltOnFailure=True, - descriptionDone=descriptor, - name='_'.join(descriptor))) + self.AddCommonStep(cmd=cmd, descriptor=descriptor, workdir='build/trunk') def AddStepsToEstablishCoverageBaseline(self): self.AddCommonStep(['lcov', '--directory', '.', '--capture', '-b', @@ -494,11 +516,8 @@ class WebRTCLinuxFactory(WebRTCFactory): elif test == 'voe_auto_test': # TODO(phoglund): Remove this notice and take appropriate action when # http://code.google.com/p/webrtc/issues/detail?id=266 is concluded. - self.addStep(shell.ShellCommand( - command=('out/Debug/voe_auto_test --automated ' - '--gtest_filter="-VolumeTest.*"'), - workdir='build/trunk', description=[test, 'running...'], - descriptionDone=[test], name=test)) + cmd = 'out/Debug/voe_auto_test --automated --gtest_filter="-VolumeTest.*"' + self.AddCommonTestRunStep(test=test, cmd=cmd) else: self.AddCommonTestRunStep(test) @@ -541,11 +560,13 @@ class WebRTCMacFactory(WebRTCFactory): if self.build_type == 'xcode' or self.build_type == 'both': cmd = ['xcodebuild/%s/%s' % (test_folder, test)] self.AddCommonStep(cmd, descriptor=descriptor + ['(xcode)'], - workdir='build/trunk') + halt_build_on_failure=False, + workdir=workdir) if self.build_type == 'make' or self.build_type == 'both': cmd = ['out/%s/%s' % (test_folder, test)] self.AddCommonStep(cmd, descriptor=descriptor + ['(make)'], - workdir='build/trunk') + halt_build_on_failure=False, + workdir=workdir) def AddCommonMakeStep(self, target, extra_text=None, make_extra=None): descriptor = [target, extra_text] if extra_text else [target] @@ -567,7 +588,8 @@ class WebRTCMacFactory(WebRTCFactory): class WebRTCWinFactory(WebRTCFactory): """Sets up the Windows build. - Allows building with Debug, Release or both in sequence.""" + Allows building with Debug, Release or both in sequence. + """ def __init__(self): WebRTCFactory.__init__(self) @@ -580,7 +602,6 @@ class WebRTCWinFactory(WebRTCFactory): configuration='Debug', build_only=False): self.build_enabled = True self.force_sync = force_sync - """Win specific Build""" if platform not in self.allowed_platforms: print '*** INCORRECT PLATFORM (%s)!!! ***' % platform sys.exit(0) diff --git a/tools/continuous_build/webrtc_buildbot/utils_test.py b/tools/continuous_build/webrtc_buildbot/utils_test.py index 559f4ec7ef..7da58f6fed 100644 --- a/tools/continuous_build/webrtc_buildbot/utils_test.py +++ b/tools/continuous_build/webrtc_buildbot/utils_test.py @@ -7,34 +7,70 @@ # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. +"""Unit tests for helper functions in utils.py.""" + __author__ = 'kjellander@webrtc.org (Henrik Kjellander)' import unittest from webrtc_buildbot import utils + class Test(unittest.TestCase): def testGetEnabledTests(self): tests = { - # Test name Linux Mac Windows - "test_1": (True, True, False), - "test_2": (True, False, False), + # Name Linux Mac Windows + 'test_1': (True, True, False), + 'test_2': (True, False, False), } - result = utils.GetEnabledTests(tests, "Linux") + result = utils.GetEnabledTests(tests, 'Linux') self.assertEqual(2, len(result)) self.assertEqual('test_1', result[0]) self.assertEqual('test_2', result[1]) - result = utils.GetEnabledTests(tests, "Mac") + result = utils.GetEnabledTests(tests, 'Mac') self.assertEqual(1, len(result)) self.assertEqual('test_1', result[0]) - result = utils.GetEnabledTests(tests, "Windows") + result = utils.GetEnabledTests(tests, 'Windows') self.assertEqual(0, len(result)) self.assertRaises(utils.UnsupportedPlatformError, - utils.GetEnabledTests, tests, "BeOS") + utils.GetEnabledTests, tests, 'BeOS') -if __name__ == "__main__": + def testEmptyListExitQuietly(self): + factory = utils.WebRTCFactory() + self.assertEqual([], factory._WrapLongLines([])) + + def testShortLinesShallNotWrap(self): + factory = utils.WebRTCFactory() + self.assertEqual(['a'], factory._WrapLongLines(['a'])) + + string_25_len = '12345678901234567890123_5' + result = factory._WrapLongLines([string_25_len, string_25_len]) + self.assertEqual(string_25_len, result[0]) + self.assertEqual(string_25_len, result[1]) + + def testLinesWithMoreThan25CharactersWithNoWrapCharacterIsUnchanged(self): + factory = utils.WebRTCFactory() + string_26_len = '12345678901234567890123456' + result = factory._WrapLongLines([string_26_len, string_26_len]) + self.assertEqual(string_26_len, result[0]) + self.assertEqual(string_26_len, result[1]) + + def testLinesWithMoreThan25CharactersShallWrapOnWrapCharacter(self): + factory = utils.WebRTCFactory() + string_26_len = '123456789012345678901234_6' + test_list = [string_26_len, string_26_len] + result = factory._WrapLongLines(test_list) + expected_result = '123456789012345678901234 _6' + self.assertEqual(expected_result, result[0]) + self.assertEqual(expected_result, result[1]) + # Verify the original test_list was not modified too. + self.assertEqual(string_26_len, test_list[0]) + self.assertEqual(string_26_len, test_list[1]) + + +if __name__ == '__main__': unittest.main()