Re: [PATCH v3 14/15] Test on saving tracepoint defs: CTF

Yao Qi
2013-03-13T09:55:58Z

On 03/13/2013 04:23 AM, Tom Tromey wrote:
> standard_output_file if you don't mind.
>

'standard_output_file' is used in the patch 13/15, and save the file
name in 'tracefile'. We use $tracefile here.

> Yao> +gdb_test_multiple "target ctf ${testfile}.ctf" "" {
> Yao> + -re "Undefined target command: \"ctf ${testfile}.ctf\"\. Try \"help target\"\.\r\n$gdb_prompt $" {
> Yao> + }
> Yao> + -re ".*\r\n$gdb_prompt $" {
> Yao> + gdb_exit
> Yao> + gdb_start
> Yao> + gdb_reinitialize_dir $srcdir/$subdir
> Yao> + gdb_file_cmd $binfile
> Yao> + gdb_test "target ctf ${testfile}.ctf" ".*" \
> Yao> + "change to ctf target"
> Yao> + check_tracepoint "ctf"
>
> It seems very iffy to me to restart gdb inside a call to gdb_test_multiple.
> I would instead recommend setting a flag and checking it outside this
> command.

Fixed as you suggested.

--
Yao (é½å°§)

gdb/testsuite:

2013-03-11 Yao Qi <yao@codesourcery.com>

* gdb.trace/actions.exp: Save trace data to CTF.
Change to ctf target if GDB supports, read CTF data in ctf
target, and check the actions of tracepoints.
* gdb.trace/while-stepping.exp: Likewise.
---
gdb/testsuite/gdb.trace/actions.exp | 23 +++++++++++++++++++++++
gdb/testsuite/gdb.trace/while-stepping.exp | 23 +++++++++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp
index 5fa1b97..74db104 100644
--- a/gdb/testsuite/gdb.trace/actions.exp
+++ b/gdb/testsuite/gdb.trace/actions.exp
@@ -310,6 +310,8 @@ gdb_test_no_output "tstop" ""
set tracefile [standard_output_file ${testfile}]
gdb_test "tsave ${tracefile}.tf" \
"Trace data saved to file '${tracefile}.tf'\.\\r"
+gdb_test "tsave -ctf ${tracefile}.ctf" \
+ "Trace data saved to directory '${tracefile}.ctf'\.\\r"

# Restart GDB and read the trace data in tfile target.
gdb_exit
@@ -319,3 +321,24 @@ gdb_file_cmd $binfile
gdb_test "target tfile ${tracefile}.tf" ".*" \
"change to tfile target"
check_tracepoint "tfile"
+
+# Try to read ctf data if GDB supports.
+set gdb_can_read_ctf_data 0
+gdb_test_multiple "target ctf" "" {
+ -re "Undefined target command: \"ctf\"\. Try \"help target\"\.\r\n$gdb_prompt $" {
+ set gdb_can_read_ctf_data 0
+ }
+ -re "No CTF directory specified.*\r\n$gdb_prompt $" {
+ set gdb_can_read_ctf_data 1
+ }
+}
+
+if { $gdb_can_read_ctf_data } {
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_file_cmd $binfile
+ gdb_test "target ctf ${tracefile}.ctf" ".*" \
+ "change to ctf target"
+ check_tracepoint "ctf"
+}
diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp
index 0b823a4..c74281f 100644
--- a/gdb/testsuite/gdb.trace/while-stepping.exp
+++ b/gdb/testsuite/gdb.trace/while-stepping.exp
@@ -136,6 +136,8 @@ set tracefile [standard_output_file ${testfile}]
gdb_test "tsave ${tracefile}.tf" \
"Trace data saved to file '${tracefile}.tf'\.\\r" \
"save tfile trace file"
+gdb_test "tsave -ctf ${tracefile}.ctf" \
+ "Trace data saved to directory '${tracefile}.ctf'\.\\r"

# Restart GDB and read the trace data in tfile target.
gdb_exit
@@ -145,3 +147,24 @@ gdb_file_cmd $binfile
gdb_test "target tfile ${tracefile}.tf" ".*" \
"change to tfile target"
check_tracepoint "tfile"
+
+# Try to read ctf data if GDB supports.
+set gdb_can_read_ctf_data 0
+gdb_test_multiple "target ctf" "" {
+ -re "Undefined target command: \"ctf\"\. Try \"help target\"\.\r\n$gdb_prompt $" {
+ set gdb_can_read_ctf_data 0
+ }
+ -re "No CTF directory specified.*\r\n$gdb_prompt $" {
+ set gdb_can_read_ctf_data 1
+ }
+}
+
+if { $gdb_can_read_ctf_data } {
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_file_cmd $binfile
+ gdb_test "target ctf ${tracefile}.ctf" ".*" \
+ "change to ctf target"
+ check_tracepoint "ctf"
+}
--
1.7.7.6