Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Hui Zhu <teawater@gmail.com>
Cc: Joel Brobecker <brobecker@adacore.com>,
	gdb-patches ml	<gdb-patches@sourceware.org>,
	Tom Tromey <tromey@redhat.com>
Subject: Re: [PATCH] Add CTF support to GDB [5] Add test for CTF function
Date: Tue, 15 Jan 2013 13:49:00 -0000	[thread overview]
Message-ID: <50F55E11.40008@codesourcery.com> (raw)
In-Reply-To: <CANFwon1LH6ipUFXE2xHwXaG6ChzBEVVvoVn-bcnZJVbbYkQz3w@mail.gmail.com>

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'

> +    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.

> +
> +#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.

-- 
Yao (齐尧)


  reply	other threads:[~2013-01-15 13:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14  3:49 Hui Zhu
2013-01-14 12:44 ` Yao Qi
2013-01-15 11:19   ` Hui Zhu
2013-01-15 13:49     ` Yao Qi [this message]
2013-01-16  7:39       ` Hui Zhu
2013-01-16  9:52         ` Yao Qi
2013-01-18  1:23           ` Hui Zhu
2013-01-18  2:07             ` Yao Qi
2013-01-18 15:28             ` Tom Tromey
2013-01-25 11:10               ` Hui Zhu
2013-02-11 12:55                 ` Hui Zhu
2013-02-18 10:39                 ` Yao Qi
2013-02-19  6:57                   ` Hui Zhu
2013-01-14 13:30 ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50F55E11.40008@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=teawater@gmail.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox