当前位置:   article > 正文

shell测试工具框架_shell 自动化测试框架

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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/918793
推荐阅读
相关标签
  

闽ICP备14008679号