clean repo in between revisions

This commit is contained in:
Arvid Norberg 2014-01-26 17:31:06 +00:00
parent 57489489ab
commit d5accd9ead
3 changed files with 47 additions and 43 deletions

View File

@ -1,34 +0,0 @@
import os
import shutil
import glob
to_delete = [
'session_stats',
'libtorrent_logs*',
'round_trip_ms.log',
'dht.log',
'upnp.log',
'natpmp.log',
'bin',
'test_tmp_*',
'bjam_build.*.xml'
]
directories = [
'examples',
'test',
'.',
'tools'
]
for d in directories:
for f in to_delete:
path = os.path.join(d, f)
entries = glob.glob(path)
for p in entries:
print p
try:
shutil.rmtree(p)
except:
pass

38
tools/clean.py Normal file
View File

@ -0,0 +1,38 @@
import os
import shutil
import glob
def clean():
to_delete = [
'session_stats',
'libtorrent_logs*',
'round_trip_ms.log',
'dht.log',
'upnp.log',
'natpmp.log',
'bin',
'test_tmp_*',
'bjam_build.*.xml'
]
directories = [
'examples',
'test',
'.',
'tools'
]
for d in directories:
for f in to_delete:
path = os.path.join(d, f)
entries = glob.glob(path)
for p in entries:
print p
try:
shutil.rmtree(p)
except:
pass
if __name__ == "__main__":
clean()

View File

@ -47,6 +47,7 @@ from multiprocessing import Pool
import glob
import shutil
import traceback
import clean
# the .regression.yml configuration file format looks like this (it's yaml):
@ -82,7 +83,7 @@ def svn_info():
return (revision, author)
def run_tests(toolset, tests, features, options, test_dir, time_limit, incremental):
def run_tests(toolset, tests, features, options, test_dir, time_limit):
assert(type(features) == str)
xml_file = 'bjam_build.%d.xml' % random.randint(0, 100000)
@ -94,11 +95,6 @@ def run_tests(toolset, tests, features, options, test_dir, time_limit, increment
feature_list = features.split(' ')
os.chdir(test_dir)
# if not incremental:
# p = subprocess.Popen(['bjam', '--abbreviate-paths', toolset, 'clean'] + options + feature_list, stdout=subprocess.PIPE)
# for l in p.stdout: pass
# p.wait()
for t in tests:
options_copy = options[:]
if t != '': options_copy.append(t)
@ -204,6 +200,10 @@ def main(argv):
print_usage()
sys.exit(1)
if not incremental:
print 'cleaning repo'
clean.clean()
try:
cfg = open('.regression.yml', 'r')
except:
@ -292,14 +292,14 @@ def main(argv):
# futures = []
# for features in configs:
# futures.append(tester_pool.apply_async(run_tests, [toolset, tests, features, options, test_dir, time_limit, incremental]))
# futures.append(tester_pool.apply_async(run_tests, [toolset, tests, features, options, test_dir, time_limit]))
# for future in futures:
# (compiler, r) = future.get()
# results[toolset].update(r)
for features in configs:
(compiler, r) = run_tests(toolset, tests, features, options, test_dir, time_limit, incremental)
(compiler, r) = run_tests(toolset, tests, features, options, test_dir, time_limit)
results[toolset].update(r)
print ''
@ -308,7 +308,7 @@ def main(argv):
print 'deleting ',
for filt in clean_files:
for f in glob.glob(filt):
# a precautio to make sure a malicious repo
# a precaution to make sure a malicious repo
# won't clean things outside of the test directory
if not os.path.abspath(f).startswith(test_dir): continue
print '%s ' % f,