aboutsummaryrefslogtreecommitdiff
path: root/testcases/network/generate.sh
blob: 9345d9af5707c986da2b34b7d006627f16d1f2b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
#
#   Copyright (c) International Business Machines  Corp., 2001
#
#   This program is free software;  you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
#   the GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program;  if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
#   FILE: generate.sh
#
#   PURPOSE: Creates data_dir for use in network file transfer tests.
#
#   AUTHOR: Robbie Williamson (robbiew@us.ibm.com)
#
############################################################################

small_file=ascii.sm
medium_file=ascii.med
large_file=ascii.lg
jumbo_file=ascii.jmb
jumbo_size=1600020
large_size=80020
medium_size=4020
small_size=220

set -e

if [ -z "$abs_top_srcdir" ] ; then
	echo "The variable \`abs_top_srcdir', must be defined." >&2
	exit 1
else
	make_file="$abs_top_srcdir/tools/make-file.sh"
	if [ ! -x "$make_file" ] ; then
		echo "$make_file isn't an executable file" >&2
		exit 1
	fi
fi

"$make_file" "$small_file" $small_size
"$make_file" "$medium_file" $medium_size
"$make_file" "$large_file" $large_size
"$make_file" "$jumbo_file" $jumbo_size

if [ ! -e "bin.sm" ] ; then
	cnt=0
	while [ $cnt -lt 5 ] ; do
		gzip -1 -c ascii.sm >> "bin.sm"
		cnt=$(($cnt + 1))
	done
fi

genfile() {
	local input="$1" output="$2"
	local cnt=19

	[ -e "$output" ] && return $?

	while [ $cnt -ge 0 ] ; do
		cat "$input" >> "$output"
		cnt=$(($cnt-1))
	done
}

genfile bin.sm bin.med
genfile bin.med bin.lg
genfile bin.lg bin.jmb

chmod 666 bin.*