Lines Matching refs:self

45     def setUp(self):  argument
46 super(TaskTestBase, self).setUp()
47 self.sched = self.mox.CreateMock(deduping_scheduler.DedupingScheduler)
59 def setUp(self): argument
60 super(TaskCreateTest, self).setUp()
61 self.config = forgiving_config_parser.ForgivingConfigParser()
62 self.config.add_section(self._TASK_NAME)
63 self.config.set(self._TASK_NAME, 'suite', self._SUITE)
64 self.config.set(self._TASK_NAME, 'branch_specs', self._BRANCH_SPEC)
65 self.config.set(self._TASK_NAME, 'run_on', self._EVENT_KEY)
66 self.config.set(self._TASK_NAME, 'pool', self._POOL)
67 self.config.set(self._TASK_NAME, 'num', '%d' % self._NUM)
68 self.config.set(self._TASK_NAME, 'boards', self._BOARD)
71 def testCreateFromConfig(self): argument
73 keyword, new_task = task.Task.CreateFromConfigSection(self.config,
74 self._TASK_NAME)
75 self.assertEquals(keyword, self._EVENT_KEY)
76 self.assertEquals(new_task, task.Task(self._TASK_NAME, self._SUITE,
77 [self._BRANCH_SPEC], self._POOL,
78 self._NUM, self._BOARD,
79 self._PRIORITY, self._TIMEOUT))
80 self.assertTrue(new_task._FitsSpec(self._BRANCH))
81 self.assertFalse(new_task._FitsSpec('12'))
84 def testCreateFromConfigEqualBranch(self): argument
88 self.config.set(self._TASK_NAME, 'branch_specs',
89 self._BRANCH_SPEC_EQUAL)
90 keyword, new_task = task.Task.CreateFromConfigSection(self.config,
91 self._TASK_NAME)
92 self.assertEquals(keyword, self._EVENT_KEY)
93 self.assertEquals(new_task, task.Task(self._TASK_NAME, self._SUITE,
94 [self._BRANCH_SPEC_EQUAL],
95 self._POOL, self._NUM,
96 self._BOARD, self._PRIORITY,
97 self._TIMEOUT))
98 self.assertTrue(new_task._FitsSpec(self._BRANCH))
99 self.assertFalse(new_task._FitsSpec('12'))
100 self.assertFalse(new_task._FitsSpec('21'))
102 self.config.set(self._TASK_NAME, 'branch_specs', self._BRANCH_SPEC)
105 def testCreateFromConfigLessThanOrEqualBranch(self): argument
109 self.config.set(self._TASK_NAME, 'branch_specs',
110 self._BRANCH_SPEC_LTE)
111 keyword, new_task = task.Task.CreateFromConfigSection(self.config,
112 self._TASK_NAME)
113 self.assertEquals(keyword, self._EVENT_KEY)
114 self.assertEquals(new_task, task.Task(self._TASK_NAME, self._SUITE,
115 [self._BRANCH_SPEC_LTE],
116 self._POOL, self._NUM,
117 self._BOARD, self._PRIORITY,
118 self._TIMEOUT))
119 self.assertTrue(new_task._FitsSpec(self._BRANCH))
120 self.assertTrue(new_task._FitsSpec('12'))
121 self.assertFalse(new_task._FitsSpec('21'))
123 self.config.set(self._TASK_NAME, 'branch_specs', self._BRANCH_SPEC)
126 def testCreateFromConfigNoBranch(self): argument
128 self.config.remove_option(self._TASK_NAME, 'branch_specs')
129 keyword, new_task = task.Task.CreateFromConfigSection(self.config,
130 self._TASK_NAME)
131 self.assertEquals(keyword, self._EVENT_KEY)
132 self.assertEquals(new_task, task.Task(self._TASK_NAME, self._SUITE,
133 [], self._POOL, self._NUM,
134 self._BOARD, self._PRIORITY,
135 self._TIMEOUT))
136 self.assertTrue(new_task._FitsSpec(self._BRANCH))
139 def testCreateFromConfigMultibranch(self): argument
141 specs = ['factory', self._BRANCH_SPEC]
142 self.config.set(self._TASK_NAME, 'branch_specs', ','.join(specs))
143 keyword, new_task = task.Task.CreateFromConfigSection(self.config,
144 self._TASK_NAME)
145 self.assertEquals(keyword, self._EVENT_KEY)
146 self.assertEquals(new_task, task.Task(self._TASK_NAME, self._SUITE,
147 specs, self._POOL, self._NUM,
148 self._BOARD, self._PRIORITY,
149 self._TIMEOUT))
150 for spec in [specs[0], self._BRANCH]:
151 self.assertTrue(new_task._FitsSpec(spec))
154 def testCreateFromConfigNoNum(self): argument
156 self.config.remove_option(self._TASK_NAME, 'num')
157 keyword, new_task = task.Task.CreateFromConfigSection(self.config,
158 self._TASK_NAME)
159 self.assertEquals(keyword, self._EVENT_KEY)
160 self.assertEquals(new_task, task.Task(self._TASK_NAME, self._SUITE,
161 [self._BRANCH_SPEC], self._POOL,
162 boards=self._BOARD))
163 self.assertTrue(new_task._FitsSpec(self._BRANCH))
164 self.assertFalse(new_task._FitsSpec('12'))
167 def testCreateFromNoSuiteConfig(self): argument
169 self.config.remove_option(self._TASK_NAME, 'suite')
170 self.assertRaises(task.MalformedConfigEntry,
172 self.config,
173 self._TASK_NAME)
176 def testCreateFromNoKeywordConfig(self): argument
178 self.config.remove_option(self._TASK_NAME, 'run_on')
179 self.assertRaises(task.MalformedConfigEntry,
181 self.config,
182 self._TASK_NAME)
185 def testCreateFromNonexistentConfig(self): argument
187 self.assertRaises(task.MalformedConfigEntry,
189 self.config,
193 def testFileBugsNoConfigValue(self): argument
195 keyword, new_task = task.Task.CreateFromConfigSection(self.config,
196 self._TASK_NAME)
197 self.assertFalse(new_task._file_bugs)
204 def setUp(self): argument
205 super(TaskTest, self).setUp()
206 self.task = task.Task(self._TASK_NAME, self._SUITE, [self._BRANCH_SPEC],
207 None, None, self._BOARD, self._PRIORITY,
208 self._TIMEOUT)
211 def testRun(self): argument
213 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
214 None, None, self._PRIORITY, self._TIMEOUT,
215 False, file_bugs=self._FILE_BUGS,
219 self.mox.ReplayAll()
220 self.assertTrue(self.task.Run(self.sched, self._MAP, self._BOARD))
223 def testRunCustomSharding(self): argument
226 mytask = task.Task(self._TASK_NAME, self._SUITE, [self._BRANCH_SPEC],
228 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
230 False, file_bugs=self._FILE_BUGS,
234 self.mox.ReplayAll()
235 self.assertTrue(mytask.Run(self.sched, self._MAP, self._BOARD))
238 def testRunDuplicate(self): argument
240 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
241 None, None, self._PRIORITY, self._TIMEOUT,
242 False, file_bugs=self._FILE_BUGS,
246 self.mox.ReplayAll()
247 self.assertTrue(self.task.Run(self.sched, self._MAP, self._BOARD))
250 def testRunUnrunnablePool(self): argument
252 self.sched.CheckHostsExist(
254 self.mox.ReplayAll()
255 t = task.Task(self._TASK_NAME, self._SUITE,
256 [self._BRANCH_SPEC], "BadPool")
257 self.assertTrue(not t.AvailableHosts(self.sched, self._BOARD))
260 def testRunUnrunnableBoard(self): argument
262 self.mox.ReplayAll()
263 t = task.Task(self._TASK_NAME, self._SUITE,
264 [self._BRANCH_SPEC], self._POOL, boards="BadBoard")
265 self.assertTrue(not t.AvailableHosts(self.sched, self._BOARD))
268 def testNoRunBranchMismatch(self): argument
270 t = task.Task(self._TASK_NAME, self._SUITE, task.BARE_BRANCHES)
271 self.mox.ReplayAll()
272 self.assertTrue(t.Run(self.sched, self._MAP, self._BOARD))
275 def testNoRunBareBranchMismatch(self): argument
277 self.mox.ReplayAll()
278 self.assertTrue(
279 self.task.Run(self.sched, {'factory': 'build2'}, self._BOARD))
282 def testRunNoSpec(self): argument
284 t = task.Task(self._TASK_NAME, self._SUITE, [])
285 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
287 False, file_bugs=self._FILE_BUGS,
291 self.mox.ReplayAll()
292 self.assertTrue(t.Run(self.sched, self._MAP, self._BOARD))
295 def testRunExplodes(self): argument
298 self.sched.ScheduleSuite(
299 self._SUITE, self._BOARD, self._BUILD, None, None, self._PRIORITY,
300 self._TIMEOUT, False, file_bugs=self._FILE_BUGS,
304 self.mox.ReplayAll()
305 self.assertTrue(self.task.Run(self.sched, self._MAP, self._BOARD))
308 def testForceRun(self): argument
310 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
311 None, None, self._PRIORITY, self._TIMEOUT,
312 True, file_bugs=self._FILE_BUGS,
316 self.mox.ReplayAll()
317 self.assertTrue(self.task.Run(self.sched, self._MAP, self._BOARD, True))
320 def testHash(self): argument
322 same_task = task.Task(self._TASK_NAME, self._SUITE, [self._BRANCH_SPEC],
323 boards=self._BOARD)
324 other_task = task.Task(self._TASK_NAME, self._SUITE,
325 [self._BRANCH_SPEC, '>=RX1'], 'pool')
326 self.assertEquals(hash(self.task), hash(same_task))
327 self.assertNotEquals(hash(self.task), hash(other_task))
334 def setUp(self): argument
335 super(OneShotTaskTest, self).setUp()
336 self.task = task.OneShotTask(self._TASK_NAME, self._SUITE,
337 [self._BRANCH_SPEC])
340 def testRun(self): argument
342 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
344 file_bugs=self._FILE_BUGS,
348 self.mox.ReplayAll()
349 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD))
352 def testRunDuplicate(self): argument
354 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
356 file_bugs=self._FILE_BUGS,
360 self.mox.ReplayAll()
361 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD))
364 def testRunExplodes(self): argument
367 self.sched.ScheduleSuite(
368 self._SUITE, self._BOARD, self._BUILD, None, None,
369 None, None, False, file_bugs=self._FILE_BUGS,
373 self.mox.ReplayAll()
374 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD))
377 def testForceRun(self): argument
379 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
381 file_bugs=self._FILE_BUGS,
385 self.mox.ReplayAll()
386 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD,
390 def testFileBugs(self): argument
392 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
397 self.mox.ReplayAll()
398 self.task._file_bugs = True
399 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD,