# test-tools **Repository Path**: oscstudio/test-tools ## Basic Information - **Project Name**: test-tools - **Description**: 并发测试脚本 - **Primary Language**: Shell - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-07-12 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #test-tools ##并发测试脚本 ###1.gtest.sh ./gtest.sh repo [password] 脚本中可配置变量如下: host="git.lo" user="nwf" password="123456" repo="" port="80" protocol="http" #for diff protocol newfilesize="4KB" #bigfile添加新文件大小,最小为4KB gcobj="07*" #gcobj不为空时,脚本对全库清理该对象(匹配07开始的文件) 单趟测试,两条线路: a,rm old->clone->add->commit->push; b,rm old->clone->filter-branch->push force. 由gcobj变量选择b线路.仓库新增文件使用bigfile(/home/git/oscsrc/git-hook/build/bin/bigfile)生成,bigfile是git-hook中的工具. 程序异常退出时,错误信息回输出到/tmp/bf.log ###2.single-repo-test.sh ./single-repo-test.sh [rand] 对单个库克隆到随机目录rand中,方便对同一个库进行并发clone测试. 脚本中可配置变量如下: host=git.lo user=nwf passwd=123456 protocol=http repo=n00 程序异常退出时,错误信息回输出到/tmp/single-bf.log ###3.cycle-test.sh ./cycle-test.sh script [arg1] [arg2] [arg3] 该脚本可以定时开始并循环运行参数1中的脚本 脚本中可用变量如下: hour=10 min=01 设置启动时分. ###4.bf.sh ./bf.sh [single] 对多个库同时进行脚本测试,可以使用cycle-test.sh使得测试循环化以长时间并发. 通用变量: cycle="./cycle-test.sh" #注释改行可避免循环并发测试,进行单次并发 在测试gtest.sh时(./bf.sh),每个库的脚本测试前台输出定向到/tmp/bf-$name.log,name为库名; 可配置变量: check=false # 是否使用仓库获取库名 if $check;then REPOPATH="/home/git/repositories/nw/nwf" REPO=$(find $REPOPATH -name "n[01][0-9].git")-->从仓库中匹配找出 else REPO="n00 n01" -->直接库名 fi 测试single-repo-test.sh时(./bf.sh single),每个脚本测试前台输出定向到/tmp/bf-$rand.log,rand为clone到的路径. 可配置变量: times=6 #并发数