summaryrefslogtreecommitdiffstats
path: root/wintest/wintest.py
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-12-03 15:31:39 +1100
committerAndrew Tridgell <tridge@samba.org>2010-12-03 06:17:44 +0100
commit9de6b4a7ca7520b93771d595866ad303116c02ee (patch)
tree7a841390f24c23cefbbd7dc025cb8bb4913ddbdf /wintest/wintest.py
parent8dcd4cca4eb81eb41fab8da7bb5f32c3a3de8b55 (diff)
downloadsamba-9de6b4a7ca7520b93771d595866ad303116c02ee.tar.gz
samba-9de6b4a7ca7520b93771d595866ad303116c02ee.tar.xz
samba-9de6b4a7ca7520b93771d595866ad303116c02ee.zip
wintest: put most of the main program login in wintest.py
this makes it easier to create new tests Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Fri Dec 3 06:17:44 CET 2010 on sn-devel-104
Diffstat (limited to 'wintest/wintest.py')
-rw-r--r--wintest/wintest.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/wintest/wintest.py b/wintest/wintest.py
index b8e6ea2dd19..ec2624bde55 100644
--- a/wintest/wintest.py
+++ b/wintest/wintest.py
@@ -3,6 +3,7 @@
'''automated testing library for testing Samba against windows'''
import pexpect, subprocess
+import optparse
import sys, os, time, re
class wintest():
@@ -13,6 +14,7 @@ class wintest():
self.list_mode = False
self.vms = None
os.putenv('PYTHONUNBUFFERED', '1')
+ self.parser = optparse.OptionParser("wintest")
def setvar(self, varname, value):
'''set a substitution variable'''
@@ -553,3 +555,48 @@ class wintest():
if v[-3:] == "_VM":
ret.append(self.vars[v])
return ret
+
+ def setup(self, testname, subdir):
+ '''setup for main tests, parsing command line'''
+ self.parser.add_option("--conf", type='string', default='', help='config file')
+ self.parser.add_option("--skip", type='string', default='', help='list of steps to skip (comma separated)')
+ self.parser.add_option("--vms", type='string', default=None, help='list of VMs to use (comma separated)')
+ self.parser.add_option("--list", action='store_true', default=False, help='list the available steps')
+ self.parser.add_option("--rebase", action='store_true', default=False, help='do a git pull --rebase')
+ self.parser.add_option("--clean", action='store_true', default=False, help='clean the tree')
+ self.parser.add_option("--prefix", type='string', default=None, help='override install prefix')
+ self.parser.add_option("--sourcetree", type='string', default=None, help='override sourcetree location')
+ self.parser.add_option("--nocleanup", action='store_true', default=False, help='disable cleanup code')
+
+ self.opts, self.args = self.parser.parse_args()
+
+ if not self.opts.conf:
+ print("Please specify a config file with --conf")
+ sys.exit(1)
+
+ # we don't need fsync safety in these tests
+ self.putenv('TDB_NO_FSYNC', '1')
+
+ self.load_config(self.opts.conf)
+
+ self.set_skip(self.opts.skip)
+ self.set_vms(self.opts.vms)
+
+ if self.opts.list:
+ self.list_steps_mode()
+
+ if self.opts.prefix:
+ self.setvar('PREFIX', self.opts.prefix)
+
+ if self.opts.sourcetree:
+ self.setvar('SOURCETREE', self.opts.sourcetree)
+
+ if self.opts.rebase:
+ self.info('rebasing')
+ self.chdir('${SOURCETREE}')
+ self.run_cmd('git pull --rebase')
+
+ if self.opts.clean:
+ self.info('cleaning')
+ self.chdir('${SOURCETREE}/' + subdir)
+ self.run_cmd('make clean')