2014-06-18 09:38:56 +00:00
|
|
|
#! /bin/bash
|
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>
2014-06-10 22:28:10 +00:00
|
|
|
|
2014-08-18 10:12:27 +00:00
|
|
|
# Copyright (C) 2014 Samsung Electronics
|
|
|
|
# Lukasz Majewski <l.majewski@samsung.com>
|
|
|
|
#
|
|
|
|
# Script fixes, enhancements and testing:
|
|
|
|
# Stephen Warren <swarren@nvidia.com>
|
|
|
|
#
|
|
|
|
# Script for test files generation
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
2014-06-18 09:38:56 +00:00
|
|
|
set -e # any command return if not equal to zero
|
|
|
|
clear
|
|
|
|
|
|
|
|
COLOUR_RED="\33[31m"
|
|
|
|
COLOUR_GREEN="\33[32m"
|
|
|
|
COLOUR_DEFAULT="\33[0m"
|
|
|
|
|
|
|
|
LOG_DIR="./log"
|
|
|
|
|
2014-08-18 10:12:26 +00:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961 1048575 1048576 8M"
|
|
|
|
else
|
|
|
|
TEST_FILES_SIZES=$@
|
|
|
|
fi
|
2014-06-18 09:38:56 +00:00
|
|
|
|
|
|
|
printf "Init script for generating data necessary for DFU test script"
|
|
|
|
|
|
|
|
if [ ! -d $LOG_DIR ]; then
|
|
|
|
`mkdir $LOG_DIR`
|
|
|
|
fi
|
|
|
|
|
|
|
|
for size in $TEST_FILES_SIZES
|
|
|
|
do
|
|
|
|
FILE="./dat_$size.img"
|
|
|
|
if [ ! -f $FILE ]; then
|
|
|
|
dd if=/dev/urandom of="./dat_$size.img" bs=$size count=1 > /dev/null 2>&1 || exit $?
|
|
|
|
fi
|
|
|
|
done
|
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>
2014-06-10 22:28:10 +00:00
|
|
|
dd if=/dev/urandom of="./dfudummy.bin" bs=1024 count=1 > /dev/null 2>&1 || exit $?
|
2014-06-18 09:38:56 +00:00
|
|
|
|
|
|
|
printf "$COLOUR_GREEN OK $COLOUR_DEFAULT \n"
|
|
|
|
|
|
|
|
exit 0
|