From 1ff97d639e631fe7465038d76e093bc5c1a31867 Mon Sep 17 00:00:00 2001 From: huangzh Date: Wed, 7 Nov 2018 11:45:38 +0800 Subject: new add s3p test scripte Change-Id: I84b933c017ad7cee12e70da868e8dea1dd9f348b Issue-ID: INT-714 Signed-off-by: huangzh --- vcpe_beijing/vcpe/pressure/.test.sh.swp | Bin 0 -> 12288 bytes vcpe_beijing/vcpe/pressure/control.sh | 25 +++++++++++++++++++++++++ vcpe_beijing/vcpe/pressure/echo.sh | 9 +++++++++ vcpe_beijing/vcpe/pressure/test.sh | 26 ++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 vcpe_beijing/vcpe/pressure/.test.sh.swp create mode 100644 vcpe_beijing/vcpe/pressure/control.sh create mode 100644 vcpe_beijing/vcpe/pressure/echo.sh create mode 100644 vcpe_beijing/vcpe/pressure/test.sh (limited to 'vcpe_beijing/vcpe/pressure') diff --git a/vcpe_beijing/vcpe/pressure/.test.sh.swp b/vcpe_beijing/vcpe/pressure/.test.sh.swp new file mode 100644 index 0000000..d5704e1 Binary files /dev/null and b/vcpe_beijing/vcpe/pressure/.test.sh.swp differ diff --git a/vcpe_beijing/vcpe/pressure/control.sh b/vcpe_beijing/vcpe/pressure/control.sh new file mode 100644 index 0000000..65c9bc4 --- /dev/null +++ b/vcpe_beijing/vcpe/pressure/control.sh @@ -0,0 +1,25 @@ +#!/bin/bash +start_time=`date +%s` #定义脚本运行的开始时间 +[ -e /tmp/fd1 ] || mkfifo /tmp/fd1 #创建有名管道 +exec 3<>/tmp/fd1 #创建文件描述符,以可读(<)可写(>)的方式关联管道文件,这时候文件描述符3就有了有名管道文件的所有特性 +rm -rf /tmp/fd1 #关联后的文件描述符拥有管道文件的所有特性,所以这时候管道文件可以删除,我们留下文件描述符来用就可以了 +for ((i=1;i<=1000;i++)) +do + echo >&3 #&3代表引用文件描述符3,这条命令代表往管道里面放入了一个"令牌" +done + +for ((i=1;i<=10000;i++)) +do +read -u3 #代表从管道中读取一个令牌 +{ + echo 'success'$i & + echo >&3 #代表我这一次命令执行到最后,把令牌放回管道 +}& +done +wait + +stop_time=`date +%s` #定义脚本运行的结束时间 + +echo "TIME:`expr $stop_time - $start_time`" +exec 3<&- #关闭文件描述符的读 +exec 3>&- #关闭文件描述符的写 diff --git a/vcpe_beijing/vcpe/pressure/echo.sh b/vcpe_beijing/vcpe/pressure/echo.sh new file mode 100644 index 0000000..96489f2 --- /dev/null +++ b/vcpe_beijing/vcpe/pressure/echo.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +python /home/ubuntu/autotest/vcpe.py init + +#python /home/ubuntu/autotest/vcpe.py brg + +#python /home/ubuntu/autotest/vcpe.py customer + +#python /home/ubuntu/autotest/vcpe.py loop diff --git a/vcpe_beijing/vcpe/pressure/test.sh b/vcpe_beijing/vcpe/pressure/test.sh new file mode 100644 index 0000000..367db10 --- /dev/null +++ b/vcpe_beijing/vcpe/pressure/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +#开始时间 +begin=$(date +%s) + +count=4 +rsnum=1 +cishu=$(expr $count / $rsnum) + +for ((i=0; i<$cishu;)) +do + start_num=$(expr $i \* $rsnum + 1) + end_num=$(expr $start_num + $rsnum - 1) + for j in `seq $start_num $end_num` + do + #echo $j + ./echo.sh & + done + wait + i=$(expr $i + 1) +done + +#结束时间 +end=$(date +%s) +spend=$(expr $end - $begin) +echo "花费时间为$spend秒" -- cgit