Skip to content
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

Fix unit test terminating message not starting on new line #44257

Merged
merged 2 commits into from
Sep 19, 2020

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Sep 19, 2020

Summary

SUMMARY: None

Purpose of change

If an exception is thrown during test initialization before any other debug message is printed, the terminating message does not start on its own line.

Describe the solution

Use DebugLog instead of printf so messages always starts on their own line. Furthermore, print the exception message on its own line too so it can be captured by github problem matcher. Removed (?:Terminated: )? in the regexp of problem matcher since it's no longer needed.

Also, removed two lines of redundant code outputing the rand seed of unit test. The seed is already printed at the beginning of the test, and the removed lines did not check for zero value which means not seeding the random engines explicitly.

Testing

Ran the unit test and the terminating message is now on its own line.

@anothersimulacrum anothersimulacrum added the Code: Tests Measurement, self-control, statistics, balancing. label Sep 19, 2020
@ZhilkinSerg ZhilkinSerg merged commit 987bd4b into CleverRaven:master Sep 19, 2020
printf( "\nTreating result as failure due to error logged during tests.\n" );
printf( "Randomness seeded to: %u\n", seed );
DebugLog( D_INFO, DC_ALL ) << "Treating result as failure due to error logged during tests.";
Copy link
Contributor

Choose a reason for hiding this comment

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

It was convenient to have the seed printed out here too since its at the end of the output and easy to find.

@Qrox Qrox deleted the newline branch September 20, 2020 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Tests Measurement, self-control, statistics, balancing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants