]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 5160: Test suite fails with -flto=auto (#897)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 2 Jul 2022 14:09:16 +0000 (14:09 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 2 Jul 2022 14:09:25 +0000 (14:09 +0000)
commit27685efafa1108ccbcba99ec63e78427ee920f3c
treef40e974ff001f7fdc687b9612915440f934a7ee9
parentdfbef72d3e433d5bf64abae5905f6245f10e2b1f
Bug 5160: Test suite fails with -flto=auto (#897)

    FAIL: tests/testStore
    Test name: testStoreHashIndex::testSearch
        - check failed: setHow_ != optUnspecified
        exception location: ../src/base/YesNoNone.h(48) operator bool

Segmentation fault in tests/testStore is another symptom.

testStoreHashIndex calls Store::Root().init() which eventually gets to
MemStore::Requested() which correctly requires Config.memShared to be
configured. Hack the missing configuration replacement, following the
inconsistent pattern in three other test suites.

Similarly, Store::Disks::init() needs Config.store_dir_select_algorithm.

TODO: Reduce configuration code duplication and such bugs by providing
initialization method(s) for all Store::Root()-using tests to (re)use.

What does LTO have to do with any of it? CPPUnit [allegedly] randomizes
execution of test suites using raw C++ pointers, and a test suite in the
testStore collection probably contains the right initialization code.
Unfortunately, Config initialization is evidently shared across test
suites (XXX). LTO evidently changes those raw pointer values enough to
change the order in an unfortunate way.

[allegedly]: https://sourceforge.net/p/cppunit/bugs/182/
src/tests/testStoreHashIndex.cc