-
Notifications
You must be signed in to change notification settings - Fork 18
Add comparison rule, tolerance if applicable, and hex64 view to test failure text output #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
796dd2e
add comparison rule, tolerance if applicable, and hex64 view to test …
bob80905 d2f03d1
make sure hex representation is correct
bob80905 1dccd9c
address build errors
bob80905 21c5b1e
fix typo
bob80905 78467e7
print as strings, use standard hex float format for C++
bob80905 d9ee686
try applying clangformat
bob80905 db2f5ea
clang format
bob80905 cde6fee
add hex data text after the yaml
bob80905 f8fd606
try clang-format
bob80905 7a7634a
address build errors
bob80905 edb7c30
use std::hex for exact tests
bob80905 bb0b384
address Alex
bob80905 0d167eb
address Alex + Finn
bob80905 4bc8e29
fix missing output props bug
bob80905 72bd6d8
use appropriate variable naming rules
bob80905 2a9c56b
clarify comment
bob80905 33d3eac
more variable rule fixes
bob80905 2517d5e
more build errors
bob80905 d2f8e25
prefix hex values with 0x
bob80905 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,26 +268,34 @@ static bool testBufferFloatULP(offloadtest::Buffer *B1, offloadtest::Buffer *B2, | |
} | ||
|
||
llvm::Error verifyResult(offloadtest::Result R) { | ||
llvm::SmallString<256> TestRuleStr; | ||
llvm::raw_svector_ostream TestRuleOStr(TestRuleStr); | ||
switch (R.ComparisonRule) { | ||
case offloadtest::Rule::BufferExact: { | ||
if (testBufferExact(R.ActualPtr, R.ExpectedPtr)) | ||
return llvm::Error::success(); | ||
TestRuleOStr << "Comparison Rule: BufferExact\n"; | ||
break; | ||
} | ||
case offloadtest::Rule::BufferFloatULP: { | ||
if (testBufferFloatULP(R.ActualPtr, R.ExpectedPtr, R.ULPT, R.DM)) | ||
return llvm::Error::success(); | ||
TestRuleOStr << "Comparison Rule: BufferFloatULP\nULP: " << R.ULPT << "\n"; | ||
break; | ||
} | ||
case offloadtest::Rule::BufferFloatEpsilon: { | ||
if (testBufferFloatEpsilon(R.ActualPtr, R.ExpectedPtr, R.Epsilon, R.DM)) | ||
return llvm::Error::success(); | ||
TestRuleOStr << "Comparison Rule: BufferFloatEpsilon\nEpsilon: " | ||
<< R.Epsilon << "\n"; | ||
break; | ||
} | ||
} | ||
llvm::SmallString<256> Str; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor nit: Would it make sense to move the declarations of Str and OS to the beginning of this function and get rid of TestRuleStr and TestRuleOStr? Would probably want to increase the size of the llvm::SmallString in that case. |
||
llvm::raw_svector_ostream OS(Str); | ||
OS << "Test failed: " << R.Name << "\nExpected:\n"; | ||
OS << "Test failed: " << R.Name << "\n"; | ||
OS << TestRuleStr; | ||
OS << "Expected:\n"; | ||
llvm::yaml::Output YAMLOS(OS); | ||
YAMLOS << *R.ExpectedPtr; | ||
OS << "Got:\n"; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Do we want to add a test case of the correct error message output?
We could use
FileCheck
to ensure the hex values or whatnot are being formatted as expected