// Get test parameters from autotesting db void AutotestingSystem::FetchParametersFromDB() { Logger::Debug("AutotestingSystem::FetchParametersFromDB"); groupName = AutotestingDB::Instance()->GetStringTestParameter(deviceName, "Group"); if (groupName == "not_found") { ForceQuit("Couldn't get Group parameter from DB."); } testFileName = AutotestingDB::Instance()->GetStringTestParameter(deviceName, "Filename"); if (testFileName == "not_found") { ForceQuit("Couldn't get Filename parameter from DB."); } testIndex = AutotestingDB::Instance()->GetIntTestParameter(deviceName, "Number"); if (testIndex == -9999) { ForceQuit("Couldn't get Number parameter from DB."); } testsDate = AutotestingDB::Instance()->GetStringTestParameter(deviceName, "Date"); if (testsDate == "not_found") { ForceQuit("Couldn't get Date parameter from DB."); } Logger::Debug("AutotestingSystem::FetchParametersFromDB Date=%s Group=%s Filename=%s TestIndex=%d", testsDate.c_str(), groupName.c_str(), testFileName.c_str(), testIndex); }
// Read DB parameters from config file and set connection to it void AutotestingSystem::SetUpConnectionToDB() { KeyedArchive *option = new KeyedArchive(); bool res = option->LoadFromYamlFile("~res:/Autotesting/dbConfig.yaml"); if (!res) { ForceQuit("Couldn't open file ~res:/Autotesting/dbConfig.yaml"); } String dbName = option->GetString("name"); String dbAddress = option->GetString("hostname"); String collection = option->GetString("collection"); int32 dbPort = option->GetInt32("port"); Logger::Debug("AutotestingSystem::SetUpConnectionToDB %s -> %s[%s:%d]", collection.c_str(), dbName.c_str(), dbAddress.c_str(), dbPort); if(! AutotestingDB::Instance()->ConnectToDB(collection, dbName, dbAddress, dbPort)) { ForceQuit("Couldn't connect to Test DB"); } else { isDB = true; } SafeRelease(option); }
/** * @brief flush cyc buffer is data to file * * @author hankejia * @date 2012-07-05 * @param[in] pthis the pointer point to the CCycBuffer. * @param[in] fd file is descriptor.the cyc buffer is data will write to this file * @return T_S32 * @retval return >=0 the size of bytes write to file, < 0 failed */ static T_S32 flush( T_pVOID pthis, T_S32 fd ) { CCycBuffer *this = ( CCycBuffer * )pthis; CycBuffer_handle * handle = (CycBuffer_handle *)this->handle; while ( !(handle->mPopComplete) ) { ForceQuit( pthis ); delay_loop( 0, 1000 ); // 1ms } return WriteToFs( pthis, fd, -1 ); }
// Get test parameters from id.tx void AutotestingSystem::FetchParametersFromIdTxt() { FilePath file = "~res:/Autotesting/id.yaml"; Logger::Debug("AutotestingSystem::FetchParametersFromIdTxt %s", file.GetAbsolutePathname().c_str()); KeyedArchive *option = new KeyedArchive(); bool res = option->LoadFromYamlFile(file); if (!res) { ForceQuit("Couldn't open file " + file.GetAbsolutePathname()); } buildId = option->GetString("buildId"); buildDate = option->GetString("date"); branch = option->GetString("branch"); framework = option->GetString("framework"); branchRev = option->GetString("branchRev"); frameworkRev = option->GetString("frameworkRev"); SafeRelease(option); }