From patchwork Sat Dec 1 13:38:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 30508 Received: (qmail 90171 invoked by alias); 1 Dec 2018 13:38:22 -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 90147 invoked by uid 89); 1 Dec 2018 13:38:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:build_b, sk:foreach, HContent-Transfer-Encoding:8bit X-HELO: mailsec101.isp.belgacom.be Received: from mailsec101.isp.belgacom.be (HELO mailsec101.isp.belgacom.be) (195.238.20.97) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 01 Dec 2018 13:38:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1543671498; x=1575207498; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9TAS2QbLtNnIFoK4H1JXrif1j4n8tGYvpcmDBSHzFro=; b=sDL9YKTrfzPy0Rh5RIIEoJibkjU8z47caaJxWKjagmDV+rLhqjAXySPT NkvCf9b4TFugIx7nG8abwYwrhyfN6w==; Received: from 184.205-67-87.adsl-dyn.isp.belgacom.be (HELO md.home) ([87.67.205.184]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 01 Dec 2018 14:38:16 +0100 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFA] Ensure deterministic result order in gdb.ada/info_auto_lang.exp Date: Sat, 1 Dec 2018 14:38:10 +0100 Message-Id: <20181201133810.9542-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes standard_ada_testfile, standard_test_file and the explicit csrcfile assignment in info_auto_lang.exp all gives similar pathnames prefix for a source, such as /home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.. However, the gnat compiler normalizes Ada sources path when compiling. So, the 'Ada' .o object are referencing a pathname such as /home/philippe/gdb/git/binutils-gdb/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb, while the 'C' .o object still references the not normalized pathname. As the results of 'info functions | ...' are sorted by pathname first, the order of the results depends on the comparison between different directories, leading to results that can change depending on these directories. => Ensure the result order is always the same, by normalising the C source file. Tested by running the testcase in 2 different builds, that without normalize were giving different results. Note: such 'set csrcfile' is used in 4 other tests mixing Ada and C. If deemed better (Joel?), I can factorize building such a csrcfile and normalizing it in an ada.exp standard_csrcfile_for_ada function. gdb/testsuite/ChangeLog 2018-12-01 Philippe Waroquiers * gdb.ada/info_auto_lang.exp: Normalize some_c source file. Update order of results accordingly. --- gdb/testsuite/gdb.ada/info_auto_lang.exp | 38 +++++++++++++----------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/gdb/testsuite/gdb.ada/info_auto_lang.exp b/gdb/testsuite/gdb.ada/info_auto_lang.exp index 4ba79fff42..31d706241a 100644 --- a/gdb/testsuite/gdb.ada/info_auto_lang.exp +++ b/gdb/testsuite/gdb.ada/info_auto_lang.exp @@ -24,7 +24,11 @@ load_lib "ada.exp" standard_ada_testfile proc_in_ada set cfile "some_c" -set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c +# gnat normalizes proc_in_ada source file when compiling. +# As the 'info' commands results are sorted by absolute path names, also normalize +# the some_c source file to ensure that the 'info' results are always +# giving Ada results first. +set csrcfile [file normalize ${srcdir}/${subdir}/${testdir}/${cfile}.c] set cobject [standard_output_file ${cfile}.o] if { [gdb_compile "${csrcfile}" "${cobject}" object [list debug]] != "" } { @@ -111,41 +115,41 @@ foreach_with_prefix language_choice { "auto" "ada" "c" } { [multi_line \ "All functions matching regular expression \"proc_in_\":" \ "" \ - "File .*some_c.c:" \ - $func_in_c($c_match) \ - "" \ "File .*proc_in_ada.adb:" \ - $func_in_ada($ada_match) + $func_in_ada($ada_match) \ + "" \ + "File .*some_c.c:" \ + $func_in_c($c_match) ] gdb_test "info types some_type" \ [multi_line \ - "All types matching regular expression \"some_type\":" \ - "" \ - "File .*some_c.c:" \ - $type_in_c($c_match) \ + "All types matching regular expression \"some_type\":" \ "" \ "File .*global_pack.ads:" \ - $type_in_ada($ada_match) + $type_in_ada($ada_match)\ + "" \ + "File .*some_c.c:" \ + $type_in_c($c_match) ] gdb_test "info variables some_struct" \ [multi_line \ "All variables matching regular expression \"some_struct\":" \ "" \ - "File .*some_c.c:" \ - $var_in_c($c_match) \ - "" \ "File .*global_pack.ads:" \ - $var_in_ada($ada_match) + $var_in_ada($ada_match) \ + "" \ + "File .*some_c.c:" \ + $var_in_c($c_match) ] gdb_test "rbreak proc_in_" \ [multi_line \ - "Breakpoint.*file .*some_c.c,.*" \ - $rbreak_func_in_c($c_match) \ "Breakpoint.*file .*proc_in_ada.adb,.*" \ - $rbreak_func_in_ada($ada_match) + $rbreak_func_in_ada($ada_match) \ + "Breakpoint.*file .*some_c.c,.*" \ + $rbreak_func_in_c($c_match) ] delete_breakpoints }