- Adding a relaunch feature to the performance tester: you can use the relaunch if you want to measure multiple runs of your app keeping the same metrics alive. New arguments must be supplied - and the step counter will not be reset (this makes it easy to avoid endless loops)
- Having the Sketch test case relaunch itself llvm-svn: 179548
This commit is contained in:
		
							parent
							
								
									fe7a59d9c2
								
							
						
					
					
						commit
						a571e21c4e
					
				| 
						 | 
					@ -171,20 +171,25 @@ public:
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            exit(1);
 | 
					            exit(1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        lldb::SBLaunchInfo launch_info = GetLaunchInfo();
 | 
				
			||||||
        m_target = m_debugger.CreateTarget(m_app_path.c_str());
 | 
					        m_target = m_debugger.CreateTarget(m_app_path.c_str());
 | 
				
			||||||
        const char* file_arg = m_doc_path.c_str(); 
 | 
					 | 
				
			||||||
        const char* persist_arg = "-ApplePersistenceIgnoreState";
 | 
					 | 
				
			||||||
        const char* persist_skip = "YES";
 | 
					 | 
				
			||||||
        const char* empty = nullptr;
 | 
					 | 
				
			||||||
        const char* args[] = {file_arg,persist_arg,persist_skip,empty};
 | 
					 | 
				
			||||||
        SBLaunchInfo launch_info (args);
 | 
					 | 
				
			||||||
        m_file_line_bp_measurement("SKTDocument.m",245);
 | 
					        m_file_line_bp_measurement("SKTDocument.m",245);
 | 
				
			||||||
        m_file_line_bp_measurement("SKTDocument.m",283);
 | 
					        m_file_line_bp_measurement("SKTDocument.m",283);
 | 
				
			||||||
        m_file_line_bp_measurement("SKTText.m",326);
 | 
					        m_file_line_bp_measurement("SKTText.m",326);
 | 
				
			||||||
        return Launch (launch_info);
 | 
					        return Launch (launch_info);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    lldb::SBLaunchInfo
 | 
				
			||||||
 | 
					    GetLaunchInfo ()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        const char* file_arg = m_doc_path.c_str();
 | 
				
			||||||
 | 
					        const char* persist_arg = "-ApplePersistenceIgnoreState";
 | 
				
			||||||
 | 
					        const char* persist_skip = "YES";
 | 
				
			||||||
 | 
					        const char* empty = nullptr;
 | 
				
			||||||
 | 
					        const char* args[] = {file_arg,persist_arg,persist_skip,empty};
 | 
				
			||||||
 | 
					        return SBLaunchInfo(args);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    void
 | 
					    void
 | 
				
			||||||
    DoTest ()
 | 
					    DoTest ()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -199,14 +204,17 @@ public:
 | 
				
			||||||
        switch (counter)
 | 
					        switch (counter)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
        case 0:
 | 
					        case 0:
 | 
				
			||||||
 | 
					        case 10:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DoTest ();
 | 
					                DoTest ();
 | 
				
			||||||
                m_file_line_bp_measurement("SKTDocument.m",254);
 | 
					                if (counter == 0)
 | 
				
			||||||
 | 
					                    m_file_line_bp_measurement("SKTDocument.m",254);
 | 
				
			||||||
                next_action.Continue();
 | 
					                next_action.Continue();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
        case 1:
 | 
					        case 1:
 | 
				
			||||||
 | 
					            case 11:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DoTest ();
 | 
					                DoTest ();
 | 
				
			||||||
                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"properties");
 | 
					                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"properties");
 | 
				
			||||||
| 
						 | 
					@ -219,6 +227,7 @@ public:
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case 2:
 | 
					        case 2:
 | 
				
			||||||
 | 
					            case 12:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DoTest ();
 | 
					                DoTest ();
 | 
				
			||||||
                next_action.Continue();
 | 
					                next_action.Continue();
 | 
				
			||||||
| 
						 | 
					@ -226,6 +235,7 @@ public:
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case 3:
 | 
					        case 3:
 | 
				
			||||||
 | 
					            case 13:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DoTest ();
 | 
					                DoTest ();
 | 
				
			||||||
                next_action.StepOver(m_thread);
 | 
					                next_action.StepOver(m_thread);
 | 
				
			||||||
| 
						 | 
					@ -233,6 +243,8 @@ public:
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case 4:
 | 
					        case 4:
 | 
				
			||||||
 | 
					            case 14:
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DoTest ();
 | 
					                DoTest ();
 | 
				
			||||||
                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"layoutManager");
 | 
					                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"layoutManager");
 | 
				
			||||||
| 
						 | 
					@ -242,6 +254,7 @@ public:
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        case 5:
 | 
					        case 5:
 | 
				
			||||||
 | 
					            case 15:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DoTest ();
 | 
					                DoTest ();
 | 
				
			||||||
                next_action.StepOver(m_thread);
 | 
					                next_action.StepOver(m_thread);
 | 
				
			||||||
| 
						 | 
					@ -249,6 +262,7 @@ public:
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case 6:
 | 
					        case 6:
 | 
				
			||||||
 | 
					            case 16:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DoTest ();
 | 
					                DoTest ();
 | 
				
			||||||
                next_action.StepOver(m_thread);
 | 
					                next_action.StepOver(m_thread);
 | 
				
			||||||
| 
						 | 
					@ -256,6 +270,7 @@ public:
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case 7:
 | 
					        case 7:
 | 
				
			||||||
 | 
					            case 17:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DoTest ();
 | 
					                DoTest ();
 | 
				
			||||||
                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"@\"an NSString\"");
 | 
					                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"@\"an NSString\"");
 | 
				
			||||||
| 
						 | 
					@ -266,15 +281,20 @@ public:
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case 8:
 | 
					        case 8:
 | 
				
			||||||
 | 
					            case 18:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                DoTest ();
 | 
					                DoTest ();
 | 
				
			||||||
                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"[graphics description]");
 | 
					                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"[graphics description]");
 | 
				
			||||||
                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"[selectionIndexes description]");
 | 
					                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"[selectionIndexes description]");
 | 
				
			||||||
                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"(BOOL)NSIntersectsRect(rect, graphicDrawingBounds)");
 | 
					                m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"(BOOL)NSIntersectsRect(rect, graphicDrawingBounds)");
 | 
				
			||||||
                next_action.Kill();
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        
 | 
					        case 9:
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                next_action.Relaunch(GetLaunchInfo());
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                next_action.Kill();
 | 
					                next_action.Kill();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -292,6 +292,14 @@ TestCase::Loop ()
 | 
				
			||||||
                m_process.SetSelectedThread(action.thread);
 | 
					                m_process.SetSelectedThread(action.thread);
 | 
				
			||||||
                action.thread.StepOver();
 | 
					                action.thread.StepOver();
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            case ActionWanted::Type::eRelaunch:
 | 
				
			||||||
 | 
					                if (m_process.IsValid())
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    m_process.Kill();
 | 
				
			||||||
 | 
					                    m_process.Clear();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                Launch(action.launch_info);
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
            case ActionWanted::Type::eKill:
 | 
					            case ActionWanted::Type::eKill:
 | 
				
			||||||
                if (m_verbose)
 | 
					                if (m_verbose)
 | 
				
			||||||
                    printf("kill\n");
 | 
					                    printf("kill\n");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,13 +30,16 @@ public:
 | 
				
			||||||
			eStepOver,
 | 
								eStepOver,
 | 
				
			||||||
			eContinue,
 | 
								eContinue,
 | 
				
			||||||
            eStepOut,
 | 
					            eStepOut,
 | 
				
			||||||
 | 
					            eRelaunch,
 | 
				
			||||||
			eKill
 | 
								eKill
 | 
				
			||||||
		} type;
 | 
							} type;
 | 
				
			||||||
		lldb::SBThread thread;
 | 
							lldb::SBThread thread;
 | 
				
			||||||
 | 
					        lldb::SBLaunchInfo launch_info;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        ActionWanted () :
 | 
					        ActionWanted () :
 | 
				
			||||||
            type (Type::eContinue),
 | 
					            type (Type::eContinue),
 | 
				
			||||||
            thread ()
 | 
					            thread (),
 | 
				
			||||||
 | 
					            launch_info (NULL)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
| 
						 | 
					@ -61,6 +64,14 @@ public:
 | 
				
			||||||
            thread = t;
 | 
					            thread = t;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        void
 | 
				
			||||||
 | 
					        Relaunch (lldb::SBLaunchInfo l)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            type = Type::eRelaunch;
 | 
				
			||||||
 | 
					            thread = lldb::SBThread();
 | 
				
			||||||
 | 
					            launch_info = l;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        void
 | 
					        void
 | 
				
			||||||
        Kill ()
 | 
					        Kill ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue