PR python/16699: GDB Python command completion with overriden complete vs. completer class

Message ID 20140708153221.GA15767@host2.jankratochvil.net
State Not applicable
Headers

Commit Message

Jan Kratochvil July 8, 2014, 3:32 p.m. UTC
  Hi Sergio,

the testcase FAILs with "read1" from:
	reproducer for races of expect incomplete reads
	http://sourceware.org/bugzilla/show_bug.cgi?id=12649

Additionally the testcase uses $objdir instead of [standard_output_file],
filed for it now tracking PR:
	$objdir and $subdir should be tainted
	https://sourceware.org/bugzilla/show_bug.cgi?id=17129


Jan
  

Comments

Sergio Durigan Junior July 8, 2014, 8:30 p.m. UTC | #1
On Tuesday, July 08 2014, Jan Kratochvil wrote:

> Hi Sergio,
>
> the testcase FAILs with "read1" from:
> 	reproducer for races of expect incomplete reads
> 	http://sourceware.org/bugzilla/show_bug.cgi?id=12649
>
> Additionally the testcase uses $objdir instead of [standard_output_file],
> filed for it now tracking PR:
> 	$objdir and $subdir should be tainted
> 	https://sourceware.org/bugzilla/show_bug.cgi?id=17129

On Tuesday, July 08 2014, Jan Kratochvil wrote:

> On Tue, 08 Jul 2014 17:32:21 +0200, Jan Kratochvil wrote:
>> -    -re "^completefilecommandcond ${objdir}/${subdir}/py-completion-t$" {
>> +    -re "^completefilecommandcond ${completion_regex}$" {
>
> There was a racy bug here - and even in the former test - here should be:
>   +    -re "^completefilecommandcond ${completion_regex}\007$" {
>
> Updated fix attached.

Hello Jan,

Thank you for the catches.  I will update my local version.
  

Patch

--- gdb.python/py-completion.exp-orig	2014-07-07 21:32:17.891045058 +0200
+++ gdb.python/py-completion.exp	2014-07-08 17:29:36.500459749 +0200
@@ -26,9 +26,9 @@  if { [skip_python_tests] } { continue }
 gdb_test_no_output "source ${srcdir}/${subdir}/${testfile}.py"
 
 # Create a temporary directory
-set testdir "${objdir}/${subdir}/py-completion-testdir/"
+set testdir "[standard_output_file "py-completion-testdir"]/"
 set testdir_regex [string_to_regexp $testdir]
-set testdir_complete "${objdir}/${subdir}/py-completion-test"
+set testdir_complete [standard_output_file "py-completion-test"]
 file mkdir $testdir
 
 # This one should always pass.
@@ -40,8 +40,7 @@  gdb_test_multiple "" "completefileinit c
 }
 
 # Just discarding whatever we typed.
-send_gdb "\n"
-gdb_test "print" ".*"
+gdb_test " " ".*" "discard #1"
 
 # This is the problematic one.
 send_gdb "completefilemethod ${testdir_complete}\t"
@@ -55,16 +54,16 @@  gdb_test_multiple "" "completefilemethod
 }
 
 # Discarding again
-send_gdb "\n"
-gdb_test "print" ".*"
+gdb_test " " ".*" "discard #2"
 
 # Another problematic
-send_gdb "completefilecommandcond ${objdir}/${subdir}/py-completion-t\t"
+set completion_regex "[string_to_regexp [standard_output_file "py-completion-t"]]"
+send_gdb "completefilecommandcond [standard_output_file "py-completion-t\t"]"
 gdb_test_multiple "" "completefilecommandcond completion" {
     -re "^completefilecommandcond ${testdir}$" {
 	fail "completefilecommandcond completion (completed filename instead of command)"
     }
-    -re "^completefilecommandcond ${objdir}/${subdir}/py-completion-t$" {
+    -re "^completefilecommandcond ${completion_regex}$" {
 	pass "completefilecommandcond completion"
     }
 }