Skip to content

unit/zap: add MT_MATCH_CASE mixed-case test#18638

Merged
behlendorf merged 1 commit into
openzfs:masterfrom
chrislongros:unit/zap-lookup-norm
Jun 24, 2026
Merged

unit/zap: add MT_MATCH_CASE mixed-case test#18638
behlendorf merged 1 commit into
openzfs:masterfrom
chrislongros:unit/zap-lookup-norm

Conversation

@chrislongros

@chrislongros chrislongros commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Adds MT_MATCH_CASE coverage for MT_NORMALIZE lookups that miss from #18654

Description

Adds test_norm_match_case, run against a normalizing microzap and fatzap.

  • MT_NORMALIZE: a differently-cased name matches.
  • MT_NORMALIZE | MT_MATCH_CASE: only the stored casing matches; differently-cased name does not.

How Has This Been Tested?

Built tests/unit/test_zap and ran the suite:

>  make unit T=zap TOPT='zap.norm_match_case'
  UNITTEST tests/unit/test_zap
Running test suite with seed 0x071ebff6...
zap.norm_match_case
  type=micro                         [ OK    ] [ 0.00002834 / 0.00002752 CPU ]
  type=fat                           [ OK    ] [ 0.00003386 / 0.00003302 CPU ]
2 of 2 (100%) tests successful, 0 (0%) test skipped.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Documentation (a change to man pages or other documentation)

Checklist:

@chrislongros chrislongros force-pushed the unit/zap-lookup-norm branch 2 times, most recently from a85e716 to e996a60 Compare June 6, 2026 15:29
@behlendorf behlendorf requested a review from robn June 6, 2026 17:39
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Jun 6, 2026
Comment thread tests/unit/test_zap.c Outdated
@robn

robn commented Jun 9, 2026

Copy link
Copy Markdown
Member

These are my tests for zap_lookup_norm/zap_remove_norm: robn/zap-unit-casenorm. They also exercise the Unicode normalization forms and the conflict API. I was actually going to post the PR for these today, but this one turned up over the weekend :)

(Incidentally, this was the reason I started putting all this test stuff together - I started looking at #7633 and traced it into the ZAP guts, and had no confidence about changing anything without breaking something else).

@chrislongros similar question to #18639 - do you want to go first and I'll follow, or combine them, or something else?

@chrislongros

Copy link
Copy Markdown
Contributor Author

These are my tests for zap_lookup_norm/zap_remove_norm: robn/zap-unit-casenorm. They also exercise the Unicode normalization forms and the conflict API. I was actually going to post the PR for these today, but this one turned up over the weekend :)

(Incidentally, this was the reason I started putting all this test stuff together - I started looking at #7633 and traced it into the ZAP guts, and had no confidence about changing anything without breaking something else).

@chrislongros similar question to #18639 - do you want to go first and I'll follow, or combine them, or something else?

The mock functions you introduce are the right direction! Go ahead and I'll follow.

@robn robn mentioned this pull request Jun 9, 2026
14 tasks
@robn

robn commented Jun 9, 2026

Copy link
Copy Markdown
Member

@chrislongros thank you! #18654 posted.

@behlendorf

behlendorf commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@chrislongros the path is clear!

New case-normalization test to cover the exact-case path. On a TOUPPER
ZAP, MT_NORMALIZE | MT_MATCH_CASE matches only the stored casing, while
an MT_NORMALIZE lookup matches any case.

Signed-off-by: Christos Longros <chris.longros@gmail.com>
@chrislongros chrislongros force-pushed the unit/zap-lookup-norm branch from e996a60 to 7e7a278 Compare June 10, 2026 16:56
@chrislongros chrislongros changed the title unit/zap: zap_lookup_norm unit/zap: add MT_MATCH_CASE mixed-case test Jun 10, 2026

@robn robn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great, thanks.

Turns out that U8_TEXTPREP_TOUPPER is actually valid for the Unicode normalization forms too, and MT_MATCH_CASE also defangs that. I don't think its worth adding that here unless you especially wanted to; it's already kind of unclear what any of this means for ZFS proper (vs u8_textprep itself). I'll be down that way soon, I think.

@behlendorf behlendorf left a comment

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.

Looks good. Sorry about the delay in taking another look at this.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Jun 24, 2026
@behlendorf behlendorf merged commit ca24d0a into openzfs:master Jun 24, 2026
42 of 47 checks passed
@behlendorf behlendorf mentioned this pull request Jun 25, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Accepted Ready to integrate (reviewed, tested)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants