Lukasz Majewski | a4c86bb | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 1 | #! /bin/bash |
Stephen Warren | 7ad67e5 | 2014-06-10 16:28:10 -0600 | [diff] [blame] | 2 | |
Lukasz Majewski | a4c86bb | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 3 | set -e # any command return if not equal to zero |
| 4 | clear |
| 5 | |
| 6 | COLOUR_RED="\33[31m" |
| 7 | COLOUR_GREEN="\33[32m" |
| 8 | COLOUR_DEFAULT="\33[0m" |
| 9 | |
| 10 | LOG_DIR="./log" |
Lukasz Majewski | a4c86bb | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 11 | |
Stephen Warren | 54ce79c | 2014-07-01 12:16:56 -0600 | [diff] [blame] | 12 | TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961 1048575 1048576 8M" |
Lukasz Majewski | a4c86bb | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 13 | |
| 14 | printf "Init script for generating data necessary for DFU test script" |
| 15 | |
| 16 | if [ ! -d $LOG_DIR ]; then |
| 17 | `mkdir $LOG_DIR` |
| 18 | fi |
| 19 | |
Lukasz Majewski | a4c86bb | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 20 | for size in $TEST_FILES_SIZES |
| 21 | do |
| 22 | FILE="./dat_$size.img" |
| 23 | if [ ! -f $FILE ]; then |
| 24 | dd if=/dev/urandom of="./dat_$size.img" bs=$size count=1 > /dev/null 2>&1 || exit $? |
| 25 | fi |
| 26 | done |
Stephen Warren | 7ad67e5 | 2014-06-10 16:28:10 -0600 | [diff] [blame] | 27 | dd if=/dev/urandom of="./dfudummy.bin" bs=1024 count=1 > /dev/null 2>&1 || exit $? |
Lukasz Majewski | a4c86bb | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 28 | |
| 29 | printf "$COLOUR_GREEN OK $COLOUR_DEFAULT \n" |
| 30 | |
| 31 | exit 0 |