2013-06-16 22:37:54 +02:00
|
|
|
#!/bin/python
|
|
|
|
|
|
|
|
import run_tests
|
|
|
|
import os
|
|
|
|
import time
|
2013-06-16 23:04:01 +02:00
|
|
|
import subprocess
|
|
|
|
import sys
|
2013-06-16 22:37:54 +02:00
|
|
|
|
2013-06-17 05:08:41 +02:00
|
|
|
def indent(s):
|
|
|
|
s = string.split(s, '\n')
|
|
|
|
s = [(3 * ' ') + string.lstrip(line) for line in s]
|
|
|
|
s = string.join(s, '\n')
|
|
|
|
return s
|
|
|
|
|
2013-06-16 22:37:54 +02:00
|
|
|
# returns a list of new revisions
|
2013-06-17 04:53:52 +02:00
|
|
|
def svn_fetch(last_rev):
|
2013-06-16 22:37:54 +02:00
|
|
|
|
|
|
|
p = subprocess.Popen(['svn', 'up'], stdout=subprocess.PIPE)
|
|
|
|
|
|
|
|
revision = -1
|
|
|
|
|
|
|
|
output = ''
|
|
|
|
for l in p.stdout:
|
|
|
|
if 'At revision ' in l:
|
2013-06-16 23:04:01 +02:00
|
|
|
revision = int(l.split('At revision')[1].strip()[0:-1])
|
2013-06-17 00:51:03 +02:00
|
|
|
if 'Updated to revision ' in l:
|
|
|
|
revision = int(l.split('Updated to revision')[1].strip()[0:-1])
|
2013-06-16 22:37:54 +02:00
|
|
|
output += l
|
|
|
|
|
|
|
|
if revision == -1:
|
2013-06-17 05:08:41 +02:00
|
|
|
print '\n\nsvn update failed\n\n%s' % indent(output)
|
|
|
|
return []
|
2013-06-16 22:37:54 +02:00
|
|
|
|
2013-06-17 04:53:52 +02:00
|
|
|
return range(last_rev + 1, revision + 1)
|
2013-06-16 22:37:54 +02:00
|
|
|
|
|
|
|
def svn_up(revision):
|
|
|
|
os.system('svn up %d' % revision)
|
|
|
|
|
|
|
|
def print_usage():
|
2013-06-17 03:30:45 +02:00
|
|
|
print '''usage: run_regression_tests.py [options] toolset [toolset...]
|
2013-06-16 22:37:54 +02:00
|
|
|
|
|
|
|
toolset are bjam toolsets. For instance clang, gcc, darwin, msvc etc.
|
2013-06-17 03:30:45 +02:00
|
|
|
The path "./regression_tests" is expected to be a shared folder
|
|
|
|
between all testsers.
|
2013-06-16 22:37:54 +02:00
|
|
|
|
|
|
|
options:
|
|
|
|
|
|
|
|
-j<n> use n parallel processes for running tests
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
def loop():
|
2013-06-16 23:04:01 +02:00
|
|
|
|
2013-06-17 08:54:00 +02:00
|
|
|
if len(sys.argv) < 2:
|
2013-06-16 23:04:01 +02:00
|
|
|
print_usage()
|
|
|
|
sys.exit(1)
|
|
|
|
|
2013-06-17 04:53:52 +02:00
|
|
|
rev_file = os.path.join(os.getcwd(), '.rev')
|
|
|
|
print 'restoring last state from "%s"' % rev_file
|
|
|
|
|
|
|
|
try:
|
|
|
|
last_rev = int(open(rev_file, 'r').read())
|
|
|
|
except:
|
2013-06-17 07:50:53 +02:00
|
|
|
last_rev = run_tests.svn_info()[0] - 1
|
2013-06-17 04:53:52 +02:00
|
|
|
open(rev_file, 'w+').write('%d' % last_rev)
|
|
|
|
|
2013-06-16 22:37:54 +02:00
|
|
|
while True:
|
2013-06-17 04:53:52 +02:00
|
|
|
revs = svn_fetch(last_rev)
|
2013-06-16 22:37:54 +02:00
|
|
|
|
|
|
|
for r in revs:
|
|
|
|
print '\n\nREVISION %d ===\n' % r
|
|
|
|
svn_up(r)
|
|
|
|
|
2013-06-17 03:30:45 +02:00
|
|
|
run_tests.main(sys.argv[1:])
|
2013-06-17 04:53:52 +02:00
|
|
|
last_rev = r;
|
|
|
|
|
|
|
|
open(rev_file, 'w+').write('%d' % last_rev)
|
2013-06-16 22:37:54 +02:00
|
|
|
|
|
|
|
time.sleep(120)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
loop()
|