From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22545 invoked by alias); 13 Nov 2012 13:41:47 -0000 Received: (qmail 22535 invoked by uid 22791); 13 Nov 2012 13:41:46 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mms2.broadcom.com (HELO mms2.broadcom.com) (216.31.210.18) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Nov 2012 13:41:12 +0000 Received: from [10.9.200.133] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Tue, 13 Nov 2012 05:38:26 -0800 X-Server-Uuid: 4500596E-606A-40F9-852D-14843D8201B2 Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB02.corp.ad.broadcom.com (10.9.200.133) with Microsoft SMTP Server id 8.2.247.2; Tue, 13 Nov 2012 05:40:35 -0800 Received: from [10.177.72.87] (unknown [10.177.72.87]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 95F2F40FE8 for ; Tue, 13 Nov 2012 05:41:01 -0800 (PST) Message-ID: <50A24DEF.6050507@broadcom.com> Date: Tue, 13 Nov 2012 13:41:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [PATCH] Uniquify test name py-test.exp References: <50A21822.1000207@broadcom.com> In-Reply-To: <50A21822.1000207@broadcom.com> Content-Type: text/plain; charset=iso-8859-1 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: 2012-11/txt/msg00311.txt.bz2 On 13/11/2012 9:51 AM, Andrew Burgess wrote: > While working on something else I regressed a test in py-test.exp, and spotted that lots of the tests in here have duplicate names. > > Patch adds a few calls to with_test_prefix and adds some extra text to test names in order to make all the test names unique. > > The patch below **does not** include all the whitespace changes introduced by the nested nature of 'with_test_prefix "prefix" {...}', I can post the full patch if needed, but I thought this would be easier to read. If/when I commit I'd push a version with correct indentation. > > Ok to apply? No. I stupidly put the wrong version of this patch in the email. I'll try again. Again, without whitespace change. How's this one? Sorry for the noise. Andrew gdb/testsuite/ChangeLog 2012-11-13 Andrew Burgess * gdb.python/py-type.exp: Uniquify test names. diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index b997c51..0f77229 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -56,6 +56,7 @@ proc runto_bp {bp} { } proc test_fields {lang} { + with_test_prefix "test_fields" { global gdb_prompt # .fields() of a typedef should still return the underlying field list @@ -64,10 +65,10 @@ proc test_fields {lang} { if {$lang == "c++"} { # Test usage with a class - gdb_py_test_silent_cmd "print c" "print value" 1 - gdb_py_test_silent_cmd "python c = gdb.history (0)" "get value from history" 1 - gdb_py_test_silent_cmd "python fields = c.type.fields()" "get fields" 1 - gdb_test "python print len(fields)" "2" "Check number of fields" + gdb_py_test_silent_cmd "print c" "print value (c)" 1 + gdb_py_test_silent_cmd "python c = gdb.history (0)" "get value (c) from history" 1 + gdb_py_test_silent_cmd "python fields = c.type.fields()" "get fields from c.type" 1 + gdb_test "python print len(fields)" "2" "Check number of fields (c)" gdb_test "python print fields\[0\].name" "c" "Check class field c name" gdb_test "python print fields\[1\].name" "d" "Check class field d name" @@ -77,10 +78,10 @@ proc test_fields {lang} { } # Test normal fields usage in structs. - gdb_py_test_silent_cmd "print st" "print value" 1 - gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value from history" 1 - gdb_py_test_silent_cmd "python fields = st.type.fields()" "get fields" 1 - gdb_test "python print len(fields)" "2" "Check number of fields" + gdb_py_test_silent_cmd "print st" "print value (st)" 1 + gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value (st) from history" 1 + gdb_py_test_silent_cmd "python fields = st.type.fields()" "get fields from st.type" 1 + gdb_test "python print len(fields)" "2" "Check number of fields (st)" gdb_test "python print fields\[0\].name" "a" "Check structure field a name" gdb_test "python print fields\[1\].name" "b" "Check structure field b name" @@ -90,7 +91,7 @@ proc test_fields {lang} { "Check that dir includes name" # Test Python mapping behavior of gdb.Type for structs/classes - gdb_test "python print len(st.type)" "2" "Check number of fields" + gdb_test "python print len(st.type)" "2" "Check number of fields (st.type)" gdb_test "python print st.type\['a'\].name" "a" "Check fields lookup by name" gdb_test "python print \[v.bitpos for v in st.type.itervalues()\]" {\[0L, 32L\]} "Check fields iteration over values" gdb_test "python print \[(n, v.bitpos) for (n, v) in st.type.items()\]" {\[\('a', 0L\), \('b', 32L\)\]} "Check fields items list" @@ -108,8 +109,8 @@ proc test_fields {lang} { gdb_test "python print not not st.type\['a'\].type" "True" # Test regression PR python/10805 - gdb_py_test_silent_cmd "print ar" "print value" 1 - gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value from history" 1 + gdb_py_test_silent_cmd "print ar" "print value (ar)" 1 + gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value (ar) from history" 1 gdb_test "python fields = ar.type.fields()" gdb_test "python print len(fields)" "1" "Check the number of fields" gdb_test "python print fields\[0\].type" "" "Check array field type" @@ -136,51 +137,63 @@ proc test_fields {lang} { "python vec3 = ar\[1\].cast(ar\[1\].type.vector(1))" "set vec3" 1 gdb_test "python print vec1 == vec3" "False" } +} proc test_enums {} { - gdb_py_test_silent_cmd "print e" "print value" 1 - gdb_py_test_silent_cmd "python e = gdb.history (0)" "get value from history" 1 - gdb_py_test_silent_cmd "python fields = e.type.fields()" "get value from history" 1 + with_test_prefix "test_enum" { + gdb_py_test_silent_cmd "print e" "print value (e)" 1 + gdb_py_test_silent_cmd "python e = gdb.history (0)" "get value (e) from history" 1 + gdb_py_test_silent_cmd "python fields = e.type.fields()" "extract type fields from e" 1 gdb_test "python print len(fields)" "3" "Check the number of enum fields" - gdb_test "python print fields\[0\].name" "v1" "Check enum field name" - gdb_test "python print fields\[1\].name" "v2" "Check enum field name" + gdb_test "python print fields\[0\].name" "v1" "Check enum field\[0\] name" + gdb_test "python print fields\[1\].name" "v2" "Check enum field\[1\]name" # Ditto but by mapping operations - gdb_test "python print len(e.type)" "3" "Check the number of enum fields" - gdb_test "python print e.type\['v1'\].name" "v1" "Check enum field lookup by name" - gdb_test "python print e.type\['v3'\].name" "v3" "Check enum field lookup by name" + gdb_test "python print len(e.type)" "3" "Check the number of type fields" + gdb_test "python print e.type\['v1'\].name" "v1" "Check enum field lookup by name (v1)" + gdb_test "python print e.type\['v3'\].name" "v3" "Check enum field lookup by name (v2)" gdb_test "python print \[v.enumval for v in e.type.itervalues()\]" {\[0L, 1L, 2L\]} "Check num fields iteration over values" gdb_test "python print \[(n, v.enumval) for (n, v) in e.type.items()\]" {\[\('v1', 0L\), \('v2', 1L\), \('v3', 2L\)\]} "Check enum fields items list" + } } proc test_base_class {} { - gdb_py_test_silent_cmd "print d" "print value" 1 - gdb_py_test_silent_cmd "python d = gdb.history (0)" "get value from history" 1 - gdb_py_test_silent_cmd "python fields = d.type.fields()" "get value from history" 1 + with_test_prefix "test_base_class" { + gdb_py_test_silent_cmd "print d" "print value (d)" 1 + gdb_py_test_silent_cmd "python d = gdb.history (0)" "get value (d) from history" 1 + gdb_py_test_silent_cmd "python fields = d.type.fields()" "extract type fields from d" 1 gdb_test "python print len(fields)" "3" "Check the number of fields" - gdb_test "python print fields\[0\].is_base_class" "True" "Check base class" - gdb_test "python print fields\[1\].is_base_class" "False" "Check base class" + gdb_test "python print fields\[0\].is_base_class" "True" "Check base class (fields\[0\])" + gdb_test "python print fields\[1\].is_base_class" "False" "Check base class (fields\[1\])" + } } proc test_range {} { - + with_test_prefix "test_range" { + with_test_prefix "on ranged value" { # Test a valid range request. - gdb_py_test_silent_cmd "print ar" "print value" 1 - gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value from history" 1 + gdb_py_test_silent_cmd "print ar" "print value (ar)" 1 + gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value (ar) from history" 1 gdb_test "python print len(ar.type.range())" "2" "Check correct tuple length" - gdb_test "python print ar.type.range()\[0\]" "0" "Check low range" - gdb_test "python print ar.type.range()\[1\]" "1" "Check high range" + gdb_test "python print ar.type.range()\[0\]" "0" "Check range low bound" + gdb_test "python print ar.type.range()\[1\]" "1" "Check range high bound" + } + with_test_prefix "on ranged type" { # Test a range request on a ranged type. - gdb_py_test_silent_cmd "print ar" "print value" 1 - gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value from history" 1 + gdb_py_test_silent_cmd "print ar" "print value (ar)" 1 + gdb_py_test_silent_cmd "python ar = gdb.history (0)" "get value (ar) from history" 1 gdb_py_test_silent_cmd "python fields = ar.type.fields()" "get fields" 1 - gdb_test "python print fields\[0\].type.range()\[0\]" "0" "Check range type low bound" - gdb_test "python print fields\[0\].type.range()\[1\]" "1" "Check range type high bound" + gdb_test "python print fields\[0\].type.range()\[0\]" "0" "Check range low bound" + gdb_test "python print fields\[0\].type.range()\[1\]" "1" "Check range high bound" + } + with_test_prefix "on unranged value" { # Test where a range does not exist. - gdb_py_test_silent_cmd "print st" "print value" 1 - gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value from history" 1 + gdb_py_test_silent_cmd "print st" "print value (st)" 1 + gdb_py_test_silent_cmd "python st = gdb.history (0)" "get value (st) from history" 1 gdb_test "python print st.type.range()" "RuntimeError: This type does not have a range.*" "Check range for non ranged type." + } + } } # Some tests of template arguments. @@ -221,16 +234,20 @@ restart_gdb "${binfile}" # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } -runto_bp "break to inspect struct and array." -test_fields "c" -test_enums +with_test_prefix "lang_c" { + runto_bp "break to inspect struct and array." + test_fields "c" + test_enums +} # Perform C++ Tests. build_inferior "${binfile}-cxx" "c++" restart_gdb "${binfile}-cxx" -runto_bp "break to inspect struct and array." -test_fields "c++" -test_base_class -test_range -test_template -test_enums +with_test_prefix "lang_cpp" { + runto_bp "break to inspect struct and array." + test_fields "c++" + test_base_class + test_range + test_template + test_enums +}