pypy unit tests fail when running as subprocess

Issue #68 closed
Franz Schrober
created an issue

Issue #66 shows that the pypy tests cannot be run without subprocesses. Now with subprocesses they fail (without an crash):

pypy -B -m sdl2.test.util.runtests -s -t70
Executing tests from [audio_test.py]... OK
Executing tests from [clipboard_test.py]... OK
Executing tests from [cpuinfo_test.py]... OK
Executing tests from [endian_test.py]... OK
Executing tests from [error_test.py]... OK
Executing tests from [events_test.py]... OK
Executing tests from [filesystem_test.py]... ERROR
Running tests [ 2 / 2 ] ...              
======================================================================
-- Statistics --
======================================================================
Python:         /usr/bin/pypy
Options:
                'filename' = '/tmp/pysdl2/sdl2/test/util/../filesystem_test.py'
                'subprocess' = 'False'
                'timeout' = '70'
                'random' = 'False'
                'seed' = 'None'
                'verbose' = 'False'
                'excludetags' = '['interactive']'
Time taken:     0.001 seconds
Tests executed: 2 
Tests OK:       0 
Tests SKIPPED:  1 
Tests ERROR:    0 
Tests FAILURE:  1 
Failures:

----------------------------------------------------------------------
FAILURE: test_SDL_GetBasePath (sdl2.test.filesystem_test.SDLFileSystemTest)
======================================================================
Traceback (most recent call last):
  File "/tmp/pysdl2/sdl2/test/filesystem_test.py", line 15, in test_SDL_GetBasePath
    self.assertEqual(execpath, ppath.decode("utf-8"))
AssertionError: '/usr/bin/' != u'/usr/lib/pypy/bin/'


Executing tests from [hints_test.py]... OK
Executing tests from [joystick_test.py]... OK
Executing tests from [keyboard_test.py]... OK
Executing tests from [log_test.py]... OK
Executing tests from [mouse_test.py]... OK
Executing tests from [pixels_test.py]... OK
Executing tests from [platform_test.py]... OK
Executing tests from [power_test.py]... OK
Executing tests from [rect_test.py]... OK
Executing tests from [render_test.py]... OK
Executing tests from [rwops_test.py]... OK
Executing tests from [sdl2ext_algorithms_test.py]... OK
Executing tests from [sdl2ext_array_test.py]... ERROR
Running tests [ 13 / 13 ] ...               
======================================================================
-- Statistics --
======================================================================
Python:         /usr/bin/pypy
Options:
                'filename' = '/tmp/pysdl2/sdl2/test/util/../sdl2ext_array_test.py'
                'subprocess' = 'False'
                'timeout' = '70'
                'random' = 'False'
                'seed' = 'None'
                'verbose' = 'False'
                'excludetags' = '['interactive']'
Time taken:     0.286 seconds
Tests executed: 13 
Tests OK:       10 
Tests SKIPPED:  0 
Tests ERROR:    3 
Tests FAILURE:  0 
Errors:

----------------------------------------------------------------------
ERROR: test_CTypesView__doublebytes (sdl2.test.sdl2ext_array_test.SDL2ExtArrayTest)
======================================================================
Traceback (most recent call last):
  File "/tmp/pysdl2/sdl2/test/sdl2ext_array_test.py", line 189, in test_CTypesView__doublebytes
    buf1 = sdlextarray.CTypesView(doublebyteseq, USHORT_SIZE, docopy=True)
  File "sdl2/ext/array.py", line 88, in __init__
    self._create_view(itemsize, bool(docopy), objsize)
  File "sdl2/ext/array.py", line 116, in _create_view
    self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
ValueError: byte must be in range(0, 256)

----------------------------------------------------------------------
ERROR: test_CTypesView__quadbytes (sdl2.test.sdl2ext_array_test.SDL2ExtArrayTest)
======================================================================
Traceback (most recent call last):
  File "/tmp/pysdl2/sdl2/test/sdl2ext_array_test.py", line 228, in test_CTypesView__quadbytes
    buf1 = sdlextarray.CTypesView(quadbyteseq, UINT_SIZE, docopy=True)
  File "sdl2/ext/array.py", line 88, in __init__
    self._create_view(itemsize, bool(docopy), objsize)
  File "sdl2/ext/array.py", line 116, in _create_view
    self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
ValueError: byte must be in range(0, 256)

----------------------------------------------------------------------
ERROR: test_CTypesView__repr__ (sdl2.test.sdl2ext_array_test.SDL2ExtArrayTest)
======================================================================
Traceback (most recent call last):
  File "/tmp/pysdl2/sdl2/test/sdl2ext_array_test.py", line 279, in test_CTypesView__repr__
    buf = sdlextarray.CTypesView(seq, size, not shared)
  File "sdl2/ext/array.py", line 88, in __init__
    self._create_view(itemsize, bool(docopy), objsize)
  File "sdl2/ext/array.py", line 116, in _create_view
    self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
ValueError: byte must be in range(0, 256)


Executing tests from [sdl2ext_color_test.py]... OK
Executing tests from [sdl2ext_draw_test.py]... OK
Executing tests from [sdl2ext_ebs_test.py]... OK
Executing tests from [sdl2ext_events_test.py]... OK
Executing tests from [sdl2ext_font_test.py]... OK
Executing tests from [sdl2ext_gui_test.py]... OK
Executing tests from [sdl2ext_image_test.py]... OK
Executing tests from [sdl2ext_particles_test.py]... OK
Executing tests from [sdl2ext_pixelaccess_test.py]... OK
Executing tests from [sdl2ext_resources_test.py]... OK
Executing tests from [sdl2ext_sprite_test.py]... ERROR
Running tests [ 39 / 39 ] ...                
======================================================================
-- Statistics --
======================================================================
Python:         /usr/bin/pypy
Options:
                'filename' = '/tmp/pysdl2/sdl2/test/util/../sdl2ext_sprite_test.py'
                'subprocess' = 'False'
                'timeout' = '70'
                'random' = 'False'
                'seed' = 'None'
                'verbose' = 'False'
                'excludetags' = '['interactive']'
Time taken:     18.621 seconds
Tests executed: 39 
Tests OK:       22 
Tests SKIPPED:  14 
Tests ERROR:    3 
Tests FAILURE:  0 
Errors:

----------------------------------------------------------------------
ERROR: test_Renderer (sdl2.test.sdl2ext_sprite_test.SDL2ExtSpriteTest)
======================================================================
Traceback (most recent call last):
  File "/tmp/pysdl2/sdl2/test/sdl2ext_sprite_test.py", line 545, in test_Renderer
    self.assertIsInstance(renderer.renderer.contents, SDL_Renderer)
  File "/usr/lib/pypy/lib_pypy/_ctypes/pointer.py", line 83, in getcontents
    raise ValueError("NULL pointer access")
ValueError: NULL pointer access

----------------------------------------------------------------------
ERROR: test_Renderer_clear (sdl2.test.sdl2ext_sprite_test.SDL2ExtSpriteTest)
======================================================================
Traceback (most recent call last):
  File "/tmp/pysdl2/sdl2/test/sdl2ext_sprite_test.py", line 594, in test_Renderer_clear
    self.check_areas(view, 10, 10, [[0, 0, 10, 10]], 0xFF000000, (0x0,))
  File "/tmp/pysdl2/sdl2/test/sdl2ext_sprite_test.py", line 64, in check_areas
    self.assertEqual(view[y][x], c1,
  File "sdl2/ext/array.py", line 250, in __getitem__
    return self._getfunc(offset, offset + self.itemsize)
  File "sdl2/ext/pixelaccess.py", line 60, in _getitem
    src = ctypes.byref(self.source.contents, start)
TypeError: byref() takes exactly 1 argument (2 given)

----------------------------------------------------------------------
ERROR: test_Renderer_color (sdl2.test.sdl2ext_sprite_test.SDL2ExtSpriteTest)
======================================================================
Traceback (most recent call last):
  File "/tmp/pysdl2/sdl2/test/sdl2ext_sprite_test.py", line 566, in test_Renderer_color
    self.check_areas(view, 10, 10, [[0, 0, 10, 10]], 0xFF000000, (0x0,))
  File "/tmp/pysdl2/sdl2/test/sdl2ext_sprite_test.py", line 64, in check_areas
    self.assertEqual(view[y][x], c1,
  File "sdl2/ext/array.py", line 250, in __getitem__
    return self._getfunc(offset, offset + self.itemsize)
  File "sdl2/ext/pixelaccess.py", line 60, in _getitem
    src = ctypes.byref(self.source.contents, start)
TypeError: byref() takes exactly 1 argument (2 given)


Executing tests from [sdl2ext_test.py]... OK
Executing tests from [sdl2ext_window_test.py]... OK
Executing tests from [sdl_test.py]... OK
Executing tests from [sdlgfx_test.py]... OK
Executing tests from [sdlimage_test.py]... OK
Executing tests from [sdlmixer_test.py]... OK
Executing tests from [sdlttf_test.py]... OK
Executing tests from [shape_test.py]... OK
Executing tests from [surface_test.py]... ERROR
Running tests [ 27 / 27 ] ...         
======================================================================
-- Statistics --
======================================================================
Python:         /usr/bin/pypy
Options:
                'filename' = '/tmp/pysdl2/sdl2/test/util/../surface_test.py'
                'subprocess' = 'False'
                'timeout' = '70'
                'random' = 'False'
                'seed' = 'None'
                'verbose' = 'False'
                'excludetags' = '['interactive']'
Time taken:     12.919 seconds
Tests executed: 27 
Tests OK:       19 
Tests SKIPPED:  6 
Tests ERROR:    2 
Tests FAILURE:  0 
Errors:

----------------------------------------------------------------------
ERROR: test_SDL_ConvertPixels (sdl2.test.surface_test.SDLSurfaceTest)
======================================================================
Traceback (most recent call last):
  File "/tmp/pysdl2/sdl2/test/surface_test.py", line 75, in test_SDL_ConvertPixels
    src = CTypesView(array.array(arflag, buf), bytecount)
  File "sdl2/ext/array.py", line 88, in __init__
    self._create_view(itemsize, bool(docopy), objsize)
  File "sdl2/ext/array.py", line 116, in _create_view
    self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
ValueError: byte must be in range(0, 256)

----------------------------------------------------------------------
ERROR: test_SDL_CreateRGBSurfaceFrom (sdl2.test.surface_test.SDLSurfaceTest)
======================================================================
Traceback (most recent call last):
  File "/tmp/pysdl2/sdl2/test/surface_test.py", line 215, in test_SDL_CreateRGBSurfaceFrom
    bytebuf = CTypesView(array.array(arflag, buf))
  File "sdl2/ext/array.py", line 88, in __init__
    self._create_view(itemsize, bool(docopy), objsize)
  File "sdl2/ext/array.py", line 116, in _create_view
    self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
ValueError: byte must be in range(0, 256)


Executing tests from [syswm_test.py]... OK
Executing tests from [timer_test.py]... OK
Executing tests from [version_test.py]... OK
Executing tests from [video_test.py]... OK

Comments (8)

  1. Franz Schrober reporter

    There still seems to be more necessary. I still get (pypy 2.4.0):

    ----------------------------------------------------------------------
    ERROR: test_CTypesView__doublebytes (sdl2.test.sdl2ext_array_test.SDL2ExtArrayTest)
    ======================================================================
    Traceback (most recent call last):
      File "/tmp/buildd/pysdl2-0.9.3+dfsg1/sdl2/test/sdl2ext_array_test.py", line 189, in test_CTypesView__doublebytes
        buf1 = sdlextarray.CTypesView(doublebyteseq, USHORT_SIZE, docopy=True)
      File "sdl2/ext/array.py", line 88, in __init__
        self._create_view(itemsize, bool(docopy), objsize)
      File "sdl2/ext/array.py", line 116, in _create_view
        self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
    ValueError: byte must be in range(0, 256)
    
    ----------------------------------------------------------------------
    ERROR: test_CTypesView__quadbytes (sdl2.test.sdl2ext_array_test.SDL2ExtArrayTest)
    ======================================================================
    Traceback (most recent call last):
      File "/tmp/buildd/pysdl2-0.9.3+dfsg1/sdl2/test/sdl2ext_array_test.py", line 228, in test_CTypesView__quadbytes
        buf1 = sdlextarray.CTypesView(quadbyteseq, UINT_SIZE, docopy=True)
      File "sdl2/ext/array.py", line 88, in __init__
        self._create_view(itemsize, bool(docopy), objsize)
      File "sdl2/ext/array.py", line 116, in _create_view
        self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
    ValueError: byte must be in range(0, 256)
    
    ----------------------------------------------------------------------
    ERROR: test_CTypesView__repr__ (sdl2.test.sdl2ext_array_test.SDL2ExtArrayTest)
    ======================================================================
    Traceback (most recent call last):
      File "/tmp/buildd/pysdl2-0.9.3+dfsg1/sdl2/test/sdl2ext_array_test.py", line 279, in test_CTypesView__repr__
        buf = sdlextarray.CTypesView(seq, size, not shared)
      File "sdl2/ext/array.py", line 88, in __init__
        self._create_view(itemsize, bool(docopy), objsize)
      File "sdl2/ext/array.py", line 116, in _create_view
        self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
    ValueError: byte must be in range(0, 256)
    
    ----------------------------------------------------------------------
    ERROR: test_Renderer (sdl2.test.sdl2ext_sprite_test.SDL2ExtSpriteTest)
    ======================================================================
    Traceback (most recent call last):
      File "/tmp/buildd/pysdl2-0.9.3+dfsg1/sdl2/test/sdl2ext_sprite_test.py", line 545, in test_Renderer
        self.assertIsInstance(renderer.renderer.contents, SDL_Renderer)
      File "/usr/lib/pypy/lib_pypy/_ctypes/pointer.py", line 83, in getcontents
        raise ValueError("NULL pointer access")
    ValueError: NULL pointer access
    
    ----------------------------------------------------------------------
    ERROR: test_SDL_ConvertPixels (sdl2.test.surface_test.SDLSurfaceTest)
    ======================================================================
    Traceback (most recent call last):
      File "/tmp/buildd/pysdl2-0.9.3+dfsg1/sdl2/test/surface_test.py", line 75, in test_SDL_ConvertPixels
        src = CTypesView(array.array(arflag, buf), bytecount)
      File "sdl2/ext/array.py", line 88, in __init__
        self._create_view(itemsize, bool(docopy), objsize)
      File "sdl2/ext/array.py", line 116, in _create_view
        self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
    ValueError: byte must be in range(0, 256)
    
    ----------------------------------------------------------------------
    ERROR: test_SDL_CreateRGBSurfaceFrom (sdl2.test.surface_test.SDLSurfaceTest)
    ======================================================================
    Traceback (most recent call last):
      File "/tmp/buildd/pysdl2-0.9.3+dfsg1/sdl2/test/surface_test.py", line 215, in test_SDL_CreateRGBSurfaceFrom
        bytebuf = CTypesView(array.array(arflag, buf))
      File "sdl2/ext/array.py", line 88, in __init__
        self._create_view(itemsize, bool(docopy), objsize)
      File "sdl2/ext/array.py", line 116, in _create_view
        self._view = (ctypes.c_ubyte * bsize)(*bytearray(self._obj))
    ValueError: byte must be in range(0, 256)
    
  2. Franz Schrober reporter

    I can confirm that this doesn't happen with pypy 2.2.1. But it happens with pypy 2.3.1 and 2.4.0. The null pointer stuff also seemed to be new. Previously it just segfaulted (at least with 2.2.1 i have a segfault during the test)

  3. Log in to comment