diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 266aa832..b235b18c 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -984,8 +984,11 @@ void igt_debug_wait_for_keypress(const char *var) { struct termios oldt, newt; - if (!isatty(STDIN_FILENO)) + if (!isatty(STDIN_FILENO)) { + errno = 0; /* otherwise may be ENOTTY */ return; + } + if (!igt_interactive_debug) return; Found the culprit in this particular case. This would suppress most of the weird errno logged in kms tests. The questions is now: do we really want to hunt all similar cases down? A round of gdb through a couple of tests with 'watch errno' shows that it gets set to non-zero value about a dozen times every single subtest. Depending when we hit an assert we may get any of those printed out adding to confusion. I see 3 options: 1. make sure that errno is reset to 0 by everything that touches it and change my nickname to Sisyphus 2. get rid of printing errno in igt_assert(), but then lose valuable information for all those igt_assert(write(...)); 3. change igt_assert*(expr,...) macros so that they 'errno = 0;' before evaluating expr I think that 3 makes the most sense, then we can quickly go through all the 4000-ish of calls we have to make sure that we don't have any weird 'int ret = write(); igt_assert(ret);' for those functions where errno matters.