Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-03-04 14:01:43 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fe5811304b00e1c9f466ab0090ccab4274c7f2c4
fe581130
1 parent
02326cd8
add utest script to generate the utest Makefile
显示空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
196 行增加
和
22 行删除
trunk/auto/depends.sh
trunk/auto/libs.sh
trunk/auto/options.sh
trunk/auto/utest.sh
trunk/configure
trunk/src/srs/srs.upp
trunk/src/utest/srs_utest.cpp
trunk/src/utest/srs_utest.hpp
trunk/auto/depends.sh
100755 → 100644
查看文件 @
fe58113
trunk/auto/libs.sh
查看文件 @
fe58113
...
...
@@ -55,4 +55,8 @@ for item in ${MODULE_OBJS[*]}; do
done
echo
""
>>
${
FILE
}
# parent Makefile, to create module output dir before compile it.
echo
" mkdir -p
${
SRS_OBJS
}
/include"
>>
${
SRS_MAKEFILE
}
echo
" mkdir -p
${
SRS_OBJS
}
/lib"
>>
${
SRS_MAKEFILE
}
echo
-n
"generate lib
${
LIB_NAME
}
ok"
;
echo
'!'
;
...
...
trunk/auto/options.sh
查看文件 @
fe58113
...
...
@@ -26,7 +26,7 @@ SRS_SSL=YES
SRS_FFMPEG
=
YES
SRS_HTTP
=
YES
SRS_RESEARCH
=
NO
SRS_UTEST
=
NO
SRS_UTEST
=
YES
#####################################################################################
# parse options
...
...
trunk/auto/utest.sh
0 → 100644
查看文件 @
fe58113
# generate utest Makefile
#
# params:
# $SRS_OBJS the objs directory. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile
#
FILE
=
${
SRS_OBJS
}
/
${
SRS_MAKEFILE
}
.utest
cat
<< END > ${FILE}
# A sample Makefile for building Google Test and using it in user
# tests. Please tweak it to suit your environment and project. You
# may want to move it to your project's root directory.
#
# SYNOPSIS:
#
# make [all] - makes everything.
# make TARGET - makes the given target.
# make clean - removes all files generated by make.
# Please tweak the following variable definitions as needed by your
# project, except GTEST_HEADERS, which you can use in your own targets
# but shouldn't modify.
# Points to the root of Google Test, relative to where this file is.
# Remember to tweak this if you move this file.
GTEST_DIR = gtest-1.6.0
# Where to find user code.
USER_DIR = .
# Flags passed to the preprocessor.
CPPFLAGS += -I\$(GTEST_DIR)/include
# Flags passed to the C++ compiler.
CXXFLAGS += -g -Wall -Wextra -O0
# All tests produced by this Makefile. Remember to add new tests you
# created to the list.
TESTS = smart_utest
# All Google Test headers. Usually you shouldn't change this
# definition.
GTEST_HEADERS = \$(GTEST_DIR)/include/gtest/*.h \\
\$(GTEST_DIR)/include/gtest/internal/*.h
# House-keeping build targets.
all : \$(TESTS)
clean :
rm -f \$(TESTS) gtest.a gtest_main.a *.o
# Builds gtest.a and gtest_main.a.
# Usually you shouldn't tweak such internal variables, indicated by a
# trailing _.
GTEST_SRCS_ = \$(GTEST_DIR)/src/*.cc \$(GTEST_DIR)/src/*.h \$(GTEST_HEADERS)
# For simplicity and to avoid depending on Google Test's
# implementation details, the dependencies specified below are
# conservative and not optimized. This is fine as Google Test
# compiles fast and for ordinary users its source rarely changes.
gtest-all.o : \$(GTEST_SRCS_)
\$(CXX) \$(CPPFLAGS) -I\$(GTEST_DIR) \$(CXXFLAGS) -c \\
\$(GTEST_DIR)/src/gtest-all.cc
gtest_main.o : \$(GTEST_SRCS_)
\$(CXX) \$(CPPFLAGS) -I\$(GTEST_DIR) \$(CXXFLAGS) -c \\
\$(GTEST_DIR)/src/gtest_main.cc
gtest.a : gtest-all.o
\$(AR) \$(ARFLAGS) \$@ \$^
gtest_main.a : gtest-all.o gtest_main.o
\$(AR) \$(ARFLAGS) \$@ \$^
# Builds a sample test. A test should link with either gtest.a or
# gtest_main.a, depending on whether it defines its own main()
# function.
SMART_DIR=../objs
ST_DIR=\$(SMART_DIR)/st-1.9/obj
SSL_LINK = \$(SMART_DIR)/openssl-1.0.1c/libssl.a \$(SMART_DIR)/openssl-1.0.1c/libcrypto.a -ldl
smart_objs_o = objs/src/core/smt_public.o objs/src/core/smt_error_code.o objs/src/core/smt_log.o objs/src/core/smt_app.o objs/src/core/smt_utility.o objs/src/core/smt_process.o objs/src/core/smt_bytes_pool.o objs/src/core/smt_config.o objs/src/core/smt_buffer_manager.o objs/src/core/smt_connection.o objs/src/core/smt_descriptor.o objs/src/core/smt_tearup_ret.o objs/src/core/smt_context.o objs/src/core/smt_empty_app.o objs/src/core/smt_serialize.o objs/src/app/smt_app_process_handler.o objs/src/app/smt_app_smart_app.o objs/src/app/smt_app_connection.o objs/src/app/smt_app_socket_stream.o objs/src/app/smt_app_handshake.o objs/src/app/smt_app_context.o objs/src/app/smt_app_endpoint_switch.o objs/src/app/smt_app_edge.o objs/src/app/smt_app_edge_cache.o objs/src/app/smt_app_edge_stream.o objs/src/app/smt_app_utility.o objs/src/app/smt_app_edge_proxy.o objs/src/app/smt_app_api.o objs/src/app/smt_app_vhost_statistic.o objs/src/app/smt_app_bandwidth_check.o objs/src/protocol/rtmp/smt_rtmp_utility.o objs/src/protocol/rtmp/smt_rtmp_description_builder.o objs/src/protocol/rtmp/smt_rtmp_interfaces.o objs/src/protocol/rtmp/smt_rtmp_api.o objs/src/protocol/rtmp/smt_rtmp_chunk_packet.o objs/src/protocol/rtmp/smt_rtmp_handshake_packet.o objs/src/protocol/rtmp/smt_rtmp_message_packet.o objs/src/protocol/rtmp/smt_rtmp_farm.o objs/src/protocol/rtmp/smt_rtmp_crypto.o objs/src/protocol/rtmp/smt_rtmp_amf3.o objs/src/protocol/rtmp/smt_rtmp_bytes_pool.o objs/src/os/st/smt_st_process_model.o objs/src/os/st/smt_st_process_spawner.o objs/src/os/st/smt_st_process_channel.o objs/src/os/st/smt_st_utility.o objs/src/os/st/smt_st_pipe.o objs/src/os/st/smt_st_signal_channel.o objs/src/os/st/smt_st_server_listener.o objs/src/os/st/smt_st_connection.o objs/src/os/st/smt_st_connection_farm.o objs/src/os/st/smt_st_fd_auto_closer.o objs/src/log/smt_log_simple_log.o objs/src/log/smt_log_fast_log.o objs/src/amf0/smt_amf0_public.o objs/src/amf0/smt_amf0_packet.o objs/src/amf0/smt_amf0_codec.o objs/src/amf0/smt_amf0_utility.o objs/src/config/smt_config_app_args.o objs/src/config/smt_config_options_parser.o objs/src/config/smt_config_file_parser.o objs/src/stream/smt_stream_source.o objs/src/stream/smt_stream_vod_cache.o objs/src/stream/smt_stream_live_stream.o objs/src/stream/smt_stream_flv_muxer.o objs/src/stream/smt_stream_f4v_muxer.o objs/src/stream/smt_stream_vod_stream.o objs/src/stream/smt_stream_public_api.o objs/src/stream/smt_stream_internal_api.o objs/src/stream/smt_stream_utility.o objs/src/stream/smt_stream_buffer_manager.o objs/src/stream/smt_stream_factory.o objs/src/stream/smt_stream_file_stream.o objs/src/stream/smt_stream_strategy.o objs/src/stream/smt_stream_source_pool.o
smart_objs = \$(addprefix \$(SMART_DIR)/../, \$(smart_objs_o))
SMART_INC = -I\$(SMART_DIR)/inc -I\$(ST_DIR)
SSL_LINK = \$(SMART_DIR)/openssl-1.0.1c/libssl.a \$(SMART_DIR)/openssl-1.0.1c/libcrypto.a -ldl
smart_refer_utest.o : \$(smart_objs) smart_refer_utest.cpp
\$(CXX) \$(CPPFLAGS) \$(CXXFLAGS) \$(SMART_INC) -c smart_refer_utest.cpp -o \$@
smart_app_utest.o : \$(smart_objs) smart_app_utest.cpp
\$(CXX) \$(CPPFLAGS) \$(CXXFLAGS) \$(SMART_INC) -c smart_app_utest.cpp -o \$@
smart_reload_utest.o : \$(smart_objs) smart_reload_utest.cpp
\$(CXX) \$(CPPFLAGS) \$(CXXFLAGS) \$(SMART_INC) -c smart_reload_utest.cpp -o \$@
smart_process_pool_utest.o : \$(smart_objs) smart_process_pool_utest.cpp
\$(CXX) \$(CPPFLAGS) \$(CXXFLAGS) \$(SMART_INC) -c smart_process_pool_utest.cpp -o \$@
smart_config_utest.o : \$(smart_objs) smart_config_utest.cpp
\$(CXX) \$(CPPFLAGS) \$(CXXFLAGS) \$(SMART_INC) -c smart_config_utest.cpp -o \$@
smart_utest.o : \$(smart_objs) smart_utest.cpp
@echo "ensure the smart-server is updated: (cd .. && make all)"
\$(CXX) \$(CPPFLAGS) \$(CXXFLAGS) \$(SMART_INC) -c smart_utest.cpp -o \$@
utest_objs = smart_utest.o smart_config_utest.o smart_process_pool_utest.o smart_reload_utest.o smart_app_utest.o smart_refer_utest.o
smart_utest : \$(utest_objs) gtest_main.a \$(smart_objs)
@echo \$(smart_objs)
@echo "===================="
@echo "the utest must run in centos6, for we depends on -lssl, that used in smart-server is openssl-1.0.1c"
\$(CXX) \$(CPPFLAGS) \$(CXXFLAGS) -lpthread \$^ \$(ST_DIR)/libst.a \$(SSL_LINK) -o \$@
END
# parent Makefile, to create module output dir before compile it.
echo
" mkdir -p
${
SRS_OBJS
}
/utest"
>>
${
SRS_MAKEFILE
}
echo
-n
"generate utest ok"
;
echo
'!'
;
...
...
trunk/configure
查看文件 @
fe58113
...
...
@@ -49,9 +49,11 @@ echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# srs-librtmp sample entry
SrsLibrtmpSampleEntry
=
"nossl"
;
if
[
$SRS_SSL
=
YES
]
;
then
SrsLibrtmpSampleEntry
=
"ssl"
;
fi
SrsLibrtmpSampleEntry
=
"nossl"
if
[
$SRS_SSL
=
YES
]
;
then
SrsLibrtmpSampleEntry
=
"ssl"
;
fi
# utest make entry, (cd utest; make)
SrsUtestMakeEntry
=
"@echo -e
\"
ignore utest for it's disabled
\"
"
;
if
[
$SRS_UTEST
=
YES
]
;
then
SrsUtestMakeEntry
=
"(cd utest;
\$
(MAKE))"
;
fi
SrsUtestMakeEntry
=
"@echo -e
\"
ignore utest for it's disabled
\"
"
if
[
$SRS_UTEST
=
YES
]
;
then
SrsUtestMakeEntry
=
"(
\$
(MAKE) -f
${
SRS_OBJS
}
/
${
SRS_MAKEFILE
}
.utest)"
;
fi
#####################################################################################
# colorful summary
...
...
@@ -102,7 +104,8 @@ help:
@echo " utest build the utest for srs"
clean:
(rm -f Makefile; cd ${SRS_OBJS}; rm -rf srs bandwidth Makefile *.hpp srs_utest)
(rm -f Makefile; rm -f ${SRS_OBJS}/Makefile*)
(cd ${SRS_OBJS}; rm -rf srs bandwidth *.hpp srs_utest)
(cd ${SRS_OBJS}; rm -rf src research include lib utest)
(cd research/librtmp; make clean)
...
...
@@ -153,8 +156,8 @@ CC ?= gcc
GCC ?= gcc
CXX ?= g++
AR ?= ar
LINK ?= g++
CXXFLAGS = ${CXXFLAGS}
LINK = g++
.PHONY: default srs bandwidth librtmp
...
...
@@ -168,22 +171,13 @@ END
# library(.a): add to ModuleLibFiles if binary need the specifeid library. for example, LibSTfile
#
# st(state-threads) the basic network library for SRS.
LibSTRoot
=
"
${
SRS_OBJS
}
/st"
LibSTfile
=
"
${
LibSTRoot
}
/libst.a"
LibSTRoot
=
"
${
SRS_OBJS
}
/st"
;
LibSTfile
=
"
${
LibSTRoot
}
/libst.a"
# hp(http-parser) the http request/url parser, for SRS to support HTTP callback.
LibHttpParserRoot
=
""
LibHttpParserfile
=
""
if
[
$SRS_HTTP
=
YES
]
;
then
LibHttpParserRoot
=
"
${
SRS_OBJS
}
/hp"
LibHttpParserfile
=
"
${
LibHttpParserRoot
}
/libhttp_parser.a"
fi
LibHttpParserRoot
=
""
;
LibHttpParserfile
=
""
if
[
$SRS_HTTP
=
YES
]
;
then
LibHttpParserRoot
=
"
${
SRS_OBJS
}
/hp"
;
LibHttpParserfile
=
"
${
LibHttpParserRoot
}
/libhttp_parser.a"
;
fi
# openssl-1.0.1f, for the RTMP complex handshake.
LibSSLRoot
=
""
LibSSLfile
=
""
if
[
$SRS_SSL
=
YES
]
;
then
LibSSLRoot
=
"
${
SRS_OBJS
}
/openssl/include"
LibSSLfile
=
"
${
SRS_OBJS
}
/openssl/lib/libssl.a
${
SRS_OBJS
}
/openssl/lib/libcrypto.a"
fi
LibSSLRoot
=
""
;
LibSSLfile
=
""
if
[
$SRS_SSL
=
YES
]
;
then
LibSSLRoot
=
"
${
SRS_OBJS
}
/openssl/include"
;
LibSSLfile
=
"
${
SRS_OBJS
}
/openssl/lib/libssl.a
${
SRS_OBJS
}
/openssl/lib/libcrypto.a"
;
fi
#####################################################################################
# Modules, compile each module, then link to binary
...
...
@@ -241,6 +235,11 @@ MODULE_DIR="src/main" . auto/modules.sh
MAIN_OBJS
=
"
${
MODULE_OBJS
[@].o
}
"
#####################################################################################
# utest, the unit-test cases of srs, base on gtest1.6
MODULE_OBJS
=
"
${
CORE_OBJS
[@]
}
${
KERNEL_OBJS
[@]
}
${
RTMP_OBJS
[@]
}
${
APP_OBJS
[@]
}
${
MAIN_OBJS
[@]
}
"
BUILD_KEY
=
"utest"
APP_NAME
=
"srs_utest"
. auto/utest.sh
#####################################################################################
# Binaries, main entrances, link the module and its depends modules,
# then link to a binary, for example, objs/srs
#
...
...
@@ -272,9 +271,6 @@ echo 'configure ok! '
#####################################################################################
# create objs/logs for ffmpeg to write log.
mkdir -p
${
SRS_OBJS
}
/logs
# lib and include for library
mkdir -p
${
SRS_OBJS
}
/lib
mkdir -p
${
SRS_OBJS
}
/include
#####################################################################################
# configure summary
...
...
trunk/src/srs/srs.upp
查看文件 @
fe58113
...
...
@@ -73,6 +73,9 @@ file
..\app\srs_app_socket.cpp,
..\app\srs_app_source.hpp,
..\app\srs_app_source.cpp,
utest readonly separator,
..\utest\srs_utest.hpp,
..\utest\srs_utest.cpp,
research readonly separator,
..\..\research\librtmp\srs_play.c,
..\..\research\librtmp\srs_publish.c,
...
...
trunk/src/utest/srs_utest.cpp
0 → 100644
查看文件 @
fe58113
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_utest.hpp>
...
...
trunk/src/utest/srs_utest.hpp
0 → 100644
查看文件 @
fe58113
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_UTEST_PUBLIC_SHARED_HPP
#define SRS_UTEST_PUBLIC_SHARED_HPP
/*
#include <srs_utest.hpp>
*/
#endif
...
...
请
注册
或
登录
后发表评论