Unit tests fail with libpano13-2.9.21_rc2

42 views
Skip to first unread message

Robert Clausecker

unread,
Dec 6, 2021, 6:34:10 PM12/6/21
to hugi...@googlegroups.com
Greetings!

While preparing the FreeBSD port for libpano13 in preparation of the
upcoming 2.9.21 release, I noticed that the unit tests fail. This is
regardless of whether suitesparse is used or not. This is a regression
from 2.9.21_rc1 were all unit tests still passed. Please fix the unit
tests or the code before making the final release.

Yours,
Robert Clausecker

Test project /usr/home/fuz.ports/graphics/libpano13/work/.build
Start 1: simpleStitch
1/8 Test #1: simpleStitch ........................ Passed 0.74 sec
Start 2: simpleTiff16
2/8 Test #2: simpleTiff16 ........................ Passed 1.12 sec
Start 3: simpleTiff2psd-1-layer
3/8 Test #3: simpleTiff2psd-1-layer ..............***Failed 0.12 sec
Start 4: simpleTiff2psd-2-layers
4/8 Test #4: simpleTiff2psd-2-layers .............***Failed 0.12 sec
Start 5: simpleTiff2psd-1-layer-uncropped
5/8 Test #5: simpleTiff2psd-1-layer-uncropped ....***Failed 0.13 sec
Start 6: simpleTiff2psd-2-layers-uncropped
6/8 Test #6: simpleTiff2psd-2-layers-uncropped ...***Failed 0.13 sec
Start 7: simpleTiff16-16bit-1-layer
7/8 Test #7: simpleTiff16-16bit-1-layer ..........***Failed 0.13 sec
Start 8: simpleTiff16-16bit-2-layers
8/8 Test #8: simpleTiff16-16bit-2-layers .........***Failed 0.13 sec

25% tests passed, 6 tests failed out of 8

Total Test time (real) = 2.64 sec

The following tests FAILED:
3 - simpleTiff2psd-1-layer (Failed)
4 - simpleTiff2psd-2-layers (Failed)
5 - simpleTiff2psd-1-layer-uncropped (Failed)
6 - simpleTiff2psd-2-layers-uncropped (Failed)
7 - simpleTiff16-16bit-1-layer (Failed)
8 - simpleTiff16-16bit-2-layers (Failed)

T. Modes

unread,
Dec 9, 2021, 11:39:12 AM12/9/21
to hugin and other free panoramic software
fuz... schrieb am Dienstag, 7. Dezember 2021 um 00:34:10 UTC+1:
Greetings!

While preparing the FreeBSD port for libpano13 in preparation of the
upcoming 2.9.21 release, I noticed that the unit tests fail.

On which architecture, which compiler? Where there warning during compiling?

Between 2.9.21 rc1 and rc2 there were code added to automatically deduce the endianess of the system to fix test failures on different architectures.
After searching the internet there were already special code added for FreeBSD in panorama.h:
#if defined(__GNUC__) && !defined(__MINGW32__)
#if defined(__FreeBSD__)
#include <sys/endian.h>
#else
#include <endian.h>
#endif

Could you check if sys/endian.h (or files included from there) defines __BYTE_ORDER  and __BIG_ENDIAN.
If not, are they defined in machine/endian.h?

TIA

Robert Clausecker

unread,
Dec 13, 2021, 9:02:11 AM12/13/21
to hugin and other free panoramic software
Hello,

The architectures I tested were armv7 and arm64 on FreeBSD 13.  The compiler is clang 11.0.1.
FreeBSD defines _BYTE_ORDER but not __BYTE_ORDER.  Likewise, it defines _BIG_ENDIAN but not __BIG_ENDIAN.
You should be able to make your code work with something like this:

    #if defined(_BYTE_ORDER) && !defined(__BYTE_ORDER)
    # define __BYTE_ORDER _BYTE_ORDER
    #endif

I recommend patching the endianess detection code so it checks for the presence of the macros you want to test
in addition to using them (the C preprocessors substitutes 0 for undefined macros).  For example, try this:

    #if !defined(__BYTE_ORDER) || !defined(__BIG_ENDIAN)
    # error cannot determine byte order
    #endif

Also consider checking both for big and little endian instead of just assuming little endian if the big endian case does not apply.
This makes the code robust against architectures where the byte order is neither big nor little endian.

Also consider writing endian agnostic code instead of having separate code paths for both endianesses.  This also has
the effect of making the code compliant with the strict aliasing rule which your code does not seem to be.  For example,
you can use functions like these for accessing fields in files with a defined endianess without having to make assumptions
about the endianess of the architecture you are programming for:


This implementation compiles to reasonable code with modern gcc and clang and allows you to completely avoid
having to detect and deal with host endianess.

Yours,
Robert Clausecker

T. Modes

unread,
Dec 13, 2021, 11:28:45 AM12/13/21
to hugin and other free panoramic software
Thanks, I committed the necessary changes.


Bruno Postle

unread,
Dec 14, 2021, 7:31:09 PM12/14/21
to hugin and other free panoramic software
Tests pass ok on Linux arm7, i386, x86_64, arm64 with this latest change.

--
Bruno

T. Modes

unread,
Dec 15, 2021, 2:09:58 PM12/15/21
to hugin and other free panoramic software
Hi Bruno,

bruno schrieb am Mittwoch, 15. Dezember 2021 um 01:31:09 UTC+1:
Tests pass ok on Linux arm7, i386, x86_64, arm64 with this latest change.

thanks for testing and confirming. Sorry for the noise in the release cycle.

Thomas

Robert Clausecker

unread,
Dec 15, 2021, 2:24:54 PM12/15/21
to hugi...@googlegroups.com
Hi Bruno,

I can confirm that the tests pass on armv7 and arm64 FreeBSD 13, too.

Yours,
Robert Clausecker
Reply all
Reply to author
Forward
0 new messages