aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2017-07-03 20:05:38 +0000
committerbloodstalker <thabogre@gmail.com>2017-07-03 20:05:38 +0000
commitbf16fe873d684838fd69a17244bb808213391b9b (patch)
treec0ca06c552e7dc6ffe36cf17be4d07df1796dc86
parentremoved extra spaces (diff)
downloadmutator-bf16fe873d684838fd69a17244bb808213391b9b.tar.gz
mutator-bf16fe873d684838fd69a17244bb808213391b9b.zip
added a new bruiser option. you pass bruiser a lua script and bruiser runs it in non-cli mode.
-rw-r--r--bruiser/bruiser.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp
index 1cb137f..25531e9 100644
--- a/bruiser/bruiser.cpp
+++ b/bruiser/bruiser.cpp
@@ -101,6 +101,7 @@ namespace
cl::opt<bool> Intrusive("intrusive", cl::desc("If set true. bruiser will mutate the source."), cl::init(true), cl::cat(BruiserCategory), cl::ZeroOrMore);
cl::opt<std::string> M0XMLPath("xmlpath", cl::desc("tells bruiser where to find the XML file containing the Mutator-LVL0 report."), cl::init(bruiser::M0REP), cl::cat(BruiserCategory), cl::ZeroOrMore);
cl::opt<bool> LuaJIT("jit", cl::desc("should bruiser use luajit or not."), cl::init(true), cl::cat(BruiserCategory), cl::ZeroOrMore);
+cl::opt<std::string> NonCLILuaScript("lua", cl::desc("specifies a lua script for bruiser to run in non-interactiv mode"), cl::init(""), cl::cat(BruiserCategory), cl::Optional);
/**********************************************************************************************************************/
class LuaEngine
{
@@ -1493,6 +1494,9 @@ int LuaDispatch(lua_State* __ls)
/*Main*/
int main(int argc, const char **argv)
{
+ /*initializing the log*/
+ bruiser::BruiserReport BruiserLog;
+
/*gets the compilation database and options for the clang instances that we would later run*/
CommonOptionsParser op(argc, argv, BruiserCategory);
ClangTool Tool(op.getCompilations(), op.getSourcePathList());
@@ -1566,6 +1570,26 @@ int main(int argc, const char **argv)
#undef X
#undef LIST_LIST_GENERATORS
+ /*The non-cli execution loop*/
+ if (NonCLILuaScript != "")
+ {
+ std::ifstream lua_script_noncli;
+ lua_script_noncli.open(NonCLILuaScript);
+ std::string line;
+
+ while(std::getline(lua_script_noncli, line))
+ {
+ BruiserLog.PrintToLog("running in non-cli mode...");
+ BruiserLog.PrintToLog(line + "\n");
+ LE.RunChunk((char*)line.c_str());
+ }
+
+ LE.Cleanup();
+
+ return 0;
+ }
+
+ /*cli execution loop*/
while((command = linenoise(">>>")) != NULL)
{
linenoiseHistoryAdd(command);