Skip to content
This repository has been archived by the owner on Jul 19, 2018. It is now read-only.

SetDesiredFailureMsg() doesn't handle the same message added twice #2639

Open
cdwfs opened this issue May 4, 2018 · 1 comment
Open

SetDesiredFailureMsg() doesn't handle the same message added twice #2639

cdwfs opened this issue May 4, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@cdwfs
Copy link
Contributor

cdwfs commented May 4, 2018

I recently hit a few cases writing unit tests where the same error is emitted 2+ times by a single API call. I tried adding multiple calls to SetDesiredFailureMsg() with the same VUID, but everything after the first occurrence was still treated as an unexpected error. I'm not sure if this is the expected behavior or not; @chrisforbes was surprised to hear it didn't work, but if this is an intentional restriction, feel free to ignore; I can easily rework the tests to emit multiple errors 1x times apiece.

Details: the messages / message IDs are inserted into a std::unordered_set, and a count is incremented. Adding a duplicate message has no effect on the set contents, but the count is still incremented. The first time the message is encountered, it's removed from the set, causing subsequent appearances to be treated as unexpected errors. If duplicate messages should be allowed, one possibility would be to replace the unordered_set a std::map<ID, count> or similar.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants