Skip to content

Unit tests log messages should be more easily discovered and viewed; e.g. all output to stdout #288

@gapisback

Description

@gapisback

This issue requests for some enhancements in the way outputs from unit tests are generated. Currently, they all go to files in tmp; i.e. /tmp/unit_test.stderr and /tmp/unit_test.stdout. Feedback received on this is as follows:


Request the ability to have the unit test output get printed to the terminal, somehow….

In doing this refactoring work, I’m trying to test-drive it, so I’m running individual unit tests like bin/unit/splinterdb_test repeatedly. And they often fail with informative messages, e.g. an assertion trips.

But the assertion doesn’t appear in the terminal. Instead, I repeatedly have to run this 3-part command

rm /tmp/unit_test.std* && bin/unit/splinterdb_test ; cat /tmp/unit_test.std*

If I don’t do the rm then the output is contaminated with prior test output.

On past projects, I got accustomed to having both:

  1. test stdout and stderr are always printed when a test fails.
  2. one can invoke the unit test binary with -v to always print the full output, regardless of exit status.

It would be really nice if at least one of those two things worked on this project.

--- Another use-case: when running the unit tests in the debugger.

It’s nice to see assertion text or other messages printed to the terminal, rather that having to go cat this other random file to see what’s happened since the last step/breakpoint/whatever.


Proposed solution to investigate and productize:

  • Figure out if we can better manage the swizzling of platform output file handles that CTests do
  • Provide an optional -v | --verbose flag under which these file handles are redirected to stdout. This way all output will come to the terminal.
  • Investigate if this solution would address the debugging use-case (reported internally)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions