[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] 7 failures and 1 error in test suite



Ok, so here goes my analysis of the failures in ColorTypeTest:
In src/color.c line 1435 (and some following lines) we bit shift each color component and stuff them
in an unsigned long.
I think the problem arises when we bitshift the r value and r is >127
My guess is that C converts r to an integer during the bitshift and not to an unsigned int so
if r > 127 the integer (r is shifted by 24) overflows and becomes negative (note that the internal
bit representation of the int has not changed) but when we store this (negative) integer into a
long it remains negative so the first bits get filled up with "1"s.
I see different solutions to this and cant decide which is the _correct_ one so I'll just present them
instead:
 1) don't save the combined color in an unsigned long. use a unsigned int instead.
    This should work as long as r, g, b, a are UInt8 and aren't shifted more than 24
 2) explicitly cast the r value to be unsigned
 3) cast the r value to be (unsigned) long

furthermore I think in the we should compare tmp to UINT_MAX in line 1438, 1476 and 1492.
even though I haven't put much thought into this at least then the tests don't fail.

yours
//Lorenz



Lorenz Quack wrote:
Hi,

I just ran the test suit ("make tests") and got 7 failures and 1 error.
6 of the 7 failures arise in the ColorTypeTest and seem to be 64- vs 32-bit related. the last failure comes from SurfaceTypeTest and the error seems to have to do with midi.

I haven't looked into any of these, yet. I just wanted to let you know since we're already -rc2


so here comes the full report:


$ make tests
python run_tests.py
skipping test.cdrom_test (tag 'interactive')
loading test.base_test
loading test.blit_test
loading test.bufferproxy_test
loading test.color_test
loading test.cursors_test
loading test.display_test
loading test.draw_test
loading test.event_test
loading test.fastevent_test
loading test.font_test
loading test.gfxdraw_test
loading test.image__save_gl_surface_test
loading test.image_test
loading test.joystick_test
loading test.key_test
loading test.mask_test
loading test.midi_test
loading test.mixer_music_test
loading test.mixer_test
loading test.mouse_test
loading test.movie_test
loading test.overlay_test
loading test.pixelarray_test
loading test.rect_test
loading test.scrap_test
loading test.sndarray_test
loading test.sprite_test
loading test.surface_test
loading test.surfarray_test
loading test.surflock_test
loading test.sysfont_test
loading test.threads_test
loading test.time_test
loading test.transform_test
.....................F.F...........F...F...F.......F....................................................................................E.........................................................................................................................................................................................................F..................................................................
======================================================================
FAIL: ColorTypeTest.test_float
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lorenz/src/extern/pygame/trunk/test/color_test.py", line 480, in test_float
self.assertEquals (float (c), float (0xCC00CC00))
AssertionError: 1.844674407283719e+19 != 3422604288.0

======================================================================
FAIL: ColorTypeTest.test_hex
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lorenz/src/extern/pygame/trunk/test/color_test.py", line 510, in test_hex
self.assertEquals (hex (c), hex (0xCC00CC00))
AssertionError: '0xffffffffcc00cc00L' != '0xcc00cc00'

======================================================================
FAIL: ColorTypeTest.test_int
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lorenz/src/extern/pygame/trunk/test/color_test.py", line 562, in test_int
self.assertEquals (int (c), int (0xCC00CC00))
AssertionError: 18446744072837188608L != 3422604288

======================================================================
FAIL: ColorTypeTest.test_long
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lorenz/src/extern/pygame/trunk/test/color_test.py", line 579, in test_long
self.assertEquals (long_ (c), long_ (0xCC00CC00))
AssertionError: 18446744072837188608L != 3422604288L

======================================================================
FAIL: ColorTypeTest.test_oct
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lorenz/src/extern/pygame/trunk/test/color_test.py", line 495, in test_oct
self.assertEquals (oct (c), oct (0xCC00CC00))
AssertionError: '01777777777771400146000L' != '031400146000'

======================================================================
FAIL: ColorTypeTest.test_webstyle
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lorenz/src/extern/pygame/trunk/test/color_test.py", line 526, in test_webstyle
self.assertEquals (hex (c), hex (0xCC00CC11))
AssertionError: '0xffffffffcc00cc11L' != '0xcc00cc11'


======================================================================
ERROR: all_tests_for (test.midi_test.AllTestCases)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test.midi_test.py", line 1, in all_tests_for
subprocess completely failed with return code of 0
cmd: ['/usr/bin/python', '/home/lorenz/src/extern/pygame/trunk/test/test_utils/test_runner.py', 'test.midi_test', '--exclude', 'interactive,subprocess_ignore', '--timings', '1'] test_env: {'USER': 'lorenz', 'DCCC_PATH': '/usr/lib64/distcc/bin', 'LESS': '-R -M --shift 5', 'KDE_SESSION_VERSION': '4', 'LESSCOLOR': '1', 'WINDOWPATH': '7', 'LESSOPEN': '|lesspipe.sh %s', 'CVS_RSH': 'ssh', 'STRIGI_PLUGIN_PATH': '/usr/lib64/strigi:', 'OPENGL_PROFILE': 'nvidia', 'DM_CONTROL': '/var/run/xdmctl', 'PATH': '/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/i686-pc-linux-gnu/gcc-bin/4.3.3:/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.3:/usr/games/bin', 'XCURSOR_THEME': 'Oxygen_Black', 'MAKEFLAGS': '', 'KDE_FULL_SESSION': 'true', 'LANG': 'en_US.UTF-8', 'INFOPATH': '/usr/share/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.19.1/info:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.3/info:/usr/share/info/emacs-22', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'COLORFGBG': '15;0', 'JDK_HOME': '/etc/java-config-2/current-system-vm', 'LANGUAGE': '', 'SESSION_MANAGER': 'local/horst:@/tmp/.ICE-unix/6395,unix/horst:/tmp/.ICE-unix/6395', 'XDG_DATA_DIRS': '/usr/share:/usr/local/share:/usr/share', 'CONFIG_PROTECT_MASK': '/etc/gentoo-release /etc/sandbox.d /etc/env.d/java/ /etc/udev/rules.d /etc/fonts/fonts.conf /etc/gconf /etc/terminfo /etc/ca-certificates.conf /etc/texmf/web2c /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/revdep-rebuild', 'DISTCC_LOG': '', 'HG': '/usr/bin/hg', 'LESSCOLORIZER': 'pygmentize', 'WINDOWID': '52428871', 'EDITOR': '/bin/nano', 'MANPATH': '/etc/java-config-2/current-system-vm/man:/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.19.1/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.3/man:/etc/java-config/system-vm/man/', 'DISTCC_VERBOSE': '', 'LOGNAME': 'lorenz', 'JAVA_HOME': '/etc/java-config-2/current-system-vm', 'HOME': '/home/lorenz', 'KONSOLE_DBUS_SESSION': '/Sessions/2', 'SANE_CONFIG_DIR': '/etc/sane.d', 'MAKELEVEL': '1', 'QT_PLUGIN_PATH': '/home/lorenz/.kde4/lib64/kde4/plugins/:/usr/lib64/kde4/plugins/', 'PROFILEHOME': '', 'KONSOLE_DBUS_SERVICE': ':1.73', 'KDE_SESSION_UID': '1000', 'XDM_MANAGED': 'method=classic', 'GCC_SPECS': '', 'GTK2_RC_FILES': '/etc/gtk-2.0/gtkrc:/home/lorenz/.gtkrc-2.0::/home/lorenz/.kde4/share/config/gtkrc-2.0', 'GS_LIB': '/home/lorenz/.fonts', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-F7rSYb3MqZ,guid=fa04ebb86b855c79686195374a4b8c22', '_': '/usr/bin/make', 'XDG_SESSION_COOKIE': '51ecdf246d5072ed2ec79a68493b971f-1246465039.504142-833156469', 'DESKTOP_SESSION': 'KDE-4', 'LS_COLORS':
'rs=0:di=01;34:ln=01;36:hl=44;37:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.axv=01;35:*.anx=01;35:
*.

ogv=01;35:*.ogx=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:', 'XDG_CONFIG_DIRS': '/etc/xdg', 'JAVAC': '/etc/java-config-2/current-system-vm/bin/javac', 'ANT_HOME': '/usr/share/ant', 'GDK_USE_XFT': '1', 'MFLAGS': '', 'CONFIG_PROTECT': '/usr/share/config', 'SHLVL': '2', 'PWD': '/home/lorenz/src/extern/pygame/trunk', 'SGML_CATALOG_FILES': '/etc/sgml/sgml-docbook-3.1.cat:/etc/sgml/sgml-ent.cat:/etc/sgml/sgml-lite.cat:/etc/sgml/dsssl-docbook-stylesheets.cat:/etc/sgml/xml-docbook-4.2.cat:/etc/sgml/openjade-1.3.2.cat:/etc/sgml/sgml-docbook.cat', 'DESKTOP_STARTUP_ID': '', 'GTK_RC_FILES': '/etc/gtk/gtkrc:/home/lorenz/.gtkrc::/home/lorenz/.kde4/share/config/gtkrc', 'DISPLAY': ':0.0', 'XDG_MENU_PREFIX': 'kde-4.2-', 'KDE_MULTIHEAD': 'false', 'PAGER': '/usr/bin/less', 'USB_DEVFS_PATH': '/dev/bus/usb'}
working_dir: /home/lorenz/src/extern/pygame/trunk
return (top 5 lines):
loading test.midi_test


======================================================================
FAIL: SurfaceTypeTest.test_flags
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lorenz/src/extern/pygame/trunk/test/surface_test.py", line 104, in test_flags
self.failUnlessRaises(ValueError, make_surf, 32, 0, masks)
AssertionError: ValueError not raised

----------------------------------------------------------------------
Ran 405 tests in 17.614s

FAILED (failures=7, errors=1)