Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test failure on big endian archs with 0.15.3 #132

Closed
jcfp opened this issue Jan 5, 2016 · 4 comments

Comments

@jcfp
Copy link
Contributor

commented Jan 5, 2016

Hi,

After updating re2c in debian to 0.15.3, building the executable works fine on all architectures (with some compiler warnings in the Wconversion, Wsign-conversion and Wformat departments) but unfortunately 3 out of 976 tests do not pass on any big endian arch (mips, powerpc, s390x, hppa). See build logs here or here. The BE archs whose builds appear to succeed (m68k, sparc64) only do so because their build daemons skipped the test-suite. None of the little endian builders failed the test-suite.

Due to an slight oversight on my end the debian build logs don't show the content of the test-suite.log, so I had to resort to running an emulated BE system (debian jessie on mips) in qemu to reproduce the issue. Log and files of the failed tests linked below originate from there. The failed tests are:

FAIL       repeat-07_default.gir--skeleton.re
FAIL       unicode_blocks.u--skeleton--encoding-policy(ignore).re
FAIL       unicode_blocks.x--skeleton--encoding-policy(ignore).re

I assume it's these very same tests that also fail on the build daemons (all running debian unstable). A quick inspection of the *.c.diff files shows parts with byte order reversed like this:

screenshot

Test-suite.log and retained test files are available here. If you need more info let me know!

@skvadrik skvadrik added this to the 0.16 milestone Jan 5, 2016

@skvadrik skvadrik self-assigned this Jan 5, 2016

@skvadrik

This comment has been minimized.

Copy link
Owner

commented Jan 5, 2016

Reproduced failures on powerpc64. Those tests probably failed because they store binary data in native endianness (native to amd64, as it happens to be my host platform). Should be easy to fix.

Thanks for a detailed report!

skvadrik added a commit that referenced this issue Jan 7, 2016

Serialize '--skeleton' generated data in little-endian.
This commit fixes bug #132 "test failure on big endian archs with 0.15.3".

Tests failed because re2c with '--skeleton' option used host endianness
when serializing binary data to file. Expected test result was generated
on little-endian arch, while actual test was run on big-endian arch.

Only three tests failed (out of ~40 tests that are always run with
'--skeleton'), because in most cases data unit is 1 byte and endianness
doesn't matter.

The fix: re2c now converts binary data from host-endian to little-endian
before dumping it to file. Skeleton programs convert data back from
little-endian to host-endian when reading it from file (iff data unit
size is greater than 1 byte).
@skvadrik

This comment has been minimized.

Copy link
Owner

commented Jan 7, 2016

Fixed in this commit: de094eb (tested on powerpc64). Fix will be included in re2c-0.16.

@jcfp

This comment has been minimized.

Copy link
Contributor Author

commented Jan 7, 2016

Thanks!

Do you have an ETA for 0.16 in mind? Not meaning to pressure you here, but just so I know whether it makes sense to wait or backport the bugfix to the 0.15.3 package.

@skvadrik

This comment has been minimized.

Copy link
Owner

commented Jan 7, 2016

I plan to release 0.16 in a couple of weeks. I think the fix can wait - it only affects tests (everything else works fine on big-endian platforms, including --skeleton switch).

skvadrik added a commit that referenced this issue Jan 11, 2016

Serialize '--skeleton' generated data in little-endian.
This commit fixes bug #132 "test failure on big endian archs with 0.15.3".

Tests failed because re2c with '--skeleton' option used host endianness
when serializing binary data to file. Expected test result was generated
on little-endian arch, while actual test was run on big-endian arch.

Only three tests failed (out of ~40 tests that are always run with
'--skeleton'), because in most cases data unit is 1 byte and endianness
doesn't matter.

The fix: re2c now converts binary data from host-endian to little-endian
before dumping it to file. Skeleton programs convert data back from
little-endian to host-endian when reading it from file (iff data unit
size is greater than 1 byte).

@jcfp jcfp closed this Jan 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.