sierrafoxtrot/srecord

Fail in test t0260a.sh on msys2

Closed this issue · 6 comments

The following test contributed by @marcows in PR from #6 runs perfectly on linux including github CI. Appears to fail under windows/msys2. No analysis yet.

$ ctest --rerun-failed --output-on-failure
Test project C:/msys64/home/scott/work/srecord-cmake/build
    Start 210: t0260a.sh: "random fill near end of address space"
1/1 Test #210: t0260a.sh: "random fill near end of address space" ...***Failed    0.69 sec
5c5
<         FFFFFFFF - FFFFFFFFFFFFFFFF
---
>         FFFFFFFF - FFFFFFFF
FAILED test of random fill near end of address space


0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.73 sec

The following tests FAILED:
        210 - t0260a.sh: "random fill near end of address space" (Failed)
Errors while running CTest

jtxa commented

Probably some 32/64-bit problem?
Or the different 64-bit data models between Windows and Linux.

That's my guess too.

jtxa commented

This is a duplicate to #10

Thanks @jtxa . Confirmed. Unsure as to why it showed up as a failure on my windows machine. Likely a merge problem at my end.

jtxa commented

It's because of the unsigned long, which is 32-bit on 32-Bit Linux and 32/64-Bit Windows. But on 64-Linux it is 64-bit.
The end address is calculated as 0-1 causing an underflow, resulting in the maximum value of the data type.

This code:

            unsigned long hi = tmp.get_highest();
            ...
            snprintf(buf, sizeof(buf), "%0*lX", prec, hi - 1);

Understood. I was certain I had run the correct PR on the windows machine but was still showing up this single fault. But great that we have a fix for the underlying bug.