diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/IceGridAdmin.py | 2 | ||||
-rw-r--r-- | scripts/IceStormUtil.py | 16 | ||||
-rwxr-xr-x | scripts/TestUtil.py | 96 |
3 files changed, 107 insertions, 7 deletions
diff --git a/scripts/IceGridAdmin.py b/scripts/IceGridAdmin.py index 85f93226545..9b11b3dd94a 100644 --- a/scripts/IceGridAdmin.py +++ b/scripts/IceGridAdmin.py @@ -92,7 +92,7 @@ def startIceGridRegistry(testdir, dynamicRegistration = False): cleanDbDir(dataDir) print "starting icegrid " + name + "...", - cmd = command + \ + cmd = command + ' ' + TestUtil.getQtSqlOptions('IceGrid', dataDir) + \ r' --Ice.ProgramName=' + name + \ r' --IceGrid.Registry.Client.Endpoints="default -p ' + str(iceGridPort + i) + '" ' + \ r' --IceGrid.Registry.Data=' + dataDir diff --git a/scripts/IceStormUtil.py b/scripts/IceStormUtil.py index a81894faade..a481a111372 100644 --- a/scripts/IceStormUtil.py +++ b/scripts/IceStormUtil.py @@ -25,7 +25,9 @@ origIceStormService = ' --IceBox.Service.IceStorm=IceStormService,' + TestUtil.g ' --IceBox.InheritProperties=1' + \ ' --Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0' + \ ' --Ice.ServerIdleTime=0' + origIceStormProxy = '%s/TopicManager:default -p %d' + origIceStormReference = ' --IceStormAdmin.TopicManager.Default="%s"' class IceStormUtil(object): @@ -120,7 +122,12 @@ class Replicated(IceStormUtil): dbHome = os.path.join(self.testdir, "%d.%s" % (replica, dbDir)) self.dbHome.append(dbHome) TestUtil.cleanDbDir(dbHome) - self.iceStormDBEnv.append(" --Freeze.DbEnv.IceStorm.DbHome=%s" % dbHome) + + sqlOptions = TestUtil.getQtSqlOptions('IceStorm', dbHome) + if len(sqlOptions) == 0: + self.iceStormDBEnv.append(" --Freeze.DbEnv.IceStorm.DbHome=%s" % dbHome) + else: + self.iceStormDBEnv.append(" %s" % sqlOptions) self.procs.append(None) topicReplicaProxy = '%s/TopicManager:%s' % (instanceName, replicaTopicManagerEndpoints) @@ -215,7 +222,12 @@ class NonReplicated(IceStormUtil): self.dbHome = os.path.join(self.testdir, self.dbDir) TestUtil.cleanDbDir(self.dbHome) - self.iceStormDBEnv=" --Freeze.DbEnv.IceStorm.DbHome=" + self.dbHome + + sqlOptions = TestUtil.getQtSqlOptions('IceStorm', self.dbHome) + if len(sqlOptions) == 0: + self.iceStormDBEnv = " --Freeze.DbEnv.IceStorm.DbHome=" + self.dbHome + else: + self.iceStormDBEnv = " " + sqlOptions def clean(self): TestUtil.cleanDbDir(self.dbHome) diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py index 1c6acdc378a..da661272a6d 100755 --- a/scripts/TestUtil.py +++ b/scripts/TestUtil.py @@ -26,6 +26,11 @@ tracefile = None printenv = False cross = [] watchDog = None +sqlType = None +sqlDbName = None +sqlHost = None +sqlUser = None +sqlPassword = None def isCygwin(): # The substring on sys.platform is required because some cygwin @@ -257,7 +262,12 @@ def run(tests, root = False): --x64 Binary distribution is 64-bit. --cross=lang Run cross language test. --script Generate a script to run the tests. - --env Print important environment variables + --env Print important environment variables. + --sql-type=<driver> Run IceStorm/IceGrid tests using QtSql with specified driver. + --sql-db=<db> Set SQL database name. + --sql-host=<host> Set SQL host name. + --sql-user=<user> Set SQL user name. + --sql-passwd=<passwd> Set SQL password. """ sys.exit(2) @@ -265,7 +275,8 @@ def run(tests, root = False): opts, args = getopt.getopt(sys.argv[1:], "lr:R:", ["start=", "start-after=", "filter=", "rfilter=", "all", "all-cross", "loop", "debug", "protocol=", "compress", "valgrind", "host=", "serialize", "continue", - "ipv6", "no-ipv6", "ice-home=", "cross=", "x64", "script", "env"]) + "ipv6", "no-ipv6", "ice-home=", "cross=", "x64", "script", "env", "sql-type=", + "sql-db=", "sql-host=", "sql-user=", "sql-passwd="]) except getopt.GetoptError: usage() @@ -317,7 +328,7 @@ def run(tests, root = False): sys.exit(1) if o in ( "--cross", "--protocol", "--host", "--debug", "--compress", "--valgrind", "--serialize", "--ipv6", \ - "--ice-home", "--x64", "--env"): + "--ice-home", "--x64", "--env", "--sql-type", "--sql-db", "--sql-host", "--sql-user", "--sql-passwd"): arg += " " + o if len(a) > 0: arg += " " + a @@ -611,6 +622,11 @@ class DriverConfig: overrides = None ipv6 = False x64 = False + sqlType = None + sqlDbName = None + sqlHost = None + sqlUser = None + sqlPassword = None def __init__(self, type = None): global protocol @@ -621,6 +637,11 @@ class DriverConfig: global valgrind global ipv6 global x64 + global sqlType + global sqlDbName + global sqlHost + global sqlUser + global sqlPassword self.lang = getDefaultMapping() self.protocol = protocol self.compress = compress @@ -631,6 +652,11 @@ class DriverConfig: self.type = type self.ipv6 = ipv6 self.x64 = x64 + self.sqlType = sqlType + self.sqlDbName = sqlDbName + self.sqlHost = sqlHost + self.sqlUser = sqlUser + self.sqlPassword = sqlPassword def argsToDict(argumentString, results): """Converts an argument string to dictionary""" @@ -797,6 +823,47 @@ def getDefaultCollocatedFile(): def isDebug(): return debug +def getQtSqlOptions(prefix, dataDir): + if sqlType == None: + return "" + + options = '--' + prefix+ '.SQL.DatabaseType=' + sqlType + + options += ' --' + prefix+ '.SQL.DatabaseName=' + if sqlDbName == None: + if sqlType == "QSQLITE": + options += dataDir + '/SQL.db' + elif sqlType == "QODBC": + options += 'testdsn' + else: + options += 'test' + else: + options += sqlDbName + + options += ' --' + prefix+ '.SQL.HostName=' + if sqlHost == None: + if sqlType == "QODBC": + options += '.\SQLExpress' + else: + options += 'localhost' + else: + options += sqlHost + + options += ' --' + prefix+ '.SQL.UserName=' + if sqlUser == None: + options += 'test' + else: + options += sqlUser + + options += ' --' + prefix+ '.SQL.Password=' + if sqlPassword != None: + options += sqlPassword + + if prefix == "IceStorm": + options += ' --Ice.Plugin.SQLThreadHook=IceStormService:createThreadHook' + + return options + import Expect def spawn(cmd, env=None, cwd=None, startReader=True, lang=None): # Start/Reset the watch dog thread @@ -1083,13 +1150,19 @@ def processCmdLine(): --x64 Binary distribution is 64-bit. --env Print important environment variables. --cross=lang Run cross language test. + --sql-type=<driver> Run IceStorm/IceGrid tests using QtSql with specified driver. + --sql-db=<db> Set SQL database name. + --sql-host=<host> Set SQL host name. + --sql-user=<user> Set SQL user name. + --sql-passwd=<passwd> Set SQL password. """ sys.exit(2) try: opts, args = getopt.getopt( sys.argv[1:], "", ["debug", "trace=", "protocol=", "compress", "valgrind", "host=", "serialize", "ipv6", \ - "ice-home=", "x64", "cross=", "env"]) + "ice-home=", "x64", "cross=", "env", "sql-type=", "sql-db=", "sql-host=", "sql-user=", + "sql-passwd="]) except getopt.GetoptError: usage() @@ -1157,6 +1230,21 @@ def processCmdLine(): sys.exit(1) global protocol protocol = a + elif o == "--sql-type": + global sqlType + sqlType = a + elif o == "--sql-db": + global sqlDbName + sqlDbName = a + elif o == "--sql-host": + global sqlHost + sqlHost = a + elif o == "--sql-user": + global sqlUser + sqlUser = a + elif o == "--sql-passwd": + global sqlPassword + sqlPassword = a if len(args) > 0: usage() |