1f08c3bdfSopenharmony_ci#!/bin/sh
2f08c3bdfSopenharmony_ci#
3f08c3bdfSopenharmony_ci#   Copyright (c) International Business Machines  Corp., 2001
4f08c3bdfSopenharmony_ci#
5f08c3bdfSopenharmony_ci#   This program is free software;  you can redistribute it and/or modify
6f08c3bdfSopenharmony_ci#   it under the terms of the GNU General Public License as published by
7f08c3bdfSopenharmony_ci#   the Free Software Foundation; either version 2 of the License, or
8f08c3bdfSopenharmony_ci#   (at your option) any later version.
9f08c3bdfSopenharmony_ci#
10f08c3bdfSopenharmony_ci#   This program is distributed in the hope that it will be useful,
11f08c3bdfSopenharmony_ci#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12f08c3bdfSopenharmony_ci#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13f08c3bdfSopenharmony_ci#   the GNU General Public License for more details.
14f08c3bdfSopenharmony_ci#
15f08c3bdfSopenharmony_ci#   You should have received a copy of the GNU General Public License
16f08c3bdfSopenharmony_ci#   along with this program;  if not, write to the Free Software
17f08c3bdfSopenharmony_ci#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18f08c3bdfSopenharmony_ci#
19f08c3bdfSopenharmony_ci#
20f08c3bdfSopenharmony_ci#   FILE: generate.sh
21f08c3bdfSopenharmony_ci#
22f08c3bdfSopenharmony_ci#   PURPOSE: Creates data_dir for use in network file transfer tests.
23f08c3bdfSopenharmony_ci#
24f08c3bdfSopenharmony_ci#   AUTHOR: Robbie Williamson (robbiew@us.ibm.com)
25f08c3bdfSopenharmony_ci#
26f08c3bdfSopenharmony_ci############################################################################
27f08c3bdfSopenharmony_ci
28f08c3bdfSopenharmony_cismall_file=ascii.sm
29f08c3bdfSopenharmony_cimedium_file=ascii.med
30f08c3bdfSopenharmony_cilarge_file=ascii.lg
31f08c3bdfSopenharmony_cijumbo_file=ascii.jmb
32f08c3bdfSopenharmony_cijumbo_size=1600020
33f08c3bdfSopenharmony_cilarge_size=80020
34f08c3bdfSopenharmony_cimedium_size=4020
35f08c3bdfSopenharmony_cismall_size=220
36f08c3bdfSopenharmony_ci
37f08c3bdfSopenharmony_ciset -e
38f08c3bdfSopenharmony_ci
39f08c3bdfSopenharmony_ciif [ -z "$abs_top_srcdir" ] ; then
40f08c3bdfSopenharmony_ci	echo "The variable \`abs_top_srcdir', must be defined." >&2
41f08c3bdfSopenharmony_ci	exit 1
42f08c3bdfSopenharmony_cielse
43f08c3bdfSopenharmony_ci	make_file="$abs_top_srcdir/tools/make-file.sh"
44f08c3bdfSopenharmony_ci	if [ ! -x "$make_file" ] ; then
45f08c3bdfSopenharmony_ci		echo "$make_file isn't an executable file" >&2
46f08c3bdfSopenharmony_ci		exit 1
47f08c3bdfSopenharmony_ci	fi
48f08c3bdfSopenharmony_cifi
49f08c3bdfSopenharmony_ci
50f08c3bdfSopenharmony_ci"$make_file" "$small_file" $small_size
51f08c3bdfSopenharmony_ci"$make_file" "$medium_file" $medium_size
52f08c3bdfSopenharmony_ci"$make_file" "$large_file" $large_size
53f08c3bdfSopenharmony_ci"$make_file" "$jumbo_file" $jumbo_size
54f08c3bdfSopenharmony_ci
55f08c3bdfSopenharmony_ciif [ ! -e "bin.sm" ] ; then
56f08c3bdfSopenharmony_ci	cnt=0
57f08c3bdfSopenharmony_ci	while [ $cnt -lt 5 ] ; do
58f08c3bdfSopenharmony_ci		gzip -1 -c -n ascii.sm >> "bin.sm"
59f08c3bdfSopenharmony_ci		cnt=$(($cnt + 1))
60f08c3bdfSopenharmony_ci	done
61f08c3bdfSopenharmony_cifi
62f08c3bdfSopenharmony_ci
63f08c3bdfSopenharmony_cigenfile() {
64f08c3bdfSopenharmony_ci	local input="$1" output="$2"
65f08c3bdfSopenharmony_ci	local cnt=19
66f08c3bdfSopenharmony_ci
67f08c3bdfSopenharmony_ci	[ -e "$output" ] && return $?
68f08c3bdfSopenharmony_ci
69f08c3bdfSopenharmony_ci	while [ $cnt -ge 0 ] ; do
70f08c3bdfSopenharmony_ci		cat "$input" >> "$output"
71f08c3bdfSopenharmony_ci		cnt=$(($cnt-1))
72f08c3bdfSopenharmony_ci	done
73f08c3bdfSopenharmony_ci}
74f08c3bdfSopenharmony_ci
75f08c3bdfSopenharmony_cigenfile bin.sm bin.med
76f08c3bdfSopenharmony_cigenfile bin.med bin.lg
77f08c3bdfSopenharmony_cigenfile bin.lg bin.jmb
78f08c3bdfSopenharmony_ci
79f08c3bdfSopenharmony_cichmod 666 bin.*
80