#!/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