Skip to content

test(libfetchers): cover throwing comparisons in a set - #16786

Merged
xokdvium merged 1 commit into
NixOS:masterfrom
roberth:attr-comparison-tests
Nov 9, 2026
Merged

xokdvium merged 1 commit into
NixOS:masterfrom
roberth:attr-comparison-tests

Conversation

@roberth

@roberth roberth commented Nov 8, 2026

Copy link
Copy Markdown
Member

Extending #16731 tests, not exactly as requested - thank you @xokdvium for handling the PR.
Here's some small additions to consider.

Motivation

The input cache, a std::map keyed by Input, looks up and inserts with
such comparisons.

Implementation

×


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@roberth
roberth requested a review from xokdvium November 8, 2026 20:30
@roberth
roberth requested a review from edolstra as a code owner November 8, 2026 20:30
@roberth roberth added the fetching Networking with the outside (non-Nix) world, input locking label Nov 8, 2026
Comment thread src/libfetchers-tests/attrs.cc Outdated
Comment on lines +10 to +21
/* The left operand's operator does the comparison, so check both orders. */
#define EXPECT_EQ_SYMMETRICALLY(a, b) \
do { \
EXPECT_EQ(a, b); \
EXPECT_EQ(b, a); \
} while (0)

#define EXPECT_NE_SYMMETRICALLY(a, b) \
do { \
EXPECT_NE(a, b); \
EXPECT_NE(b, a); \
} while (0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe worth moving to libutil-test-support header?

Comparing lazy attributes forces them, so a comparison can throw.
As Sergei points out, it is not obvious that std::set behaves under a
comparator that throws
(NixOS#16430 (comment)).
The input cache, a std::map keyed by Input, looks up and inserts with
such comparisons.

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
Assisted-by: Claude Code (Claude Opus 5.5)
@roberth
roberth force-pushed the attr-comparison-tests branch from 23d7bcb to 8b3e3aa Compare November 9, 2026 09:15
@xokdvium
xokdvium added this pull request to the merge queue Nov 9, 2026
Merged via the queue into NixOS:master with commit 13751d2 Nov 9, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fetching Networking with the outside (non-Nix) world, input locking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants