diff --git a/csync/CMakeLists.txt b/csync/CMakeLists.txt index d34926c59..808349ba5 100644 --- a/csync/CMakeLists.txt +++ b/csync/CMakeLists.txt @@ -41,7 +41,7 @@ endif (MEM_NULL_TESTS) add_subdirectory(src) if (UNIT_TESTING) - set(WITH_UNIT_TESTING ON) + set(WITH_TESTING ON) find_package(CMocka) if (CMOCKA_FOUND) diff --git a/csync/config_csync.h.cmake b/csync/config_csync.h.cmake index c42eb1045..155329bbd 100644 --- a/csync/config_csync.h.cmake +++ b/csync/config_csync.h.cmake @@ -26,4 +26,4 @@ #cmakedefine HAVE___MINGW_ASPRINTF 1 #cmakedefine HAVE_ASPRINTF 1 -#cmakedefine WITH_UNIT_TESTING 1 +#cmakedefine WITH_TESTING 1 diff --git a/csync/src/csync_exclude.c b/csync/src/csync_exclude.c index bf636c3de..e125b3346 100644 --- a/csync/src/csync_exclude.c +++ b/csync/src/csync_exclude.c @@ -45,7 +45,7 @@ #define CSYNC_LOG_CATEGORY_NAME "csync.exclude" #include "csync_log.h" -#ifndef WITH_UNIT_TESTING +#ifndef WITH_TESTING static #endif int _csync_exclude_add(c_strlist_t **inList, const char *string) { diff --git a/csync/src/csync_exclude.h b/csync/src/csync_exclude.h index f9f26547d..ae49bbd8d 100644 --- a/csync/src/csync_exclude.h +++ b/csync/src/csync_exclude.h @@ -36,7 +36,7 @@ enum csync_exclude_type_e { }; typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE; -#ifdef WITH_UNIT_TESTING +#ifdef WITH_TESTING int OCSYNC_EXPORT _csync_exclude_add(c_strlist_t **inList, const char *string); #endif diff --git a/src/libsync/excludedfiles.cpp b/src/libsync/excludedfiles.cpp index 80e459f10..d9793ce0f 100644 --- a/src/libsync/excludedfiles.cpp +++ b/src/libsync/excludedfiles.cpp @@ -47,7 +47,7 @@ void ExcludedFiles::addExcludeFilePath(const QString& path) _excludeFiles.insert(path); } -#ifdef WITH_UNIT_TESTING +#ifdef WITH_TESTING void ExcludedFiles::addExcludeExpr(const QString &expr) { _csync_exclude_add(_excludesPtr, expr.toLatin1().constData()); diff --git a/src/libsync/excludedfiles.h b/src/libsync/excludedfiles.h index 441aa29ae..97e3a98da 100644 --- a/src/libsync/excludedfiles.h +++ b/src/libsync/excludedfiles.h @@ -58,7 +58,7 @@ public: const QString& basePath, bool excludeHidden) const; -#ifdef WITH_UNIT_TESTING +#ifdef WITH_TESTING void addExcludeExpr(const QString &expr); #endif diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index cd0b4a232..b3b737a6b 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -224,7 +224,9 @@ void PropagateUploadFileCommon::slotComputeContentChecksum() // change during the checksum calculation _item->_modtime = FileSystem::getModTime(filePath); +#ifdef WITH_TESTING _stopWatch.start(); +#endif QByteArray checksumType = contentChecksumType(); @@ -251,8 +253,10 @@ void PropagateUploadFileCommon::slotComputeTransmissionChecksum(const QByteArray _item->_contentChecksum = contentChecksum; _item->_contentChecksumType = contentChecksumType; +#ifdef WITH_TESTING _stopWatch.addLapTime(QLatin1String("ContentChecksum")); _stopWatch.start(); +#endif // Reuse the content checksum as the transmission checksum if possible const auto supportedTransmissionChecksums = @@ -299,7 +303,9 @@ void PropagateUploadFileCommon::slotStartUpload(const QByteArray& transmissionCh done(SyncFileItem::SoftError, tr("File Removed")); return; } +#ifdef WITH_TESTING _stopWatch.addLapTime(QLatin1String("TransmissionChecksum")); +#endif time_t prevModtime = _item->_modtime; // the _item value was set in PropagateUploadFile::start() // but a potential checksum calculation could have taken some time during which the file could diff --git a/src/libsync/propagateupload.h b/src/libsync/propagateupload.h index 3638acdbb..db70b566c 100644 --- a/src/libsync/propagateupload.h +++ b/src/libsync/propagateupload.h @@ -188,7 +188,9 @@ protected: bool _deleteExisting; // measure the performance of checksum calc and upload +#ifdef WITH_TESTING Utility::StopWatch _stopWatch; +#endif QByteArray _transmissionChecksum; QByteArray _transmissionChecksumType; diff --git a/src/libsync/propagateuploadng.cpp b/src/libsync/propagateuploadng.cpp index 459d9991b..5d637d467 100644 --- a/src/libsync/propagateuploadng.cpp +++ b/src/libsync/propagateuploadng.cpp @@ -483,6 +483,7 @@ void PropagateUploadFileNG::slotMoveJobFinished() } _item->_responseTimeStamp = job->responseTimestamp(); +#ifdef WITH_TESTING // performance logging quint64 duration = _stopWatch.stop(); qDebug() << "*==* duration UPLOAD" << _item->_size @@ -491,6 +492,7 @@ void PropagateUploadFileNG::slotMoveJobFinished() << duration; // The job might stay alive for the whole sync, release this tiny bit of memory. _stopWatch.reset(); +#endif finalize(); } diff --git a/src/libsync/propagateuploadv1.cpp b/src/libsync/propagateuploadv1.cpp index 21778a7d3..081a0dc4f 100644 --- a/src/libsync/propagateuploadv1.cpp +++ b/src/libsync/propagateuploadv1.cpp @@ -339,6 +339,7 @@ void PropagateUploadFileV1::slotPutFinished() done(SyncFileItem::SoftError, "Server does not support X-OC-MTime"); } +#ifdef WITH_TESTING // performance logging quint64 duration = _stopWatch.stop(); qDebug() << "*==* duration UPLOAD" << _item->_size @@ -347,6 +348,7 @@ void PropagateUploadFileV1::slotPutFinished() << duration; // The job might stay alive for the whole sync, release this tiny bit of memory. _stopWatch.reset(); +#endif finalize(); }