8
8
function usage
9
9
{
10
10
echo "
11
- Usage: test_axl [-c sec [-k]] [-n num_files] [xfer_type]
11
+ Usage: test_axl [-s src_dir] [-d dst_dir ] [- c sec [-k]] [-n num_files] [-p num_bytes] [-S host:port ] [xfer_type]
12
12
13
13
-c sec: Cancel transfer after 'sec' seconds (can be decimal number)
14
+ -s src_dir: Source directory (typically where SCR cache files are kept)
15
+ -d dst_dir: Destination directory (typically a shared parallel file system directory)
14
16
-n num_files: Number of files to create (default 50)
15
17
-p bytes: Pause the transfer after $bytes bytes
18
+ -S host:port: Hostname:Portnum of where AXL Service is listening
16
19
-U: After starting the transfer, kill -9 it, and resume it
17
20
xfer_type: sync|pthread|bbapi|dw|state_file (defaults to sync if none specified)
18
21
"
@@ -23,7 +26,20 @@ function isnum
23
26
[[ " $1 " =~ ^[0-9.]+$ ]]
24
27
}
25
28
26
- while getopts " c:kn:p:U" opt; do
29
+ function run_cmd
30
+ {
31
+ echo $1
32
+ if ! eval $1 ; then
33
+ echo " Command Failed"
34
+ exit 1
35
+ fi
36
+ }
37
+
38
+
39
+ src_dir=" "
40
+ dst_dir=" "
41
+
42
+ while getopts " c:d:kn:p:s:S:U" opt; do
27
43
case " ${opt} " in
28
44
c)
29
45
sec=${OPTARG}
@@ -33,6 +49,12 @@ while getopts "c:kn:p:U" opt; do
33
49
exit 1
34
50
fi
35
51
;;
52
+ s)
53
+ src_dir=${OPTARG}
54
+ ;;
55
+ d)
56
+ dst_dir=${OPTARG}
57
+ ;;
36
58
n)
37
59
num_files=${OPTARG}
38
60
if ! isnum $num_files ; then
@@ -50,9 +72,18 @@ while getopts "c:kn:p:U" opt; do
50
72
fi
51
73
;;
52
74
53
- U)
54
- resume=1
75
+ S)
76
+ host_name=${OPTARG%:* }
77
+ port_num=${OPTARG#*: }
78
+ if ! isnum $port_num ; then
79
+ echo " '$port_num ' is not a number"
80
+ usage
81
+ exit
82
+ fi
55
83
;;
84
+
85
+ U)
86
+ resume=1 ;;
56
87
* )
57
88
usage
58
89
exit
@@ -70,20 +101,32 @@ case $xfer in
70
101
pthread) ;;
71
102
bbapi) ;;
72
103
dw) ;;
104
+ axlservice) ;;
105
+ # nnfdm) ;;
73
106
* )
74
107
echo " Invalid transfer type '$xfer '"
108
+ usage
75
109
exit 1;
76
110
;;
77
111
esac
78
112
79
- src=$( mktemp -d)
80
- dest=$( mktemp -d)
113
+ function create_tmpdir
114
+ {
115
+ if [ -z " ${1} " ] ; then
116
+ mktemp -d
117
+ else
118
+ mktemp -p ${1} -d
119
+ fi
120
+ }
121
+
122
+ src=$( create_tmpdir ${src_dir} )
123
+ dest=$( create_tmpdir ${dst_dir} )
81
124
82
125
trap ctrl_c INT
83
126
84
127
function cleanup
85
128
{
86
- rm -fr " $ src" " $ dest"
129
+ run_cmd " rm -fr ${ src} ${ dest} "
87
130
}
88
131
89
132
function ctrl_c() {
@@ -107,8 +150,10 @@ function create_files {
107
150
for (( i= 0 ; i < $num ; i++ )) ; do
108
151
dirnum=$(( $i % $num_dirs ))
109
152
tmp=" $src /${dirs[$dirnum]} "
110
- dd if=/dev/zero of=" $tmp /$i .file" bs=1k count=$i & > /dev/null
153
+ dd if=/dev/zero of=" $tmp /$i .file" bs=1M count=$(( i + 1 )) & > /dev/null
111
154
done
155
+ tree -h $src
156
+ tree -h $dest
112
157
}
113
158
114
159
# $1 Transfer type
@@ -191,6 +236,8 @@ if ! run_test $xfer $sec $pause_after $resume ; then
191
236
cleanup
192
237
exit 1
193
238
else
239
+ tree -h $src
240
+ tree -h $dest
194
241
# Files are copied, verify they're all there and correct
195
242
if ! out2=" $( diff -qr $src $dest ) " ; then
196
243
# Files aren't all there. If we canceled the transfer this is
0 commit comments