TestCase.h revision f5af85a2946ed4e1ff4766829d328cfb4961f259
1//
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>
62    Measurement<G,A> CreateMeasurement (A a, const char* name = NULL)
63    {
64        return Measurement<G,A> (a,name);
65    }
66
67    static void
68    Run (TestCase& test, int argc, const char** argv);
69
70protected:
71	SBDebugger m_debugger;
72	SBTarget m_target;
73	SBProcess m_process;
74	SBThread m_thread;
75	SBListener m_listener;
76    bool m_verbose;
77};
78} }
79
80#endif /* defined(__PerfTestDriver__TestCase__) */
81