diff options
author | Tom de Vries <tdevries@suse.de> | 2021-10-09 18:53:12 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-10-09 18:53:12 +0200 |
commit | fa9ce2c143ce7ee6bc4f22a0577fe5c0858beddd (patch) | |
tree | 9fbe732c77013df72d0fdc67a47490a7a828d500 /gdb/testsuite/Makefile.in | |
parent | f9edf608302736ec68bc80d6b6bc7d0f54171554 (diff) | |
download | fsf-binutils-gdb-fa9ce2c143ce7ee6bc4f22a0577fe5c0858beddd.zip fsf-binutils-gdb-fa9ce2c143ce7ee6bc4f22a0577fe5c0858beddd.tar.gz fsf-binutils-gdb-fa9ce2c143ce7ee6bc4f22a0577fe5c0858beddd.tar.bz2 |
[gdb/testsuite] Add check-readmore
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.
There are 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, and so on.
The second method is potentially faster, has less risc of timeout and could
potentially detect more problems. The first method has a simpler
implementation.
The second method is enabled by default. The default waiting period is 10
miliseconds.
The first method can be enabled using:
...
$ export READMORE_METHOD=1
...
and the waiting period can be specified in miliseconds using:
...
$ export READMORE_SLEEP=9
...
Also a log file can be specified using:
...
$ export READMORE_LOG=$(pwd -P)/LOG
...
Tested on x86_64-linux.
Testing with check-readmore showed these regressions:
...
FAIL: gdb.base/bp-cmds-continue-ctrl-c.exp: run: stop with control-c (continue)
FAIL: gdb.base/bp-cmds-continue-ctrl-c.exp: attach: stop with control-c (continue)
...
I have not been able to find a problem in the test-case, and I think it's the
nature of both the test-case and readmore that makes it run longer. Make
these pass by increasing the alarm timeout from 60 to 120 seconds.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27957
Diffstat (limited to 'gdb/testsuite/Makefile.in')
-rw-r--r-- | gdb/testsuite/Makefile.in | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in index 20cb3da..6b4c758 100644 --- a/gdb/testsuite/Makefile.in +++ b/gdb/testsuite/Makefile.in @@ -39,6 +39,8 @@ CC=@CC@ EXPECT = `if [ "$${READ1}" != "" ] ; then \ echo $${rootme}/expect-read1; \ + elif [ "$${READMORE}" != "" ] ; then \ + echo $${rootme}/expect-readmore; \ elif [ -f $${rootme}/../../expect/expect ] ; then \ echo $${rootme}/../../expect/expect ; \ else \ @@ -161,6 +163,9 @@ check: all $(abs_builddir)/site.exp check-read1: read1.so expect-read1 $(MAKE) READ1="1" check +check-readmore: readmore.so expect-readmore + $(MAKE) READMORE="1" check + # Check whether we need to print the timestamp for each line of # status. TIMESTAMP = $(if $(TS),| $(srcdir)/print-ts.py $(if $(TS_FORMAT),$(TS_FORMAT),),) @@ -344,7 +349,7 @@ clean mostlyclean: -rm -f *.dwo *.dwp -rm -rf outputs temp cache -rm -rf gdb.perf/workers gdb.perf/outputs gdb.perf/temp gdb.perf/cache - -rm -f read1.so expect-read1 + -rm -f read1.so expect-read1 readmore.so expect-readmore distclean maintainer-clean realclean: clean -rm -f *~ core @@ -367,18 +372,22 @@ TAGS: force - # Build the expect wrapper script that preloads the read1.so library. -expect-read1: +expect-read1 expect-readmore: $(ECHO_GEN) \ - rm -f expect-read1-tmp; \ - touch expect-read1-tmp; \ - echo "# THIS FILE IS GENERATED -*- buffer-read-only: t -*- \n" >>expect-read1-tmp; \ - echo "# vi:set ro: */\n\n" >>expect-read1-tmp; \ - echo "# To regenerate this file, run:\n" >>expect-read1-tmp; \ - echo "# make clean; make/\n" >>expect-read1-tmp; \ - echo "export LD_PRELOAD=`pwd`/read1.so" >>expect-read1-tmp; \ - echo 'exec expect "$$@"' >>expect-read1-tmp; \ - chmod +x expect-read1-tmp; \ - mv expect-read1-tmp expect-read1 + rm -f $@-tmp; \ + touch $@-tmp; \ + echo "# THIS FILE IS GENERATED -*- buffer-read-only: t -*- \n" >>$@-tmp; \ + echo "# vi:set ro: */\n\n" >>$@-tmp; \ + echo "# To regenerate this file, run:\n" >>$@-tmp; \ + echo "# make clean; make/\n" >>$@-tmp; \ + if [ $@ = expect-read1 ]; then \ + echo "export LD_PRELOAD=`pwd`/read1.so" >>$@-tmp; \ + else \ + echo "export LD_PRELOAD=`pwd`/readmore.so" >>$@-tmp; \ + fi; \ + echo 'exec expect "$$@"' >>$@-tmp; \ + chmod +x $@-tmp; \ + mv $@-tmp $@ # Build the read1.so preload library. This overrides the `read' # function, making it read one byte at a time. Running the testsuite @@ -386,9 +395,17 @@ expect-read1: read1.so: lib/read1.c $(ECHO_CC) $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC $(CFLAGS) +# Build the readmore.so preload library. This overrides the `read' +# function, making it try harder to read more at a time. Running the +# testsuite with this catches racy tests. +readmore.so: lib/read1.c + $(ECHO_CC) $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC \ + $(CFLAGS) -DREADMORE + # Build the read1 machinery. -.PHONY: read1 +.PHONY: read1 readmore read1: read1.so expect-read1 +readmore: readmore.so expect-readmore # Disable implicit make rules. include $(srcdir)/../disable-implicit-rules.mk |