Skip to content

refactor: Move TestSink to src/test_helpers #8005

Description

@mvadari

Summary

Follow-up to a review comment on #7012: #7012 (comment)

That PR introduces src/test_helpers/ as the home for test helpers shared across the test and benchmark binaries (starting with TempDir.h, moved out of include/xrpl/beast/utility/temp_dir.h). TestSink should be moved there as well.

Current state

TestSink lives in the gtest-only helper directory:

  • src/tests/libxrpl/helpers/TestSink.h
  • src/tests/libxrpl/helpers/TestSink.cpp

and is included as <helpers/TestSink.h> by, among others:

  • src/tests/libxrpl/basics/KeyCache.cpp
  • src/tests/libxrpl/basics/TaggedCache.cpp
  • src/tests/libxrpl/consensus/Consensus.cpp
  • src/tests/libxrpl/net/HTTPClient.cpp
  • src/tests/libxrpl/nodestore/Database.cpp
  • src/tests/libxrpl/peerfinder/Livecache.cpp
  • src/tests/libxrpl/shamap/SHAMap.cpp

Because it sits under src/tests/libxrpl/helpers, it is only reachable from the xrpl_tests target, so the older src/test suites cannot use it.

Proposed change

  1. Move TestSink.h/TestSink.cpp to src/test_helpers/.
  2. Update the includes to <test_helpers/TestSink.h> and adjust the xrpl_tests source list in src/tests/libxrpl/CMakeLists.txt.
  3. Make sure the isolate_headers/include wiring added in refactor: Replace boost::filesystem with std::filesystem across the codebase #7012 exposes it to the other test and benchmark targets that need it.

Optional cleanup

There are two unrelated, locally-defined TestSink classes that could be consolidated onto the shared one once it is generally reachable:

  • src/test/beast/beast_Journal_test.cpp:11
  • src/test/server/Server_test.cpp:79

Note these have different semantics (severity threshold, suite-reporting), so consolidation may not be a straight substitution.

Blocked on

#7012 landing first, since src/test_helpers/ does not exist on develop yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions