diff mbox

[1/4] gdb.exp: Support absolute path name args in 'prepare_for_testing' etc.

Message ID 87ha73ocu4.fsf@br87z6lw.de.ibm.com
State Committed
Headers show

Commit Message

Andreas Arnez March 12, 2014, 11:50 a.m. UTC
On Tue, Mar 11 2014, Ulrich Weigand wrote:

> Andreas Arnez wrote:
>
>> Test cases that produce source files in the build directory have not
>> been able to use prepare_for_testing and friends.  This was because
>> build_executable_from_specs unconditionally prepended the source
>> directory path name to its arguments.
>> 
>> gdb/testsuite/
>> 	* lib/gdb.exp (build_executable_from_specs): Don't prepend source
>> 	directory to absolute path name arguments.
>
> I think that makes sense, and there is precedent to this approach in
> gdb_get_line_number and mi_prepare_inline_tests.
>
> However, for consistency, I think you should also support absolute
> path names in the gdb_compile_shlib[_pthreads] path just next to
> the location you're modifying.

OK, good point.  Done.

BTW, is any test case using the shlib[_pthreads] option with
build_executable_from_specs at all?

> Otherwise this looks good to me.

Thanks.  With the updated patch below, is the patch set then OK to
apply?

---

Test cases that produce source files in the build directory have not
been able to use prepare_for_testing and friends.  This was because
build_executable_from_specs unconditionally prepended the source
directory path name to its arguments.

gdb/testsuite/
	* lib/gdb.exp (build_executable_from_specs): Don't prepend source
	directory to absolute path name arguments.
---
 gdb/testsuite/lib/gdb.exp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2d04a8c..4a6f930 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4260,14 +4260,21 @@  proc build_executable_from_specs {testname executable options args} {
     if [string match gdb_compile_shlib* $func] {
 	set sources_path {}
 	foreach {s local_options} $args {
-	    lappend sources_path "${srcdir}/${subdir}/${s}"
+	    if { [regexp "^/" "$s"] } then {
+		lappend sources_path "$s"
+	    } else {
+		lappend sources_path "$srcdir/$subdir/$s"
+	    }
 	}
 	set ret [$func $sources_path "${binfile}" $options]
     } else {
 	set objects {}
 	set i 0
 	foreach {s local_options} $args {
-	    if  { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } {
+	    if { ! [regexp "^/" "$s"] } then {
+		set s "$srcdir/$subdir/$s"
+	    }
+	    if  { [gdb_compile "${s}" "${binfile}${i}.o" object $local_options] != "" } {
 		untested $testname
 		return -1
 	    }