Skip to content

Commit 30db11b

Browse files
committed
Make test script aware of new AXL Service transfer type
1 parent 166849d commit 30db11b

File tree

1 file changed

+55
-8
lines changed

1 file changed

+55
-8
lines changed

test/test_axl.sh

+55-8
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
function usage
99
{
1010
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]
1212
1313
-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)
1416
-n num_files: Number of files to create (default 50)
1517
-p bytes: Pause the transfer after $bytes bytes
18+
-S host:port: Hostname:Portnum of where AXL Service is listening
1619
-U: After starting the transfer, kill -9 it, and resume it
1720
xfer_type: sync|pthread|bbapi|dw|state_file (defaults to sync if none specified)
1821
"
@@ -23,7 +26,20 @@ function isnum
2326
[[ "$1" =~ ^[0-9.]+$ ]]
2427
}
2528

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
2743
case "${opt}" in
2844
c)
2945
sec=${OPTARG}
@@ -33,6 +49,12 @@ while getopts "c:kn:p:U" opt; do
3349
exit 1
3450
fi
3551
;;
52+
s)
53+
src_dir=${OPTARG}
54+
;;
55+
d)
56+
dst_dir=${OPTARG}
57+
;;
3658
n)
3759
num_files=${OPTARG}
3860
if ! isnum $num_files ; then
@@ -50,9 +72,18 @@ while getopts "c:kn:p:U" opt; do
5072
fi
5173
;;
5274

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
5583
;;
84+
85+
U)
86+
resume=1 ;;
5687
*)
5788
usage
5889
exit
@@ -70,20 +101,32 @@ case $xfer in
70101
pthread) ;;
71102
bbapi) ;;
72103
dw) ;;
104+
axlservice) ;;
105+
# nnfdm) ;;
73106
*)
74107
echo "Invalid transfer type '$xfer'"
108+
usage
75109
exit 1;
76110
;;
77111
esac
78112

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})
81124

82125
trap ctrl_c INT
83126

84127
function cleanup
85128
{
86-
rm -fr "$src" "$dest"
129+
run_cmd "rm -fr ${src} ${dest}"
87130
}
88131

89132
function ctrl_c() {
@@ -107,8 +150,10 @@ function create_files {
107150
for ((i=0; i < $num; i++)) ; do
108151
dirnum=$(($i % $num_dirs))
109152
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
111154
done
155+
tree -h $src
156+
tree -h $dest
112157
}
113158

114159
# $1 Transfer type
@@ -191,6 +236,8 @@ if ! run_test $xfer $sec $pause_after $resume ; then
191236
cleanup
192237
exit 1
193238
else
239+
tree -h $src
240+
tree -h $dest
194241
# Files are copied, verify they're all there and correct
195242
if ! out2="$(diff -qr $src $dest)" ; then
196243
# Files aren't all there. If we canceled the transfer this is

0 commit comments

Comments
 (0)