mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-07 19:36:06 +00:00

Add a function to make it easier to debug a test failure caused by an unexpected state. Currently, tests are using assertEqual which results in a cryptic error message: "AssertionError: 5 != 10". Even when a test provides a message to make it clear why a particular state is expected, you still have to figure out which of the two was the expected state, and what the other value corresponds to. We have a function in lldbutil that helps you convert the state number into a user readable string. This patch adds a wrapper around assertEqual specifically for comparing states and reporting better error messages. The aforementioned error message now looks like this: "AssertionError: stopped (5) != exited (10)". If the user provided a message, that continues to get printed as well. Differential revision: https://reviews.llvm.org/D127355