Author: Anton Gulenko <[email protected]>
Branch: storage-cleanups
Changeset: r1019:7b439eadbc99
Date: 2014-08-06 11:40 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/7b439eadbc99/

Log:    Fixed tests that were marked as skip. Added 64bit image versions to
        regular versions (no need to separate them).

diff --git a/spyvm/squeakimage.py b/spyvm/squeakimage.py
--- a/spyvm/squeakimage.py
+++ b/spyvm/squeakimage.py
@@ -1,4 +1,4 @@
-import os, sys, time
+import os, time
 from spyvm import constants, model, util
 from spyvm.util import stream
 from spyvm.util.bitmanipulation import splitter
@@ -41,24 +41,16 @@
     0x68190000:         ImageVersion(6504,  False, False, True,  False),
     0x00001969:         ImageVersion(6505,  True,  False, True,  True ),
     0x69190000:         ImageVersion(6505,  False, False, True,  True ),
+    
+    # Versions for 64 bit images
     0x00000000000109A0: ImageVersion(68000, True,  True,  False, False),
+    -0x5ff6ff0000000000:ImageVersion(68000, False, True,  False, False), # 
0xA009010000000000
+    0x00000000000109A2: ImageVersion(68002, True,  True,  True,  False),
+    -0x5df6ff0000000000:ImageVersion(68002, False, True,  True,  False), # 
0xA209010000000000
+    0x00000000000109A3: ImageVersion(68003, True,  True,  True,  True ),
+    -0x5cf6ff0000000000:ImageVersion(68003, False, True,  True,  True ), # 
0xA309010000000000
 }
 
-if sys.maxint == 2 ** 63 - 1:
-    image_versions.update({
-   -0x5ff6ff0000000000:
-    # signed version of 0xA009010000000000:
-                        ImageVersion(68000, False, True,  False, False),
-    0x00000000000109A2: ImageVersion(68002, True,  True,  True,  False),
-   -0x5df6ff0000000000:
-    # signed version of 0xA209010000000000:
-                        ImageVersion(68002, False, True,  True,  False),
-    0x00000000000109A3: ImageVersion(68003, True,  True,  True,  True ),
-   -0x5cf6ff0000000000:
-    # signed version of 0xA309010000000000:
-                        ImageVersion(68003, False, True,  True,  True ),
-})
-
 def version(magic):
     ver = image_versions.get(magic, None)
     if ver is None:
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
@@ -15,12 +15,6 @@
     w_result = perform(image.w_asSymbol, "asSymbol")
     assert w_result is image.w_asSymbol
 
-def test_create_new_symbol():
-    py.test.skip("This test takes quite long and is actually included in 
test_retrieve_symbol.")
-    w_result = perform(w("someString"), "asSymbol")
-    assert w_result is not None
-    assert w_result.as_string() == "someString"
-
 def test_retrieve_symbol():
     """asSymbol
     "This is the only place that new Symbols are created. A Symbol is created
@@ -30,6 +24,7 @@
             self = sym
                 ifTrue: [ ^ sym ] ].
     ^ (Symbol basicNew: self size) initFrom: self"""
+    
     w_result = perform(w("someString"), "asSymbol")
     assert w_result.as_string() == "someString"
     w_anotherSymbol = perform(w("someString"), "asSymbol")
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,5 +1,5 @@
 import py, math
-from spyvm import model, constants, storage_contexts, wrapper, primitives
+from spyvm import model, constants, storage_contexts, wrapper, primitives, 
interpreter, error
 from .util import read_image, open_reader, copy_to_module, cleanup_module, 
TestInterpreter
 
 def setup_module():
@@ -210,14 +210,18 @@
     w_false = image.special(constants.SO_FALSE)
     assert w_false.is_same_object(space.w_false)
 
-def test_runimage():
-    py.test.skip("This method actually runs an image. Fails since no graphical 
primitives yet")
-    ap = wrapper.ProcessWrapper(space, 
wrapper.scheduler(space).active_process())
-    w_ctx = ap.suspended_context()
-    ap.store_suspended_context(space.w_nil)
-
-    interp = TestInterpreter(space)
-    interp.interpret_toplevel(w_ctx)
+def test_runimage_and_quit():
+    # This image has been prepared executing the following DoIt (the entire 
line):
+    # Smalltalk snapshotPrimitive. Smalltalk snapshot: false andQuit: true.
+    # After starting, the image quits immediately. This allows testing the 
full image execution.
+    
+    from targetimageloadingsmalltalk import active_context, execute_context
+    space, interp, _, _ = read_image('running-exit.image')
+    frame = active_context(space)
+    try:
+        execute_context(interp, frame)
+    except error.Exit, e:
+        assert e.msg == "Quit-Primitive called"
 
 def test_compile_method():
     sourcecode = """fib
@@ -260,8 +264,6 @@
     assert s_ctx.top().is_same_object(space.w_true)
 
 def test_cached_methoddict():
-    py.test.skip('Should test the same as test_shadow.test_cached_methoddict, 
as long '
-                'as the implementation of MethodDictionary>>#at:put does not 
change.')
     sourcecode = """fib
                         ^self < 2
                             ifTrue: [ 1 ]
diff --git a/spyvm/test/test_model.py b/spyvm/test/test_model.py
--- a/spyvm/test/test_model.py
+++ b/spyvm/test/test_model.py
@@ -376,31 +376,30 @@
     assert target.getword(0) == 0xffff0100
     assert target.getword(1) == 0x7fff8000
 
[email protected]("'This test must be fixed!'")
 def test_display_bitmap():
-    # XXX: Patch SDLDisplay -> get_pixelbuffer() to circumvent
-    # double-free bug
-    def get_pixelbuffer(self):
-        return lltype.malloc(rffi.ULONGP.TO, self.width * self.height * 32, 
flavor='raw')
-    display.SDLDisplay.get_pixelbuffer = get_pixelbuffer
-    d = display.SDLDisplay("test")
-    d.set_video_mode(32, 10, 1)
-
-    target = model_display.W_DisplayBitmap.create(space, space.w_Array, 10, 1, 
d)
+    size = 10
+    space.display().set_video_mode(32, size, 1)
+    target = model_display.W_MappingDisplayBitmap(space, space.w_Array, size, 
1)
+    for idx in range(size):
+        target.setword(idx, r_uint(0))
+    target.take_over_display()
+    
     target.setword(0, r_uint(0xFF00))
     assert bin(target.getword(0)) == bin(0xFF00)
     target.setword(0, r_uint(0x00FF00FF))
     assert bin(target.getword(0)) == bin(0x00FF00FF)
     target.setword(0, r_uint(0xFF00FF00))
     assert bin(target.getword(0)) == bin(0xFF00FF00)
+    
+    buf = target.pixelbuffer()
     for i in xrange(2):
-        assert target.pixelbuffer[i] == 0x01010101
+        assert buf[i] == 0x01010101
     for i in xrange(2, 4):
-        assert target.pixelbuffer[i] == 0x0
+        assert buf[i] == 0x0
     for i in xrange(4, 6):
-        assert target.pixelbuffer[i] == 0x01010101
+        assert buf[i] == 0x01010101
     for i in xrange(6, 8):
-        assert target.pixelbuffer[i] == 0x0
+        assert buf[i] == 0x0
 
 def test_display_offset_computation_even():
     dbitmap = model_display.W_MappingDisplayBitmap(space, space.w_Array, 200, 
1)
@@ -419,7 +418,6 @@
     assert dbitmap.compute_pos(2) == 67
     assert dbitmap.compute_pos(3) == 67 + 32
     
[email protected]("socket.gethostname() == 'precise32'")
 def test_weak_pointers():
     w_cls = bootstrap_class(2)
     s_cls = w_cls.as_class_get_shadow(space)
diff --git a/spyvm/test/test_squeakimage.py b/spyvm/test/test_squeakimage.py
--- a/spyvm/test/test_squeakimage.py
+++ b/spyvm/test/test_squeakimage.py
@@ -187,8 +187,8 @@
     assert r.stream.pos == len(image_2)
 
 def test_simple_image64():
-    if not sys.maxint == 2 ** 63 - 1:
-      py.test.skip("on 32 bit platforms, we can't need to check for 64 bit 
images")
+    #if not sys.maxint == 2 ** 63 - 1:
+    #  py.test.skip("on 32 bit platforms, we can't need to check for 64 bit 
images")
     word_size = 8
     header_size = 16 * word_size
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to