summaryrefslogtreecommitdiff
path: root/tools/bugpoint/ExecutionDriver.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-01 20:29:45 +0000
committerChris Lattner <sabre@nondot.org>2003-08-01 20:29:45 +0000
commit65f62790d6e3e7f7ceb9cd12a7a51a66d95a3b03 (patch)
treea633f701f66aa4808f98d43e9db60508e954679b /tools/bugpoint/ExecutionDriver.cpp
parent794a58ed197f082c96a1ea33fdb9c6d0a8f151d8 (diff)
downloadllvm-65f62790d6e3e7f7ceb9cd12a7a51a66d95a3b03.tar.gz
llvm-65f62790d6e3e7f7ceb9cd12a7a51a66d95a3b03.tar.bz2
llvm-65f62790d6e3e7f7ceb9cd12a7a51a66d95a3b03.tar.xz
Use the new FileUtilities library to do diff'ing of files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7484 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/ExecutionDriver.cpp')
-rw-r--r--tools/bugpoint/ExecutionDriver.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp
index 0b875cba08..abfbe96a8c 100644
--- a/tools/bugpoint/ExecutionDriver.cpp
+++ b/tools/bugpoint/ExecutionDriver.cpp
@@ -18,6 +18,7 @@ BUGPOINT NOTES:
#include "SystemUtils.h"
#include "Support/CommandLine.h"
#include "Support/Statistic.h"
+#include "Support/FileUtilities.h"
#include <fstream>
#include <iostream>
@@ -583,30 +584,16 @@ bool BugDriver::diffProgram(const std::string &BytecodeFile,
// Execute the program, generating an output file...
std::string Output = executeProgram("", BytecodeFile, SharedObject);
- std::ifstream ReferenceFile(ReferenceOutputFile.c_str());
- if (!ReferenceFile) {
- std::cerr << "Couldn't open reference output file '"
- << ReferenceOutputFile << "'\n";
- exit(1);
- }
-
- std::ifstream OutputFile(Output.c_str());
- if (!OutputFile) {
- std::cerr << "Couldn't open output file: " << Output << "'!\n";
- exit(1);
- }
-
+ std::string Error;
bool FilesDifferent = false;
+ if (DiffFiles(ReferenceOutputFile, Output, &Error)) {
+ if (!Error.empty()) {
+ std::cerr << "While diffing output: " << Error << "\n";
+ exit(1);
+ }
+ FilesDifferent = true;
+ }
- // Compare the two files...
- int C1, C2;
- do {
- C1 = ReferenceFile.get();
- C2 = OutputFile.get();
- if (C1 != C2) { FilesDifferent = true; break; }
- } while (C1 != EOF);
-
- //removeFile(Output);
if (RemoveBytecode) removeFile(BytecodeFile);
return FilesDifferent;
}