mirror of
https://github.com/romanz/amodem.git
synced 2026-04-01 00:36:50 +08:00
run test via SSH
This commit is contained in:
44
test.sh
44
test.sh
@@ -2,30 +2,48 @@
|
||||
set -u
|
||||
set -e
|
||||
|
||||
# generate 1Mbit of random data
|
||||
dd if=/dev/urandom of=data.send bs=125kB count=1 status=none
|
||||
run() {
|
||||
echo "SRC $HOST: $CMD" 1>&2
|
||||
ssh $HOST $CMD
|
||||
}
|
||||
|
||||
run_src() {
|
||||
CMD="cd ~/Code/modem; $*"
|
||||
HOST="roman@localhost"
|
||||
run
|
||||
}
|
||||
|
||||
run_dst() {
|
||||
CMD="cd ~/Code/modem; $*"
|
||||
HOST="roman@127.0.0.1"
|
||||
run
|
||||
}
|
||||
|
||||
## generate 1Mbit of random data
|
||||
#run_src dd if=/dev/urandom of=data.send bs=125kB count=1 status=none
|
||||
SRC_HASH=`run_src sha256sum data.send | ./colorhash.py`
|
||||
|
||||
# modulate data into audio file
|
||||
./send.py <data.send >tx.int16
|
||||
run_src "./send.py <data.send >tx.int16"
|
||||
|
||||
# stop old recording and start a new one
|
||||
killall -q arecord aplay || true
|
||||
./wave.py record rx.int16 &
|
||||
run_src killall -q aplay || true
|
||||
run_dst killall -q arecord || true
|
||||
|
||||
run_dst "./wave.py record rx.int16" &
|
||||
sleep 1 # let rx.int16 be filled
|
||||
|
||||
# start the receiever
|
||||
./recv.py <rx.int16 >data.recv &
|
||||
run_dst "./recv.py <rx.int16 >data.recv" &
|
||||
|
||||
# play the modulated data
|
||||
./wave.py play tx.int16
|
||||
run_src ./wave.py play tx.int16
|
||||
|
||||
# stop recording after playing is over
|
||||
killall -q arecord aplay || true
|
||||
run_src killall -q aplay || true
|
||||
run_dst killall -q arecord || true
|
||||
|
||||
# verify transmittion
|
||||
./errors.py data.*
|
||||
sha256sum data.* | ./colorhash.py
|
||||
if [ -z $? ]; then
|
||||
./show.py tx.int16 rx.int16
|
||||
fi
|
||||
DST_HASH=`run_dst sha256sum data.recv | ./colorhash.py`
|
||||
|
||||
echo -e "$SRC_HASH\n$DST_HASH"
|
||||
Reference in New Issue
Block a user