Lukasz Majewski | 98ffe74 | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 1 | #! /bin/bash |
Stephen Warren | b1c384c | 2014-06-10 16:28:10 -0600 | [diff] [blame] | 2 | |
Lukasz Majewski | 458934e | 2014-08-18 12:12:27 +0200 | [diff] [blame^] | 3 | # Copyright (C) 2014 Samsung Electronics |
| 4 | # Lukasz Majewski <l.majewski@samsung.com> |
| 5 | # |
| 6 | # Script fixes, enhancements and testing: |
| 7 | # Stephen Warren <swarren@nvidia.com> |
| 8 | # |
| 9 | # Script for test files generation |
| 10 | # |
| 11 | # SPDX-License-Identifier: GPL-2.0+ |
| 12 | |
Lukasz Majewski | 98ffe74 | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 13 | set -e # any command return if not equal to zero |
| 14 | clear |
| 15 | |
| 16 | COLOUR_RED="\33[31m" |
| 17 | COLOUR_GREEN="\33[32m" |
| 18 | COLOUR_DEFAULT="\33[0m" |
| 19 | |
| 20 | LOG_DIR="./log" |
Lukasz Majewski | 98ffe74 | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 21 | |
Lukasz Majewski | b1e8cc4 | 2014-08-18 12:12:26 +0200 | [diff] [blame] | 22 | if [ $# -eq 0 ]; then |
| 23 | TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961 1048575 1048576 8M" |
| 24 | else |
| 25 | TEST_FILES_SIZES=$@ |
| 26 | fi |
Lukasz Majewski | 98ffe74 | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 27 | |
| 28 | printf "Init script for generating data necessary for DFU test script" |
| 29 | |
| 30 | if [ ! -d $LOG_DIR ]; then |
| 31 | `mkdir $LOG_DIR` |
| 32 | fi |
| 33 | |
Lukasz Majewski | 98ffe74 | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 34 | for size in $TEST_FILES_SIZES |
| 35 | do |
| 36 | FILE="./dat_$size.img" |
| 37 | if [ ! -f $FILE ]; then |
| 38 | dd if=/dev/urandom of="./dat_$size.img" bs=$size count=1 > /dev/null 2>&1 || exit $? |
| 39 | fi |
| 40 | done |
Stephen Warren | b1c384c | 2014-06-10 16:28:10 -0600 | [diff] [blame] | 41 | dd if=/dev/urandom of="./dfudummy.bin" bs=1024 count=1 > /dev/null 2>&1 || exit $? |
Lukasz Majewski | 98ffe74 | 2014-06-18 11:38:56 +0200 | [diff] [blame] | 42 | |
| 43 | printf "$COLOUR_GREEN OK $COLOUR_DEFAULT \n" |
| 44 | |
| 45 | exit 0 |