From 0723b53c4472a8839aee58208ff1b5f61d4abe0b Mon Sep 17 00:00:00 2001 From: Erik Jonsson Date: Tue, 5 Aug 2014 19:16:49 +0200 Subject: [PATCH] run-in-simulavr.sh: terminate simulation if stop recieved. Note by Traumflug: this while read -r LINE; do some commands done << (some other command) didn't work here (bash 4.3.11 on Ubuntu 14.04), so I had to swap the sequence of these two commands for using a pipe. Anyways, excellent idea, shortens some simulator runs drastically! --- testcases/run-in-simulavr.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/testcases/run-in-simulavr.sh b/testcases/run-in-simulavr.sh index 4ddc742..6975d2d 100755 --- a/testcases/run-in-simulavr.sh +++ b/testcases/run-in-simulavr.sh @@ -84,11 +84,18 @@ for GCODE_FILE in $*; do # We assume here queue and rx buffer are large enough to read # the file in one chunk. If not, raise MOVEBUFFER_SIZE in config.h. - set -x "${SIMULAVR}" -c vcd:${TRACEIN_FILE}:"${VCD_FILE}" \ -f ../build/teacup.elf \ - -m 60000000000 -v < "${GCODE_FILE}" - set +x + -m 60000000000 -v < "${GCODE_FILE}" | \ + while read -r LINE; do + echo "${LINE}" + case "${LINE}" in + stop) + echo "Got \"stop\", killing ${SIMULAVR}." + kill -INT $(pidof -x "${SIMULAVR}") + ;; + esac + done # Make plottable files from VCD files.