From 265df53b5c6585262239d3434521281f96e0cd4c Mon Sep 17 00:00:00 2001 From: Alexandra Iordache Date: Wed, 9 Sep 2020 12:41:08 +0300 Subject: [PATCH] Coverage test: keep stdin open Pytest closes stdin by default, so any processes spawned from it won't have it. As some tests in various rust-vmm crates might need stdin to be open, we mock it with a (currently empty) byte stream, which we can extend in the future. Signed-off-by: Alexandra Iordache --- integration_tests/test_coverage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/integration_tests/test_coverage.py b/integration_tests/test_coverage.py index c8ffdf7..01df5bb 100644 --- a/integration_tests/test_coverage.py +++ b/integration_tests/test_coverage.py @@ -79,7 +79,9 @@ def _get_current_coverage(coverage_config): exclude_pattern ) - subprocess.run(kcov_cmd, shell=True, check=True) + # Pytest closes stdin by default, but some tests might need it to be open. + # In the future, should the need arise, we can feed custom data to stdin. + subprocess.run(kcov_cmd, shell=True, check=True, input=b'') # Read the coverage reported by kcov. coverage_file = os.path.join(kcov_output_dir, 'index.js')