This is the mail archive of the gdb-patches@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]

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


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 --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
 	    }
-- 
1.8.4.2


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