本文主要是介绍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
这篇关于shell测试工具框架的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!