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"]
68 def maybeGetText2(self, cmd, results):
69 if results == SUCCESS:
71 elif results == WARNINGS:
73 elif self.incompatible:
74 return ["incompatible platform"]
76 return self.describe(True) + ["failed"]
82 Just like a plain SVN, but displays the current revision in the waterfall afterall
85 def getText(self,cmd,results):
86 lines = cmd.logs['stdio'].getText()
87 r = re.search(' (\d+).',lines)
88 if results == SUCCESS and r:
89 return self.describe(True) + ["updated to %s" % r.group(1)]
90 elif results == SUCCESS:
91 return self.describe(True) + ["updated to some version"]
93 return self.describe(True) + ["failed"]
95 def maybeGetText2(self,cmd,results):
96 lines = cmd.logs['stdio'].getText()
97 r = re.search(' (\d+).',lines)
98 if results == SUCCESS and r:
99 return ["SVN revision %s" % r.group(1)]
104 CustomCheck class for master-side representation of the checkall results.
105 This class stores and displays the amount of errors in the checks.
107 class CustomCheck(ShellCommand):
109 description = ["running checks"]
110 descriptionDone = [name]
113 # Override per step getText method.
114 def getText(self, cmd, results):
115 lines = cmd.logs['stdio'].getText().split("\n")
117 fail = len( filter(lambda line: re.search('^FAIL:', line), lines) )
118 re.compile('^XFAIL:')
119 xfail = len( filter(lambda line: re.search('^XFAIL:', line), lines) )
121 skip = len( filter(lambda line: re.search('^SKIP:', line), lines) )
122 re.compile('^XPASS:')
123 xpass = len( filter(lambda line: re.search('^XPASS:', line), lines) )
125 passed = len( filter(lambda line: re.search('^PASS:', line), lines) )
129 res += ("%d failed, " % fail)
131 res += ("%d skipped, " % skip)
133 res += ("%d unexpected success, " % xpass)
135 res += ("%d expected failure, " % xfail)
136 res += ("%d total" % (passed + fail + skip + xpass + xfail))
138 if results == SUCCESS:
139 return self.describe(True) + ["Success (%s)" % res]
140 elif results == WARNINGS:
141 return self.describe(True) + ["warnings"]
143 return self.describe(True) + ["failed strangly"]
145 return self.describe(True) + [res]
147 # Add some text to the top-column box
148 def getText2(self, cmd, results):
149 lines = cmd.logs['stdio'].getText().split("\n")
151 fail = len( filter(lambda line: re.search('^FAIL:', line), lines) )
152 re.compile('^XFAIL:')
153 xfail = len( filter(lambda line: re.search('^XFAIL:', line), lines) )
155 skip = len( filter(lambda line: re.search('^SKIP:', line), lines) )
156 re.compile('^XPASS:')
157 xpass = len( filter(lambda line: re.search('^XPASS:', line), lines) )
159 passed = len( filter(lambda line: re.search('^PASS:', line), lines) )
163 res += ("%d failed, " % fail)
165 res += ("%d skipped, " % skip)
167 res += ("%d unexpected success, " % xpass)
169 res += ("%d expected failure, " % xfail)
170 res += ("%d total" % (passed + fail + skip + xpass + xfail))
172 if results == SUCCESS:
173 return ["All tests ok (%s)" % res]
174 elif results == WARNINGS:
175 return ["Warnings (%s)" % res]
177 return ["Tests failed strangly"]