public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug testsuite/27957] New: Add check-readmore Date: Sat, 05 Jun 2021 12:30:18 +0000 [thread overview] Message-ID: <bug-27957-4717@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2021-06-05 12:30 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-05 12:30 vries at gcc dot gnu.org [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-27957-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).