[LNT] r176850 - Changed Machine.DEFAULT_BASELINE_REVISION to be set from the lnt config

Michael Gottesman mgottesman at apple.com
Mon Mar 11 21:22:05 PDT 2013


Author: mgottesman
Date: Mon Mar 11 23:22:05 2013
New Revision: 176850

URL: http://llvm.org/viewvc/llvm-project?rev=176850&view=rev
Log:
Changed Machine.DEFAULT_BASELINE_REVISION to be set from the lnt config
file with a default value that is the same as the old hardcoded
baseline. This is needed because we want LNT to be able to be used on
other code bases besides LLVM if needed.

Modified:
    lnt/trunk/lnt/server/config.py
    lnt/trunk/lnt/server/db/testsuitedb.py
    lnt/trunk/lnt/server/db/v4db.py

Modified: lnt/trunk/lnt/server/config.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/config.py?rev=176850&r1=176849&r2=176850&view=diff
==============================================================================
--- lnt/trunk/lnt/server/config.py (original)
+++ lnt/trunk/lnt/server/config.py Mon Mar 11 23:22:05 2013
@@ -95,9 +95,11 @@ class Config:
                       dbDir, os.path.join(baseDir, tempDir), secretKey,
                       dict([(k,DBInfo.fromData(dbDirPath, v,
                                                default_email_config))
-                                     for k,v in data['databases'].items()]))
+                                     for k,v in data['databases'].items()]),
+                      data.get('baselineRevision', '144168'))
 
-    def __init__(self, name, zorgURL, dbDir, tempDir, secretKey, databases):
+    def __init__(self, name, zorgURL, dbDir, tempDir, secretKey, databases,
+                 baselineRevision):
         self.name = name
         self.zorgURL = zorgURL
         self.dbDir = dbDir
@@ -108,6 +110,7 @@ class Config:
         self.databases = databases
         for db in self.databases.values():
             db.config = self
+        self.baselineRevision = baselineRevision
 
     def get_database(self, name, echo=False):
         """
@@ -123,7 +126,7 @@ class Config:
 
         # Instantiate the appropriate database version.
         if db_entry.db_version == '0.4':
-            return lnt.server.db.v4db.V4DB(db_entry.path, echo=echo)
+            return lnt.server.db.v4db.V4DB(db_entry.path, self, echo=echo)
 
         raise NotImplementedError,"unable to load version %r database" % (
             db_entry.db_version,)

Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=176850&r1=176849&r2=176850&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Mon Mar 11 23:22:05 2013
@@ -58,10 +58,11 @@ class TestSuiteDB(object):
                 return setattr(self, field.name, value)
 
         db_key_name = self.test_suite.db_key_name
+        baselineRevision = self.v4db.config.baselineRevision
         class Machine(self.base, ParameterizedMixin):
             __tablename__ = db_key_name + '_Machine'
 
-            DEFAULT_BASELINE_REVISION = 144168
+            DEFAULT_BASELINE_REVISION = baselineRevision
 
             fields = self.machine_fields
             id = Column("ID", Integer, primary_key=True)

Modified: lnt/trunk/lnt/server/db/v4db.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/v4db.py?rev=176850&r1=176849&r2=176850&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/v4db.py (original)
+++ lnt/trunk/lnt/server/db/v4db.py Mon Mar 11 23:22:05 2013
@@ -67,12 +67,13 @@ class V4DB(object):
             for name in self:
                 yield name,self[name]
 
-    def __init__(self, path, echo=False):
+    def __init__(self, path, config, echo=False):
         # If the path includes no database type, assume sqlite.
         if lnt.server.db.util.path_has_no_database_type(path):
             path = 'sqlite:///' + path
 
         self.path = path
+        self.config = config
         with V4DB._engine_lock:
             if path not in V4DB._engine:
                 V4DB._engine[path] = sqlalchemy.create_engine(path, echo=echo)





More information about the llvm-commits mailing list