Index: sources/storage/FileHandler.cpp =================================================================== diff -u -ra5760947d3ed0d2748ba023a1c25e3c6aa0b1de1 -ra58f91b077c8131bea3dbde0fc338adb113fc9f3 --- sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision a5760947d3ed0d2748ba023a1c25e3c6aa0b1de1) +++ sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision a58f91b077c8131bea3dbde0fc338adb113fc9f3) @@ -43,9 +43,7 @@ { static uint count; static QString mCritical; - // disabled coco begin validated : This has been manually test. Needs file system access to produce errors for hundred times. if (mCritical != vMessage || !(count % 1000)) { - // disabled coco end count = 0; mCritical = vMessage; QTextStream err(stderr); @@ -73,14 +71,12 @@ QFile::OpenMode openMode = vAppend ? QFile::Text | QFile::Append : QFile::Text | QFile::WriteOnly; - // disabled coco begin validated : This has been manually test. Needs file system access to make file the way it cannot be opened for writing. if (! file.open(openMode)) { QString msg = QString("Cannot open file for write (%1). Possible corrupted file system.").arg(vFileName); // here cannot use LOG_XXXX because if the folder cannot be created then the log cannot be written. errOut (msg); return false; } - // disabled coco end QTextStream out(&file); out << vContent; out.flush(); @@ -141,15 +137,12 @@ */ int FileHandler::copyFolder(const QString &vSource, const QString &vDestination) { - // disabled coco begin validated: This needs user interaction to export to USB device - // has been tested manually since currently it is the only place it has been used. QString cmd = "cp"; QStringList arguments; arguments << "-r" << vSource << vDestination; int result = QProcess::execute(cmd, arguments); return result; } -// disabled coco end /*! * \brief FileHandler::moveFolder @@ -161,15 +154,12 @@ */ int FileHandler::moveFolder(const QString &vSource, const QString &vDestination) { - // disabled coco begin validated: This needs user interaction to check the file system - // has been tested manually since currently it is the only place it has been used. QString cmd = "mv"; QStringList arguments; arguments << vSource << vDestination; int result = QProcess::execute(cmd, arguments); return result; } -// disabled coco end /*! * \brief FileHandler::removeFolder @@ -182,15 +172,12 @@ */ int FileHandler::removeFolder(const QString &vFolder) { - // disabled coco begin validated: This needs user interaction to check the file system - // has been tested manually since currently it is the only place it has been used. QString cmd = "rm"; QStringList arguments; arguments << "-frd" << vFolder; int result = QProcess::execute(cmd, arguments); return result; } -// disabled coco end /*! * \brief FileHandler::removeFiles @@ -211,7 +198,6 @@ for (const auto &info : infoList) { QDateTime fileTime = info.lastModified(); QString fileName = info.absoluteFilePath(); - // disabled coco begin validated : This has been manually tested since requires to change in file system to reproduce the error. if (fileTime.isValid()) { if (fileTime.date() <= vDateOlderThan) { if (QFile::remove(fileName)) { @@ -226,7 +212,6 @@ else { errOut(QString("Cannot get last modified date of file : ") + fileName); } - // disabled coco end } } return countRemoved; @@ -329,8 +314,6 @@ * if vRetainPercent is used then it contains list of the file(s) to be removed. */ QFileInfoList FileHandler::find(const QString &vPath, QStringList vNameFilters, quint8 vRetainPercent) { - // disabled coco begin validated: Manually tested. Needs to fill up the storage to test some functionalities like vRetainPercent - QFileInfoList fileInfoList; // if all the files need to retain then no file shall be listed in the remove list. if ( vRetainPercent == 100 ) return fileInfoList; @@ -393,7 +376,6 @@ // ; return fileInfoList; } -// disabled coco end /*! * \brief FileHandler::find @@ -404,8 +386,6 @@ * if vRetainPercent is used then it contains list of the file(s) to be removed. */ QFileInfoList FileHandler::find(const QString &vPath, QStringList vNameFilters) { - // disabled coco begin validated: Needs to manually create specific folder with specific files to check the functionality - // manually tested QFileInfoList fileInfoList; QDir dir(vPath); if (!dir.exists()) return fileInfoList; @@ -420,17 +400,14 @@ ); return fileInfoList; } -// disabled coco end quint64 FileHandler::totalSize(const QFileInfoList &vFileInfoList) { - // disabled coco begin validated: Manually tested. requires list of files on file system to test and requires manual specific files for test. quint64 total = 0; for (auto it = vFileInfoList.crbegin(); it != vFileInfoList.crend(); ++it) { total += it->size(); } return total; } -// disabled coco end /*! * \brief FileHandler::subFolders