Author: Matti Picus <[email protected]>
Branch: chameleon
Changeset: r417:88b0250f4c41
Date: 2020-01-06 10:47 +0200
http://bitbucket.org/pypy/benchmarks/changeset/88b0250f4c41/

Log:    use 42 as a sentinel exit code when running a python2-only benchmark
        on python3

        If the python running the benchmarks is python3, these will already
        be skipped, this is for the case when the runner is python2 but the
        pythons under test are python3

diff --git a/benchmarks.py b/benchmarks.py
--- a/benchmarks.py
+++ b/benchmarks.py
@@ -170,6 +170,10 @@
         pypy-c-jit in the nightly benchmarks, we are not interested in
         ``changed_python`` (aka pypy-c-nojit) right now.
         """
+        if sys.version_info[0] > 2:
+            print('cannot run translation on Python3')
+            sys.exit(42)
+
         translate_py = relative('lib/pypy/rpython/bin/rpython')
         target = relative('lib/pypy/pypy/goal/targetpypystandalone.py')
         #targetnop = 
relative('lib/pypy/pypy/translator/goal/targetnopstandalone.py')
diff --git a/own/bm_krakatau.py b/own/bm_krakatau.py
--- a/own/bm_krakatau.py
+++ b/own/bm_krakatau.py
@@ -1,6 +1,12 @@
-import sys, os, cStringIO
 import time
 import util, optparse
+import sys, os
+
+if sys.version_info[0] > 2:
+    print('cannot run kratatau on Python3')
+    sys.exit(42)
+
+import cStringIO
 
 this_dir = os.path.dirname(__file__)
 sys.path.insert(0, os.path.join(this_dir, 'krakatau/Krakatau'))
diff --git a/own/pypy_interp.py b/own/pypy_interp.py
--- a/own/pypy_interp.py
+++ b/own/pypy_interp.py
@@ -2,6 +2,10 @@
 import time
 import util, optparse
 
+if sys.version_info[0] > 2:
+    print('cannot run pypy_interp on Python3')
+    sys.exit(42)
+
 pardir = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
 pypypath = os.path.join(pardir, 'lib', 'pypy')
 sys.path.insert(0, pypypath)
diff --git a/unladen_swallow/perf.py b/unladen_swallow/perf.py
--- a/unladen_swallow/perf.py
+++ b/unladen_swallow/perf.py
@@ -674,6 +674,8 @@
         A string summarizing the difference between the runs, suitable for
         human consumption.
     """
+    if options.no_statistics or len(base_times) ==0 or len(changed_times) == 0:
+        return RawResult(base_times, changed_times)
     if len(base_times) != len(changed_times):
         print("Base:")
         print(base_times)
@@ -684,8 +686,6 @@
         l = min(len(base_times), len(changed_times))
         base_times = base_times[:l]
         changed_times = changed_times[:l]
-    if options.no_statistics:
-        return RawResult(base_times, changed_times)
     if len(base_times) == 1:
         # With only one data point, we can't do any of the interesting stats
         # below.
@@ -772,8 +772,10 @@
     if track_memory:
         future = MemoryUsageFuture(subproc.pid)
     result, err = subproc.communicate()
-    if subproc.returncode != 0:
-        print(result)
+    if subproc.returncode == 42:
+        assert 'Python3' in result
+        return '', None
+    elif subproc.returncode != 0:
         raise RuntimeError("Benchmark died (returncode: %d): %s" %
                            (subproc.returncode, err))
     if track_memory:
diff --git a/unladen_swallow/performance/bm_rietveld.py 
b/unladen_swallow/performance/bm_rietveld.py
--- a/unladen_swallow/performance/bm_rietveld.py
+++ b/unladen_swallow/performance/bm_rietveld.py
@@ -42,6 +42,12 @@
 import optparse
 import os
 import time
+import sys
+
+if sys.version_info[0] > 2:
+    print('cannot run rietveld on Python3')
+    sys.exit(42)
+
 
 # Local imports
 import util
diff --git a/unladen_swallow/performance/bm_spambayes.py 
b/unladen_swallow/performance/bm_spambayes.py
--- a/unladen_swallow/performance/bm_spambayes.py
+++ b/unladen_swallow/performance/bm_spambayes.py
@@ -13,6 +13,11 @@
 import optparse
 import os.path
 import time
+import sys
+
+if sys.version_info[0] > 2:
+    print('cannot run spambayes on Python3')
+    sys.exit(42)
 
 # SpamBayes imports
 from spambayes import hammie, mboxutils
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to