diff --git a/trunk/3rdparty/gtest-1.6.0.zip b/trunk/3rdparty/gtest-1.6.0.zip new file mode 100644 index 000000000..f07c43a74 Binary files /dev/null and b/trunk/3rdparty/gtest-1.6.0.zip differ diff --git a/trunk/3rdparty/readme.txt b/trunk/3rdparty/readme.txt index 2e930e5df..3c11c8909 100755 --- a/trunk/3rdparty/readme.txt +++ b/trunk/3rdparty/readme.txt @@ -27,6 +27,9 @@ tools/ccache-3.1.9.zip 1.st.arm.Makefile.patch st编译脚本补丁,允许用户指定cc编译器。 + +gtest-1.6.0.zip + google单元测试框架。 links: ffmpeg: @@ -53,4 +56,7 @@ links: openssl: http://www.openssl.org/ http://www.openssl.org/source/openssl-1.0.1f.tar.gz + gtest: + https://code.google.com/p/googletest + https://code.google.com/p/googletest/downloads/list diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 353206756..4ad84c5d4 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -405,3 +405,16 @@ if [ $SRS_RESEARCH = YES ]; then (cd research/ffempty && make && mv ffempty ../../${SRS_OBJS}/research) ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/ffempty failed, ret=$ret"; exit $ret; fi fi + +##################################################################################### +# build utest code +##################################################################################### +if [ $SRS_UTEST = YES ]; then + mkdir -p ${SRS_OBJS}/utest + + (cd research/hls && make && mv ts_info ../../${SRS_OBJS}/research) + ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/hls failed, ret=$ret"; exit $ret; fi + + (cd research/ffempty && make && mv ffempty ../../${SRS_OBJS}/research) + ret=$?; if [[ $ret -ne 0 ]]; then echo "build research/ffempty failed, ret=$ret"; exit $ret; fi +fi diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index e7adad567..e66729742 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -16,6 +16,7 @@ SRS_SSL=RESERVED SRS_FFMPEG=RESERVED SRS_HTTP=RESERVED SRS_RESEARCH=RESERVED +SRS_UTEST=RESERVED # TODO: remove the default to yes. SRS_HLS=YES @@ -23,6 +24,7 @@ SRS_SSL=YES SRS_FFMPEG=YES SRS_HTTP=YES SRS_RESEARCH=NO +SRS_UTEST=NO ##################################################################################### # parse options @@ -45,13 +47,15 @@ do --with-hls) SRS_HLS=YES ;; --with-ffmpeg) SRS_FFMPEG=YES ;; --with-http) SRS_HTTP=YES ;; - --with-research) SRS_RESEARCH=YES ;; + --with-research) SRS_RESEARCH=YES ;; + --with-utest) SRS_UTEST=YES ;; --without-ssl) SRS_SSL=NO ;; --without-hls) SRS_HLS=NO ;; --without-ffmpeg) SRS_FFMPEG=NO ;; --without-http) SRS_HTTP=NO ;; - --without-research) SRS_RESEARCH=NO ;; + --without-research) SRS_RESEARCH=NO ;; + --without-utest) SRS_UTEST=NO ;; *) echo "$0: error: invalid option \"$option\"" @@ -78,12 +82,14 @@ if [ $help = yes ]; then srs will call the http hooks, such as: on_connect. --with-ffmpeg enable transcoding with ffmpeg. --with-research build the research tools. + --with-utest build the utest for srs. --without-ssl disable rtmp complex handshake. --without-hls disable hls, rtmp streaming only. --without-http disable http, http hooks callback. --without-ffmpeg disable the ffmpeg transcoding feature. --without-research do not build the research tools. + --without-utest do not build the utest for srs. END exit 0 @@ -113,6 +119,10 @@ if [ $SRS_RESEARCH = RESERVED ]; then echo "you must specifies the research, see: ./configure --help"; __check_ok=NO fi +if [ $SRS_UTEST = RESERVED ]; then + echo "you must specifies the utest, see: ./configure --help"; + __check_ok=NO +fi if [ $__check_ok = NO ]; then exit 1; fi diff --git a/trunk/configure b/trunk/configure index f591a2968..7cdd5cb81 100755 --- a/trunk/configure +++ b/trunk/configure @@ -45,11 +45,17 @@ if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl" fi +# utest make entry, (cd utest; make) +SrsUtestMakeEntry="@echo -e \"\$(YELLOW)ignore utest for it's disabled\$(BLACK)\"" +if [ $SRS_UTEST = YES ]; then + SrsUtestMakeEntry="(cd utest; make)" +fi + # makefile echo "generate Makefile" SRS_MAKEFILE="Makefile" cat << END > ${SRS_MAKEFILE} -.PHONY: default help clean server bandwidth librtmp librtmp-sample _prepare_dir +.PHONY: default help clean server bandwidth librtmp librtmp-sample utest _prepare_dir # linux shell color support. RED="\\\\e[31m" @@ -57,26 +63,29 @@ GREEN="\\\\e[32m" YELLOW="\\\\e[33m" BLACK="\\\\e[0m" -default: server bandwidth librtmp librtmp-sample +default: server bandwidth librtmp librtmp-sample utest @echo -e "\$(GREEN)" @echo -e "build success:" @echo -e " server: ./objs/srs, the srs server" @echo -e " bandwidth: ./objs/bandwidth, the bandwidth test client" @echo -e " librtmp: ./objs/include, ./objs/lib, the srs-librtmp library" @echo -e " librtmp-sample: ./research/librtmp, the srs-librtmp client sample" + @echo -e " utest: ./objs/srs_utest, the utest for srs" @echo -e "\$(BLACK)" help: - @echo "Usage: make |||||" + @echo "Usage: make ||||||" @echo " help display this help menu" @echo " clean cleanup project" @echo " server build the srs(simple rtmp server) over st(state-threads)" @echo " bandwidth build the bandwidth test client tool." @echo " librtmp build the client publish/play library." @echo " librtmp-sample build the srs-librtmp sample" + @echo " utest build the utest for srs" clean: - (rm -f Makefile; cd ${SRS_OBJS}; rm -rf srs bandwidth Makefile *.hpp src st_*_load research include lib) + (rm -f Makefile; cd ${SRS_OBJS}; rm -rf srs bandwidth Makefile *.hpp srs_utest) + (cd ${SRS_OBJS}; rm -rf src research include lib utest) (cd research/librtmp; make clean) server: _prepare_dir @@ -96,6 +105,11 @@ librtmp-sample: (cd research/librtmp; make ${SrsLibrtmpSampleEntry}) @echo "srs-librtmp sample build success" +utest: + @echo "build the utest for srs" + ${SrsUtestMakeEntry} + @echo "utest for srs build success" + # the ./configure will generate it. _prepare_dir: @mkdir -p ${SRS_OBJS}