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

In tests, keep reading buffered child process output even after it has exited #2923

Merged
merged 2 commits into from
Oct 21, 2021

Conversation

teor2345
Copy link
Contributor

Motivation

Some OSes (macOS) have large buffers between child and parent processes.

We need to flush the entire buffer on the child side before exiting (PR #2911).
Then we need to read the entire buffer on the test side, and flush test output to the test runner process. (This PR.)

This is unexpected work in sprint 21.

Specifications

This is a known issue in Rust:
rust-lang/rust#23818 (comment)

Solution

  • Keep reading buffered output from the child process even when it has exited
  • Flush printed child output after checking each line

Review

This fix is urgent, because it is causing failures like:
https://github.com/ZcashFoundation/zebra/runs/3954220535#step:10:1356

Anyone can review.

Reviewer Checklist

  • Tests pass on macOS

Follow Up Work

If this PR doesn't fix the issue, we should disable the test, and open a ticket to do a fix later.

@teor2345 teor2345 added C-bug Category: This is a bug P-High I-integration-fail Continuous integration fails, including build and test failures labels Oct 21, 2021
@teor2345 teor2345 added this to the 2021 Sprint 21 milestone Oct 21, 2021
@teor2345 teor2345 requested a review from a team October 21, 2021 00:44
@teor2345 teor2345 self-assigned this Oct 21, 2021
@teor2345
Copy link
Contributor Author

I'm testing this branch locally on macOS as well.
Hopefully it's similar enough to our CI to show that it works.

@teor2345 teor2345 enabled auto-merge (squash) October 21, 2021 00:51
Comment on lines +290 to +292
// We don't check `is_running` here,
// because we want to read to the end of the buffered output,
// even if the child process has exited.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@teor2345 teor2345 merged commit 3db5ecb into main Oct 21, 2021
@teor2345 teor2345 deleted the read-all-test-output branch October 21, 2021 01:40
@teor2345
Copy link
Contributor Author

teor2345 commented Oct 21, 2021

(This branch passed the zebrad tests 19 times on my macOS machine, then failed in activate_mempool_mainnet due to a slow network connection.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug I-integration-fail Continuous integration fails, including build and test failures
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants