[Bug,110354] Confusing Junk in the results: Last errno: 25, Inappropriate ioctl for device
diff mbox series

Message ID bug-110354-502-CaLFntU52A@http.bugs.freedesktop.org/
State New
Headers show
Series
  • [Bug,110354] Confusing Junk in the results: Last errno: 25, Inappropriate ioctl for device
Related show

Commit Message

bugzilla-daemon@freedesktop.org April 8, 2019, 2:53 p.m. UTC
https://bugs.freedesktop.org/show_bug.cgi?id=110354

--- Comment #1 from Arek Hiler <arkadiusz.hiler@intel.com> ---
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 266aa832..b235b18c 100644

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.

Patch
diff mbox series

--- 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;