Skip to content

Improve viewer test logs#14873

Open
AviaAv wants to merge 2 commits intorealsenseai:developmentfrom
AviaAv:realsense-viewer-tests
Open

Improve viewer test logs#14873
AviaAv wants to merge 2 commits intorealsenseai:developmentfrom
AviaAv:realsense-viewer-tests

Conversation

@AviaAv
Copy link
Copy Markdown
Contributor

@AviaAv AviaAv commented Mar 29, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the realsense-viewer-tests live unit test wrapper to make the test output logs more readable/consistent by normalizing the viewer test runner’s console output.

Changes:

  • Capture realsense-viewer-tests stdout and stream it line-by-line after stripping ANSI escape sequences.
  • Replace the viewer’s "[####] " prefix with an elapsed-time prefix ("[ x.xs] "), to make logs easier to interpret over time.
  • Keep filtering Mesa-specific glCopyTexImage2D warnings from stderr.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 54 to 57
p = subprocess.Popen( cmd,
stdout=None,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env )
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

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

Using both stdout=PIPE and stderr=PIPE while reading the streams sequentially (stdout loop completes before stderr loop starts) can deadlock if the child writes enough data to stderr to fill the OS pipe buffer. Consider either (a) redirecting stderr to STDOUT and processing a single stream, or (b) draining stderr concurrently (e.g., a dedicated thread/queue) while continuing to process stdout in real time.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unlikely to happen, but changed logic to two threads for future scalability

elapsed = time.monotonic() - test_start
line = line[:m.start()] + f'[{elapsed:5.1f}s] '.encode() + line[m.end():]
sys.stdout.buffer.write( line )
sys.stdout.buffer.flush()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do you flush in a loop?
the outcome is not the same as flushing once at the end?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

flush removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants