RFA: cd before completing

Jim Blandy
2001-12-04T17:14:44Z

2001-12-04 Jim Blandy <jimb@redhat.com>

* gdb.base/completion.exp: Rather than completing very long
filenames, which can make the readline library produce output we
don't recognize, cd to the directory first, and then complete
using nice, short relative paths.

*** gdb/testsuite/gdb.base/completion.exp.orig Tue Dec 4 12:12:05 2001
--- gdb/testsuite/gdb.base/completion.exp Tue Dec 4 12:13:36 2001
***************
*** 585,618 ****
timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-'" }
}

! send_gdb "file ${objdir}/Make\t"
sleep 1
gdb_expect {
! -re "file ${objdir}/Makefile.*$"\
{ send_gdb "\n"
gdb_expect {
-re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $"\
{ send_gdb "n\n"
gdb_expect {
-re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\
! { pass "complete 'file Make'"}
! -re ".*$gdb_prompt $" { fail "complete 'file Make'"}
! timeout {fail "(timeout) complete 'file Make'"}
}
}
! -re ".*$gdb_prompt $" { fail "complete 'file Make'"}
! timeout {fail "(timeout) complete 'file Make'"}
}
}
! -re ".*$gdb_prompt $" { fail "complete 'file Make'" }
! timeout { fail "(timeout) complete 'file Make'" }
}

! send_gdb "file ${srcdir}/gdb.base/compl\t"
sleep 1
gdb_expect {
! -re "^file ${srcdir}/gdb.base/completion\\.exp $"\
{ send_gdb "\n"
gdb_expect {
-re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $"
--- 585,623 ----
timeout { fail "(timeout) complete (2) 'p no_var_by_this_name-'" }
}

! # Rather than completing very long filenames, which can make the
! # readline library produce output we don't recognize, cd to the
! # directory first, and then complete using nice, short relative paths.
! gdb_test "cd ${objdir}" "Working directory ${objdir}.*" "cd to \${objdir}"
! send_gdb "file ./Make\t"
sleep 1
gdb_expect {
! -re "file ./Makefile.*$"\
{ send_gdb "\n"
gdb_expect {
-re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $"\
{ send_gdb "n\n"
gdb_expect {
-re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\
! { pass "complete 'file ./Make'"}
! -re ".*$gdb_prompt $" { fail "complete 'file ./Make'"}
! timeout {fail "(timeout) complete 'file ./Make'"}
}
}
! -re ".*$gdb_prompt $" { fail "complete 'file ./Make'"}
! timeout {fail "(timeout) complete 'file ./Make'"}
}
}
! -re ".*$gdb_prompt $" { fail "complete 'file ./Make'" }
! timeout { fail "(timeout) complete 'file ./Make'" }
}

! gdb_test "cd ${srcdir}" "Working directory ${srcdir}.*" "cd to \${srcdir}"
! send_gdb "file ./gdb.base/compl\t"
sleep 1
gdb_expect {
! -re "^file ./gdb.base/completion\\.exp $"\
{ send_gdb "\n"
gdb_expect {
-re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $"
***************
*** 620,636 ****
{ send_gdb "n\n"
gdb_expect {
-re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\
! { pass "complete 'file gdb.base/compl'"}
! -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/compl'"}
! timeout {fail "(timeout) complete 'file gdb.base/compl'"}
}
}
! -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/compl'"}
! timeout {fail "(timeout) complete 'file gdb.base/compl'"}
}
}
! -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/compl'" }
! timeout { fail "(timeout) complete 'file gdb.base/compl'" }
}

send_gdb "info func mark\t"
--- 625,641 ----
{ send_gdb "n\n"
gdb_expect {
-re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\
! { pass "complete 'file ./gdb.base/compl'"}
! -re ".*$gdb_prompt $" { fail "complete 'file ./gdb.base/compl'"}
! timeout {fail "(timeout) complete 'file ./gdb.base/compl'"}
}
}
! -re ".*$gdb_prompt $" { fail "complete 'file ./gdb.base/compl'"}
! timeout {fail "(timeout) complete 'file ./gdb.base/compl'"}
}
}
! -re ".*$gdb_prompt $" { fail "complete 'file ./gdb.base/compl'" }
! timeout { fail "(timeout) complete 'file ./gdb.base/compl'" }
}

send_gdb "info func mark\t"