* Kees Cook (k...@kernel.org) wrote:
> 
> 
...

> I'm hoping to add runtime testing, but the hurdles for getting it to sanely 
> interact with a qemu instance is tricky.

When doing qemu dev, I frequently run it in a tmux, and start it with
'-nographic' which gets you a single stream with both serial and monitor in it;
alternatively you can get one pane with the serial output and one with the
monitor, that takes a little more setup;

anyway, then I can do :

tmux -L $SESS send-keys -t srcqemu "cd /mnt" enter

and have a wait function that waits until a string is displayed:
# pane string command
function waitstr {
  PANE=$1
  STR=$2
  CMD="$3"
  until [ -n "$(tmux -L $SESS capture-pane -p -t $PANE | grep "$STR" )" ]; do
    $CMD
    sleep 1
  done;
}

so do:
waitstr srcqemu "root@localhost" "sleep 1"

it feels like it should be fairly easy to wrap some of those for tests.
(Beware the 'send-keys' command is a bit touchy about what strings it takes,
but it has some flags to help).

Dave


> -- 
> Kees Cook
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

Reply via email to