def _load_compilers(self):
from buildfarm import util
- return util.load_list(os.path.join(self.webdir, "compilers.list"))
+ return set(util.load_list(os.path.join(self.webdir, "compilers.list")))
def lcov_status(self, tree):
"""get status of build"""
return self.upload_builds.get_build(tree, host, compiler)
def get_new_builds(self):
- from buildfarm import data
- for host in self.hostdb.hosts():
- for tree in self.trees:
- for compiler in self.compilers:
- # By building the log file name this way, using only the list of
- # hosts, trees and compilers as input, we ensure we
- # control the inputs
- try:
- yield self.upload_builds.get_build(tree, host.name, compiler)
- except data.NoSuchBuildError:
- continue
+ hosts = set([host.name for host in self.hostdb.hosts()])
+ for build in self.upload_builds.get_new_builds():
+ if build.tree in self.trees and build.compiler in self.compilers and build.host in hosts:
+ yield build
class CachingBuildFarm(BuildFarm):
def __str__(self):
if self.other_failures:
return ",".join(self.other_failures)
- return "/".join(self._status_tuple())
+ return "/".join(map(str, self._status_tuple()))
def broken_host(self):
if "disk full" in self.other_failures:
"""
self.path = path
+ def get_new_builds(self):
+ for name in os.listdir(self.path):
+ try:
+ (build, tree, host, compiler, extension) = name.split(".")
+ except ValueError:
+ continue
+ if build != "build" or extension != "log":
+ continue
+ yield self.get_build(tree, host, compiler)
+
def build_fname(self, tree, host, compiler):
return os.path.join(self.path, "build.%s.%s.%s" % (tree, host, compiler))
self.x.build_fname("mytree", "myhost", "cc"),
"%s/data/upload/build.mytree.myhost.cc" % self.path)
+ def test_get_new_builds(self):
+ self.assertEquals([], list(self.x.get_new_builds()))
+ path = self.create_mock_logfile("tdb", "charis", "cc")
+ new_builds = list(self.x.get_new_builds())
+ self.assertEquals(1, len(new_builds))
+ self.assertEquals("tdb", new_builds[0].tree)
+ self.assertEquals("charis", new_builds[0].host)
+ self.assertEquals("cc", new_builds[0].compiler)
+
class UploadBuildResultStoreTests(UploadBuildResultStoreTestBase,BuildFarmTestCase):