[llvm-commits] CVS: llvm/tools/bugpoint/ExecutionDriver.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Aug 1 15:30:08 PDT 2003
Changes in directory llvm/tools/bugpoint:
ExecutionDriver.cpp updated: 1.12 -> 1.13
---
Log message:
Use the new FileUtilities library to do diff'ing of files
---
Diffs of the changes:
Index: llvm/tools/bugpoint/ExecutionDriver.cpp
diff -u llvm/tools/bugpoint/ExecutionDriver.cpp:1.12 llvm/tools/bugpoint/ExecutionDriver.cpp:1.13
--- llvm/tools/bugpoint/ExecutionDriver.cpp:1.12 Wed Jul 30 15:15:44 2003
+++ llvm/tools/bugpoint/ExecutionDriver.cpp Fri Aug 1 15:29:45 2003
@@ -18,6 +18,7 @@
#include "SystemUtils.h"
#include "Support/CommandLine.h"
#include "Support/Statistic.h"
+#include "Support/FileUtilities.h"
#include <fstream>
#include <iostream>
@@ -583,30 +584,16 @@
// 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;
}
More information about the llvm-commits
mailing list