From becce266de9da07399e468a207df55a8f1d6e6b5 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 29 Nov 2016 15:44:12 -0500 Subject: [PATCH] modify compare.py to consider patches This is not smart enough to track the time for each incremental change separately. I didn't do that because I think it'd be better to retool so that both `process.sh` and `compare.py` are using the same code (i.e., so we are measuring the same thing that the server is). --- compare.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/compare.py b/compare.py index 75ac5295e..a406c37d3 100755 --- a/compare.py +++ b/compare.py @@ -10,9 +10,25 @@ import sys import time +def read_patches(): + (stdout, _stderr) = subprocess.Popen('make patches', + stdout = subprocess.PIPE, + stderr = subprocess.PIPE, + shell = True).communicate() + return stdout.split() + +def make(patches, make_env): + if not patches: + subprocess.check_call('make all > /dev/null 2>&1', env=make_env, shell=True) + else: + for patch in patches: + subprocess.check_call('make all%s > /dev/null 2>&1' % patch, env=make_env, shell=True) + def run_test(dir, rustc): os.chdir(dir) + patches = read_patches() + # First clean and rebuild from scratch. This downloads any necessary code # and builds preliminary crates. # @@ -22,14 +38,14 @@ def run_test(dir, rustc): subprocess.call('make clean > /dev/null 2>&1', shell=True) make_env = os.environ.copy() make_env['RUSTC'] = rustc - subprocess.check_call('make > /dev/null 2>&1', env=make_env, shell=True) + make(patches, make_env) # Measure compilation speed of the crate of interest three times. times = [] for i in range(0, 3): subprocess.check_call('make touch > /dev/null 2>&1', shell=True) t1 = time.time() - subprocess.check_call('make > /dev/null 2>&1', env=make_env, shell=True) + make(patches, make_env) t2 = time.time() t = t2 - t1 times.append(t)