We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2448 - testautomation failure of case platform_testSetErrorInvalidInput on cygwin
Summary: testautomation failure of case platform_testSetErrorInvalidInput on cygwin
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: thread (show other bugs)
Version: 2.0.3
Hardware: x86_64 Windows 7
: P2 minor
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-12 15:27 UTC by Andreas Schiffler
Modified: 2017-10-28 11:56 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schiffler 2014-03-12 15:27:15 UTC
SDL_SetError with NULL input prevents subsequent SDL_SetError calls until SDL_ClearError has been called. I suspect some issue in the TLS implementation - maybe specific to cygwin - which is used to store the error string.

Repro:
./testautomation --seed 0MQVAR556AUAIGMM --filter platform_testSetErrorInvalidInput

INFO:  03/12/14 08:23:56: Test Description: 'Tests SDL_SetError with invalid input'
INFO:  03/12/14 08:23:56: Test Iteration 1: execKey 5943290658402602649
INFO:  03/12/14 08:23:56: Assert 'SDL_ClearError()': Pass
INFO:  03/12/14 08:23:56: Assert 'SDL_SetError()': Pass
INFO:  03/12/14 08:23:56: Assert 'SDL_SetError: expected -1, got: -1': Passed
INFO:  03/12/14 08:23:56: Assert 'SDL_GetError() != NULL': Passed
INFO:  03/12/14 08:23:56: Assert 'SDL_GetError(): expected message len 0, was len: 0': Passed
INFO:  03/12/14 08:23:56: Assert 'SDL_GetError(): expected message '', was message: ''': Passed
INFO:  03/12/14 08:23:56: Assert 'SDL_SetError()': Pass
INFO:  03/12/14 08:23:56: Assert 'SDL_SetError: expected -1, got: -1': Passed
---> Here the test case sets the string "Testing"

INFO:  03/12/14 08:23:56: Assert 'SDL_SetError()': Pass
INFO:  03/12/14 08:23:56: Assert 'SDL_SetError: expected -1, got: -1': Passed
---> Here the test case sets the string NULL which should be a NoOp

INFO:  03/12/14 08:23:56: Assert 'SDL_GetError() != NULL': Passed
ERROR: 03/12/14 08:23:56: Assert 'SDL_GetError(): expected message len 7, was len: 0': Failed
ERROR: 03/12/14 08:23:56: Assert 'SDL_GetError(): expected message 'Testing', was message: ''': Failed
---> Failure here as "Testing" was not returned

INFO:  03/12/14 08:23:56: Assert 'SDL_ClearError()': Pass
INFO:  03/12/14 08:23:56: Assert 'SDL_SetError()': Pass
INFO:  03/12/14 08:23:56: Assert 'SDL_SetError: expected -1, got: -1': Passed
INFO:  03/12/14 08:23:56: Assert 'SDL_GetError() != NULL': Passed
---> Here the test case sets the string "Testing" after Clear was called

INFO:  03/12/14 08:23:56: Assert 'SDL_GetError(): expected message len 7, was len: 7': Passed
INFO:  03/12/14 08:23:56: Assert 'SDL_GetError(): expected message 'Testing', was message: 'Testing'': Passed
INFO:  03/12/14 08:23:56: Assert 'SDL_ClearError()': Pass
ERROR: 03/12/14 08:23:56: Assert Summary: Total=20 Passed=18 Failed=2
INFO:  03/12/14 08:23:56: Total Test runtime: 0.0 sec


Full Repro Steps:
cd build
../configure --disable-haptic --disable-joystick
make
make install
cd ../test
make clean
make
./testautomation --seed 0MQVAR556AUAIGMM --filter platform_testSetErrorInvalidInput


$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/4.8.2/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc4/gcc-4.8.2-2/src/gcc-4.8.2/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc4/gcc-4.8.2-2/src/gcc-4.8.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --disable-__cxa_atexit --with-dwarf2 --with-arch=i686 --with-tune=generic --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libjava --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --libexecdir=/usr/lib
Thread model: posix
gcc version 4.8.2 (GCC)
Comment 1 Ryan C. Gordon 2015-02-19 06:32:16 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry
if you got a lot of email from this. This is to help me sort through some bugs
in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4,
though!
Comment 2 Juha Niemimäki 2017-10-28 09:57:24 UTC
Now there is another test failure when NULL ptr is passed. SDL2 seems to put "(null)" string into error message in such a case, thus string length becomes 6. Tested on AmigaOS 4 (PowerPC) and Linux Mint (x86_64).

./testautomation --filter platform_testSetErrorInvalidInput

INFO:  10/28/17 12:51:22: ----- Test Case 8.10: 'platform_testSetErrorInvalidInput' started
INFO:  10/28/17 12:51:22: Test Description: 'Tests SDL_SetError with invalid input'
INFO:  10/28/17 12:51:22: Test Iteration 1: execKey 116539865576515858
INFO:  10/28/17 12:51:22: Assert 'SDL_ClearError()': Pass
INFO:  10/28/17 12:51:22: Assert 'SDL_SetError()': Pass
INFO:  10/28/17 12:51:22: Assert 'SDL_SetError: expected -1, got: -1': Passed
INFO:  10/28/17 12:51:22: Assert 'SDL_GetError() != NULL': Passed
ERROR: 10/28/17 12:51:22: Assert 'SDL_GetError(): expected message len 0, was len: 6': Failed
INFO:  10/28/17 12:51:22: Assert 'SDL_SetError('Testing')': Pass
INFO:  10/28/17 12:51:22: Assert 'SDL_SetError: expected -1, got: -1': Passed
INFO:  10/28/17 12:51:22: Assert 'SDL_SetError(NULL)': Pass
INFO:  10/28/17 12:51:22: Assert 'SDL_SetError: expected -1, got: -1': Passed
INFO:  10/28/17 12:51:22: Assert 'SDL_GetError() != NULL': Passed
ERROR: 10/28/17 12:51:22: Assert 'SDL_GetError(): expected message len 0, was len: 6': Failed
INFO:  10/28/17 12:51:22: Assert 'SDL_ClearError()': Pass
INFO:  10/28/17 12:51:22: Assert 'SDL_SetError()': Pass
INFO:  10/28/17 12:51:22: Assert 'SDL_SetError: expected -1, got: -1': Passed
INFO:  10/28/17 12:51:22: Assert 'SDL_GetError() != NULL': Passed
INFO:  10/28/17 12:51:22: Assert 'SDL_GetError(): expected message len 7, was len: 7': Passed
INFO:  10/28/17 12:51:22: Assert 'SDL_GetError(): expected message 'Testing', was message: 'Testing'': Passed
INFO:  10/28/17 12:51:22: Assert 'SDL_ClearError()': Pass
ERROR: 10/28/17 12:51:22: Assert Summary: Total=18 Passed=16 Failed=2
INFO:  10/28/17 12:51:22: Total Test runtime: 0.0 sec
ERROR: 10/28/17 12:51:22: >>> Test 'platform_testSetErrorInvalidInput': Failed