mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #126, srs_publiser add warnings. refine config utest.
This commit is contained in:
parent
b17c736f3f
commit
7241fa8744
8 changed files with 84 additions and 8 deletions
|
@ -30,12 +30,36 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <srs_app_log.hpp>
|
||||
|
||||
// kernel module.
|
||||
ISrsLog* _srs_log = new ISrsLog();
|
||||
ISrsLog* _srs_log = new MockEmptyLog(SrsLogLevel::Disabled);
|
||||
ISrsThreadContext* _srs_context = new ISrsThreadContext();
|
||||
// app module.
|
||||
SrsConfig* _srs_config = NULL;
|
||||
SrsServer* _srs_server = NULL;
|
||||
|
||||
MockEmptyLog::MockEmptyLog(int level)
|
||||
{
|
||||
_level = level;
|
||||
}
|
||||
|
||||
MockEmptyLog::~MockEmptyLog()
|
||||
{
|
||||
}
|
||||
|
||||
int MockEmptyLog::on_reload_log_tank()
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
int MockEmptyLog::on_reload_log_level()
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
int MockEmptyLog::on_reload_log_file()
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
void __srs_bytes_print(char* pa, int size)
|
||||
{
|
||||
for(int i = 0; i < size; i++) {
|
||||
|
|
|
@ -31,6 +31,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <srs_app_log.hpp>
|
||||
|
||||
// we add an empty macro for upp to show the smart tips.
|
||||
#define VOID
|
||||
|
||||
|
@ -52,4 +54,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
// print the bytes.
|
||||
void __srs_bytes_print(char* pa, int size);
|
||||
|
||||
class MockEmptyLog : public SrsFastLog
|
||||
{
|
||||
private:
|
||||
int _level;
|
||||
public:
|
||||
MockEmptyLog(int level);
|
||||
virtual ~MockEmptyLog();
|
||||
public:
|
||||
virtual int on_reload_log_tank();
|
||||
virtual int on_reload_log_level();
|
||||
virtual int on_reload_log_file();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4341,3 +4341,26 @@ VOID TEST(ConfigMainTest, ParseFullConf_removed)
|
|||
EXPECT_STREQ("/", conf.get_vhost_http_mount(vhost).c_str());
|
||||
EXPECT_STREQ("./objs/nginx/html", conf.get_vhost_http_dir(vhost).c_str());
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, CheckConf_listen)
|
||||
{
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
EXPECT_TRUE(ERROR_SUCCESS != conf.parse("listens 1935;"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
EXPECT_TRUE(ERROR_SUCCESS != conf.parse("listen 0;"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
EXPECT_TRUE(ERROR_SUCCESS != conf.parse("listen -1;"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
EXPECT_TRUE(ERROR_SUCCESS != conf.parse("listen -1935;"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue