summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/loopback-test.sh71
-rwxr-xr-xtests/run-and-decode-test.sh78
2 files changed, 149 insertions, 0 deletions
diff --git a/tests/loopback-test.sh b/tests/loopback-test.sh
new file mode 100755
index 0000000..7ae03a4
--- /dev/null
+++ b/tests/loopback-test.sh
@@ -0,0 +1,71 @@
+#! /bin/bash
+
+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 compare {
+ PCILIB_PATH=$TESTS_PATH/..
+ LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/apps/compare_to_value $*
+}
+
+#size=`expr 1024 "*" 1024`
+size=`expr 1024 "*" 1`
+multiplier=2
+wait=0
+
+/root/pcitool/tests/frame.sh &> /dev/null
+rm -f bench.out
+
+pci --stop-dma dma1
+pci --start-dma dma1
+
+pci -r dma1 -s 16777216 --multipacket -o /dev/null &> /dev/null
+
+pci -r dma1 -s 1024 -o /dev/null | grep -i "Error (62)" &> /dev/null
+if [ $? -ne 0 ]; then
+ echo "There is data on dma..."
+ exit
+fi
+
+failed=0
+send=0
+errors=0
+
+read_size=`expr $multiplier '*' $size`
+echo "Starting..."
+i=1
+pci -w 0x9040 0x201
+while [ 1 ]; do
+ pci -w dma1 -s $size "*0x$i"
+ rm -f /tmp/camera-test.out
+ pci -r dma1 --multipacket -s $read_size -o /tmp/camera-test.out &> /dev/null
+ if [ $wait -gt 0 ]; then
+ wrdone=0
+ while [ $wrdone -eq 0 ]; do
+ pci --list-dma-engines
+ pci --list-dma-engines | grep "DMA1 S2C" | grep "SD" #&> /dev/null
+ wrdone=$?
+ done
+ fi
+
+ res=`compare /tmp/camera-test.out $read_size "$i" 6 2 6`
+ if [ $? -eq 0 ]; then
+ err_cnt=`echo $res | cut -f 1 -d ' '`
+ byte_cnt=`echo $res | cut -f 3 -d ' '`
+ send=$(($send + $byte_cnt * 4))
+ errors=$(($errors + $err_cnt * 4))
+ else
+ failed=$(($failed + 1))
+ fi
+
+ i=$((i + 1))
+ if [ $i -eq 100 ]; then
+ echo "Data send: $send bytes, Errors: $errors bytes, Failed exchanges: $failed"
+ i=1
+ fi
+done
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