From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25099 invoked by alias); 30 Aug 2010 17:41:41 -0000 Received: (qmail 25090 invoked by uid 22791); 30 Aug 2010 17:41:39 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,TW_FL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Aug 2010 17:41:35 +0000 Received: (qmail 23093 invoked from network); 30 Aug 2010 17:41:33 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Aug 2010 17:41:33 -0000 Date: Mon, 30 Aug 2010 17:41:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: [commit] Speed up cpexprs.exp Message-ID: <20100830174130.GA28036@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-08/txt/msg00525.txt.bz2 The cpexprs.exp takes 45 seconds on native GNU/Linux, and 7.5 minutes on an ARM EABI simulator. The reason is that each breakpoint test starts a clean copy of the executable, runs to main, sets a breakpoint, and continues to it. The run operation involves a lot of overhead, e.g. a fork() or a download. I've checked in this patch which arranges to call an outer test function over and over again. That way, we can use a single binary. This does open the possibility for cascading failures in a test that is likely to crash mid-run - a persistant problem with our testsuite - but that seems unlikely here. This drops the test time down to 10-20 seconds. Should I put this on the branch too? -- Daniel Jacobowitz CodeSourcery 2010-08-30 Daniel Jacobowitz * gdb.cp/cpexprs.exp (test_breakpoint): Continue to test_function instead of running to main. Do not test the main function. * gdb/testsuite/gdb.cp/cpexprs.cc (main): Rename to test_function. Add new main. Index: gdb.cp/cpexprs.cc =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/cpexprs.cc,v retrieving revision 1.1 diff -u -p -r1.1 cpexprs.cc --- gdb.cp/cpexprs.cc 9 Mar 2010 18:08:03 -0000 1.1 +++ gdb.cp/cpexprs.cc 30 Aug 2010 17:34:33 -0000 @@ -309,8 +309,8 @@ class derived : public base1, public bas }; int -main (int argc, char* argv[]) // main -{ // main +test_function (int argc, char* argv[]) // test_function +{ // test_function derived d; void (derived::*pfunc) (void) const = &derived::a_function; (d.*pfunc) (); @@ -427,5 +427,19 @@ main (int argc, char* argv[]) // main char* str = a; fluff* flp = a; fluff** flpp = a; + + return 0; } +int +main (int argc, char* argv[]) +{ + int i; + + /* Call the test function repeatedly, enough times for all our tests + without running forever if something goes wrong. */ + for (i = 0; i < 1000; i++) + test_function (argc, argv); + + return 0; +} Index: gdb.cp/cpexprs.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/cpexprs.exp,v retrieving revision 1.3 diff -u -p -r1.3 cpexprs.exp --- gdb.cp/cpexprs.exp 11 Jun 2010 17:35:28 -0000 1.3 +++ gdb.cp/cpexprs.exp 30 Aug 2010 17:34:33 -0000 @@ -24,9 +24,14 @@ proc test_breakpoint {func} { global DEC - # Restart every time - if {![runto_main]} { - perror "could not run to main when attempting to break at $func" + # Return to the top of the test function every time. + delete_breakpoints + if { ! [gdb_breakpoint test_function] } { + fail "set test_function breakpoint for $func" + } elseif { [gdb_test "continue" \ + "Continuing.\r\n\r\nBreakpoint $DEC+,.*test_function.*" \ + ""] != 0 } { + fail "continue to test_function for $func" } else { gdb_breakpoint "$func" set i [expr {[string last : $func] + 1}] @@ -113,7 +118,7 @@ set ADDR "0x$HEX+"; # address array set all_functions {} # "Normal" functions/methods -add {main} \ +add {test_function} \ {int (int, char **)} \ - \ - @@ -717,8 +722,8 @@ foreach name [get_functions list] { # Running to breakpoint -- use any function we can "list" foreach name [get_functions list] { - # Skip "main", since test_breakpoint uses it - if {[string compare $name "main"] != 0} { + # Skip "test_function", since test_breakpoint uses it + if {[string compare $name "test_function"] != 0} { test_breakpoint $name } }