Skip to content

Instantly share code, notes, and snippets.

@qiujianzhong
Last active June 5, 2018 07:37
Show Gist options
  • Save qiujianzhong/45e6f5425b6ca787ef605be545db8087 to your computer and use it in GitHub Desktop.
Save qiujianzhong/45e6f5425b6ca787ef605be545db8087 to your computer and use it in GitHub Desktop.
avvod test script
#!/bin/bash
#make by xiaoqiu
#2018-04-09
#持续完善中
#第一次使用,需要安装依赖
#brew install coreutils
#brew install mpv --with-bundle
#每个视频约放7秒
TIMEOUT=15
#播放的时候结尾加随机数
rmd=`date +%s%N`
#publicbucket_z0 加速域名
z0host='http://oepw6i5pr.qnssl.com'
#publicbucket_z1 加速域名
z1host='http://oepwccwak.qnssl.com'
#publicbucket_z2 普通域名
z2host='http://7xlv47.com0.z2.glb.clouddn.com'
#publicbucket_na0 加速域名
na0host='http://na0.qbox.net'
#publicbucket_as0
as0host='http://p2zu52t3g.sabkt.gdipper.com'
#publicbucket_z0 cs
cshost='http://8fgwoh.com1.z0.glb.clouddn.com'
#各机房的proxy
#https://cf.qiniu.io/pages/viewpage.action?pageId=16092953
export http_proxy=""
export https_proxy=""
name=""
case $1 in
cs)
echo "cs testing"
host=$cshost
;;
z0)
echo "z0 testing"
host=$z0host
;;
z1)
echo "z1 testing"
host=$z1host
;;
z2)
echo "z2 没有avvod"
host=$z2host
exit 1
;;
na0)
echo "na0 testing"
host=$na0host
;;
as0)
echo "as0 testing"
host=$as0host
;;
xs)
echo "xs testing"
host=$z0host
#设置 proxy
export http_proxy=http://nbxs-gate-io.qiniu.com:80
export https_proxy=http://nbxs-gate-io.qiniu.com:80
;;
jjh)
echo "jjh testing"
host=$z0host
#设置 proxy
export http_proxy=http://nbjjh-gate-io.qiniu.com:80
export https_proxy=http://nbjjh-gate-io.qiniu.com:80
;;
bc)
echo "bc testing"
host=$z1host
#设置 proxy
export http_proxy=http://bc-gate-io.qiniu.com:80
export https_proxy=http://bc-gate-io.qiniu.com:80
;;
zz)
echo "zz testing"
host=$z1host
#exit 1
#设置 proxy
export http_proxy=http://hbzz-gate-io.qiniu.com:80
export https_proxy=http://hbzz-gate-io.qiniu.com:80
;;
fs)
echo "fs 没有avvod"
host=$z2host
exit 1
#设置 proxy
#export http_proxy=http://hnfs-gate-io.qiniu.com:80
#export https_proxy=http://hnfs-gate-io.qiniu.com:80
;;
*)
echo "请输入正确的区域:[cs|z0|z1|z2|na0|as0|xs|jjh|bc|zz|fs]"
exit 1
;;
esac
echo $http_proxy
#echo "testing"
echo '查看测试用户是否正常'
strA=$(curl -i $host/testmkv.mkv?avvod/m3u8/1/$rmd |egrep "Content-Type|avts|X-Reqid:")
strB="avts"
result=$(echo $strA | grep "${strB}")
if [[ "$result" == "" ]]
then
echo "返回内容不包含m3u8,测试不通过"
exit 1
fi
echo '基础格式avvod测试'
mpv $host/testmkv.mkv?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.mp4?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.mpeg?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/xsw0.ts?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.MOV?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.wmv?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.mp3?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.aac?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.m4r?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.amr?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.wma?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test2.wav?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.ogg?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/flac.flac?avvod/m3u8/$rmd & sleep $TIMEOUT ; kill $!
echo '音频相关 正向用例'
#选填参数请求
mpv $host/upload.mp3?avvod/m3u8/pipeline/av-test/aq/9/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.mp3?avvod/m3u8/pipeline/av-test/aq/0/ar/8000/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.mp3?avvod/m3u8/pipeline/av-test/ab/128k/acodec/libfaac/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.aac?avvod/m3u8/pipeline/av-test/aq/250/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.aac?avvod/m3u8/pipeline/av-test/ab/128k/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.aac?avvod/m3u8/pipeline/av-test/ab/64k/acodec/libfaac/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.m4r?avvod/m3u8/pipeline/av-test/aq/500/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.m4r?avvod/m3u8/pipeline/av-test/ab/192k/acodec/libmp3lame/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.amr?avvod/m3u8/pipeline/av-test/aq/150/ar/22050/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.amr?avvod/m3u8/pipeline/av-test/ab/256k/ar/44100/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.wma?avvod/m3u8/pipeline/av-test/aq/9/ar/44100/$rmd & sleep $TIMEOUT ; kill $!
#mpv $host/test.wma?avvod/m3u8/pipeline/av-test/ab/320k/acodec/libvorbis/$rmd & sleep $TIMEOUT ; kill $! #无法播放[暂时移除这种编码格式]
mpv $host/test2.wav?avvod/m3u8/pipeline/av-test/aq/250/ar/22050/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.ogg?avvod/m3u8/pipeline/av-test/aq/125/ar/44100/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/test.ogg?avvod/m3u8/pipeline/av-test/ab/125k/ar/8000/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/flac.flac?avvod/m3u8/pipeline/av-test/aq/9/$rmd & sleep $TIMEOUT ; kill $!
#反向用例
mpv $host/upload.mp3?avvod/m3u8/pipeline/notexist/$rmd & sleep $TIMEOUT ; kill $! #"no such pipeline" [已修改策略,目前预期用avvod-pipeline或第一个pipeline处理]
echo '此请求400 xxxxxxxxxxxxxxxxx'
mpv $host/test2.wav?avvod/m3u8/pipeline/av-test/ab/256k/ar/12050/$rmd & sleep $TIMEOUT ; kill $!
echo '此请求400 xxxxxxxxxxxxxxxxx'
mpv $host/test.m4r?avvod/m3u8/pipeline/av-test/ab/192k/acodec/libmp3la/$rmd & sleep $TIMEOUT ; kill $! # "unsupported audio encoder"
echo '此请求400 xxxxxxxxxxxxxxxxx'
mpv $host/test.m4r?avvod/m3u8/pipeline/av-test/ab/asdfj/$rmd & sleep $TIMEOUT ; kill $! # "invalid audio bitrate"
echo '视频相关 正向用例'
#选填参数请求
mpv $host/upload.flv?avvod/m3u8/pipeline/av-test/ab/64k/aq/20/ar/8000/r/24/vb/128k/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.mp4?avvod/m3u8/pipeline/av-test/ab/64k/aq/20/ar/8000/r/24/vb/128k/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.mpeg?avvod/m3u8/pipeline/av-test/ab/64k/aq/20/ar/8000/r/24/vb/128k/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/testmkv.mkv?avvod/m3u8/pipeline/av-test/ab/64k/aq/20/ar/8000/r/24/vb/128k/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.wmv?avvod/m3u8/pipeline/av-test/ab/64k/aq/20/ar/8000/r/24/vb/128k/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.MOV?avvod/m3u8/pipeline/av-test/ab/64k/aq/20/ar/8000/r/24/vb/128k/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.avi?avvod/m3u8/pipeline/av-test/ab/64k/aq/20/ar/8000/r/24/vb/128k/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.avi?avvod/m3u8/pipeline/av-test/autosave/0/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/upload.avi?avvod/m3u8/pipeline/av-test/autosave/1/$rmd & sleep $TIMEOUT ; kill $!
sleep 5
mpv $host/upload.avi?avvod/m3u8/pipeline/av-test/autosave/1/$rmd & sleep $TIMEOUT ; kill $!
mpv $host/4k.mp4?avvod/m3u8/pipeline/av-test/s/320x240/vcodec/libx264/$rmd & sleep 30 ; kill $!
mpv $host/4k.mp4?avvod/m3u8/pipeline/av-test/s/640x480/vcodec/libx265/$rmd & sleep 30 ; kill $!
mpv $host/4k.mp4?avvod/m3u8/pipeline/av-test/s/1080x720/$rmd & sleep 30 ; kill $!
mpv $host/4k.mp4?avvod/m3u8/pipeline/av-test/s/1920x1080/$rmd & sleep 30 ; kill $!
#mpv $host/4k.mp4?avvod/m3u8/pipeline/av-test/s/2560x1440/$rmd & sleep 30 ; kill $!
#mpv $host/4k.mp4?avvod/m3u8/pipeline/av-test/s/3840x2160/$rmd & sleep 30 ; kill $!
#用户请求指定pipeline参数不存在
echo "error 474 Unknown"
mpv $host/upload.flv?avvod/m3u8/pipeline/nohave/shsh/$rmd & sleep $TIMEOUT ; kill $!
#取消proxy
export http_proxy=""
export https_proxy=""
exit 0
:<<BLOCK
#下载视频
echo '下载'
mkdir avvod
cd avvod
nbhost='http://oepw6i5pr.qnssl.com'
wget $nbhost/copy.3gp #Error
wget $nbhost/upload.avi
wget $nbhost/upload.flv
#wget $nbhost/xsw.m3u8 #400
wget $nbhost/testmkv.mkv
wget $nbhost/upload.mp3
wget $nbhost/upload.mp4
wget $nbhost/upload.mpeg
wget $nbhost/xsw0.ts
wget $nbhost/upload.MOV
wget $nbhost/upload.wmv
wget $nbhost/test.aac
wget $nbhost/test.m4r
wget $nbhost/test.amr
wget $nbhost/test.wma
wget $nbhost/test2.wav
wget $nbhost/test.ogg
wget $nbhost/flac.flac
qshell account lKqiRDS8itbxtyLjwaLyE08SvU5979waNpggrE2S jWZqSKm4EEaAh9AaC39cpgmq9C7lpwXUsnUqX_hS
#qshell account lVgtk5xr03Oz_uvkzDtQ8LtpiEUWx5tGEDUZVg1y Kutyz7qxjZ_v_EySl49IsJw_Di06hvSLR3pRrH6P
cd avvod
for f in `ls `;
do
nohup qshell rput publicbucket_z0 $f $f http://10.200.20.23:5010 >/dev/null 2>&1
done
exit
BLOCK
#Playing: http://oepwccwak.qnssl.com/test2.wav?avvod/m3u8/pipeline/av-test/ab/256k/ar/12050/1504255480N
#Failed to open http://oepwccwak.qnssl.com/test2.wav?avvod/m3u8/pipeline/av-test/ab/256k/ar/12050/1504255480N.
#Failed to open http://oepwccwak.qnssl.com/test.m4r?avvod/m3u8/pipeline/av-test/ab/192k/acodec/libmp3la/1504255480N.
#Failed to open http://oepwccwak.qnssl.com/test.m4r?avvod/m3u8/pipeline/av-test/ab/asdfj/1504255480N.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment