Re: [PATCH] Add CTF support to GDB [5] Add test for CTF function

Yao Qi
2013-01-16T09:52:58Z

On 01/16/2013 03:38 PM, Hui Zhu wrote:
> make check RUNTESTFLAGS="--target_board=native-gdbserver ctf.exp"
> remote_exec host "babeltrace $ctfdir < /dev/null" "" "" "output" will
> get error. I think that is why gas_version have "if [is_remote host]"
> for that.

What is the error? 'remote_exec host' has been used in some places in
gdb testsuite so it should work well. The one-line statement below
works with combinations of {remote-host, local-host} x {babeltrace
installed, babeltrace not installed}

set ctfdir "foo"
set status [remote_exec host "babeltrace $ctfdir < /dev/null"]
verbose -log "status\[0\] ([lindex $status 0])"
verbose -log "status\[1\] ([lindex $status 1])"

1) babeltrace installed (local-host and remote-host). We'll get,
status[0] (1)
status[1] ([error] opening trace "foo" for reading.

2) babeltrace not installed, local-host. We'll get,
status[0] (-1)
status[1] (spawn failed)

3) babeltrace not installed, remote-host. We'll get,
status[0] (1)
status[1] (sh: babeltrace: command not found)

We can match 'status[1]' to know the different results of executing
'babeltrace' on host.

P.S. I am not good at tcl/expect, so I may miss something.

--
Yao (é½å°§)