[llvm-commits] CVS: llvm/tools/bugpoint/ToolRunner.cpp ToolRunner.h
Evan Cheng
evan.cheng at apple.com
Thu May 3 11:36:33 PDT 2007
Changes in directory llvm/tools/bugpoint:
ToolRunner.cpp updated: 1.61 -> 1.62
ToolRunner.h updated: 1.24 -> 1.25
---
Log message:
Added -rsh-host and -rsh-user to support remote execution.
---
Diffs of the changes: (+44 -6)
ToolRunner.cpp | 46 +++++++++++++++++++++++++++++++++++++++++-----
ToolRunner.h | 4 +++-
2 files changed, 44 insertions(+), 6 deletions(-)
Index: llvm/tools/bugpoint/ToolRunner.cpp
diff -u llvm/tools/bugpoint/ToolRunner.cpp:1.61 llvm/tools/bugpoint/ToolRunner.cpp:1.62
--- llvm/tools/bugpoint/ToolRunner.cpp:1.61 Fri Feb 16 13:11:07 2007
+++ llvm/tools/bugpoint/ToolRunner.cpp Thu May 3 13:36:15 2007
@@ -15,6 +15,7 @@
#include "ToolRunner.h"
#include "llvm/Config/config.h" // for HAVE_LINK_R
#include "llvm/System/Program.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FileUtilities.h"
#include <fstream>
@@ -22,6 +23,16 @@
#include <iostream>
using namespace llvm;
+namespace {
+ cl::opt<std::string>
+ RSHHost("rsh-host",
+ cl::desc("Remote execution (rsh) host"));
+
+ cl::opt<std::string>
+ RSHUser("rsh-user",
+ cl::desc("Remote execution (rsh) user id"));
+}
+
ToolExecutionError::~ToolExecutionError() throw() { }
/// RunProgramWithTimeout - This function provides an alternate interface to the
@@ -482,7 +493,22 @@
std::vector<const char*> ProgramArgs;
- ProgramArgs.push_back(OutputBinary.c_str());
+ if (RSHPath.isEmpty())
+ ProgramArgs.push_back(OutputBinary.c_str());
+ else {
+ ProgramArgs.push_back(RSHPath.c_str());
+ ProgramArgs.push_back(RSHHost.c_str());
+ ProgramArgs.push_back("-l");
+ ProgramArgs.push_back(RSHUser.c_str());
+
+ char* env_pwd = getenv("PWD");
+ std::string Exec = "cd ";
+ Exec += env_pwd;
+ Exec += "; ./";
+ Exec += OutputBinary.c_str();
+ ProgramArgs.push_back(Exec.c_str());
+ }
+
// Add optional parameters to the running program from Argv
for (unsigned i=0, e = Args.size(); i != e; ++i)
ProgramArgs.push_back(Args[i].c_str());
@@ -497,9 +523,15 @@
);
FileRemover OutputBinaryRemover(OutputBinary);
- return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
- sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
- Timeout, MemoryLimit);
+
+ if (RSHPath.isEmpty())
+ return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
+ sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
+ Timeout, MemoryLimit);
+ else
+ return RunProgramWithTimeout(sys::Path(RSHPath), &ProgramArgs[0],
+ sys::Path(InputFile), sys::Path(OutputFile), sys::Path(OutputFile),
+ Timeout, MemoryLimit);
}
int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
@@ -583,6 +615,10 @@
return 0;
}
+ sys::Path RSHPath;
+ if (!RSHHost.empty())
+ RSHPath = FindExecutable("rsh", ProgramPath);
+
Message = "Found gcc: " + GCCPath.toString() + "\n";
- return new GCC(GCCPath);
+ return new GCC(GCCPath, RSHPath);
}
Index: llvm/tools/bugpoint/ToolRunner.h
diff -u llvm/tools/bugpoint/ToolRunner.h:1.24 llvm/tools/bugpoint/ToolRunner.h:1.25
--- llvm/tools/bugpoint/ToolRunner.h:1.24 Fri Feb 16 13:11:07 2007
+++ llvm/tools/bugpoint/ToolRunner.h Thu May 3 13:36:15 2007
@@ -44,7 +44,9 @@
//
class GCC {
sys::Path GCCPath; // The path to the gcc executable
- GCC(const sys::Path &gccPath) : GCCPath(gccPath) { }
+ sys::Path RSHPath; // The path to the rsh executable
+ GCC(const sys::Path &gccPath, const sys::Path &rshPath)
+ : GCCPath(gccPath), RSHPath(rshPath) { }
public:
enum FileType { AsmFile, CFile };
More information about the llvm-commits
mailing list