This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] [gdb/testsuite] Clean up stale exec in gdb_compile_pascal


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d7a11d1383a2d0cdffc8c08e46b0cf5a66b3ce28

commit d7a11d1383a2d0cdffc8c08e46b0cf5a66b3ce28
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Aug 20 17:18:09 2019 +0200

    [gdb/testsuite] Clean up stale exec in gdb_compile_pascal
    
    When running a pascal test with the stabs target board:
    ...
    $ test=gdb.pascal/case-insensitive-symbols.exp
    $ cd build/gdb/testsuite
    $ make check RUNTESTFLAGS="$test --target_board=stabs"
    ...
    we get:
    ...
    nr of untested testcases         1
    nr of unsupported tests          1
    ...
    due to:
    ...
    Error: Illegal parameter: -gstabs+^M
    Error: /usr/bin/ppcx64 returned an error exitcode^M
    ...
    
    OTOH, when running the same pascal test without the stabs target board:
    ...
    $ make check RUNTESTFLAGS="$test"
    ...
    we get:
    ...
    nr of expected passes            20
    ...
    
    But when subsequently again running with the stabs target board:
    ...
    $ make check RUNTESTFLAGS="$test --target_board=stabs"
    ...
    we now get:
    ...
    nr of expected passes            20
    ...
    
    The problem is that gdb_compile_pascal determines success based on existence
    of the exec after compilation:
    ...
        if ![file exists $destfile] {
            unsupported "Pascal compilation failed: $result"
            return "Pascal compilation failed."
        }
    ...
    without removing the exec before compilation, which allows a stale exec to
    make it seem as if compilation has succeeded.
    
    Fix this by removing the stale exec before compilation.
    
    gdb/testsuite/ChangeLog:
    
    2019-08-20  Tom de Vries  <tdevries@suse.de>
    
    	* lib/pascal.exp (gdb_compile_pascal): Remove $destfile before
    	compilation.

Diff:
---
 gdb/testsuite/ChangeLog      | 5 +++++
 gdb/testsuite/lib/pascal.exp | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index edf7d17..5bc5f77 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-08-20  Tom de Vries  <tdevries@suse.de>
+
+	* lib/pascal.exp (gdb_compile_pascal): Remove $destfile before
+	compilation.
+
 2019-08-16  Tom de Vries  <tdevries@suse.de>
 
 	* gdb.base/compare-sections.exp ("after run to main"): Allow
diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
index 796c2a7..dcdbb8d 100644
--- a/gdb/testsuite/lib/pascal.exp
+++ b/gdb/testsuite/lib/pascal.exp
@@ -153,6 +153,8 @@ proc gdb_compile_pascal {source destfile type options} {
 	pascal_init
     }
 
+    file delete $destfile
+
     if { $pascal_compiler_is_fpc == 1 } {
         set result [fpc_compile $source $destfile $type $options]
     } elseif { $pascal_compiler_is_gpc == 1 } {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]