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 testCreateFromInvalidCrOSSuiteConfig(self): argument
196 self.config.set(self._TASK_NAME, 'boards', 'shamu-2')
197 self.assertRaises(task.MalformedConfigEntry,
199 self.config,
200 self._TASK_NAME)
203 def testFileBugsNoConfigValue(self): argument
205 keyword, new_task = task.Task.CreateFromConfigSection(self.config,
206 self._TASK_NAME)
207 self.assertFalse(new_task._file_bugs)
214 def setUp(self): argument
215 super(TaskTest, self).setUp()
216 self.task = task.Task(self._TASK_NAME, self._SUITE, [self._BRANCH_SPEC],
217 None, None, self._BOARD, self._PRIORITY,
218 self._TIMEOUT)
221 def testRun(self): argument
223 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
224 None, None, self._PRIORITY, self._TIMEOUT,
225 False, file_bugs=self._FILE_BUGS,
234 self.mox.ReplayAll()
235 self.assertTrue(self.task.Run(self.sched, self._MAP, self._BOARD))
238 def testRunCustomSharding(self): argument
241 mytask = task.Task(self._TASK_NAME, self._SUITE, [self._BRANCH_SPEC],
243 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
245 False, file_bugs=self._FILE_BUGS,
254 self.mox.ReplayAll()
255 self.assertTrue(mytask.Run(self.sched, self._MAP, self._BOARD))
258 def testRunDuplicate(self): argument
260 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
261 None, None, self._PRIORITY, self._TIMEOUT,
262 False, file_bugs=self._FILE_BUGS,
271 self.mox.ReplayAll()
272 self.assertTrue(self.task.Run(self.sched, self._MAP, self._BOARD))
275 def testRunUnrunnablePool(self): argument
277 self.sched.CheckHostsExist(
279 self.mox.ReplayAll()
280 t = task.Task(self._TASK_NAME, self._SUITE,
281 [self._BRANCH_SPEC], "BadPool")
282 self.assertTrue(not t.AvailableHosts(self.sched, self._BOARD))
285 def testRunUnrunnableBoard(self): argument
287 self.mox.ReplayAll()
288 t = task.Task(self._TASK_NAME, self._SUITE,
289 [self._BRANCH_SPEC], self._POOL, boards="BadBoard")
290 self.assertTrue(not t.AvailableHosts(self.sched, self._BOARD))
293 def testNoRunBranchMismatch(self): argument
295 t = task.Task(self._TASK_NAME, self._SUITE, task.BARE_BRANCHES)
296 self.mox.ReplayAll()
297 self.assertTrue(t.Run(self.sched, self._MAP, self._BOARD))
300 def testNoRunBareBranchMismatch(self): argument
302 self.mox.ReplayAll()
303 self.assertTrue(
304 self.task.Run(self.sched, {'factory': 'build2'}, self._BOARD))
307 def testRunNoSpec(self): argument
309 t = task.Task(self._TASK_NAME, self._SUITE, [])
310 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
312 False, file_bugs=self._FILE_BUGS,
321 self.mox.ReplayAll()
322 self.assertTrue(t.Run(self.sched, self._MAP, self._BOARD))
325 def testRunExplodes(self): argument
328 self.sched.ScheduleSuite(
329 self._SUITE, self._BOARD, self._BUILD, None, None,
330 self._PRIORITY, self._TIMEOUT, False, file_bugs=self._FILE_BUGS,
337 self.mox.ReplayAll()
338 self.assertTrue(self.task.Run(self.sched, self._MAP, self._BOARD))
341 def testForceRun(self): argument
343 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
344 None, None, self._PRIORITY, self._TIMEOUT,
345 True, file_bugs=self._FILE_BUGS,
354 self.mox.ReplayAll()
355 self.assertTrue(self.task.Run(self.sched, self._MAP, self._BOARD, True))
358 def testHash(self): argument
360 same_task = task.Task(self._TASK_NAME, self._SUITE, [self._BRANCH_SPEC],
361 boards=self._BOARD)
362 other_task = task.Task(self._TASK_NAME, self._SUITE,
363 [self._BRANCH_SPEC, '>=RX1'], 'pool')
364 self.assertEquals(hash(self.task), hash(same_task))
365 self.assertNotEquals(hash(self.task), hash(other_task))
372 def setUp(self): argument
373 super(OneShotTaskTest, self).setUp()
374 self.task = task.OneShotTask(self._TASK_NAME, self._SUITE,
375 [self._BRANCH_SPEC])
378 def testRun(self): argument
380 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
382 file_bugs=self._FILE_BUGS,
391 self.mox.ReplayAll()
392 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD))
395 def testRunDuplicate(self): argument
397 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
399 file_bugs=self._FILE_BUGS,
408 self.mox.ReplayAll()
409 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD))
412 def testRunExplodes(self): argument
415 self.sched.ScheduleSuite(
416 self._SUITE, self._BOARD, self._BUILD, None, None,
417 None, None, False, file_bugs=self._FILE_BUGS,
424 self.mox.ReplayAll()
425 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD))
428 def testForceRun(self): argument
430 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
432 file_bugs=self._FILE_BUGS,
441 self.mox.ReplayAll()
442 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD,
446 def testFileBugs(self): argument
448 self.sched.ScheduleSuite(self._SUITE, self._BOARD, self._BUILD,
458 self.mox.ReplayAll()
459 self.task._file_bugs = True
460 self.assertFalse(self.task.Run(self.sched, self._MAP, self._BOARD,