From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1156 invoked by alias); 22 Feb 2010 12:45:39 -0000 Received: (qmail 1130 invoked by uid 22791); 22 Feb 2010 12:45:37 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS 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; Mon, 22 Feb 2010 12:45:33 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1MCjW6w001409 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Feb 2010 07:45:32 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1MCjSP2013240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Mon, 22 Feb 2010 07:45:30 -0500 Date: Mon, 22 Feb 2010 12:45:00 -0000 From: Phil Muldoon To: gdb-patches@sourceware.org Subject: [patch][python] Define and use skip_python_tests. Message-ID: <20100222124527.GA17677@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) 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: 2010-02/txt/msg00524.txt.bz2 This patch defines "skip_python_tests" and alters the Python tests to use this function. This avoids constantly reinventing the Python scripting presence test. I noticed that the other skip_{lang} tests just return 0 or 1, and the consumer of those functions just fail silently. In this case, for the Python scripting tests, I opted to return an unsupported () message unconditionally. I think this is ok, and it lets the user know the tests have been skipped. Cheers, Phil -- ChangeLog: 2010-02-22 Phil Muldoon * lib/gdb.exp (skip_python_tests): New function. * gdb.python/py-cmd.exp: Use skip_python_tests. * gdb.python/py-frame.exp: Likewise. * gdb.python/py-function.exp: Likewise. * gdb.python/py-prettyprint.exp: Likewise. * gdb.python/py-template.exp: Likewise. * gdb.python/py-type.exp: Likewise. * gdb.python/py-value.exp: Likewise. -- diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp index 2a3ed0d..d3c05ff 100644 --- a/gdb/testsuite/gdb.python/py-cmd.exp +++ b/gdb/testsuite/gdb.python/py-cmd.exp @@ -44,13 +44,8 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -gdb_test_multiple "python print 'hello, world!'" "verify python support" { - -re "not supported.*$gdb_prompt $" { - unsupported "python support is disabled" - return -1 - } - -re "$gdb_prompt $" {} -} +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } # Test a simple command. diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp index 86fe660..6989207 100644 --- a/gdb/testsuite/gdb.python/py-frame.exp +++ b/gdb/testsuite/gdb.python/py-frame.exp @@ -46,13 +46,8 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -gdb_test_multiple "python print 'hello, world!'" "verify python support" { - -re "not supported.*$gdb_prompt $" { - unsupported "python support is disabled" - return -1 - } - -re "$gdb_prompt $" {} -} +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } # The following tests require execution. diff --git a/gdb/testsuite/gdb.python/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp index 461295d..38c5693 100644 --- a/gdb/testsuite/gdb.python/py-function.exp +++ b/gdb/testsuite/gdb.python/py-function.exp @@ -44,13 +44,8 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -gdb_test_multiple "python print 'hello, world!'" "verify python support" { - -re "not supported.*$gdb_prompt $" { - unsupported "python support is disabled" - return -1 - } - -re "$gdb_prompt $" {} -} +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } gdb_py_test_multiple "input convenience function" \ "python" "" \ diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp index 2626895..414362b 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.exp +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp @@ -27,13 +27,9 @@ set binfile ${objdir}/${subdir}/${testfile} # Start with a fresh gdb. gdb_exit gdb_start -gdb_test_multiple "python print 'hello, world!'" "verify python support" { - -re "not supported.*$gdb_prompt $" { - unsupported "python support is disabled" - return -1 - } - -re "$gdb_prompt $" {} -} + +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } # Run a command in GDB, and report a failure if a Python exception is thrown. # If report_pass is true, report a pass if no exception is thrown. diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp index 713ad5f..9089de6 100644 --- a/gdb/testsuite/gdb.python/py-template.exp +++ b/gdb/testsuite/gdb.python/py-template.exp @@ -35,13 +35,8 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -gdb_test_multiple "python print 23" "verify python support" { - -re "not supported.*$gdb_prompt $" { - unsupported "python support is disabled" - return -1 - } - -re "$gdb_prompt $" {} -} +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } proc test_template_arg {type} { global testfile srcdir subdir srcfile binfile diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index ef74d87..63117ad 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -34,8 +34,8 @@ proc build_inferior {lang} { } } -# Restart GDB, set breakpoint and run to that breakpoint. -proc restart_gdb {bp} { +# Restart GDB. +proc restart_gdb {} { global srcdir subdir srcfile binfile testfile hex gdb_exit @@ -47,12 +47,14 @@ proc restart_gdb {bp} { perror "couldn't run to breakpoint" return } +} +# Set breakpoint and run to that breakpoint. +proc runto_bp {bp} { gdb_breakpoint [gdb_get_line_number $bp] gdb_continue_to_breakpoint $bp } - # Run a command in GDB, and report a failure if a Python exception is thrown. # If report_pass is true, report a pass if no exception is thrown. proc gdb_py_test_silent_cmd {cmd name report_pass} { @@ -127,21 +129,18 @@ proc test_range {} { # Perform C Tests. build_inferior "c" -restart_gdb "break to inspect struct and array." +restart_gdb -gdb_test_multiple "python print 'hello, world!'" "verify python support" { - -re "not supported.*$gdb_prompt $" { - unsupported "python support is disabled" - return -1 - } - -re "$gdb_prompt $" {} -} +# 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" # Perform C++ Tests. build_inferior "c++" -restart_gdb "break to inspect struct and array." +restart_gdb +runto_bp "break to inspect struct and array." test_fields "c++" test_base_class test_range diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp index d980a3d..2b18e02 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -394,13 +394,8 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -gdb_test_multiple "python print 'hello, world!'" "verify python support" { - -re "not supported.*$gdb_prompt $" { - unsupported "python support is disabled" - return -1 - } - -re "$gdb_prompt $" {} -} +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } test_value_creation test_value_numeric_ops diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 627941d..8c18f33 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1299,6 +1299,21 @@ proc skip_java_tests {} { return 0 } +# Return a 1 for configurations that do not support Python scripting. + +proc skip_python_tests {} { + global gdb_prompt + gdb_test_multiple "python print 'test'" "verify python support" { + -re "not supported.*$gdb_prompt $" { + unsupported "Python support is disabled." + return 1 + } + -re "$gdb_prompt $" {} + } + + return 0 +} + # Return a 1 if we should skip shared library tests. proc skip_shlib_tests {} {