shell测试工具框架
作者:互联网
#!/bin/bash
function usage(){
echo "NAME:"
echo " "$0
echo ""
echo "USAGE:"
echo " "$0" [command options] [arguments...]"
echo ""
echo "Author:jack"
echo "VERSION:"
echo " v0.0.1"
echo ""
echo "OPTIONS::"
echo " -help print this help text:"
echo " -m gpu|disk|mem|cpu|net|all"
}
#获取当前目录
#WORKDIR=$(cd $(dirname $0); pwd)
MODE="all"
while getopts "h:m:" opt
do
case $opt in
h)
usage
exit 0
;;
m)
#echo "mode option $OPTARG"
MODE=$OPTARG
;;
?)
usage
exit -1
;;
esac
done
function tgpu(){
# ...
echo "do gpu stress test"
}
function tdisk(){
# ...
echo "do disk stress test"
}
function tmem(){
# ...
echo "do memory stress test"
}
function tcpu(){
# ...
echo "do cpu stress test"
}
function tnet(){
# ...
echo "do net stress test"
}
case $MODE in
"gpu")
echo "test gpu"
tgpu
;;
"disk")
echo "test disk or ssd"
tdisk
;;
"mem")
echo "test memory"
tmem
;;
"cpu")
echo "test cpu"
tcpu
;;
"net")
echo "test net"
tnet
;;
"all")
echo "test all devices"
echo "------------------------------------------------------------>"
tgpu
echo "------------------------------------------------------------>"
tdisk
echo "------------------------------------------------------------>"
tmem
echo "------------------------------------------------------------>"
tcpu
echo "------------------------------------------------------------>"
tnet
;;
*)
echo "invalid options!"
usage
exit -1
;;
esac
标签:function,...,stress,shell,框架,do,echo,test,测试工具 来源: https://blog.csdn.net/jacky128256/article/details/120999379