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] Add CTF support to GDB [5] Add test for CTF function


On Tue, Jan 15, 2013 at 9:48 PM, Yao Qi <yao@codesourcery.com> wrote:
> On 01/15/2013 07:18 PM, Hui Zhu wrote:
>>
>> +#Get the pathname of babeltrace and set it to $which_babeltrace.
>> +#If host doesn't have babeltrace, $which_babeltrace will set to 0.
>> +if [is_remote host] then {
>> +    remote_exec host "which babeltrace" "" "" "babeltrace.which"
>> +    remote_upload host "babeltrace.which"
>> +    set which_babeltrace [file_contents "babeltrace.which"]
>
>
> proc file_contents is not defined.
>
> FAIL: gdb.trace/ctf.exp: tsave -ctf ctf.ctf
> ERROR: (DejaGnu) proc "file_contents babeltrace.which" does not exist.
> The error code is NONE
> The info on the error is:
> invalid command name "file_contents"
>     while executing
> "::tcl_unknown file_contents babeltrace.which"
>     ("uplevel" body line 1)
>     invoked from within
> "uplevel 1 ::tcl_unknown $args"
>
> You can run this test case in a remote-host setting in this way,
>
> $ make check RUNTESTFLAGS='--target_board=native-gdbserver
> --host_board=local-remote-host ctf.exp'

I add a file_contents in ctf.exp.  Not sure why my part can running
without define "file_contents" inside ctf.exp.

>
>> +    remote_file build delete "babeltrace.which"
>> +    remote_file host delete "babeltrace.which"
>> +} else {
>> +    set which_babeltrace [which babeltrace]
>> +}
>> +
>> +if { $which_babeltrace == 0 } then {
>>
>> +    unsupported "babeltrace check ctf directory"
>> +} else {
>> +    #Let babeltrace output an error to make sure current way is right.
>> +    if [is_remote host] then {
>> +       remote_exec host "$which_babeltrace not_exist < /dev/null" "" ""
>> "babeltrace.output"
>> +       remote_upload host "babeltrace.output"
>> +       set babeltrace_output [file_contents "babeltrace.output"]
>> +       remote_file build delete "babeltrace.output"
>> +       remote_file host delete "babeltrace.output"
>> +    } else {
>> +       catch "exec $which_babeltrace not_exist < /dev/null"
>> babeltrace_output
>> +    }
>> +    if { [string last "\[error\]" $babeltrace_output] == -1 } then {
>>
>> +       unsupported "babeltrace check ctf directory"
>> +    } else {
>> +       if [is_remote host] then {
>> +           remote_exec host "$which_babeltrace $ctfdir < /dev/null" "" ""
>> "babeltrace.output"
>> +           remote_upload host "babeltrace.output"
>> +           set babeltrace_output [file_contents "babeltrace.output"]
>> +           remote_file build delete "babeltrace.output"
>> +           remote_file host delete "babeltrace.output"
>> +       } else {
>> +           catch "exec $which_babeltrace $ctfdir < /dev/null"
>> babeltrace_output
>> +       }
>> +       if { [string last "\[error\]" $babeltrace_output] != -1 } then {
>>
>> +           fail "babeltrace open ctf directory"
>> +       }
>> +    }
>> +}
>> +
>
>
> These code looks overkill to me.  What we want to do here is to run
> babeltrace on host.  Maybe we can do something simpler,
>
>   remote_exec host "babeltrace $ctfdir < /dev/null" "" ""  "output"
>   remote_upload host "output"
>   # Then check the content in file "output" to see 1) babeltrace exists, 2)
> the result of execution.

If use test:
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.

>
>> +
>> +#Test "target ctf"
>> +gdb_test_no_output "set confirm off"
>> +gdb_test_no_output "kill"
>> +gdb_test_multiple "target ctf $ctfdir" "" {
>> +    -re "Undefined target command: \"ctf ctf\.ctf\"\.  Try \"help
>> target\"\." {
>> +       unsupported "target does not support ctf"
>> +       remote_exec host "rm -rf $ctfdir"
>> +       return -1;
>> +    }
>> +    -re ".*fail.*" {
>> +       fail "target ctf $ctfdir"
>> +    }
>> +    -re "^$" {
>> +        pass "target ctf $ctfdir"
>> +    }
>> +}
>
>
> Please add ".*\r\n$gdb_prompt $" at the end of each pattern to be matched to
> avoid racing.

Fixed.

>
> --
> Yao (éå)

Post a new version.

Thanks,
Hui

Attachment: ctf-test.txt
Description: Text document


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