summaryrefslogtreecommitdiffstats
path: root/tests/run-and-decode-test.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2013-11-25 21:13:53 +0100
committerSuren A. Chilingaryan <csa@suren.me>2013-11-25 21:13:53 +0100
commitba90c7c942f39b83986e4ed899def33ce79e2f1d (patch)
tree155b0762262642f8caa83019efd6fc1f8d7f36f9 /tests/run-and-decode-test.sh
parentba1ef9d055cbb94cd06c92709546174047f02a15 (diff)
downloadipecamera-ba90c7c942f39b83986e4ed899def33ce79e2f1d.tar.gz
ipecamera-ba90c7c942f39b83986e4ed899def33ce79e2f1d.tar.bz2
ipecamera-ba90c7c942f39b83986e4ed899def33ce79e2f1d.tar.xz
ipecamera-ba90c7c942f39b83986e4ed899def33ce79e2f1d.zip
Some tests are added
Diffstat (limited to 'tests/run-and-decode-test.sh')
-rwxr-xr-xtests/run-and-decode-test.sh78
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/run-and-decode-test.sh b/tests/run-and-decode-test.sh
new file mode 100755
index 0000000..c021c2d
--- /dev/null
+++ b/tests/run-and-decode-test.sh
@@ -0,0 +1,78 @@
+#! /bin/bash
+
+#location=/mnt/fast/
+location="./"
+duration=10000000
+wait_frame=1000000
+
+TESTS_PATH="`dirname \"$0\"`"
+TESTS_PATH="`( cd \"$TESTS_PATH\" && pwd )`"
+
+function pci {
+ PCILIB_PATH=$TESTS_PATH/..
+ LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $*
+}
+
+function stop {
+ usleep $duration
+ pci -w control 0x201 &> /dev/null
+}
+
+/root/pcitool/tests/frame.sh &> /dev/null
+rm -f bench.out
+
+pci --stop-dma
+pci --start-dma dma1
+
+
+pci -r dma1 -s 16777216 --multipacket -o /dev/null &> /dev/null
+
+pci -r dma1 -s 1 | grep -i "Error (62)" &> /dev/null
+if [ $? -ne 0 ]; then
+ echo "There is data on dma..."
+ exit
+fi
+
+echo "Starting ... "
+
+decode_failures=0
+failures=0
+failed=0
+frames=0
+
+iter=0
+while [ 1 ]; do
+ pci -w control 0xa01 &> /dev/null
+ stop &
+
+ output="$location/test$iter.out"
+ rm -f $output
+ pci -r dma1 -o $output --wait --multipacket -t $wait_frame &> /dev/null
+
+ killall -9 usleep &> /dev/null
+ usleep 100000
+ pci -w control 0x201 &> /dev/null
+
+ if [ -f $output ]; then
+ result=`ipedec -d -v --continue $output 2>&1 | grep -iE "failed|decoded"`
+ cur_failed=`echo $result | wc -l`
+ cur_decoded=`echo $result | tail -n 1 | grep -i decoded`
+ if [ $? -ne 0 -o $cur_failed -eq 0 ]; then
+ ipedec -d -v --continue $output > $output.decode
+ decode_failures=$(($decode_failures + 1))
+ else
+ cur_failed=$(($cur_failed - 1))
+ cur_frames=`echo $cur_decoded | cut -f 2 -d ' '`
+ failed=$(($failed + $cur_failed))
+ frames=$(($frames + $cur_frames))
+ if [ $cur_failed -eq 0 ]; then
+ rm -f $output
+ fi
+ fi
+ else
+ failures=$(($failures + 1))
+ fi
+
+ echo "Frames: $frames, Failed Frames: $failed, Failed Exchanges: $failures, Failed Decodings: $decode_failures"
+ iter=`expr $iter + 1`
+done