From 656348628dd83cb7713b070f101375efab4fe8b4 Mon Sep 17 00:00:00 2001 From: Vadim Gimpelson <156319763+vadiklyutiy@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:49:07 +0400 Subject: [PATCH] [CI] Print stderr in `run_tests.py` (#443) For `run_tests.py` (Regression) output subtests' `stderr`. "Compiling..." from hidet go there. [Example of output in Regression logs](https://github.com/CentML/hidet/actions/runs/10625143157/job/29454729970) --- tests/benchmarks/run_tests.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/benchmarks/run_tests.py b/tests/benchmarks/run_tests.py index 127f44fd0..514e91b21 100644 --- a/tests/benchmarks/run_tests.py +++ b/tests/benchmarks/run_tests.py @@ -1,4 +1,5 @@ import os +import sys import json import subprocess import pathlib @@ -11,13 +12,16 @@ def run_command(cmd): cmd = " ".join(cmd) print("Running command: " + cmd) + sys.stdout.flush() process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True) + + for line in iter(process.stderr.readline, ''): + sys.stderr.write(line) + sys.stderr.flush() + stdout, stderr = process.communicate() ret = process.returncode if ret: - print('STDERR:') - for line in stderr: - print(line, end='') raise RuntimeError(f'Command {cmd} failed with return code {ret}.') return stdout