public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/27957] New: Add check-readmore
@ 2021-06-05 12:30 vries at gcc dot gnu.org
  2021-06-08  7:25 ` [Bug testsuite/27957] " vries at gcc dot gnu.org
  2021-10-09 16:54 ` vries at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2021-06-05 12:30 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27957

            Bug ID: 27957
           Summary: Add check-readmore
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I ran into this FAIL:
...
    FAIL: gdb.base/info-types-c.exp: info types (state == 1)
...

It was not 100% reproducible, due to gdb printing speed and matching order.

And it was not one of the cases caught by check-read1, instead, check-read1
made it pass reliably.

Which made me wonder, can we make the opposite: make something similar to
read1, but instead of forcing read to return 1 byte at the a time, try to make
read more patient and try to read a bit more.

I gave it a try:
...
$ git diff
diff --git a/gdb/testsuite/lib/read1.c b/gdb/testsuite/lib/read1.c
index 7dabdd4ca0c..960db7933dc 100644
--- a/gdb/testsuite/lib/read1.c
+++ b/gdb/testsuite/lib/read1.c
@@ -29,6 +29,7 @@ ssize_t
 read (int fd, void *buf, size_t count)
 {
   static ssize_t (*read2) (int fd, void *buf, size_t count) = NULL;
+  ssize_t res, res2;
   if (read2 == NULL)
     {
       /* Use setenv (v, "", 1) rather than unsetenv (v) to work around
@@ -38,7 +39,18 @@ read (int fd, void *buf, size_t count)
       setenv ("LD_PRELOAD", "", 1);
       read2 = dlsym (RTLD_NEXT, "read");
     }
-  if (count > 1 && isatty (fd) >= 1)
-    count = 1;
-  return read2 (fd, buf, count);
+  res = read2 (fd, buf, count);
+  if (isatty (fd) == 0)
+    return res;
+
+  if (res == count || res == -1)
+    return res;
+
+  sleep (1);
+
+  res2 = read2 (fd, (char *)buf + res, count - res);
+  if (res2 == -1)
+    res2 = 0;
+
+  return res + res2;
 }
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug testsuite/27957] Add check-readmore
  2021-06-05 12:30 [Bug testsuite/27957] New: Add check-readmore vries at gcc dot gnu.org
@ 2021-06-08  7:25 ` vries at gcc dot gnu.org
  2021-10-09 16:54 ` vries at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2021-06-08  7:25 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27957

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Posted RFC: https://sourceware.org/pipermail/gdb-patches/2021-June/179675.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug testsuite/27957] Add check-readmore
  2021-06-05 12:30 [Bug testsuite/27957] New: Add check-readmore vries at gcc dot gnu.org
  2021-06-08  7:25 ` [Bug testsuite/27957] " vries at gcc dot gnu.org
@ 2021-10-09 16:54 ` vries at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-09 16:54 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27957

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.1

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=fa9ce2c143ce7ee6bc4f22a0577fe5c0858beddd

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-09 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 12:30 [Bug testsuite/27957] New: Add check-readmore vries at gcc dot gnu.org
2021-06-08  7:25 ` [Bug testsuite/27957] " vries at gcc dot gnu.org
2021-10-09 16:54 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).