[RFC][gdb/testsuite] Add check-readmore

Simon Marchi simon.marchi@polymtl.ca
Thu Aug 26 03:09:15 GMT 2021



On 2021-06-08 3:24 a.m., Tom de Vries wrote:
> Hi,
> 
> Consider the gdb output:
> ...
> 27        return SYSCALL_CANCEL (nanosleep, requested_time, remaining);^M
> (gdb) ^M
> Thread 2 "run-attach-whil" stopped.^M
> ...
> 
> When trying to match the gdb prompt using gdb_test which uses '$gdb_prompt $',
> it may pass or fail.
> 
> This sort of thing needs to be fixed (see commit b0e2f96b56b), but there's
> currently no way to reliably find this type of FAILs.
> 
> We have check-read1, but that one actually make the test pass reliably.
> 
> We need something like the opposite of check-read1: something that makes
> expect read a bit slower, or more exhaustively.
> 
> Add a new test target check-readmore that implements this.
> 
> Atm there are still two methods of implementing this in read1.c:
> - the first method waits a bit before doing a read
> - the second method does a read and then decides whether to
>   return or to wait a bit and do another read.
> 
> Atm the first method is enabled by default, given that it is more foolproof.
> The second method tries to be smart about waiting less than the first method,
> but consequently needs to make decisions about error codes, which is more
> fragile.
> 
> Tested on x86_64-linux, both with method 1 and 2.
> 
> Any comments?

Is there an advantage to method 2 over method 1?  If not, I'd just go
with the simplest.  I could imagine a modified method 2 version where we
read in a loop though, until we reached "count" bytes or the file
descriptor has no more data to offer (still with a 10ms wait between
each read, to give the writer time to produce more data).

Simon


More information about the Gdb-patches mailing list