Skip to content

Prevent mutating global variables in tests.#12190

Merged
trivialfis merged 1 commit into
dmlc:masterfrom
trivialfis:fix-cfg-test
Apr 29, 2026
Merged

Prevent mutating global variables in tests.#12190
trivialfis merged 1 commit into
dmlc:masterfrom
trivialfis:fix-cfg-test

Conversation

@trivialfis
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures unit tests don’t leave the process-wide (thread-local) global configuration in a mutated state after they run, preventing cross-test interference.

Changes:

  • Add RAII cleanup guards to restore GlobalConfigThreadLocalStore after tests that modify it.
  • Include src/common/utils.h to use common::MakeCleanup for the guard.
  • Update the test file’s copyright year.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@trivialfis trivialfis requested a review from RAMitchell April 28, 2026 18:27
@trivialfis trivialfis merged commit b6eb1ed into dmlc:master Apr 29, 2026
84 checks passed
@trivialfis trivialfis deleted the fix-cfg-test branch April 29, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants