1 #ifndef __PARSE_THAT_H__
2 #define __PARSE_THAT_H__
7 //#include "dyninst_comp.h"
9 // A (hopefully simple) c++ class interface for issuing parseThat commands
10 // inside the testsuite
37 TESTLIB_DLL_EXPORT ParseThat();
38 TESTLIB_DLL_EXPORT ~ParseThat();
40 TESTLIB_DLL_EXPORT void pt_output_redirect(std::string fname) {pt_out_name = fname;}
41 TESTLIB_DLL_EXPORT void cmd_stdout_redirect(std::string fname) {cmd_stdout_name = fname;}
42 TESTLIB_DLL_EXPORT void cmd_stderr_redirect(std::string fname) {cmd_stderr_name = fname;}
43 TESTLIB_DLL_EXPORT void func_only(std::string fname) {limit_func = fname;}
44 TESTLIB_DLL_EXPORT void module_only(std::string mname) {limit_mod = mname;}
45 TESTLIB_DLL_EXPORT void set_transactions(InstTransaction t) {trans = t;}
46 TESTLIB_DLL_EXPORT void skip_functions_matching(std::string regex) {skip_funcs = regex;}
47 TESTLIB_DLL_EXPORT void skip_modules_matching(std::string regex) {skip_mods = regex;}
48 TESTLIB_DLL_EXPORT void suppress_ipc_messages() {suppress_ipc = true;}
49 TESTLIB_DLL_EXPORT void set_verbosity(int v) {verbosity = v;}
50 TESTLIB_DLL_EXPORT void dont_fork() {nofork = true;}
51 TESTLIB_DLL_EXPORT void set_timeout(unsigned secs) {timeout_secs = secs;}
52 TESTLIB_DLL_EXPORT void set_tracing() {do_trace = true;}
53 TESTLIB_DLL_EXPORT void set_tracesize(unsigned ntraces) {tracelength = ntraces;}
54 TESTLIB_DLL_EXPORT void print_summary() {print_summary_ = true;}
55 TESTLIB_DLL_EXPORT void recursive() {do_recursive = true;}
56 TESTLIB_DLL_EXPORT void setParseLevel(ParseLevel pl) {parse_level = pl;}
57 TESTLIB_DLL_EXPORT void use_rewriter(std::string dest) {rewrite_filename = dest;}
58 TESTLIB_DLL_EXPORT void use_merge() {merge_tramps = true;}
59 TESTLIB_DLL_EXPORT void inst_level(InstLevel il) {inst_level_ = il;}
60 TESTLIB_DLL_EXPORT void include_libs() {include_libs_ = true;}
62 TESTLIB_DLL_EXPORT test_results_t operator()(std::string exec_path,
63 std::vector<std::string> &args);
64 TESTLIB_DLL_EXPORT test_results_t operator()(int pid);
66 TESTLIB_DLL_EXPORT static test_results_t sys_execute(std::string cmd,
67 std::vector<std::string> &args,
68 std::string stdout_redirect = emptyString,
69 std::string stderr_redirect = emptyString);
71 static std::string emptyString;
74 std::string cmd_stdout_name;
75 std::string cmd_stderr_name;
76 std::string pt_out_name;
77 std::string rewrite_filename;
78 InstTransaction trans;
79 std::string skip_mods; // regex string
80 std::string skip_funcs; // regex string
81 std::string limit_mod; // only use this module
82 std::string limit_func; // only use this func
86 unsigned verbosity; // presently can be 0-7
87 unsigned int timeout_secs;
91 ParseLevel parse_level;
94 InstLevel inst_level_;
97 bool setup_args(std::vector<std::string> &);
98 test_results_t pt_execute(std::vector<std::string> &);