From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7244 invoked by alias); 15 Jan 2013 13:49:02 -0000 Received: (qmail 7230 invoked by uid 22791); 15 Jan 2013 13:49:00 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Jan 2013 13:48:53 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Tv6sl-0005lW-Ns from Yao_Qi@mentor.com ; Tue, 15 Jan 2013 05:48:51 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 15 Jan 2013 05:48:51 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Tue, 15 Jan 2013 05:48:50 -0800 Message-ID: <50F55E11.40008@codesourcery.com> Date: Tue, 15 Jan 2013 13:49:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Hui Zhu CC: Joel Brobecker , gdb-patches ml , Tom Tromey Subject: Re: [PATCH] Add CTF support to GDB [5] Add test for CTF function References: <50F3ADB8.1000603@codesourcery.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-01/txt/msg00303.txt.bz2 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 (齐尧)