]> 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)
committerAmos Jeffries <yadij@users.noreply.github.com>
Mon, 18 Jul 2022 07:46:45 +0000 (19:46 +1200)
commit8ac5bf96c7dc86595fe783d76b41a664ab987bf3
treea891f08b715bc9416356dcb7569c6fcad074b171
parentfca8b79b57014caba1d6850d1371025f02a17fd9
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