-
Notifications
You must be signed in to change notification settings - Fork 27
added agnosticPrintString to accompany new test suite #335
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
Conversation
|
corresponding tests.h functions: |
llvm/lib/CheerpWriter/PreExecute.cpp
Outdated
| return (void*)(void(*)())pre_execute_abs; | ||
| if (strcmp(funcName.c_str(), "assertEqualImpl") == 0) | ||
| return (void*)(void(*)())assertEqualImpl; | ||
| if (strcmp(funcName.c_str(), "agnosticPrintString") == 0) |
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.
and we should remove this. __preexecute_print_case is just a superset of it.
we should not use |
yuri91
left a comment
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.
looks good now, but please squash all the commits together and put a relevant commit message
4634a37 to
b3cf076
Compare
added agnosticPrintString function to preexecutor, allowing for strings to be printed from the preexecutor to conform more with lit testing suite. Validation logic can now be handled externally in the test.h file as follows:
void assertEqual(double value, double expected, double epsilon, const char* msg)
{
if (value >= expected - epsilon && value <= expected + epsilon){
char buffer[256];
sprintf(buffer, "%s%g", msg, value);
agnosticPrintString(buffer);
}
}
optionally, the validation logic can be ignored entirely as the lit CHECK lines will fail if output is incorrect.
This solution simplifies the process of output generation from tests, while still allowing for descriptive messaging showing point of failure in a given test.