Commit be3c276b authored by Julien Muchembled's avatar Julien Muchembled

Update test_bot after migration to Git

parent d53cf5d2
#!/usr/bin/python
import os, subprocess, sys, time
import pysvn
def clean():
for path, dir_list, file_list in os.walk('.'):
......@@ -9,6 +8,26 @@ def clean():
if file[-4:] in ('.pyc', '.pyo'):
os.remove(os.path.join(path, file))
class GitError(EnvironmentError):
def __init__(self, err, out, returncode):
EnvironmentError.__init__(self, err)
self.stdout = out
self.returncode = returncode
def _git(*args, **kw):
p = subprocess.Popen(('git',) + args, **kw)
out, err = p.communicate()
if p.returncode:
raise GitError(err, out, p.returncode)
return out
def git(*args, **kw):
out = _git(stdout=subprocess.PIPE, stderr=subprocess.PIPE, *args, **kw)
return out.strip()
def getRevision(*path):
return git('log', '-1', '--format=%H', '--', *path)
def main():
if 'LANG' in os.environ:
del os.environ['LANG']
......@@ -21,10 +40,7 @@ def main():
break
arg_count += '=' in arg and 1 or 2
svn = pysvn.Client()
def getRevision(path):
return svn.info(path).commit_revision.number
branch = git('rev-parse', '--abbrev-ref', 'HEAD')
test_bot = os.path.realpath(__file__).split(os.getcwd())[1][1:]
test_bot_revision = getRevision(test_bot)
revision = 0
......@@ -35,10 +51,11 @@ def main():
delay = delay and time.sleep(delay) or 1800
old_revision = revision
try:
svn.update('.')
except pysvn.ClientError, e:
_git('fetch')
_git('reset', '--merge', '@{u}')
except GitError, e:
continue
revision = getRevision('.')
revision = getRevision()
if revision == old_revision:
continue
if test_bot_revision != getRevision(test_bot):
......@@ -50,7 +67,9 @@ def main():
bin = os.path.join(test_home, 'bin')
if not subprocess.call((os.path.join(bin, 'buildout'), '-v'),
cwd=test_home):
title = '(r%u-%s)' % (revision, os.path.basename(test_home))
title = '[%s:%s-g%s:%s]' % (branch,
git('rev-list', '--topo-order', '--count', revision),
revision[:7], os.path.basename(test_home))
if tests:
subprocess.call([os.path.join(bin, 'neotestrunner'),
'-' + tests, '--title',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment