Merge bitcoin/bitcoin#29907: test: Fix test/streams_tests.cpp compilation on SunOS / illumos

976e5d8f7b2bc77cb1443b8bf0f38cb07db70e9b test: Fix `test/streams_tests.cpp` compilation on SunOS / illumos (Hennadii Stepanov)

Pull request description:

  On systems where `int8_t` is defined as `char`, the `{S,Uns}erialize(Stream&, signed char)` functions become undefined.

  This PR resolves the issue by testing `{S,Uns}erialize(Stream&, int8_t)` instead.

  No behavior change on systems where `int8_t` is defined as `signed char`, which is the case for most other systems.

  Fixes https://github.com/bitcoin/bitcoin/issues/29884.

  An alternative approach is mentioned in https://github.com/bitcoin/bitcoin/issues/29884#issuecomment-2058434577 as well.

ACKs for top commit:
  maflcko:
    lgtm ACK 976e5d8f7b2bc77cb1443b8bf0f38cb07db70e9b
  theuni:
    ACK 976e5d8f7b2bc77cb1443b8bf0f38cb07db70e9b. Nice to have the serialization concept actually tested :)

Tree-SHA512: 1033863e584fa8e99a281b236fa01fc919f610a024bcec792116762e28c1c16ee481bd01325c3a0ca9dd9d753176aa63bd9ac7e08a9bbce772db2949d06f6e61
This commit is contained in:
merge-script 2024-05-04 09:07:44 +08:00 committed by pasta
parent 23f25a94fa
commit 61a5832a6a
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38

View File

@ -85,8 +85,8 @@ BOOST_AUTO_TEST_CASE(streams_vector_reader)
BOOST_CHECK_EQUAL(reader.size(), 5U);
BOOST_CHECK(!reader.empty());
// Read a single byte as a signed char.
signed char b;
// Read a single byte as a int8_t.
int8_t b;
reader >> b;
BOOST_CHECK_EQUAL(b, -1);
BOOST_CHECK_EQUAL(reader.size(), 4U);