void VfsOpenTempFileFileIoErrTest() { //Delete all temp files in this test private data cage. TInt err = DoDeleteTempFiles(); TEST(err == KErrNone || err == KErrNotFound); sqlite3_vfs* vfs = sqlite3_vfs_find(NULL); TEST(vfs != NULL); sqlite3_file* osFile = (sqlite3_file*)User::Alloc(vfs->szOsFile); TEST(osFile != NULL); err = SQLITE_ERROR; TInt cnt = 1; while(err != SQLITE_OK) { TInt processHandleCnt = 0; TInt threadHandleCnt = 0; RThread().HandleCount(processHandleCnt, threadHandleCnt); TInt allocCellsCnt = User::CountAllocCells(); TheTest.Printf(_L("%d "), cnt); (void)TheFs.SetErrorCondition(KErrGeneral, cnt); int outFlags = 0; err = sqlite3OsOpen(vfs, NULL, osFile, SQLITE_OPEN_READWRITE, &outFlags); if(err == SQLITE_OK) { //Since this is a temp file, its creation will be delayed till the first file write operation. err = sqlite3OsWrite(osFile, "1234", 4, 0); (void)sqlite3OsClose(osFile); } (void)TheFs.SetErrorCondition(KErrNone); if(err != SQLITE_OK) { TInt processHandleCnt2 = 0; TInt threadHandleCnt2 = 0; RThread().HandleCount(processHandleCnt2, threadHandleCnt2); TEST2(processHandleCnt2, processHandleCnt); TEST2(threadHandleCnt2, threadHandleCnt); TInt allocCellsCnt2 = User::CountAllocCells(); TEST2(allocCellsCnt2, allocCellsCnt); ++cnt; } //If the iteration has failed, then no temp file should exist in the test private data cage. //If the iteration has succeeded, then sqlite3OsClose() should have deleted the temp file. TInt err2 = DoDeleteTempFiles(); TEST2(err2, KErrNotFound); } TEST2(err, SQLITE_OK); TheTest.Printf(_L("\r\n=== TVfs::Open(<temp file>) file I/O error simulation test succeeded at iteration %d\r\n"), cnt); User::Free(osFile); }
void NodeJSDebugger::OnEditorChanged(wxCommandEvent& event) { event.Skip(); IEditor::List_t editors; clGetManager()->GetAllEditors(editors); wxStringSet_t tmpFiles = m_tempFiles; wxStringSet_t closedTempEditors; // Loop over the temp files list std::for_each(tmpFiles.begin(), tmpFiles.end(), [&](const wxString& filename) { // If the temp file does not match one of the editors, assume it was closed and delete // the temporary file IEditor::List_t::iterator iter = std::find_if(editors.begin(), editors.end(), [&](IEditor* editor) { if(editor->GetFileName().GetFullPath() == filename) return true; return false; }); if(iter == editors.end()) { closedTempEditors.insert(filename); m_tempFiles.erase(filename); } }); if(!closedTempEditors.empty()) { DoDeleteTempFiles(closedTempEditors); } }
void VfsOpenTempFileOomTest() { //Delete all temp files in this test private data cage. TInt err = DoDeleteTempFiles(); TEST(err == KErrNone || err == KErrNotFound); sqlite3_vfs* vfs = sqlite3_vfs_find(NULL); TEST(vfs != NULL); sqlite3_file* osFile = (sqlite3_file*)User::Alloc(vfs->szOsFile); TEST(osFile != NULL); TheTest.Printf(_L("Iteration: ")); TInt failingAllocNum = 0; err = SQLITE_IOERR_NOMEM; while(err == SQLITE_IOERR_NOMEM) { ++failingAllocNum; TheTest.Printf(_L("%d "), failingAllocNum); OomPreStep(failingAllocNum); int outFlags = 0; err = sqlite3OsOpen(vfs, NULL, osFile, SQLITE_OPEN_READWRITE, &outFlags); if(err == SQLITE_OK) { //Since this is a temp file, its creation will be delayed till the first file write operation. err = sqlite3OsWrite(osFile, "1234", 4, 0); (void)sqlite3OsClose(osFile); } OomPostStep(); if(err != SQLITE_OK) { TEST2(err, SQLITE_IOERR_NOMEM); } //If the iteration has failed, then no temp file should exist in the test private data cage. //If the iteration has succeeded, then sqlite3OsClose() should have deleted the temp file. TInt err2 = DoDeleteTempFiles(); TEST2(err2, KErrNotFound); } TEST2(err, SQLITE_OK); TheTest.Printf(_L("\r\n=== TVfs::Open(<temp file>) OOM test succeeded at allcoation %d\r\n"), failingAllocNum); User::Free(osFile); }
NodeJSDebugger::~NodeJSDebugger() { m_socket.Reset(NULL); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_START, &NodeJSDebugger::OnDebugStart, this); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_CONTINUE, &NodeJSDebugger::OnDebugContinue, this); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_STOP, &NodeJSDebugger::OnStopDebugger, this); EventNotifier::Get()->Unbind(wxEVT_DBG_IS_RUNNING, &NodeJSDebugger::OnDebugIsRunning, this); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_TOGGLE_BREAKPOINT, &NodeJSDebugger::OnToggleBreakpoint, this); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_NEXT, &NodeJSDebugger::OnDebugNext, this); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_NEXT_INST, &NodeJSDebugger::OnVoid, this); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_STEP_IN, &NodeJSDebugger::OnDebugStepIn, this); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_STEP_I, &NodeJSDebugger::OnVoid, this); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_STEP_OUT, &NodeJSDebugger::OnDebugStepOut, this); EventNotifier::Get()->Unbind(wxEVT_DBG_EXPR_TOOLTIP, &NodeJSDebugger::OnTooltip, this); EventNotifier::Get()->Unbind(wxEVT_DBG_CAN_INTERACT, &NodeJSDebugger::OnCanInteract, this); EventNotifier::Get()->Unbind(wxEVT_DBG_UI_ATTACH_TO_PROCESS, &NodeJSDebugger::OnAttach, this); EventNotifier::Get()->Unbind(wxEVT_WORKSPACE_LOADED, &NodeJSDebugger::OnWorkspaceOpened, this); EventNotifier::Get()->Unbind(wxEVT_WORKSPACE_CLOSED, &NodeJSDebugger::OnWorkspaceClosed, this); EventNotifier::Get()->Unbind(wxEVT_NODEJS_DEBUGGER_MARK_LINE, &NodeJSDebugger::OnHighlightLine, this); EventNotifier::Get()->Unbind(wxEVT_NODEJS_DEBUGGER_EVAL_EXPRESSION, &NodeJSDebugger::OnEvalExpression, this); EventNotifier::Get()->Unbind(wxEVT_ACTIVE_EDITOR_CHANGED, &NodeJSDebugger::OnEditorChanged, this); m_node.Unbind(wxEVT_TERMINAL_COMMAND_EXIT, &NodeJSDebugger::OnNodeTerminated, this); m_node.Unbind(wxEVT_TERMINAL_COMMAND_OUTPUT, &NodeJSDebugger::OnNodeOutput, this); Unbind(wxEVT_TOOLTIP_DESTROY, &NodeJSDebugger::OnDestroyTip, this); m_node.Terminate(); m_bptManager.Save(); DoDeleteTempFiles(m_tempFiles); m_tempFiles.clear(); if(m_tooltip) { m_tooltip->Destroy(); m_tooltip = NULL; } // fire stop event (needed to reload the normal layout) clDebugEvent event(wxEVT_NODEJS_DEBUGGER_STOPPED); EventNotifier::Get()->AddPendingEvent(event); // Clear all markers IEditor::List_t editors; clGetManager()->GetAllEditors(editors); std::for_each(editors.begin(), editors.end(), [&](IEditor* e) { e->DelAllCompilerMarkers(); }); }