File tree Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2- apt install -y make nasm gcc cpulimit qemu-system-x86 gocr
2+ apt install -y make nasm gcc cpulimit qemu-system-x86 gocr expect
Original file line number Diff line number Diff line change 22
33SRC_DIR=" src/"
44SRC_TEST_DIR=" src_test/"
5- BUILD_TEST_DIR=" build_test/ "
5+ BUILD_TEST_DIR=" build_test"
66MONITOR_PORT=55555
77QEMU_SCREENSHOT=" /tmp/qemu.ppm"
88
@@ -73,17 +73,21 @@ function os_test_up() {
7373 # Keep polling QEMU monitor until we get our magic word!
7474 COMMAND_OUTPUT=" "
7575 echo " Sending commands to QEMU and polling for the magic word '${magic_word:? } ' every second."
76+
7677 while true ; do
77- COMMAND_OUTPUT=" $( echo -e ' screendump ' ${QEMU_SCREENSHOT:? } ' \nprint $eax\nquit' | \
78- nc 127.0.0.1 ${MONITOR_PORT:? } | tr -d ' \0' ) "
79- echo " QEMU monitor response: ${COMMAND_OUTPUT:? } "
80- echo " $COMMAND_OUTPUT " | \
78+ COMMAND_OUTPUT=" $( ./tests/qemu_monitor_expect.sh ${MONITOR_PORT:? } " print \$ eax" ) "
79+ echo " QEMU monitor response: '${COMMAND_OUTPUT:? } '"
80+ echo " ${COMMAND_OUTPUT:? } " | \
8181 grep -i " ${magic_word:? } " && \
8282 echo " Magic Word Found! Continuing the test..." && \
8383 break
8484 sleep 1s
8585 done
8686
87+ sleep 5s
88+ ./tests/qemu_monitor_expect.sh ${MONITOR_PORT:? } " screendump ${QEMU_SCREENSHOT:? } "
89+ ./tests/qemu_monitor_expect.sh ${MONITOR_PORT:? } " quit"
90+
8791 if [ ! -f ${QEMU_SCREENSHOT:? } ]; then
8892 echo " Magic word found but no screenshot found! :( " >&2
8993 return -1
Original file line number Diff line number Diff line change 1+ #! /usr/bin/expect -f
2+ set timeout 10
3+
4+ set port [lindex $argv 0]
5+ set cmd [lindex $argv 1]
6+
7+ spawn telnet 127.0.0.1 $port
8+
9+ expect " (qemu) "
10+
11+ send -- " $cmd \r"
12+
13+ expect {
14+ " (qemu) " {}
15+ " closed" {}
16+ }
You can’t perform that action at this time.
0 commit comments