Add more debug output to TestApplication::workingCopyPathMode

This commit is contained in:
Martchus 2018-08-10 16:36:55 +02:00
parent d82e7bb869
commit d0bf2fb390
1 changed files with 4 additions and 1 deletions

View File

@ -258,18 +258,20 @@ string TestApplication::workingCopyPathMode(const string &name, WorkingCopyMode
if (origFile.fail()) { if (origFile.fail()) {
cerr << Phrases::Error << "Unable to create working copy for \"" << name << "\": an IO error occurred when opening original file \"" cerr << Phrases::Error << "Unable to create working copy for \"" << name << "\": an IO error occurred when opening original file \""
<< origFilePath << "\"." << Phrases::EndFlush; << origFilePath << "\"." << Phrases::EndFlush;
cerr << "error: " << strerror(errno) << endl;
return string(); return string();
} }
workingCopy.open(workingCopyPath, ios_base::out | ios_base::binary | ios_base::trunc); workingCopy.open(workingCopyPath, ios_base::out | ios_base::binary | ios_base::trunc);
while (workingCopy.fail() && !stat(workingCopyPath.c_str(), &currentStat)) { while (workingCopy.fail() && !stat(workingCopyPath.c_str(), &currentStat)) {
// adjust the working copy path if the target file already exists and can not be truncated // adjust the working copy path if the target file already exists and can not be truncated
workingCopyPath = argsToString(m_workingDir, "/tmp-", ++workingCopyPathAttempt, '-', name); workingCopyPath = argsToString(m_workingDir, name, '.', ++workingCopyPathAttempt);
workingCopy.clear(); workingCopy.clear();
workingCopy.open(workingCopyPath, ios_base::out | ios_base::binary | ios_base::trunc); workingCopy.open(workingCopyPath, ios_base::out | ios_base::binary | ios_base::trunc);
} }
if (workingCopy.fail()) { if (workingCopy.fail()) {
cerr << Phrases::Error << "Unable to create working copy for \"" << name << "\": an IO error occurred when opening target file \"" cerr << Phrases::Error << "Unable to create working copy for \"" << name << "\": an IO error occurred when opening target file \""
<< workingCopyPath << "\"." << Phrases::EndFlush; << workingCopyPath << "\"." << Phrases::EndFlush;
cerr << "error: " << strerror(errno) << endl;
return string(); return string();
} }
workingCopy << origFile.rdbuf(); workingCopy << origFile.rdbuf();
@ -288,6 +290,7 @@ string TestApplication::workingCopyPathMode(const string &name, WorkingCopyMode
} }
cerr << " an IO error occurred when writing to target file \"" << workingCopyPath << "\"."; cerr << " an IO error occurred when writing to target file \"" << workingCopyPath << "\".";
} }
cerr << "error: " << strerror(errno) << endl;
return string(); return string();
} }