From f65300b1a87b9f70726b57a8045cc7be5aeb5d30 Mon Sep 17 00:00:00 2001 From: n1ai Date: Sat, 31 Dec 2022 19:50:29 -0500 Subject: [PATCH] Script to test encoder/decoder flowgraph. --- SP5WWP/testing/test-enc-dec.sh | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 SP5WWP/testing/test-enc-dec.sh diff --git a/SP5WWP/testing/test-enc-dec.sh b/SP5WWP/testing/test-enc-dec.sh new file mode 100755 index 0000000..0778ec8 --- /dev/null +++ b/SP5WWP/testing/test-enc-dec.sh @@ -0,0 +1,46 @@ +#!/bin/bash -x + +# This script ASSUMEs: +# - you're running this from the 'testing' dir under the 'SP5WWP' dir +# - you have made the ../m17-coder/m17-coder-sym coder program +# - you have made the ../m17-decoder/m17-decoder-sym coder program +# - you have loaded the ./grc/m17_streamer.grc program into gnuradio-companion +# - you have changed the File Sink's path to /tmp/fifo1 +# - you have used Run->Generate to create the ../grc/m17_streamer.py file + +# Check for the bits needed +if [ ! -x ../m17-coder/m17-coder-sym ]; then + echo "coder executable not available" + exit -1 +fi +if [ ! -x ../m17-decoder/m17-decoder-sym ]; then + echo "decoder executable not available" + exit -2 +fi +if [ ! -f ../grc/m17_streamer.py ]; then + echo "m17_streamer.py program not available" + echo "use gnradio-companion to load m17_streamer.grc and generate it" + exit -3 +fi + +# Make sure pipes (named FIFOs) exist, and if not, create them +if [ ! -p /tmp/fifo1 ]; then + mkfifo /tmp/fifo1 +fi +if [ ! -p /tmp/fifo2 ]; then + mkfifo /tmp/fifo2 +fi + +# Run the encoder +../m17-coder/m17-coder-sym < /tmp/fifo1 > /tmp/fifo2 & +EPID=$! + +# Run the decoder +../m17-decoder/m17-decoder-sym < /tmp/fifo2 & +DPID=$! + +# Run the flowgraph +python3 ../grc/m17_streamer.py + +# Try to kill any remaining background processes after the flowgraph exits +kill $DPID $EPID