* [PATCH] testsuite: let find_gdbserver call which before return ""
@ 2012-03-29 5:09 Hui Zhu
2012-03-29 9:42 ` Pedro Alves
0 siblings, 1 reply; 6+ messages in thread
From: Hui Zhu @ 2012-03-29 5:09 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 941 bytes --]
Hi,
I got some trouble with testsuite about gdbserver for example:
make check RUNTESTFLAGS="server-run.exp"
It will not works because testsuite cannot get gdbserver from
find_gdbserver.
In the find_gdbserver, we can find that if didn't find gdbserver from
GDBSERVER or gdb_server_prog, it will:
set gdbserver "${GDB}server"
if { [file isdirectory $gdbserver] } {
append gdbserver "/gdbserver"
}
if { [file executable $gdbserver] } {
return $gdbserver
}
But file executable just check the gdbserver in current work directory.
So it will return "".
The attachment is a patch that add some code that call "which
$gdbserver" after this part. If the reply include $gdbserver and it is
executable, return it. Then make check RUNTESTFLAGS="server-run.exp"
can work OK now.
Thanks,
Hui
2012-03-29 Hui Zhu <hui_zhu@mentor.com>
* lib/gdbserver-support.exp (find_gdbserver): Add code for
which gdbserver.
[-- Attachment #2: testsuite-find_gdbserver.txt --]
[-- Type: text/plain, Size: 455 bytes --]
---
testsuite/lib/gdbserver-support.exp | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/testsuite/lib/gdbserver-support.exp
+++ b/testsuite/lib/gdbserver-support.exp
@@ -131,6 +131,15 @@ proc find_gdbserver { } {
return $gdbserver
}
+ spawn -noecho which $gdbserver
+ expect {
+ -re "$gdbserver" {
+ if { [file executable $expect_out(buffer)] } {
+ return $expect_out(buffer)
+ }
+ }
+ }
+
return ""
}
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] testsuite: let find_gdbserver call which before return ""
2012-03-29 5:09 [PATCH] testsuite: let find_gdbserver call which before return "" Hui Zhu
@ 2012-03-29 9:42 ` Pedro Alves
2012-03-29 10:04 ` Hui Zhu
0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2012-03-29 9:42 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches
On 03/29/2012 06:09 AM, Hui Zhu wrote:
> Hi,
>
> I got some trouble with testsuite about gdbserver for example:
> make check RUNTESTFLAGS="server-run.exp"
This should work fine in the case the tests were designed for. To test against
the gdbserver that has just been built along the native debugger, under
the build/gdb/gdbserver/ directory.
Most of these tests are in my TODO for removal/rewriting/moving elsewhere
actually. The ones that remain, should be converted to run only when testing
against gdbserver, instead of spawning gdbserver when testing the native target.
> It will not works because testsuite cannot get gdbserver from find_gdbserver.
> In the find_gdbserver, we can find that if didn't find gdbserver from GDBSERVER or gdb_server_prog, it will:
So set GDBSERVER or gdb_server_prog.
> set gdbserver "${GDB}server"
> if { [file isdirectory $gdbserver] } {
> append gdbserver "/gdbserver"
> }
>
> if { [file executable $gdbserver] } {
> return $gdbserver
> }
>
> But file executable just check the gdbserver in current work directory.
No. ${GDB} points at the built gdb binary. So ${GDB}server points at
the gdbserver build directory. In that case, when gdbserver is built along
gdb, ${GDB}server/gdbserver will point at the gdbserver binary.
So it will return "".
>
> The attachment is a patch that add some code that call "which $gdbserver" after this part. If the reply include $gdbserver and it is executable, return it. Then make check RUNTESTFLAGS="server-run.exp" can work OK now.
NAK. This will end up picking the system installed gdbserver that happens
to be in the path. Not what you normally want to test.
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] testsuite: let find_gdbserver call which before return ""
2012-03-29 9:42 ` Pedro Alves
@ 2012-03-29 10:04 ` Hui Zhu
2012-03-29 10:07 ` Pedro Alves
0 siblings, 1 reply; 6+ messages in thread
From: Hui Zhu @ 2012-03-29 10:04 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
Hi Pedro,
I agree with what you said.
But my patch didn't affect what you want to test, because if ${GDB} is a
built gdb binary, which will not return anything, find_gdbserver will
keep return "".
So only when ${GDB} is gdb, it will works.
Thanks,
Hui
On 03/29/12 17:41, Pedro Alves wrote:
> On 03/29/2012 06:09 AM, Hui Zhu wrote:
>
>> Hi,
>>
>> I got some trouble with testsuite about gdbserver for example:
>> make check RUNTESTFLAGS="server-run.exp"
>
>
> This should work fine in the case the tests were designed for. To test against
> the gdbserver that has just been built along the native debugger, under
> the build/gdb/gdbserver/ directory.
>
> Most of these tests are in my TODO for removal/rewriting/moving elsewhere
> actually. The ones that remain, should be converted to run only when testing
> against gdbserver, instead of spawning gdbserver when testing the native target.
>
>> It will not works because testsuite cannot get gdbserver from find_gdbserver.
>> In the find_gdbserver, we can find that if didn't find gdbserver from GDBSERVER or gdb_server_prog, it will:
>
>
> So set GDBSERVER or gdb_server_prog.
>
>> set gdbserver "${GDB}server"
>> if { [file isdirectory $gdbserver] } {
>> append gdbserver "/gdbserver"
>> }
>>
>> if { [file executable $gdbserver] } {
>> return $gdbserver
>> }
>>
>> But file executable just check the gdbserver in current work directory.
>
>
> No. ${GDB} points at the built gdb binary. So ${GDB}server points at
> the gdbserver build directory. In that case, when gdbserver is built along
> gdb, ${GDB}server/gdbserver will point at the gdbserver binary.
>
> So it will return "".
>>
>> The attachment is a patch that add some code that call "which $gdbserver" after this part. If the reply include $gdbserver and it is executable, return it. Then make check RUNTESTFLAGS="server-run.exp" can work OK now.
>
>
> NAK. This will end up picking the system installed gdbserver that happens
> to be in the path. Not what you normally want to test.
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] testsuite: let find_gdbserver call which before return ""
2012-03-29 10:04 ` Hui Zhu
@ 2012-03-29 10:07 ` Pedro Alves
2012-03-29 14:24 ` Hui Zhu
0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2012-03-29 10:07 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb-patches
Please don't top post.
On 03/29/2012 11:03 AM, Hui Zhu wrote:
> Hi Pedro,
>
> I agree with what you said.
>
> But my patch didn't affect what you want to test, because if ${GDB} is a built gdb binary, which will not return anything, find_gdbserver will keep return "".
>
> So only when ${GDB} is gdb, it will works.
Sorry, I don't understand what you mean.
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] testsuite: let find_gdbserver call which before return ""
2012-03-29 10:07 ` Pedro Alves
@ 2012-03-29 14:24 ` Hui Zhu
2012-03-29 14:38 ` Pedro Alves
0 siblings, 1 reply; 6+ messages in thread
From: Hui Zhu @ 2012-03-29 14:24 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On 03/29/12 18:07, Pedro Alves wrote:
> Please don't top post.
Sorry about that.
>
> On 03/29/2012 11:03 AM, Hui Zhu wrote:
>
>> Hi Pedro,
>>
>> I agree with what you said.
>>
>> But my patch didn't affect what you want to test, because if ${GDB} is a built gdb binary, which will not return anything, find_gdbserver will keep return "".
>>
>> So only when ${GDB} is gdb, it will works.
>
>
> Sorry, I don't understand what you mean.
>
My means is, what you way to use testsuite, the ${GDB} is a dir, when
call "which ${GDB}server", it will not get anything, so it didn't affect
your way to use the testsuite.
And it make the other way OK to work.
Thanks,
Hui
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] testsuite: let find_gdbserver call which before return ""
2012-03-29 14:24 ` Hui Zhu
@ 2012-03-29 14:38 ` Pedro Alves
0 siblings, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2012-03-29 14:38 UTC (permalink / raw)
To: Hui Zhu; +Cc: Pedro Alves, gdb-patches
On 03/29/2012 03:23 PM, Hui Zhu wrote:
> My means is, what you way to use testsuite, the ${GDB} is a dir, when call "which ${GDB}server", it will not get anything, so it didn't affect your way to use the testsuite.
I still don't understand what you're trying to do. Why doesn't the current code work for you?
What exactly is the way you're invoking the testsuite.
> ${GDB} is a dir
${GDB} is not a dir. It's the GDB executable.
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-29 14:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 5:09 [PATCH] testsuite: let find_gdbserver call which before return "" Hui Zhu
2012-03-29 9:42 ` Pedro Alves
2012-03-29 10:04 ` Hui Zhu
2012-03-29 10:07 ` Pedro Alves
2012-03-29 14:24 ` Hui Zhu
2012-03-29 14:38 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox