[pypy-commit] lang-smalltalk storage-cleanups: Added @very_slow_test decorator.

anton_gulenko noreply at buildbot.pypy.org
Wed Aug 6 19:46:59 CEST 2014


Author: Anton Gulenko <anton.gulenko at googlemail.com>
Branch: storage-cleanups
Changeset: r1026:7c5136678154
Date: 2014-08-06 17:11 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/7c5136678154/

Log:	Added @very_slow_test decorator.
	--all|-A runs all tests. Normal tests take 12 seconds, slow tests
	take 33 seconds, all tests take 2:35 minutes.

diff --git a/spyvm/test/conftest.py b/spyvm/test/conftest.py
--- a/spyvm/test/conftest.py
+++ b/spyvm/test/conftest.py
@@ -10,6 +10,13 @@
         help="Additionally execute slow tests (loading full Squeak image or long execution)"
     )
     group.addoption(
+        "--all", "-A",
+        dest="execute-all-tests",
+        action="store_true",
+        default=False,
+        help="Execute all tests"
+    )
+    group.addoption(
         "--jit",
         dest="rsqueak-binary",
         action="store",
diff --git a/spyvm/test/test_bootstrappedimage.py b/spyvm/test/test_bootstrappedimage.py
--- a/spyvm/test/test_bootstrappedimage.py
+++ b/spyvm/test/test_bootstrappedimage.py
@@ -1,5 +1,5 @@
 import py
-from .util import read_image, copy_to_module, cleanup_module, slow_test
+from .util import read_image, copy_to_module, cleanup_module, slow_test, very_slow_test
 
 def setup_module():
     space, interp, image, reader = read_image("bootstrapped.image")
@@ -14,7 +14,7 @@
     w_result = perform(image.w_asSymbol, "asSymbol")
     assert w_result is image.w_asSymbol
 
- at slow_test
+ at very_slow_test
 def test_retrieve_symbol():
     """asSymbol
     "This is the only place that new Symbols are created. A Symbol is created
diff --git a/spyvm/test/test_miniimage.py b/spyvm/test/test_miniimage.py
--- a/spyvm/test/test_miniimage.py
+++ b/spyvm/test/test_miniimage.py
@@ -1,6 +1,6 @@
 import py, math
 from spyvm import model, constants, storage_contexts, wrapper, primitives, interpreter, error
-from .util import read_image, open_reader, copy_to_module, cleanup_module, TestInterpreter, slow_test
+from .util import read_image, open_reader, copy_to_module, cleanup_module, TestInterpreter, very_slow_test
 
 def setup_module():
     space, interp, image, reader = read_image("mini.image")
@@ -200,7 +200,7 @@
     w_false = image.special(constants.SO_FALSE)
     assert w_false.is_same_object(space.w_false)
 
- at slow_test
+ at very_slow_test
 def test_runimage_and_quit():
     from targetimageloadingsmalltalk import active_context, execute_context
     space, interp = runningExitImage(cached=False)
diff --git a/spyvm/test/test_miniimage_compiling.py b/spyvm/test/test_miniimage_compiling.py
--- a/spyvm/test/test_miniimage_compiling.py
+++ b/spyvm/test/test_miniimage_compiling.py
@@ -2,8 +2,6 @@
 from spyvm import model, constants, storage_contexts, wrapper, primitives, interpreter, error
 from .util import read_image, open_reader, copy_to_module, cleanup_module, TestInterpreter, slow_test
 
-pytestmark = slow_test
-
 def setup_module():
     space, interp, _, _ = read_image("mini.image")
     w = space.w
@@ -18,6 +16,10 @@
 
 # ------ tests ------------------------------------------
 
+def test_load_image():
+    pass
+
+ at slow_test
 def test_compile_method():
     sourcecode = """fib
                         ^self < 2
@@ -26,6 +28,7 @@
     perform(w(10).getclass(space), "compile:classified:notifying:", w(sourcecode), w('pypy'), w(None))
     assert perform(w(10), "fib").is_same_object(w(89))
 
+ at slow_test
 def test_become():
     sourcecode = """
     testBecome
@@ -52,6 +55,7 @@
     w_result = perform(w(10), "testBecome")
     assert space.unwrap_int(w_result) == 42
 
+ at slow_test
 def test_cached_methoddict():
     sourcecode = """fib
                         ^self < 2
diff --git a/spyvm/test/test_primitives.py b/spyvm/test/test_primitives.py
--- a/spyvm/test/test_primitives.py
+++ b/spyvm/test/test_primitives.py
@@ -5,7 +5,7 @@
 from rpython.rlib.rfloat import isinf, isnan
 from rpython.rlib.rarithmetic import intmask
 from rpython.rtyper.lltypesystem import lltype, rffi
-from .util import create_space, copy_to_module, cleanup_module, TestInterpreter, slow_test
+from .util import create_space, copy_to_module, cleanup_module, TestInterpreter, slow_test, very_slow_test
 
 def setup_module():
     space = create_space(bootstrap = True)
@@ -626,14 +626,14 @@
     assert s_new_context.gettemp(1).as_string() == "second arg"
     assert s_new_context.gettemp(2).as_string() == "some value"
 
- at slow_test
+ at very_slow_test
 def test_primitive_some_instance():
     import gc; gc.collect()
     someInstance = map(space.wrap_list, [[1], [2]])
     w_r = prim(primitives.SOME_INSTANCE, [space.w_Array])
     assert w_r.getclass(space) is space.w_Array
 
- at slow_test
+ at very_slow_test
 def test_primitive_next_instance():
     someInstances = map(space.wrap_list, [[2], [3]])
     w_frame, s_context = new_frame("<never called, but needed for method generation>")
@@ -650,7 +650,7 @@
     assert w_2.getclass(space) is space.w_Array
     assert w_1 is not w_2
 
- at slow_test
+ at very_slow_test
 def test_primitive_next_instance_wo_some_instance_in_same_frame():
     someInstances = map(space.wrap_list, [[2], [3]])
     w_frame, s_context = new_frame("<never called, but needed for method generation>")
diff --git a/spyvm/test/test_zin_squeak_4_5_image.py b/spyvm/test/test_zin_squeak_4_5_image.py
--- a/spyvm/test/test_zin_squeak_4_5_image.py
+++ b/spyvm/test/test_zin_squeak_4_5_image.py
@@ -2,6 +2,7 @@
 from spyvm import model
 from .util import read_image, copy_to_module, cleanup_module, slow_test
 
+# The tests are quick, but loading the big image takes time.
 pytestmark = slow_test
 
 def setup_module():
@@ -15,8 +16,10 @@
 
 def test_all_pointers_are_valid():
     from test_miniimage import _test_all_pointers_are_valid
+    _test_all_pointers_are_valid(reader)
+    
+def test_lookup_abs_in_integer():
     from test_miniimage import _test_lookup_abs_in_integer
-    _test_all_pointers_are_valid(reader)
     _test_lookup_abs_in_integer(interp)
     
 def test_ensure():
diff --git a/spyvm/test/util.py b/spyvm/test/util.py
--- a/spyvm/test/util.py
+++ b/spyvm/test/util.py
@@ -2,12 +2,15 @@
 from spyvm import model, storage_classes, objspace, util, constants, squeakimage, interpreter, interpreter_bytecodes
 from rpython.rlib.objectmodel import instantiate
 
-# Use this as decorator, if the test takes longer then a few seconds.
-# This option is configured in conftest.py.
+# Use these as decorators, if the test takes longer then a few seconds.
+# The according options is configured in conftest.py.
 # To mark all tests in a module as slow, add this line to the module:
 # pytestmark = slow_test
-slow_test = py.test.mark.skipif('not config.getvalue("execute-slow-tests")',
-                        reason="Slow tests are being skipped. Add --slow to execute all tests.")
+slow_test = py.test.mark.skipif('not config.getvalue("execute-slow-tests") or config.getvalue("execute-all-tests")',
+                        reason="Slow tests are being skipped. Add --slow|-S to execute slow tests.")
+
+very_slow_test = py.test.mark.skipif('not config.getvalue("execute-all-tests")',
+                        reason="Very slow tests are being skipped. Add --all|-A to execute all tests.")
 
 # Most tests don't need a bootstrapped objspace. Those that do, indicate so explicitely.
 # This way, as many tests as possible use the real, not-bootstrapped ObjSpace.


More information about the pypy-commit mailing list