TEST_F(MallocDebugConfigTest, free_track_backtrace_num_frames_zero) {
  ASSERT_TRUE(InitConfig("free_track_backtrace_num_frames=0")) << getFakeLogPrint();

  ASSERT_EQ(0U, config->options);
  ASSERT_EQ(0U, config->free_track_backtrace_num_frames);

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  ASSERT_STREQ("", getFakeLogPrint().c_str());
}
TEST_F(MallocDebugConfigTest, leak_track_fail) {
  ASSERT_FALSE(InitConfig("leak_track=100")) << getFakeLogPrint();

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  std::string log_msg(
      "6 malloc_debug malloc_testing: value set for option 'leak_track' "
      "which does not take a value\n");
  ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
TEST_F(MallocDebugConfigTest, overflow) {
  ASSERT_FALSE(InitConfig("backtrace=99999999999999999999"));

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  std::string log_msg(
      "6 malloc_debug malloc_testing: bad value for option 'backtrace': "
      "Math result not representable\n");
  ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
TEST_F(MallocDebugConfigTest, multiple_options) {
  ASSERT_TRUE(InitConfig("  backtrace=64   front_guard=48")) << getFakeLogPrint();
  ASSERT_EQ(BACKTRACE | TRACK_ALLOCS | FRONT_GUARD, config->options);
  ASSERT_EQ(64U, config->backtrace_frames);
  ASSERT_EQ(48U, config->front_guard_bytes);

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  ASSERT_STREQ("", getFakeLogPrint().c_str());
}
TEST_F(MallocDebugConfigTest, no_space) {
  ASSERT_FALSE(InitConfig("backtrace=10front_guard"));

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  std::string log_msg(
      "6 malloc_debug malloc_testing: bad value for option 'backtrace', "
      "non space found after option: front_guard\n");
  ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
TEST_F(MallocDebugConfigTest, illegal_value_negative) {
  ASSERT_FALSE(InitConfig("backtrace=-1"));

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  std::string log_msg(
      "6 malloc_debug malloc_testing: bad value for option 'backtrace', "
      "value cannot be negative: -1\n");
  ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
Exemplo n.º 7
0
Arquivo: main.c Projeto: FTCr/Siemens
int maincsm_onmessage(CSM_RAM* data, GBS_MSG* msg)
{	
	if (msg->msg == MSG_RECONFIGURE_REQ)
	{
		if (strcmp_nocase(successed_config_filename, (char*)msg->data0) == 0)
			InitConfig();
	}
	return 1;
}
TEST_F(MallocDebugConfigTest, free_track_backtrace_num_frames_max_error) {
  ASSERT_FALSE(InitConfig("free_track_backtrace_num_frames=400"));

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  std::string log_msg(
      "6 malloc_debug malloc_testing: bad value for option 'free_track_backtrace_num_frames', "
      "value must be <= 256: 400\n");
  ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
Exemplo n.º 9
0
static void init()
{
	decoder_ = FLAC__file_decoder_new();
	strcpy(lastfn_, "");

	InitConfig();
	ReadConfig();
	InitInfobox();
}
TEST_F(MallocDebugConfigTest, backtrace_enable_on_signal_max_error) {
  ASSERT_FALSE(InitConfig("backtrace_enable_on_signal=300"));

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  std::string log_msg(
      "6 malloc_debug malloc_testing: bad value for option 'backtrace_enable_on_signal', "
      "value must be <= 256: 300\n");
  ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
TEST_F(MallocDebugConfigTest, fill_min_error) {
  ASSERT_FALSE(InitConfig("fill=0"));

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  std::string log_msg(
      "6 malloc_debug malloc_testing: bad value for option 'fill', "
      "value must be >= 1: 0\n");
  ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
TEST_F(MallocDebugConfigTest, rear_guard_max_error) {
  ASSERT_FALSE(InitConfig("rear_guard=20000"));

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  std::string log_msg(
      "6 malloc_debug malloc_testing: bad value for option 'rear_guard', "
      "value must be <= 16384: 20000\n");
  ASSERT_STREQ((log_msg + usage_string).c_str(), getFakeLogPrint().c_str());
}
Exemplo n.º 13
0
Scorer::Scorer(const string& name, const string& config)
  : m_name(name),
    m_vocab(mert::VocabularyFactory::GetVocabulary()),
#if defined(__GLIBCXX__) || defined(__GLIBCPP__)
    m_filter(NULL),
#endif
    m_score_data(NULL),
    m_enable_preserve_case(true)
{
  InitConfig(config);
}
Exemplo n.º 14
0
TEST(Config, SpecialSectionValues) {
    InitConfig("data/s3test.conf", "special_over");

    EXPECT_EQ(8, s3ext_threadnum);
    EXPECT_EQ(128 * 1024 * 1024, s3ext_chunksize);
    EXPECT_EQ(10240, s3ext_low_speed_limit);
    EXPECT_EQ(60, s3ext_low_speed_time);

    EXPECT_TRUE(s3ext_encryption);
    EXPECT_FALSE(s3ext_debug_curl);
}
Exemplo n.º 15
0
hkvJsonStreamReader::hkvJsonStreamReader(hkvJsonFileHandler* pFileHandler, hkvJsonStreamReadHandler* pReadHandler, int iParserFlags) :
  m_pHandle(NULL),
  m_pMemHandler(NULL),
  m_pFileHandler(pFileHandler),
  m_pReadHandler(pReadHandler)
{
  assert(m_pFileHandler);
  assert(m_pReadHandler);

  InitHandle(NULL);
  InitConfig(iParserFlags);
}
Exemplo n.º 16
0
	BOOL Init()
	{
		InitConfig( );
		InitDafaultConfig( "./ServerConfig.ini" );
		Printf( m_ddesc[0] );
		Printf( m_ddesc[1] );
		
		SetServerType(AGENT_SERVER);
		LoadServerConfig( "./ServerConfig.ini" );
		Printf( m_desc[0] );
		Printf( m_desc[1] );
		return TRUE;
	}
Exemplo n.º 17
0
//******************************************************************************
// load parameters from the registry
//******************************************************************************
void LoadConfig(sbtray_parms * p)
{
	LONG err;
	HKEY hKey;
	DWORD value;
	DWORD value_size;

#define REGLOAD_DWORD(vn,vv) \
		value_size = sizeof(DWORD); \
		err = RegQueryValueEx(hKey,vn,0,0, \
					(LPBYTE)&value,&value_size); \
		if ((err == ERROR_SUCCESS) && (value_size == sizeof(DWORD))) \
		{ \
			vv = value; \
		}

#define REGLOAD_STR(vn,vv) \
		ZeroMemory(vv,SBTRAY_PARMS_STRLEN+1); \
		value_size = SBTRAY_PARMS_STRLEN+1; \
		err = RegQueryValueEx(hKey,vn,0,0, \
					(LPBYTE)vv,&value_size); \
		if (err != ERROR_SUCCESS) \
		{ \
			vv[0] = '\0'; \
		}

	// sanity check
	if (!p)
		return;

	InitConfig(p);

	err = RegOpenKeyEx(HKEY_CURRENT_USER,TOPLEVEL_REGKEY,
				0,KEY_READ,&hKey);
	if (err == ERROR_SUCCESS)
	{
		REGLOAD_DWORD( REGVALUE_ENABLESOUNDS,  p->bEnableSounds )
		REGLOAD_DWORD( REGVALUE_UPDATEPERIOD,  p->dwUpdatePeriod )
		REGLOAD_DWORD( REGVALUE_ENABLELOGGING, p->bEnableLogging )
		REGLOAD_DWORD( REGVALUE_ENABLEEMAIL,   p->bEnableEmail )
		REGLOAD_STR(   REGVALUE_SMTPSERVER,    p->szSMTPServer )
		REGLOAD_STR(   REGVALUE_MAILFROM,      p->szMailFrom )
		REGLOAD_STR(   REGVALUE_MAILTO,        p->szMailTo )
		REGLOAD_DWORD( REGVALUE_SELECTEDWORLD, p->dwSelectedWorld )

		RegCloseKey(hKey);
	}
	
	return;
}
TEST_F(MallocDebugConfigTest, front_guard) {
  ASSERT_TRUE(InitConfig("front_guard=48"));
  ASSERT_EQ(FRONT_GUARD, config->options);
  ASSERT_EQ(48U, config->front_guard_bytes);

  ASSERT_TRUE(InitConfig("front_guard"));
  ASSERT_EQ(FRONT_GUARD, config->options);
  ASSERT_EQ(32U, config->front_guard_bytes);

  ASSERT_TRUE(InitConfig("front_guard=39"));
  ASSERT_EQ(FRONT_GUARD, config->options);
#if defined(__LP64__)
  ASSERT_EQ(48U, config->front_guard_bytes);
#else
  ASSERT_EQ(40U, config->front_guard_bytes);
#endif

  ASSERT_TRUE(InitConfig("front_guard=41"));
  ASSERT_EQ(FRONT_GUARD, config->options);
  ASSERT_EQ(48U, config->front_guard_bytes);

  ASSERT_STREQ("", getFakeLogBuf().c_str());
  ASSERT_STREQ("", getFakeLogPrint().c_str());
}
Exemplo n.º 19
0
bool MSystem::Init()
{
    if(!InitConfig())
    {
        return false;
    }

    InitDebug();
    InitLog();

    MISEISINFO("*********************************************");
    MISEISINFO("MSWA start");

    return true;
}
Exemplo n.º 20
0
int main (char *exename, char *fname)
{
    MAIN_CSM main_csm;
    LockSched();
    UpdateCSMname();
    CreateCSM(&MAINCSM.maincsm,&main_csm,0);
    UnlockSched();

    InitConfig(ELF_NAME);

    GetFileDir (exename, dir);

    //SetCurFile (fname);

    return 0;
}
Exemplo n.º 21
0
// invoked by s3_export(), need to be exception safe
GPWriter* writer_init(const char* url_with_options, const char* format) {
    GPWriter* writer = NULL;
    s3extErrorMessage.clear();

    try {
        if (!url_with_options) {
            return NULL;
        }

        string urlWithOptions(url_with_options);

        S3Params params = InitConfig(urlWithOptions);

        InitRemoteLog();

        // Prepare memory to be used for thread chunk buffer.
        PrepareS3MemContext(params);

        string extName = params.isAutoCompress() ? string(format) + ".gz" : format;
        writer = new GPWriter(params, extName);
        if (writer == NULL) {
            return NULL;
        }

        memoryContextHolder = new S3MemoryContext(params.getMemoryContext());

        writer->open(params);
        return writer;
    } catch (S3Exception& e) {
        if (writer != NULL) {
            delete writer;
            delete memoryContextHolder;
        }
        s3extErrorMessage =
            "writer_init caught a " + e.getType() + " exception: " + e.getFullMessage();
        S3ERROR("writer_init caught %s: %s", e.getType().c_str(), s3extErrorMessage.c_str());
        return NULL;
    } catch (...) {
        if (writer != NULL) {
            delete writer;
            delete memoryContextHolder;
        }
        S3ERROR("Caught an unexpected exception.");
        s3extErrorMessage = "Caught an unexpected exception.";
        return NULL;
    }
}
Exemplo n.º 22
0
int main(){
	//GLFWの初期化
	if (!Initialize_GLFW()){
		return 1;
	}

	//ウインドウを作成する
	Window::CreateWindowStart(1024, 768, "Test!");

	//GLEWの初期化
	if (!Initialize_GLEW()){
		return 1;
	}

	//初期設定=========================================
	
	InitConfig();
	//ウィンドウ、シーケンスコントローラーを作成
	InputManager::SetMyWindow(Window::GetWindow());
	if (!SeaquenceController::instance()){
		SeaquenceController::Create();
	}
	// ウィンドウ全体をビューポートにする
	glViewport(0, 0, Window::Get_w(), Window::Get_h());
	//描画関連の設定(かえることがあれば他から設定できるように移す)
	ConfingDraw();

	//=================================================

	//描画処理=========================================

	while (Window::ShouldClose() == GL_FALSE){
		// 画面消去
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		//シーケンスコントローラーが全てのUpdate、描画を管理する
		SeaquenceController::instance()->Update();

		//バッファを入れ替える
		Window::SwapBuffers();
	}

	//=================================================
	//終わった時の処理
	atexit(Cleanup);
	return 0;
}
Exemplo n.º 23
0
NTSTATUS CWdfQueue::Create(CWdfDevice &Device)
{
    WDF_IO_QUEUE_CONFIG      QueueConfig;
    WDF_OBJECT_ATTRIBUTES    Attributes;

    InitConfig(QueueConfig);
    SetCallbacks(QueueConfig);

    WDF_OBJECT_ATTRIBUTES_INIT(&Attributes);
    Attributes.ExecutionLevel = m_ExecutionLevel;

    auto status = Device.AddQueue(QueueConfig, Attributes, m_Queue);
    if (!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, TRACE_WDFDEVICE, "%!FUNC! failed %!STATUS!", status);
    }

    return status;
}
Exemplo n.º 24
0
hkvJsonStreamReader::hkvJsonStreamReader(hkvJsonMemoryHandler* pMemHandler, hkvJsonFileHandler* pFileHandler, hkvJsonStreamReadHandler* pReadHandler, int iParserFlags) :
  m_pHandle(NULL),
  m_pMemHandler(pMemHandler),
  m_pFileHandler(pFileHandler),
  m_pReadHandler(pReadHandler)
{
  assert(m_pMemHandler);
  assert(m_pFileHandler);
  assert(m_pReadHandler);

  // Allocate a structure which holds allocation routines
  yajl_alloc_funcs allocFuncs = {
    yajl_Malloc,
    yajl_Realloc,
    yajl_Free,
    m_pMemHandler
  };

  InitHandle(&allocFuncs);
  InitConfig(iParserFlags);
}
Exemplo n.º 25
0
TEST(ListBucket, s3) {
    InitConfig("test/s3.conf", "default");

    S3Credential g_cred = {s3ext_accessid, s3ext_secret};

    ListBucketResult *r =
        ListBucket("https", S3HOST, S3BUCKET, S3PREFIX, g_cred);

    ASSERT_NE(r, (void *)NULL);
    EXPECT_EQ(r->contents.size(), 16);

    char urlbuf[256];
    vector<BucketContent *>::iterator i;
    for (i = r->contents.begin(); i != r->contents.end(); i++) {
        BucketContent *p = *i;
        sprintf(urlbuf, "http://%s/%s/%s", S3HOST, S3BUCKET, p->Key().c_str());
        printf("%s, %d\n", urlbuf, p->Size());
    }

    delete r;
}
Exemplo n.º 26
0
TEST(Config, basic) {
    InitConfig("test/s3test.conf", "");

    EXPECT_STREQ("secret_test", s3ext_secret.c_str());
    EXPECT_STREQ("accessid_test", s3ext_accessid.c_str());
    EXPECT_STREQ("ABCDEFGabcdefg", s3ext_token.c_str());

#ifdef DEBUG_S3
    EXPECT_EQ(0, s3ext_segid);
    EXPECT_EQ(1, s3ext_segnum);
#endif

    EXPECT_EQ(6, s3ext_threadnum);
    EXPECT_EQ(64 * 1024 * 1024 + 1, s3ext_chunksize);

    EXPECT_EQ(EXT_DEBUG, s3ext_loglevel);
    EXPECT_EQ(STDERR_LOG, s3ext_logtype);

    EXPECT_EQ(1111, s3ext_logserverport);
    EXPECT_STREQ("127.0.0.1", s3ext_logserverhost.c_str());
    EXPECT_STREQ("'/tmp/abcde'", s3ext_logpath.c_str());
}
Exemplo n.º 27
0
bool wd::Application::Initialize(
	const HINSTANCE& hInstance,
	const int& nCmdShow)
{
	// Init config file - get global settings.
	InitConfig();

	// Create OS window.
	if (!InitWindow(hInstance, nCmdShow))
		return false;

	// Create video device and context.
	if (!InitVideoDevice())
		return false;

	InitInput();
	// Show window. By now we should be able to show some sort of loading screen.
	m_pWindow->Show();
	// Create scene.
	InitScene();

	return true;
}
Exemplo n.º 28
0
Arquivo: main.c Projeto: FTCr/Siemens
int main(const char *exe_path, const char *file_path)
{
	if (InitLang(cfg_lang_path, &lgp) == -1)
	{
		MsgBoxError(1, (int)"lang.txt not found!");
		kill_elf();
	}
	else
	{
		CSM_RAM *save_cmpc;
		char dummy[sizeof(MAIN_CSM)];
		LockSched();
		UpdateCSMname();
		InitConfig();
		save_cmpc = CSM_root()->csm_q->current_msg_processing_csm;
		CSM_root()->csm_q->current_msg_processing_csm = CSM_root()->csm_q->csm.first;
		CreateCSM(&MAINCSM.maincsm,dummy,0);
		CSM_root()->csm_q->current_msg_processing_csm = save_cmpc;
		UnlockSched();
		AddKeybMsgHook((void*)KeyHook);
	}
	return 0;
}
Exemplo n.º 29
0
void ExtWrapperTest(const char *url, uint64_t buffer_size, const char *md5_str,
                    int segid, int segnum, uint64_t chunksize) {
    InitConfig("test/s3.conf", "default");

    s3ext_segid = segid;
    s3ext_segnum = segnum;

    MD5Calc m;
    S3ExtBase *myData;
    uint64_t nread = 0;
    uint64_t buf_len = buffer_size;
    char *buf = (char *)malloc(buffer_size);

    ASSERT_NE((void *)NULL, buf);

    if (strncmp(url, "http://localhost/", 17) == 0) {
        myData = new S3Reader_fake(url);
    } else {
        myData = new S3Reader(url);
    }

    ASSERT_NE((void *)NULL, myData);
    ASSERT_TRUE(myData->Init(segid, segnum, chunksize));

    while (1) {
        nread = buf_len;
        ASSERT_TRUE(myData->TransferData(buf, nread));
        if (nread == 0) break;
        m.Update(buf, nread);
    }

    EXPECT_STREQ(md5_str, m.Get());
    myData->Destroy();
    delete myData;
    free(buf);
}
Exemplo n.º 30
0
int main(int argc, char **argv)
{
	struct passwd	*pw;
	unsigned int	seq;

	InitConfig();

	pw = getpwuid(getuid());

	InitClient(pw->pw_name, (char *)"ftnseq", CFG.location, CFG.logfile, 
		CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);

	Syslog(' ', " "); 
	Syslog(' ', "FTNSEQ v%s", VERSION);

	seq = sequencer();
	Syslog('+', "Sequence string %08lx", seq);
	printf("%08x", seq);
	fflush(stdout);

	Syslog(' ', "FTNSEQ finished");
	ExitClient(0);
	return 0;
}