4 from buildbot.steps.source import SVN
5 from buildbot.steps.shell import ShellCommand
7 from buildbot.status import builder
8 from buildbot.status.builder import SUCCESS,FAILURE, EXCEPTION,WARNINGS
10 # Define a new builder status
11 # Configure return the exit code 77 when the target platform don't
12 # bear ucontext functionnality. In this case the CustomConfigure returns
13 # INCOMPATIBLE_PLATFORM.
16 CustomConfigure class for master-side representation of the
17 custom configure command. This class considers the error (exit code 77)
18 that occurs when the platform target don't bear ucontext functionnality.
20 class CustomConfigure(ShellCommand):
23 description = ["running configure"]
24 descriptionDone = [name]
27 # Override evaluateCommand method to handle the case of platform that
28 # don't support ucontext. The method returns sets self.incompatible
31 def evaluateCommand(self, cmd):
32 """Decide whether the command was SUCCESS, FAILURE or incompatible platform"""
37 self.incompatible = True
42 # Override getColor method. The method returns the text "blue" when platform is incompatible
44 def getColor(self, cmd, results):
45 assert results in (SUCCESS, WARNINGS, FAILURE)
46 if results == SUCCESS:
48 elif results == WARNINGS:
50 elif self.incompatible:
55 # Override getText method. The method calls describe method
56 # with the text "failed {incompatible platform}" when the platform
57 # don't support ucontext functionnality.
59 def getText(self, cmd, results):
60 if results == SUCCESS:
61 return self.describe(True) + ["Configure success"]
62 elif results == WARNINGS:
63 return self.describe(True) + ["warnings"]
64 elif self.incompatible:
65 return self.describe(True) + ["failed {incompatible platform}"]
67 return self.describe(True) + ["failed"]
69 def maybeGetText2(self, cmd, results):
70 if results == SUCCESS:
72 elif results == WARNINGS:
74 elif self.incompatible:
75 return ["incompatible platform"]
77 return self.describe(True) + ["failed"]
83 Just like a plain SVN, but displays the current revision in the waterfall afterall
86 def getText(self,cmd,results):
87 lines = cmd.logs['stdio'].getText()
88 r = re.search(' (\d+).',lines)
89 if results == SUCCESS and r:
90 return self.describe(True) + ["updated to %s" % r.group(1)]
91 elif results == SUCCESS:
92 return self.describe(True) + ["updated to some version"]
94 return self.describe(True) + ["failed"]
96 def maybeGetText2(self,cmd,results):
97 lines = cmd.logs['stdio'].getText()
98 r = re.search(' (\d+).',lines)
99 if results == SUCCESS and r:
100 return ["SVN revision %s" % r.group(1)]
105 CustomCheck class for master-side representation of the checkall results.
106 This class stores and displays the amount of errors in the checks.
108 class CustomCheck(ShellCommand):
110 description = ["running checks"]
111 descriptionDone = [name]
114 # Override per step getText method.
115 def getText(self, cmd, results):
116 lines = cmd.logs['stdio'].getText().split("\n")
118 fail = len( filter(lambda line: re.search('^FAIL:', line), lines) )
119 re.compile('^XFAIL:')
120 xfail = len( filter(lambda line: re.search('^XFAIL:', line), lines) )
122 skip = len( filter(lambda line: re.search('^SKIP:', line), lines) )
123 re.compile('^XPASS:')
124 xpass = len( filter(lambda line: re.search('^XPASS:', line), lines) )
126 passed = len( filter(lambda line: re.search('^PASS:', line), lines) )
130 res += ("%d failed, " % fail)
132 res += ("%d skipped, " % skip)
134 res += ("%d unexpected success, " % xpass)
136 res += ("%d expected failure, " % xfail)
137 res += ("%d total" % (passed + fail + skip + xpass + xfail))
139 if results == SUCCESS:
140 return self.describe(True) + ["Success (%s)" % res]
141 elif results == WARNINGS:
142 return self.describe(True) + ["warnings"]
144 return self.describe(True) + ["failed strangly"]
146 return self.describe(True) + [res]
148 # Add some text to the top-column box
149 def getText2(self, cmd, results):
150 lines = cmd.logs['stdio'].getText().split("\n")
152 fail = len( filter(lambda line: re.search('^FAIL:', line), lines) )
153 re.compile('^XFAIL:')
154 xfail = len( filter(lambda line: re.search('^XFAIL:', line), lines) )
156 skip = len( filter(lambda line: re.search('^SKIP:', line), lines) )
157 re.compile('^XPASS:')
158 xpass = len( filter(lambda line: re.search('^XPASS:', line), lines) )
160 passed = len( filter(lambda line: re.search('^PASS:', line), lines) )
164 res += ("%d failed, " % fail)
166 res += ("%d skipped, " % skip)
168 res += ("%d unexpected success, " % xpass)
170 res += ("%d expected failure, " % xfail)
171 res += ("%d total" % (passed + fail + skip + xpass + xfail))
173 if results == SUCCESS:
174 return ["All tests ok (%s)" % res]
175 elif results == WARNINGS:
176 return ["Warnings (%s)" % res]
178 return ["Tests failed strangly"]