Debian Codegraph @

tests/70-callerid-mdmf.test

raw
1 #!/bin/bash
2
3 MINIMODEM="${MINIMODEM-./minimodem}"
4 [ -f "$MINIMODEM" ] || {
5 MINIMODEM="../src/minimodem"
6 [ -f "$MINIMODEM" ] || {
7 echo "E: cannot find minimodem in ./ or ../src/" 1>&2
8 exit 1
9 }
10 }
11
12
13 bytesfile="testdata-callerid-mdmf.bytes"
14 [ "$1" != "" ] && bytesfile="$1"
15
16
17 TMPF="/tmp/minimodem-test-$$"
18 trap "rm -f $TMPF.*" 0
19
20 set -e
21
22 textfile="${bytesfile%%.bytes}.txt"
23
24
25 minimodem_tx_args="1200 --ascii"
26 minimodem_rx_args="callerid"
27
28
29 $MINIMODEM --tx --file $TMPF.wav $minimodem_tx_args < "$bytesfile"
30
31 # cp $TMPF.wav /tmp/x.wav
32
33 $MINIMODEM --rx --file $TMPF.wav $minimodem_rx_args \
34 > $TMPF.out 2> $TMPF.err || {
35 cat $TMPF.err
36 exit 1
37 }
38
39 cmp "$textfile" $TMPF.out
40
41 {
42 read xlitcarrier
43 read xlitblankline
44 read xlithashes xlitnocarrier stats
45 stats="${stats% ###}"
46 } < $TMPF.err
47
48
49 result="OK "
50 exitcode=0
51
52 echo -e "$result $stats"
53
54 exit $exitcode