[LNT] r232207 - Make the baseline configurable per database. This enables different projects on the same LNT installation to use different baselines.
Michael Gottesman
mgottesman at apple.com
Fri Mar 13 13:46:49 PDT 2015
Author: mgottesman
Date: Fri Mar 13 15:46:49 2015
New Revision: 232207
URL: http://llvm.org/viewvc/llvm-project?rev=232207&view=rev
Log:
Make the baseline configurable per database. This enables different projects on the same LNT installation to use different baselines.
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=232207&r1=232206&r2=232207&view=diff
==============================================================================
--- lnt/trunk/lnt/server/config.py (original)
+++ lnt/trunk/lnt/server/config.py Fri Mar 13 15:46:49 2015
@@ -37,7 +37,7 @@ class EmailConfig:
class DBInfo:
@staticmethod
- def fromData(baseDir, dict, default_email_config):
+ def fromData(baseDir, dict, default_email_config, default_baseline_revision):
dbPath = dict.get('path')
# If the path does not contain a database specifier, assume it is a
@@ -57,23 +57,29 @@ class DBInfo:
if 'emailer' in dict:
email_config = EmailConfig.fromData(dict['emailer'])
+ baseline_revision = dict.get('baseline_revision',
+ default_baseline_revision)
+
return DBInfo(dbPath,
str(dict.get('db_version', '0.4')),
dict.get('shadow_import', None),
- email_config)
+ email_config,
+ baseline_revision)
@staticmethod
def dummyInstance():
return DBInfo("sqlite:///:memory:", "0.4", None,
- EmailConfig(False, '', '', []))
+ EmailConfig(False, '', '', []), 0)
def __init__(self, path,
- db_version, shadow_import, email_config):
+ db_version, shadow_import, email_config,
+ baseline_revision):
self.config = None
self.path = path
self.db_version = db_version
self.shadow_import = shadow_import
self.email_config = email_config
+ self.baseline_revision = baseline_revision
class Config:
@staticmethod
@@ -102,9 +108,9 @@ class Config:
return Config(data.get('name', 'LNT'), data['zorgURL'],
dbDir, os.path.join(baseDir, tempDir), secretKey,
dict([(k,DBInfo.fromData(dbDirPath, v,
- default_email_config))
- for k,v in data['databases'].items()]),
- data.get('baselineRevision', '144168'))
+ default_email_config,
+ 0))
+ for k,v in data['databases'].items()]))
@staticmethod
def dummyInstance():
@@ -114,13 +120,10 @@ class Config:
tempDir = os.path.join(baseDir, 'tmp')
secretKey = None
dbInfo = {'dummy': DBInfo.dummyInstance()}
- baselineRevision = '144168'
- return Config('LNT', 'http://localhost:8000', dbDir, tempDir, secretKey, dbInfo,
- baselineRevision)
+ return Config('LNT', 'http://localhost:8000', dbDir, tempDir, secretKey, dbInfo)
- def __init__(self, name, zorgURL, dbDir, tempDir, secretKey, databases,
- baselineRevision):
+ def __init__(self, name, zorgURL, dbDir, tempDir, secretKey, databases):
self.name = name
self.zorgURL = zorgURL
self.dbDir = dbDir
@@ -131,7 +134,6 @@ class Config:
self.databases = databases
for db in self.databases.values():
db.config = self
- self.baselineRevision = baselineRevision
def get_database(self, name, echo=False):
"""
@@ -147,7 +149,9 @@ class Config:
# Instantiate the appropriate database version.
if db_entry.db_version == '0.4':
- return lnt.server.db.v4db.V4DB(db_entry.path, self, echo=echo)
+ return lnt.server.db.v4db.V4DB(db_entry.path, self,
+ db_entry.baseline_revision,
+ 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=232207&r1=232206&r2=232207&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Fri Mar 13 15:46:49 2015
@@ -58,11 +58,10 @@ 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 = baselineRevision
+ DEFAULT_BASELINE_REVISION = self.v4db.config.baseline_revision
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=232207&r1=232206&r2=232207&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/v4db.py (original)
+++ lnt/trunk/lnt/server/db/v4db.py Fri Mar 13 15:46:49 2015
@@ -67,7 +67,7 @@ class V4DB(object):
for name in self:
yield name,self[name]
- def __init__(self, path, config, echo=False):
+ def __init__(self, path, config, baseline_revision, 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
More information about the llvm-commits
mailing list