From patchwork Mon Sep 28 04:44:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 8865 Received: (qmail 118891 invoked by alias); 28 Sep 2015 04:44:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 118570 invoked by uid 89); 28 Sep 2015 04:44:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: smtp.electronicbox.net Received: from smtp.electronicbox.net (HELO smtp.electronicbox.net) (96.127.255.83) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Sep 2015 04:44:08 +0000 Received: from simark.lan. (cable-192.222.137.139.electronicbox.net [192.222.137.139]) by smtp.electronicbox.net (Postfix) with ESMTP id 9BE5B440E7A; Mon, 28 Sep 2015 00:44:01 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] py-type.exp: Do not run tests if binary fails to build Date: Mon, 28 Sep 2015 00:44:01 -0400 Message-Id: <1443415441-31232-1-git-send-email-simon.marchi@polymtl.ca> I noticed this while working on the test case. I believe it would make sense to skip running the tests if the binary failed to build. Although I would understand the opposite argument: if the binary does not build for some reason, we probably want to know about it, and some catastrophic failures in the tests might alarm us better than a timid "UNTESTED". gdb/testsuite/ChangeLog: * gdb.python/py-type.exp: Do not run tests if binaries fail to build. --- gdb/testsuite/gdb.python/py-type.exp | 53 ++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 24 deletions(-) \ No newline at end of file diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index 26126eb..857cf89 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -32,6 +32,8 @@ proc build_inferior {exefile lang} { untested "Couldn't compile ${srcfile} in $lang mode" return -1 } + + return 0 } # Restart GDB. @@ -261,35 +263,38 @@ proc test_template {} { } # Perform C Tests. -build_inferior "${binfile}" "c" -restart_gdb "${binfile}" +if { [build_inferior "${binfile}" "c"] == 0 } { + restart_gdb "${binfile}" -# Skip all tests if Python scripting is not enabled. -if { [skip_python_tests] } { continue } + # Skip all tests if Python scripting is not enabled. + if { [skip_python_tests] } { continue } -gdb_test "python print(gdb.lookup_type('char').array(1, 0))" \ - "char \\\[0\\\]" + gdb_test "python print(gdb.lookup_type('char').array(1, 0))" \ + "char \\\[0\\\]" -gdb_test "python print(gdb.lookup_type('char').array(1, -1))" \ - "Array length must not be negative.*" + gdb_test "python print(gdb.lookup_type('char').array(1, -1))" \ + "Array length must not be negative.*" -gdb_test "python print(gdb.lookup_type('int').optimized_out())" \ - "" + gdb_test "python print(gdb.lookup_type('int').optimized_out())" \ + "" -with_test_prefix "lang_c" { - 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" -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 -} +if { [build_inferior "${binfile}-cxx" "c++"] == 0 } { + restart_gdb "${binfile}-cxx" + 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 + } +}