[pypy-svn] r70639 - in pypy/benchmarks: . test

fijal at codespeak.net fijal at codespeak.net
Sat Jan 16 22:28:34 CET 2010


Author: fijal
Date: Sat Jan 16 22:28:33 2010
New Revision: 70639

Modified:
   pypy/benchmarks/runner.py
   pypy/benchmarks/test/test_runner.py
Log:
Store a bit more info in json, including a rev number


Modified: pypy/benchmarks/runner.py
==============================================================================
--- pypy/benchmarks/runner.py	(original)
+++ pypy/benchmarks/runner.py	Sat Jan 16 22:28:33 2010
@@ -7,16 +7,20 @@
 import sys
 from unladen_swallow.perf import main
 
-def run_and_store(benchmarks, result_filename, pypy_c_path):
+def run_and_store(benchmarks, result_filename, pypy_c_path, revision=0):
     results = main(['-f', '-b', ','.join(benchmarks),
                     '--inherit_env=PATH',
                     '--no_charts', sys.executable, pypy_c_path])
     f = open(str(result_filename), "w")
-    f.write(json.dumps([(name, result.__class__.__name__, result.__dict__)
-                    for name, result in results]))
+    res = [(name, result.__class__.__name__, result.__dict__)
+           for name, result in results]
+    f.write(json.dumps({
+        'revision' : revision,
+        'results' : res,
+        }))
     f.close()
 
 if __name__ == '__main__':
     BENCHMARK_SET = ['richards', 'slowspitfire', 'django', 'spambayes',
                      'rietveld', 'html5lib', 'ai']
-    run_and_store(BENCHMARK_SET, sys.argv[1], sys.argv[2])
+    run_and_store(BENCHMARK_SET, sys.argv[1], sys.argv[2], int(sys.argv[3]))

Modified: pypy/benchmarks/test/test_runner.py
==============================================================================
--- pypy/benchmarks/test/test_runner.py	(original)
+++ pypy/benchmarks/test/test_runner.py	Sat Jan 16 22:28:33 2010
@@ -9,6 +9,6 @@
     resfile = tmpdir.join('results')
     run_and_store(['startup'], resfile, sys.executable)
     assert resfile.check()
-    data = json.loads(resfile.read())
+    data = json.loads(resfile.read())['results']
     assert [i[0] for i in data] == ['normal_startup', 'startup_nosite']
     assert [i[1] for i in data] == ['ComparisonResult', 'ComparisonResult']



More information about the Pypy-commit mailing list