Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Fixing gdb.base/completion.exp (PR testsuite/12649)
@ 2011-04-27 14:59 Marek Polacek
  2011-04-27 15:05 ` Joel Brobecker
  2011-04-28 11:56 ` Marek Polacek
  0 siblings, 2 replies; 28+ messages in thread
From: Marek Polacek @ 2011-04-27 14:59 UTC (permalink / raw)
  To: gdb-patches

Hi!

I am now trying to get rid of racy cases in gdb.base/completion.exp.  The
first thing to do is to make use of `complete' rather than of '\t'.  The '\t's
do not work well with char-wise read1() and thus they're occasionally causing
problems.  The next thing to do is to remove ubiquitous `sleep's, which are racy
themselves and also make this test quite slow (with read1() this test takes 
~8 minutes (!), with normal read() about 35 seconds).

This test basically comprises of chunks like this:

send_gdb "show output\t"
sleep 1
gdb_expect  {
        -re "^show output-radix $"\
            { send_gdb "\n"
              gdb_expect {
                      -re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
                                        { pass "complete 'show output'"}
                      -re ".*$gdb_prompt $" { fail "complete 'show output'"}
                      timeout           {fail "(timeout) complete 'show output'"}
                     }
            }
        -re "^show output$"\
            { send_gdb "\n"
               gdb_expect {
                      -re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
                                        { fail "1complete 'show output'"}
                      -re ".*$gdb_prompt $" { fail "2complete 'show output'"}
                      timeout           { fail "(timeout) complete 'show output'"}
                     }

             }

        -re ".*$gdb_prompt $"       { fail "3complete 'show output'" }
        timeout         { fail "(timeout) complete 'show output'" }
        }


I think this whole shenanigans is not necessary iff we are interested
only in testing that the _completion_ works.  If you look at it, this chunk
has only one `pass'.  What if we could replace this all with only one line like
the following?

gdb_test "complete show output" "show output-radix" "complete 'show output'"

Thus, my point is that we could replace those "send_gdb + sleep + gdb_expect"
sequences with just one gdb_test{,multiple,no_output}.  I don't know yet if this
transformation is possible for every test in the completion.exp file.
Maybe the changes would be quite dramatical.  However, this test would be _much_
simpler and much faster.  Also, the current formatting is ugly ;).

So, do you think this is a good idea?  Is there something I'm missing?

Thanks.

	Marek


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

end of thread, other threads:[~2011-05-05 15:11 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-27 14:59 [RFC] Fixing gdb.base/completion.exp (PR testsuite/12649) Marek Polacek
2011-04-27 15:05 ` Joel Brobecker
2011-04-27 15:13   ` Tom Tromey
2011-04-27 15:23   ` Pedro Alves
2011-04-27 17:41     ` Marek Polacek
2011-04-28 14:19       ` Pedro Alves
2011-04-28 15:14         ` Pedro Alves
2011-04-29 14:10           ` Marek Polacek
2011-05-02 14:58             ` Pedro Alves
2011-05-01  9:17           ` Jan Kratochvil
2011-05-02 14:00             ` Marek Polacek
2011-05-02 14:19             ` Pedro Alves
2011-05-02 14:53               ` Jan Kratochvil
2011-05-02 15:30                 ` Pedro Alves
2011-05-02 15:44                   ` Joel Brobecker
2011-05-02 15:50                     ` Pedro Alves
2011-05-02 15:56                   ` Jan Kratochvil
2011-05-02 16:10                     ` Pedro Alves
2011-05-02 16:35                       ` Jan Kratochvil
2011-05-02 16:54                         ` Pedro Alves
2011-05-02 17:04                           ` Jan Kratochvil
2011-05-02 17:21                             ` Jan Kratochvil
2011-05-02 17:23                             ` Pedro Alves
2011-05-02 17:29                               ` Jan Kratochvil
2011-05-02 17:53                                 ` Pedro Alves
2011-05-02 17:56                                   ` Pedro Alves
2011-05-05 15:11                 ` Tom Tromey
2011-04-28 11:56 ` Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox