- 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:
Enrico Granata 2013-04-15 19:07:38 +00:00
parent fe7a59d9c2
commit a571e21c4e
3 changed files with 50 additions and 11 deletions

View File

@ -171,20 +171,25 @@ public:
{
exit(1);
}
lldb::SBLaunchInfo launch_info = GetLaunchInfo();
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",283);
m_file_line_bp_measurement("SKTText.m",326);
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
DoTest ()
{
@ -199,14 +204,17 @@ public:
switch (counter)
{
case 0:
case 10:
{
DoTest ();
m_file_line_bp_measurement("SKTDocument.m",254);
if (counter == 0)
m_file_line_bp_measurement("SKTDocument.m",254);
next_action.Continue();
}
break;
case 1:
case 11:
{
DoTest ();
m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"properties");
@ -219,6 +227,7 @@ public:
break;
case 2:
case 12:
{
DoTest ();
next_action.Continue();
@ -226,6 +235,7 @@ public:
break;
case 3:
case 13:
{
DoTest ();
next_action.StepOver(m_thread);
@ -233,6 +243,8 @@ public:
break;
case 4:
case 14:
{
DoTest ();
m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"layoutManager");
@ -242,6 +254,7 @@ public:
break;
case 5:
case 15:
{
DoTest ();
next_action.StepOver(m_thread);
@ -249,6 +262,7 @@ public:
break;
case 6:
case 16:
{
DoTest ();
next_action.StepOver(m_thread);
@ -256,6 +270,7 @@ public:
break;
case 7:
case 17:
{
DoTest ();
m_run_expr_measurement(m_thread.GetFrameAtIndex(0),"@\"an NSString\"");
@ -266,15 +281,20 @@ public:
break;
case 8:
case 18:
{
DoTest ();
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),"(BOOL)NSIntersectsRect(rect, graphicDrawingBounds)");
next_action.Kill();
}
break;
case 9:
{
next_action.Relaunch(GetLaunchInfo());
break;
}
default:
{
next_action.Kill();

View File

@ -292,6 +292,14 @@ TestCase::Loop ()
m_process.SetSelectedThread(action.thread);
action.thread.StepOver();
break;
case ActionWanted::Type::eRelaunch:
if (m_process.IsValid())
{
m_process.Kill();
m_process.Clear();
}
Launch(action.launch_info);
break;
case ActionWanted::Type::eKill:
if (m_verbose)
printf("kill\n");

View File

@ -30,13 +30,16 @@ public:
eStepOver,
eContinue,
eStepOut,
eRelaunch,
eKill
} type;
lldb::SBThread thread;
lldb::SBLaunchInfo launch_info;
ActionWanted () :
type (Type::eContinue),
thread ()
thread (),
launch_info (NULL)
{
}
@ -61,6 +64,14 @@ public:
thread = t;
}
void
Relaunch (lldb::SBLaunchInfo l)
{
type = Type::eRelaunch;
thread = lldb::SBThread();
launch_info = l;
}
void
Kill ()
{