From 3778f704cde6b2b7ac7a10f9d21e1114ba2c2a9c Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Mon, 20 Jan 2025 08:17:55 +0100 Subject: [PATCH] support/testing/utils: fix get-developers test without a tty get-developers will check its stdin to decide whether it is a tty or not, and behave differently whether it is or not. So, when we run the tests, we need an actual tty. However, when running in a CI pipeline, like on Gitlab-CI, there is no tty available on stdin. Fake one. We don't need anything too fancy, so just a slave pty will suffice. Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/8830671800 Fixes: d10d22221f93 (utils/get-developers: read patch from stdin when it's not a tty) Reported-by: Julien Olivain Signed-off-by: Yann E. MORIN Signed-off-by: Julien Olivain --- support/testing/tests/utils/test_get_developers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/support/testing/tests/utils/test_get_developers.py b/support/testing/tests/utils/test_get_developers.py index 3ec4edeadd..701c3acb1a 100644 --- a/support/testing/tests/utils/test_get_developers.py +++ b/support/testing/tests/utils/test_get_developers.py @@ -15,10 +15,16 @@ import infra def call_script(args, env, cwd): """Call a script and return stdout and stderr as lists and the exit code.""" - proc = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, + # We need stdin to be a tty, not just a pipe or whatever + m_tty, s_tty = os.openpty() + proc = subprocess.Popen(args, cwd=cwd, + stdin=s_tty, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, universal_newlines=True) out, err = proc.communicate() + os.close(s_tty) + os.close(m_tty) return out.splitlines(), err.splitlines(), proc.returncode