blob: c4d449a330abd594db6a1df76331560cb025efbc [file] [log] [blame]
Enrico Granataf58cece2013-03-08 20:29:13 +00001//
2// TestCase.h
3// PerfTestDriver
4//
5// Created by Enrico Granata on 3/7/13.
6// Copyright (c) 2013 Apple Inc. All rights reserved.
7//
8
9#ifndef __PerfTestDriver__TestCase__
10#define __PerfTestDriver__TestCase__
11
12#include "lldb/API/LLDB.h"
13#include "Measurement.h"
14
15using namespace lldb;
16
17namespace lldb { namespace perf
18{
19class TestCase
20{
21public:
22 TestCase();
23
24 struct ActionWanted
25 {
26 enum class Type
27 {
28 eAWNext,
29 eAWContinue,
30 eAWFinish,
31 eAWKill
32 } type;
33 SBThread thread;
34 };
35
36 virtual
37 ~TestCase ()
38 {}
39
40 virtual void
41 Setup (int argc, const char** argv);
42
43 virtual ActionWanted
44 TestStep (int counter) = 0;
45
46 bool
47 Launch (const char** args, const char* cwd);
48
49 void
50 Loop();
51
52 void
53 SetVerbose (bool);
54
55 bool
56 GetVerbose ();
57
58 virtual void
59 Results () = 0;
60
61 template <typename G,typename A>
Enrico Granata86910572013-03-14 19:00:42 +000062 Measurement<G,A> CreateMeasurement (A a, const char* name = NULL, const char* description = NULL)
Enrico Granataf58cece2013-03-08 20:29:13 +000063 {
Enrico Granata86910572013-03-14 19:00:42 +000064 return Measurement<G,A> (a,name, description);
65 }
66
67 template <typename A>
68 TimeMeasurement<A> CreateTimeMeasurement (A a, const char* name = NULL, const char* description = NULL)
69 {
70 return TimeMeasurement<A> (a,name, description);
Enrico Granataf58cece2013-03-08 20:29:13 +000071 }
72
73 static void
74 Run (TestCase& test, int argc, const char** argv);
75
76protected:
77 SBDebugger m_debugger;
78 SBTarget m_target;
79 SBProcess m_process;
80 SBThread m_thread;
81 SBListener m_listener;
82 bool m_verbose;
83};
84} }
85
86#endif /* defined(__PerfTestDriver__TestCase__) */