Exemple #1
0
int main(int argc, char * argv[])
{
    PIN_Init(argc, argv);
    PIN_InitSymbols();

    RegThreadInfo = PIN_ClaimToolRegister();
    if (RegThreadInfo == REG_INVALID())
    {
        std::cout << "Out of tool registers" << std::endl;
        PIN_ExitProcess(1);
    }

    // Get the test type and initialize the corresponding lock variable.
    //
    TestType = GetTestType(KnobTest.Value());
    switch (TestType)
    {
    case TEST_NONE:
        std::cout << "Must specify a test to run with the '-test' knob" << std::endl;
        PIN_ExitProcess(1);
        break;
    case TEST_INVALID:
        std::cout << "Invalid test name: " << KnobTest.Value() << std::endl;
        PIN_ExitProcess(1);
        break;
    case TEST_LOCK_INTEGRITY:
    case TEST_LOCK_STRESS:
        PIN_InitLock(&Lock);
        break;
    case TEST_MUTEX_INTEGRITY:
    case TEST_MUTEX_STRESS:
    case TEST_MUTEX_TRYSTRESS:
        PIN_MutexInit(&Mutex);
        break;
    case TEST_WRITER_INTEGRITY:
    case TEST_WRITER_STRESS:
    case TEST_WRITER_TRYSTRESS:
    case TEST_READER_STRESS:
    case TEST_READER_TRYSTRESS:
    case TEST_RW_INTEGRITY:
    case TEST_RW_STRESS:
    case TEST_RW_TRYSTRESS:
        PIN_RWMutexInit(&RWMutex);
        break;
    case TEST_SEMAPHORE:
        PIN_SemaphoreInit(&Sem1);
        PIN_SemaphoreInit(&Sem2);
        PIN_SemaphoreSet(&Sem1);
        PIN_MutexInit(&Mutex);
        break;
    case TEST_TRYLOCKS:
        PIN_MutexInit(&Mutex);
        PIN_RWMutexInit(&RWMutex);
        PIN_SemaphoreInit(&Sem1);
        break;
    default:
        ASSERTX(0);
    }

    PIN_AddThreadStartFunction(OnThreadStart, 0);
    PIN_AddThreadFiniFunction(OnThreadFini, 0);
    RTN_AddInstrumentFunction(InstrumentRtn, 0);
    PIN_AddFiniFunction(OnExit, 0);
    PIN_StartProgram();
    return 0;
}
Exemple #2
0
void CTestScript::OnBnClickedButtonStartLogin()
{
    UpdateData(TRUE);

    CGameTestDlg* pMainDLg = CScriptSys::getInstance()->GetTestDialog();

    pMainDLg->GetTestResult()->SetAndOutPutTestResultInfo();

    pMainDLg->GetTestInfo()->ShowWindow(TRUE);
    ShowWindow(FALSE);
    pMainDLg->m_tabPage.SetCurSel(1);


    if (m_csCurrtWorkPath != "")
        SetCurrentDirectory(m_csCurrtWorkPath);

    if (!pMainDLg->LoadDifProjRes())
    {
        AfxMessageBox("资源加载出错");
        return;
    }

    pMainDLg->m_iProjName =
        ((CComboBox*)GetDlgItem(IDC_COMBO_TDLG_PROJNAME))->GetCurSel();

    pMainDLg->GetTestInfo()->SetTimer(1,1000,NULL);

    //用于判断测试类型容器中应返回的值
    long lType = GetTestType();

    char strScriptName[128];
    if( !m_btnChkPtToken.GetCheck() )
    {

        if ( m_lStartCDKey < 1000 || m_lEndCDKey > 9999)
        {
            MessageBox("《起始帐号》应该大于1000,小于9999","提示",MB_OK);
            return ;
        }
        if ( m_lEndCDKey < m_lStartCDKey || m_lEndCDKey > 9999 )
        {
            MessageBox("《结束帐号》应该大于或则等于《起始帐号》并且小于9999","提示",MB_OK);
            return ;
        }
        if (m_lTimer >= 200000 || m_lTimer <= 200)
        {
            MessageBox("间隔时间必须在200-200000ms之内","提示",MB_OK);
            return ;
        }

        if ( m_lStartCDKey == m_lEndCDKey )
        {
            m_lEndCDKey = m_lStartCDKey;
        }
        sprintf(strScriptName,"LoginCDKey(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",m_lStartCDKey,m_lEndCDKey,lType,m_lTimer,m_lPlayerLevel,m_ctrlOcculist.GetCurSel(),m_vecRegion[m_ctrlRegionList.GetCurSel()].id,m_lPlayerX,m_lPlayerY,m_bnMaxState.GetCheck(),m_bnEquipWeapon.GetCheck(),m_bnThirdOccu.GetCheck());
        //sprintf(strScriptName,"LoginCDKey(%d,%d,%d,%d,%d);",m_lStartCDKey,m_lEndCDKey,lType,m_lTimer,m_lSendDelayTime);
    }
    else
    {
        sprintf(strScriptName,"LoginToken(%d,%d,%d);",m_lStartCDKey,lType,m_lTimer);
    }
    CScriptSys::getInstance()->PerformString(strScriptName);

    m_bnStartLogin.EnableWindow(FALSE);

    SaveTestConfigInfo();

}