4 from buildbot.process import step
5 from buildbot.process.step import ShellCommand, SVN
6 from buildbot.status import builder
7 from buildbot.status.builder import SUCCESS,FAILURE, EXCEPTION,WARNINGS
9 # Define a new builder status
10 # Configure return the exit code 77 when the target platform don't
11 # bear ucontext functionnality. In this case the CustomConfigure returns
12 # INCOMPATIBLE_PLATFORM.
15 CustomConfigure class for master-side representation of the
16 custom configure command. This class considers the error (exit code 77)
17 that occurs when the platform target don't bear ucontext functionnality.
19 class CustomConfigure(ShellCommand):
22 description = ["running configure"]
23 descriptionDone = [name]
26 # Override evaluateCommand method to handle the case of platform that
27 # don't support ucontext. The method returns sets self.incompatible
30 def evaluateCommand(self, cmd):
31 """Decide whether the command was SUCCESS, FAILURE or incompatible platform"""
36 self.incompatible = True
41 # Override getColor method. The method returns the text "blue" when platform is incompatible
43 def getColor(self, cmd, results):
44 assert results in (SUCCESS, WARNINGS, FAILURE)
45 if results == SUCCESS:
47 elif results == WARNINGS:
49 elif self.incompatible:
54 # Override getText method. The method calls describe method
55 # with the text "failed {incompatible platform}" when the platform
56 # don't support ucontext functionnality.
58 def getText(self, cmd, results):
59 if results == SUCCESS:
60 return self.describe(True) + ["Configure success"]
61 elif results == WARNINGS:
62 return self.describe(True) + ["warnings"]
63 elif self.incompatible:
64 return self.describe(True) + ["failed {incompatible platform}"]
66 return self.describe(True) + ["failed"]
72 Just like a plain SVN, but displays the current revision in the waterfall afterall
75 def getText(self,cmd,results):
76 lines = cmd.logs['stdio'].getText()
77 r = re.search(' (\d+).',lines)
78 if results == SUCCESS and r:
79 return self.describe(True) + ["updated to %s" % r.group(1)]
80 elif results == SUCCESS:
81 return self.describe(True) + ["updated to some version"]
83 return self.describe(True) + ["failed"]
86 CustomCheck class for master-side representation of the checkall results.
87 This class stores and displays the amount of errors in the checks.
89 class CustomCheck(ShellCommand):
91 description = ["running checks"]
92 descriptionDone = [name]
95 # Override getText method.
96 def getText(self, cmd, results):
97 lines = cmd.logs['stdio'].getText().split("\n")
99 fail = len( filter(lambda line: re.search('^FAIL:', line), lines) )
100 re.compile('^XFAIL:')
101 xfail = len( filter(lambda line: re.search('^XFAIL:', line), lines) )
103 skip = len( filter(lambda line: re.search('^SKIP:', line), lines) )
104 re.compile('^XPASS:')
105 xpass = len( filter(lambda line: re.search('^XPASS:', line), lines) )
107 passed = len( filter(lambda line: re.search('^PASS:', line), lines) )
111 res += "%d failed, " % fail
113 res += "%d skipped, " % skip
115 res += "%d unexpected success, " % xpass
117 res += "%d expected failure, " % xfail
118 res += "%d total" % (passed + fail + skip + xpass + xfail)
120 if results == SUCCESS:
121 return self.describe(True) + ["Success (%s)" % res]
122 elif results == WARNINGS:
123 return self.describe(True) + ["warnings"]
125 return self.describe(True) + ["failed strangly"]
127 return self.describe(True) + [res]