From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20995 invoked by alias); 4 Mar 2011 11:31:37 -0000 Received: (qmail 20986 invoked by uid 22791); 4 Mar 2011 11:31:36 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Mar 2011 11:31:29 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 2357C2BAE5A; Fri, 4 Mar 2011 06:31:28 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5pvTIxmtNUtX; Fri, 4 Mar 2011 06:31:28 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A1B1D2BAE40; Fri, 4 Mar 2011 06:31:27 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 696931459AD; Fri, 4 Mar 2011 15:31:09 +0400 (RET) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Joel Brobecker Subject: [PATCH] fix spurious FAIL in py-inferior.exp (x86-solaris) Date: Fri, 04 Mar 2011 11:31:00 -0000 Message-Id: <1299238268-32142-1-git-send-email-brobecker@adacore.com> 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-03/txt/msg00284.txt.bz2 The inferior is single-threaded, but on x86-solaris, GDB says that the program has two entries in the thread list: (gdb) info threads Id Target Id Frame * 2 Thread 1 (LWP 1) f2 (a=1) at /[...]/py-inferior.c:20 1 LWP 1 f2 (a=1) at /[...]/py-inferior.c:20 As a result, the test that prints the list of threads trips because the expected output assumes only one thread. The regular expression I used to match is a little complicated because of the case where there is only one element -vs- the case where there is more than one. In the first case, the last element is followed by a comma. In the second case, it's not. I tried to make it easier to read by using a variable that factorizes the expression matching a thread object, as well as makes it shorter and easier to read. gdb/testsuite/ChangeLog: * gdb.python/py-inferior.exp: Adjust expected output of test printing the list of threads as seen by Python, to allow the list to contain more than 1 thread. Tested on x86-solaris and x86_64-linux. --- gdb/testsuite/gdb.python/py-inferior.exp | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp index 138c0fb..07c7801 100644 --- a/gdb/testsuite/gdb.python/py-inferior.exp +++ b/gdb/testsuite/gdb.python/py-inferior.exp @@ -64,7 +64,12 @@ gdb_test "python print 'result =', i0 == inferiors\[0\]" " = True" "test equalit gdb_test "python print 'result =', i0.num" " = \[0-9\]+" "test Inferior.num" gdb_test "python print 'result =', i0.pid" " = \[0-9\]+" "test Inferior.pid" gdb_test "python print 'result =', i0.was_attached" " = False" "test Inferior.was_attached" -gdb_test "python print i0.threads ()" "\\(,\\)" "test Inferior.threads" +# Print the list of threads in inferior 0. Althought this inferior +# does not use threads, the list of threads may in fact show more +# than 1 thread. We've seen this on x86-solaris where "info threads" +# shows 1 thread and 1 LWP. +set thread_re "" +gdb_test "python print i0.threads ()" "\\(${thread_re}((, ${thread_re})*|,)\\)" "test Inferior.threads" # Test memory read and write operations. -- 1.7.1