[autotest] Change GetBranchBuildsForBoard() to return a dict of lists

Unlike TimedEvents, BuildEvents might see multiple new builds that need testing
appear between calls to ShouldHandle().  As such, we should be able to handle
multiple builds being ready for a given branch at the same time.

BUG=chromium-os:27586
TEST=unit

Change-Id: Ifde4bb35595e5d67ffe25b7d108985b58def9e04
Reviewed-on: https://gerrit.chromium.org/gerrit/20397
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Commit-Ready: Chris Masone <cmasone@chromium.org>
diff --git a/site_utils/suite_scheduler/task.py b/site_utils/suite_scheduler/task.py
index dae0cfd..8a5ed0a 100644
--- a/site_utils/suite_scheduler/task.py
+++ b/site_utils/suite_scheduler/task.py
@@ -211,10 +211,10 @@
 
         @param scheduler: an instance of DedupingScheduler, as defined in
                           deduping_scheduler.py
-        @param branch_builds: a dict mapping branch name to the build to
+        @param branch_builds: a dict mapping branch name to the build(s) to
                               install for that branch, e.g.
-                              {'R18': 'x86-alex-release/R18-1655.0.0-a1-b1584',
-                               'R19': 'x86-alex-release/R19-2077.0.0-a1-b2056'}
+                              {'R18': ['x86-alex-release/R18-1655.0.0'],
+                               'R19': ['x86-alex-release/R19-2077.0.0']}
         @param board: the board against which to run self._suite.
         @param force: Always schedule the suite.
         @return True if the task should be kept, False if not
@@ -224,7 +224,7 @@
             logging.debug('Checking if %s fits spec %r',
                           branch, self.branch_specs)
             if self._FitsSpec(branch):
-                builds.append(build)
+                builds.extend(build)
         for build in builds:
             try:
                 if not scheduler.ScheduleSuite(self._suite, board, build,
@@ -248,10 +248,10 @@
 
         @param scheduler: an instance of DedupingScheduler, as defined in
                           deduping_scheduler.py
-        @param branch_builds: a dict mapping branch name to the build to
+        @param branch_builds: a dict mapping branch name to the build(s) to
                               install for that branch, e.g.
-                              {'beta': 'x86-alex-release/R18-1655.0.0-a1-b1584',
-                               'dev': 'x86-alex-release/R19-2077.0.0-a1-b2056'}
+                              {'R18': ['x86-alex-release/R18-1655.0.0'],
+                               'R19': ['x86-alex-release/R19-2077.0.0']}
         @param board: the board against which to run self._suite.
         @param force: Always schedule the suite.
         @return False