From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 676D7384F00C; Sat, 5 Jun 2021 12:30:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 676D7384F00C From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug testsuite/27957] New: Add check-readmore Date: Sat, 05 Jun 2021 12:30:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: testsuite X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 12:30:18 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27957 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 =3D=3D 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 m= ake 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) =3D NULL; + ssize_t res, res2; if (read2 =3D=3D 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 =3D dlsym (RTLD_NEXT, "read"); } - if (count > 1 && isatty (fd) >=3D 1) - count =3D 1; - return read2 (fd, buf, count); + res =3D read2 (fd, buf, count); + if (isatty (fd) =3D=3D 0) + return res; + + if (res =3D=3D count || res =3D=3D -1) + return res; + + sleep (1); + + res2 =3D read2 (fd, (char *)buf + res, count - res); + if (res2 =3D=3D -1) + res2 =3D 0; + + return res + res2; } ... --=20 You are receiving this mail because: You are on the CC list for the bug.=