Bug #479
test_utils 5.1.2~dr2 failure on powerpc
Start date:
02.01.2014
Due date:
Estimated time:
Affected version:
dr|rc|master
Resolution:
Fixed
Description
In addition to test_chuck, test_utils is also failing on powerpc:
Running suite 'utils': Running case 'objects': + Running case 'return functions': + Running case 'timeval_add_ms': + Running case 'htoun,untoh': ++ Running case 'round': + Running case 'string helper': +++++++++ Running case 'memxor': ++ Running case 'memstr': ++++++++++++ Running case 'translate': ++++++++++++ Running case 'printf_hooks': +-+-+-++++++++++++++++ Failure in 'test_time_printf_hook': buf != time_data[_i].out ("--- -- --:--:-- ----" != "--- -- --:--:-- UTC ----") (suites/test_utils.c:411, i = 1) Failure in 'test_time_printf_hook': buf != time_data[_i].out ("Jan 01 01:00:01 1970" != "Jan 01 00:00:01 UTC 1970") (suites/test_utils.c:411, i = 3) Failure in 'test_time_printf_hook': buf != time_data[_i].out ("Jul 01 15:43:16 2012" != "Jul 01 13:43:16 UTC 2012") (suites/test_utils.c:411, i = 5) Running case 'mark_from_string': +++++++++++++++++ Passed 10/11 'utils' test cases
Full build log: https://launchpadlibrarian.net/161458607/buildlog_ubuntu-trusty-powerpc.strongswan_5.1.2~dr2-0ubuntu1_FAILEDTOBUILD.txt.gz
Associated revisions
History
#1 Updated by Tobias Brunner over 8 years ago
- Tracker changed from Issue to Bug
- Category set to testing
- Status changed from New to Resolved
- Assignee set to Tobias Brunner
- Target version set to 5.1.2
- Resolution set to Fixed
The call in the test case, and in other places where the custom printf-specifier %T
is used, is as follows:
len = snprintf(buf, sizeof(buf), "%T", &time_data[_i].in, time_data[_i].utc);
Where the second argument after the format string is of type bool
, which gets automatically promoted to an int
.
The problem is that the callback function for this custom printf specifier did this:
bool utc = *((bool*)(args[1]));
It assumes it gets a pointer to a bool
, which is incorrect and is an issue on big-endian machines with bool
shorter than int
(most commonly the case) where the actual value got cut off by the cast.
Fixed with the associated commit.
#2 Updated by Tobias Brunner over 8 years ago
- Status changed from Resolved to Closed
utils: Fix %T printf hook on big-endian systems
The cast to a bool* cut of the actual value on big-endian systems
if bool was shorter than int because the bool argument to printf gets
promoted to an int.
Fixes #479.