run: avoid buffering of output for expect

Due to commit "run: relax IP power plug recognition + serial EOF",
when piping the serial command through 'tr', some characters might
get buffered, thereby preventing some run scripts to finish correctly.
This commit removes the 'tr' hack. Instead, to circumvent the 'expect'
problem, which kills under special conditions spawned childs used to
obtain serial line content, whenever EOF of the serial command is
recognized during the boot phase, the child process gets re-spawned.
This commit is contained in:
Stefan Kalkowski 2014-12-08 10:44:39 +01:00 committed by Christian Helmuth
parent 68abf0616a
commit 3367fd27e4
1 changed files with 18 additions and 14 deletions

View File

@ -887,24 +887,28 @@ proc spawn_serial { wait_for_re timeout_value kernel_msg } {
jtag_load
}
# pipe the serial output through 'tr', sometimes expect steps out due to
# unexpected pipe behaviour and reports EOF although the pipe is still active
eval spawn sh -c \"$serial_cmd | tr a a\"
set serial_spawn_id $spawn_id
set timeout 210
expect {
$kernel_msg { break; }
eof { puts stderr "Serial command process died unexpectedly"; incr retry -1; }
timeout { puts stderr "Boot process timed out"; close; incr retry -1; }
while {true} {
eval spawn $serial_cmd
set serial_spawn_id $spawn_id
expect {
$kernel_msg {
wait_for_output $wait_for_re $timeout_value $serial_spawn_id;
return;
}
eof { continue; }
timeout {
puts stderr "Boot process timed out";
close;
incr retry -1;
break;
}
}
}
}
if { $retry == 0 } {
puts stderr "Boot process failed 3 times in series. I give up!";
exit -1;
}
wait_for_output $wait_for_re $timeout_value $serial_spawn_id
puts stderr "Boot process failed 3 times in series. I give up!";
exit -1;
}