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-08-05 09:16:25 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
798f9139a4372cd34efaf30f5c9897ecd7bf0e09
798f9139
1 parent
daa382fe
add reload utest.
隐藏空白字符变更
内嵌
并排对比
正在显示
12 个修改的文件
包含
151 行增加
和
42 行删除
trunk/configure
trunk/src/core/srs_core.hpp
trunk/src/main/srs_main_server.cpp
trunk/src/srs/srs.upp
trunk/src/utest/srs_utest.hpp
trunk/src/utest/srs_utest_amf0.cpp
trunk/src/utest/srs_utest_config.cpp
trunk/src/utest/srs_utest_core.cpp
trunk/src/utest/srs_utest_kernel.cpp
trunk/src/utest/srs_utest_protocol.cpp
trunk/src/utest/srs_utest_reload.cpp
trunk/src/utest/srs_utest_reload.hpp
trunk/configure
查看文件 @
798f913
...
...
@@ -489,7 +489,8 @@ fi
#
# utest, the unit-test cases of srs, base on gtest1.6
MODULE_FILES
=(
"srs_utest"
"srs_utest_amf0"
"srs_utest_protocol"
"srs_utest_kernel"
"srs_utest_core"
"srs_utest_config"
)
"srs_utest_kernel"
"srs_utest_core"
"srs_utest_config"
"srs_utest_reload"
)
ModuleLibIncs
=(
${
SRS_OBJS
}
${
LibSTRoot
}
)
ModuleLibFiles
=(
${
LibSTfile
}
${
LibHttpParserfile
}
${
LibSSLfile
}
)
MODULE_DEPENDS
=(
"CORE"
"KERNEL"
"RTMP"
"APP"
)
...
...
trunk/src/core/srs_core.hpp
查看文件 @
798f913
...
...
@@ -86,7 +86,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// so we remove the srs_freepa utility.
/**
* disable copy constructor of class
* disable copy constructor of class,
* to avoid the memory leak or corrupt by copy instance.
*/
#define disable_default_copy(className)\
private:\
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
798f913
...
...
@@ -101,6 +101,11 @@ int main(int argc, char** argv)
srs_trace
(
"arm tool chain: "
SRS_AUTO_EMBEDED_TOOL_CHAIN
);
#endif
/**
* we do nothing in the constructor of server,
* and use initialize to create members, set hooks for instance the reload handler,
* all initialize will done in this stage.
*/
if
((
ret
=
_srs_server
->
initialize
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
...
...
trunk/src/srs/srs.upp
查看文件 @
798f913
...
...
@@ -125,6 +125,8 @@ file
..\utest\srs_utest_kernel.cpp,
..\utest\srs_utest_protocol.hpp,
..\utest\srs_utest_protocol.cpp,
..\utest\srs_utest_reload.hpp,
..\utest\srs_utest_reload.cpp,
research readonly separator,
..\..\research\librtmp\srs_bandwidth_check.c,
..\..\research\librtmp\srs_detect_rtmp.c,
...
...
@@ -140,4 +142,3 @@ file
mainconfig
"" = "MAIN";
...
...
trunk/src/utest/srs_utest.hpp
查看文件 @
798f913
...
...
@@ -33,6 +33,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_log.hpp>
// enable all utest.
#if 1
#define ENABLE_UTEST_AMF0
#define ENABLE_UTEST_CONFIG
#define ENABLE_UTEST_CORE
#define ENABLE_UTEST_KERNEL
#define ENABLE_UTEST_PROTOCOL
#define ENABLE_UTEST_RELOAD
#endif
// disable some for fast dev, compile and startup.
#if 1
#undef ENABLE_UTEST_AMF0
#undef ENABLE_UTEST_CONFIG
#undef ENABLE_UTEST_CORE
#undef ENABLE_UTEST_KERNEL
#undef ENABLE_UTEST_PROTOCOL
#undef ENABLE_UTEST_RELOAD
#endif
// we add an empty macro for upp to show the smart tips.
#define VOID
...
...
trunk/src/utest/srs_utest_amf0.cpp
查看文件 @
798f913
...
...
@@ -22,6 +22,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_utest_amf0.hpp>
#ifdef ENABLE_UTEST_AMF0
#include <string>
using
namespace
std
;
...
...
@@ -1269,3 +1271,5 @@ VOID TEST(ProtocolAMF0Test, ObjectEcmaStrict)
EXPECT_EQ
(
0
,
arr3
->
to_ecma_array
()
->
count
());
}
#endif
...
...
trunk/src/utest/srs_utest_config.cpp
查看文件 @
798f913
...
...
@@ -29,6 +29,47 @@ using namespace std;
#include <srs_kernel_error.hpp>
#include <srs_app_source.hpp>
MockSrsConfigBuffer
::
MockSrsConfigBuffer
(
string
buf
)
{
// read all.
int
filesize
=
(
int
)
buf
.
length
();
if
(
filesize
<=
0
)
{
return
;
}
// create buffer
pos
=
last
=
start
=
new
char
[
filesize
];
end
=
start
+
filesize
;
memcpy
(
start
,
buf
.
data
(),
filesize
);
}
MockSrsConfigBuffer
::~
MockSrsConfigBuffer
()
{
}
int
MockSrsConfigBuffer
::
fullfill
(
const
char
*
/*filename*/
)
{
return
ERROR_SUCCESS
;
}
MockSrsConfig
::
MockSrsConfig
()
{
}
MockSrsConfig
::~
MockSrsConfig
()
{
}
int
MockSrsConfig
::
parse
(
string
buf
)
{
MockSrsConfigBuffer
buffer
(
buf
);
return
parse_buffer
(
&
buffer
);
}
#ifdef ENABLE_UTEST_CONFIG
#define _MIN_OK_CONF "listen 1935; "
// full.conf
...
...
@@ -993,45 +1034,6 @@ std::string __full_conf = ""
"}
\n
"
;
MockSrsConfigBuffer
::
MockSrsConfigBuffer
(
string
buf
)
{
// read all.
int
filesize
=
(
int
)
buf
.
length
();
if
(
filesize
<=
0
)
{
return
;
}
// create buffer
pos
=
last
=
start
=
new
char
[
filesize
];
end
=
start
+
filesize
;
memcpy
(
start
,
buf
.
data
(),
filesize
);
}
MockSrsConfigBuffer
::~
MockSrsConfigBuffer
()
{
}
int
MockSrsConfigBuffer
::
fullfill
(
const
char
*
/*filename*/
)
{
return
ERROR_SUCCESS
;
}
MockSrsConfig
::
MockSrsConfig
()
{
}
MockSrsConfig
::~
MockSrsConfig
()
{
}
int
MockSrsConfig
::
parse
(
string
buf
)
{
MockSrsConfigBuffer
buffer
(
buf
);
return
parse_buffer
(
&
buffer
);
}
VOID
TEST
(
ConfigTest
,
CheckMacros
)
{
#ifndef SRS_CONSTS_LOCALHOST
...
...
@@ -5452,3 +5454,5 @@ VOID TEST(ConfigMainTest, CheckConf_pithy_print)
}
}
#endif
...
...
trunk/src/utest/srs_utest_core.cpp
查看文件 @
798f913
...
...
@@ -22,6 +22,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_utest_core.hpp>
#ifdef ENABLE_UTEST_CORE
using
namespace
std
;
#include <srs_core_autofree.hpp>
...
...
@@ -67,3 +69,5 @@ VOID TEST(CoreMacroseTest, Check)
#endif
}
#endif
...
...
trunk/src/utest/srs_utest_kernel.cpp
查看文件 @
798f913
...
...
@@ -199,6 +199,8 @@ int MockBufferReader::read(void* buf, size_t size, ssize_t* nread)
return
ERROR_SUCCESS
;
}
#ifdef ENABLE_UTEST_KERNEL
VOID
TEST
(
KernelBufferTest
,
DefaultObject
)
{
SrsBuffer
b
;
...
...
@@ -1510,3 +1512,5 @@ VOID TEST(KernelUtilityTest, UtilityString)
EXPECT_TRUE
(
srs_string_ends_with
(
"Hello"
,
"lo"
));
}
#endif
...
...
trunk/src/utest/srs_utest_protocol.cpp
查看文件 @
798f913
...
...
@@ -203,6 +203,8 @@ int MockBufferIO::read(void* buf, size_t size, ssize_t* nread)
return
ERROR_SUCCESS
;
}
#ifdef ENABLE_UTEST_PROTOCOL
#ifdef SRS_AUTO_SSL
// verify the sha256
...
...
@@ -5598,4 +5600,5 @@ VOID TEST(ProtocolRTMPTest, RTMPHandshakeBytes)
EXPECT_TRUE
(
bytes
.
s0s1s2
!=
NULL
);
}
#endif
...
...
trunk/src/utest/srs_utest_reload.cpp
0 → 100644
查看文件 @
798f913
/*
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_reload.hpp>
#ifdef ENABLE_UTEST_RELOAD
#endif
...
...
trunk/src/utest/srs_utest_reload.hpp
0 → 100644
查看文件 @
798f913
/*
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_RELOAD_HPP
#define SRS_UTEST_RELOAD_HPP
/*
#include <srs_utest_reload.hpp>
*/
#include <srs_core.hpp>
#endif
...
...
请
注册
或
登录
后发表评论