summaryrefslogtreecommitdiff
path: root/test/dfu/dfu_gadget_test.sh
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2014-06-10 16:28:10 -0600
committerTom Rini <trini@ti.com>2014-08-09 11:16:59 -0400
commit7ad67e5554730fb814c083d481b931d87f29dcbc (patch)
tree27f61c27cf759ee946ae78855bd721485fb229c0 /test/dfu/dfu_gadget_test.sh
parenta4c86bbb5ae89606d5318be4e2a6ae23110bb220 (diff)
test: dfu: script enhancements
Various misc enhancements to dfu_gadget_test.sh: * After every write (download), perform a write to a different file with different data. This ensures that the DFU buffer's content is replaced, so that if the read (upload) succeeds, we know that the correct data was actually read from the storage device, rather than simply being left over in the DFU buffer. This requires two alt setting names to be passed to the script, and a dummy data file to be generated by dfu_gadget_test_init.sh. * Fix the assumption that dfu_gadget_test.sh is run from the directory that contains it, by cd'ing to that directory before invoking ./dfu_gadget_test_init.sh. * Use $DIR$RCV_DIR consistently, rather than using plain $RCV_DIR in some places. * Add 959, 961 test file sizes, to be consistent with having one more than and one less than all the other "round" sizes 64, 128, and 4096. * Remove references to $BKP_DIR from dfu_gadget_test_init.sh, since it isn't used. Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'test/dfu/dfu_gadget_test.sh')
-rwxr-xr-xtest/dfu/dfu_gadget_test.sh13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/dfu/dfu_gadget_test.sh b/test/dfu/dfu_gadget_test.sh
index 4a848c84a78..c5c5f1d957f 100755
--- a/test/dfu/dfu_gadget_test.sh
+++ b/test/dfu/dfu_gadget_test.sh
@@ -1,4 +1,5 @@
#! /bin/bash
+
set -e # any command return if not equal to zero
clear
@@ -11,10 +12,11 @@ SUFFIX=img
RCV_DIR=rcv/
LOG_FILE=./log/log-`date +%d-%m-%Y_%H-%M-%S`
+cd `dirname $0`
./dfu_gadget_test_init.sh
cleanup () {
- rm -rf $RCV_DIR
+ rm -rf $DIR$RCV_DIR
}
die () {
@@ -40,6 +42,8 @@ dfu_test_file () {
MD5_TX=$MD5SUM
+ dfu-util -D ${DIR}/dfudummy.bin -a $TARGET_ALT_SETTING_B >> $LOG_FILE 2>&1 || die $?
+
N_FILE=$DIR$RCV_DIR${1:2}"_rcv"
dfu-util -U $N_FILE -a $TARGET_ALT_SETTING >> $LOG_FILE 2>&1 || die $?
@@ -62,7 +66,7 @@ printf "$COLOUR_GREEN===========================================================
echo "DFU EP0 transmission test program"
echo "Trouble shoot -> disable DBG (even the KERN_DEBUG) in the UDC driver"
echo "@ -> TRATS2 # dfu 0 mmc 0"
-mkdir -p $RCV_DIR
+mkdir -p $DIR$RCV_DIR
touch $LOG_FILE
if [ $# -eq 0 ]
@@ -72,10 +76,11 @@ then
fi
TARGET_ALT_SETTING=$1
+TARGET_ALT_SETTING_B=$2
-if [ -n "$2" ]
+if [ -n "$3" ]
then
- dfu_test_file $2
+ dfu_test_file $3
else
for file in $DIR*.$SUFFIX
do