minor cleanups. Add provisions for a new standard BLOCKINFO_BLOCK
[oota-llvm.git] / tools / bugpoint / ExecutionDriver.cpp
index 93135efb81559bd8daa147e3efdf09c56056106c..f4a072b14aede9f0649b7c3e7ca348bc9f6dbe4e 100644 (file)
@@ -56,6 +56,11 @@ namespace {
                    cl::desc("Assume nonzero exit code is failure (default on)"),
                        cl::init(true));
 
+  cl::opt<bool>
+  AppendProgramExitCode("append-exit-code",
+      cl::desc("Append the exit code to the output so it gets diff'd too"),
+      cl::init(false));
+
   cl::opt<std::string>
   InputFile("input", cl::init("/dev/null"),
             cl::desc("Filename to pipe in as stdin (default: /dev/null)"));
@@ -258,11 +263,11 @@ std::string BugDriver::executeProgram(std::string OutputFile,
       InterpreterSel == CBE_bug)
     RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile,
                                 OutputFile, AdditionalLinkerArgs, SharedObjs, 
-                                Timeout);
+                                Timeout, MemoryLimit);
   else 
     RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile,
                                 OutputFile, std::vector<std::string>(), 
-                                SharedObjs, Timeout);
+                                SharedObjs, Timeout, MemoryLimit);
 
   if (RetVal == -1) {
     std::cerr << "<timeout>";
@@ -277,6 +282,12 @@ std::string BugDriver::executeProgram(std::string OutputFile,
     }
   }
 
+  if (AppendProgramExitCode) {
+    std::ofstream outFile(OutputFile.c_str(), std::ios_base::app);
+    outFile << "exit " << RetVal << '\n';
+    outFile.close();
+  }
+
   if (ProgramExitedNonzero != 0)
     *ProgramExitedNonzero = (RetVal != 0);