Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#1142 closed defect (fixed)

[PATCH] TestCLogger::test_unicode() failure on FreeBSD

Reported by: historic_bruno Owned by: leper
Priority: Nice to Have Milestone: Alpha 18
Component: Core engine Keywords: freebsd patch
Cc: Patch:

Description

Running 258 tests............................................................................................................APIC: all zero
..............................................................................................................
In TestCLogger::test_unicode:
../../../source/ps/tests/../../../source/ps/tests/test_CLogger.h:100: Error: Expected (lines[0] == "\xC3\xA2 \xC4\xA7"), found ("" != �� ��)
.......................................
Failed 1 of 258 tests
Success rate: 99%

Attachments (1)

test_setup.cpp.patch (433 bytes ) - added by Teiresias 9 years ago.
Enable vswprintf-calls for Unicode in test project/*BSD-projects

Download all attachments as: .zip

Change History (4)

by Teiresias, 9 years ago

Attachment: test_setup.cpp.patch added

Enable vswprintf-calls for Unicode in test project/*BSD-projects

comment:1 by Teiresias, 9 years ago

Keywords: review patch added
Milestone: BacklogAlpha 18
Summary: TestCLogger::test_unicode() failure on FreeBSD[PATCH] TestCLogger::test_unicode() failure on FreeBSD

CLogger::LogMessage calls vswprintf. In FreeBSD, this is implemented by a call to __vfwprintf (via vswprintf_l) using a fake FILE structure followed by mbsrtowcs_l (see /usr/src/lib/libc/stdio/vswprintf.c) on the output and thus dependant on the locale setting.

When setlocale/2 has not been called, the default seems to be C/ascii which allows only code points 0-FFh to pass through. In the test case mentioned, this behavior causes an unnoticed EILSEQ error.

Apparently, this bug has been fixed in GameState.cpp already and was not copied over into the test project, see associated patch.

(Fix is simple but finding the cause took ages of grep-ing through the libc sources and multiple test programs... :-(

comment:2 by leper, 9 years ago

Owner: set to leper
Resolution: fixed
Status: newclosed

In 16058:

Call setlocale(3) on BSDs so that we can log unicode strings. Patch by Teiresias. Fixes #1142.

comment:3 by leper, 9 years ago

Keywords: review removed

Excellent research! Thanks for the patch.

Note: See TracTickets for help on using tickets.