Download:
child 60:39064bc2bcb4
parent 58:1fc22f551483
59:e78ae7d3a395
Anton Shestakov <av6@dwimlabs.net>, Mon, 04 Jul 2016 17:52:42 +0800
bench: import things from subprocess

1 файлов изменено, 9 вставок(+), 9 удалений(-) [+]
bench.py file | annotate | diff | comparison | revisions
--- a/bench.py Thu May 26 00:09:38 2016 +0800
+++ b/bench.py Mon Jul 04 17:52:42 2016 +0800
@@ -4,10 +4,10 @@
import os
import shutil
import sqlite3
-import subprocess
import time
from argparse import ArgumentParser
from collections import OrderedDict
+from subprocess import check_output, CalledProcessError, STDOUT
from settings import DBPATH, HG, LOCKFILE, TESTHGREPO, TESTREPO, rel
@@ -71,8 +71,8 @@
shutil.rmtree(rel(TESTREPO, '.hg', 'cache'), ignore_errors=True)
start = time.time()
try:
- subprocess.check_output(cmd)
- except subprocess.CalledProcessError:
+ check_output(cmd)
+ except CalledProcessError:
return None
results.append(time.time() - start)
@@ -83,14 +83,14 @@
cmd = [HG, 'log', '-R', TESTHGREPO, '-T', '{node}\n']
for revset in revsets:
cmd += ['-r', revset]
- output = subprocess.check_output(cmd)
+ output = check_output(cmd)
return output.split()
def guessnew(maxrevs):
""" Pick one continuous span of nodes that still need testing. """
cmd = [HG, 'log', '-R', TESTHGREPO, '-T', '{node}\n', '-r', 'sort(all(), rev)']
- output = subprocess.check_output(cmd)
+ output = check_output(cmd)
nodes = output.split()
picking = False
todo = []
@@ -109,7 +109,7 @@
def guessspikes(maxrevs):
cmd = [HG, 'log', '-R', TESTHGREPO, '-T', '{node}\n', '-r', 'sort(all(), -rev)']
- output = subprocess.check_output(cmd)
+ output = check_output(cmd)
nodes = output.split()
todo = []
conn = sqlite3.connect(DBPATH)
@@ -157,12 +157,12 @@
def makeclean():
- subprocess.check_output(['make', '--directory', TESTHGREPO, 'clean'], stderr=subprocess.STDOUT)
+ check_output(['make', '--directory', TESTHGREPO, 'clean'], stderr=STDOUT)
def makelocal(node):
- subprocess.check_output([HG, 'update', '-R', TESTHGREPO, '--clean', node], stderr=subprocess.STDOUT)
- subprocess.check_output(['make', '--directory', TESTHGREPO, 'local'], stderr=subprocess.STDOUT)
+ check_output([HG, 'update', '-R', TESTHGREPO, '--clean', node], stderr=STDOUT)
+ check_output(['make', '--directory', TESTHGREPO, 'local'], stderr=STDOUT)
def dbinit():