From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6930 invoked by alias); 27 Apr 2011 14:59:06 -0000 Received: (qmail 6920 invoked by uid 22791); 27 Apr 2011 14:59:05 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Apr 2011 14:58:52 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3REwld5022397 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Apr 2011 10:58:51 -0400 Received: from dhcp-25-89.brq.redhat.com (pdp-11.brq.redhat.com [10.34.24.63]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3REwkY1016247 for ; Wed, 27 Apr 2011 10:58:47 -0400 Message-ID: <4DB82F26.30801@redhat.com> Date: Wed, 27 Apr 2011 14:59:00 -0000 From: Marek Polacek User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100827 Red Hat Thunderbird/3.1.3 MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [RFC] Fixing gdb.base/completion.exp (PR testsuite/12649) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00507.txt.bz2 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