mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Speedup test build by compile the fake server just once
This commit is contained in:
parent
1b4ccea083
commit
6818b8e303
7 changed files with 1142 additions and 827 deletions
|
@ -14,6 +14,10 @@ include_directories(${CMAKE_SOURCE_DIR}/src
|
|||
|
||||
include(nextcloud_add_test.cmake)
|
||||
|
||||
set(CMAKE_AUTOMOC TRUE)
|
||||
add_library(syncenginetestutils STATIC syncenginetestutils.cpp)
|
||||
target_link_libraries(syncenginetestutils PUBLIC ${APPLICATION_EXECUTABLE}sync Qt5::Test)
|
||||
|
||||
nextcloud_add_test(NextcloudPropagator "")
|
||||
|
||||
IF(BUILD_UPDATER)
|
||||
|
@ -45,31 +49,31 @@ nextcloud_add_test(ClientSideEncryption "")
|
|||
nextcloud_add_test(ExcludedFiles "")
|
||||
|
||||
nextcloud_add_test(Utility "")
|
||||
nextcloud_add_test(SyncEngine "syncenginetestutils.h")
|
||||
nextcloud_add_test(SyncVirtualFiles "syncenginetestutils.h")
|
||||
nextcloud_add_test(SyncMove "syncenginetestutils.h")
|
||||
nextcloud_add_test(SyncDelete "syncenginetestutils.h")
|
||||
nextcloud_add_test(SyncConflict "syncenginetestutils.h")
|
||||
nextcloud_add_test(SyncFileStatusTracker "syncenginetestutils.h")
|
||||
nextcloud_add_test(Download "syncenginetestutils.h")
|
||||
nextcloud_add_test(ChunkingNg "syncenginetestutils.h")
|
||||
nextcloud_add_test(AsyncOp "syncenginetestutils.h")
|
||||
nextcloud_add_test(UploadReset "syncenginetestutils.h")
|
||||
nextcloud_add_test(AllFilesDeleted "syncenginetestutils.h")
|
||||
nextcloud_add_test(Blacklist "syncenginetestutils.h")
|
||||
nextcloud_add_test(LocalDiscovery "syncenginetestutils.h")
|
||||
nextcloud_add_test(RemoteDiscovery "syncenginetestutils.h")
|
||||
nextcloud_add_test(Permissions "syncenginetestutils.h")
|
||||
nextcloud_add_test(SelectiveSync "syncenginetestutils.h")
|
||||
nextcloud_add_test(DatabaseError "syncenginetestutils.h")
|
||||
nextcloud_add_test(LockedFiles "syncenginetestutils.h;../src/gui/lockwatcher.cpp")
|
||||
nextcloud_add_test(SyncEngine "")
|
||||
nextcloud_add_test(SyncVirtualFiles "")
|
||||
nextcloud_add_test(SyncMove "")
|
||||
nextcloud_add_test(SyncDelete "")
|
||||
nextcloud_add_test(SyncConflict "")
|
||||
nextcloud_add_test(SyncFileStatusTracker "")
|
||||
nextcloud_add_test(Download "")
|
||||
nextcloud_add_test(ChunkingNg "")
|
||||
nextcloud_add_test(AsyncOp "")
|
||||
nextcloud_add_test(UploadReset "")
|
||||
nextcloud_add_test(AllFilesDeleted "")
|
||||
nextcloud_add_test(Blacklist "")
|
||||
nextcloud_add_test(LocalDiscovery "")
|
||||
nextcloud_add_test(RemoteDiscovery "")
|
||||
nextcloud_add_test(Permissions "")
|
||||
nextcloud_add_test(SelectiveSync "")
|
||||
nextcloud_add_test(DatabaseError "")
|
||||
nextcloud_add_test(LockedFiles "../src/gui/lockwatcher.cpp")
|
||||
nextcloud_add_test(FolderWatcher "${FolderWatcher_SRC}")
|
||||
|
||||
if( UNIX AND NOT APPLE )
|
||||
nextcloud_add_test(InotifyWatcher "${FolderWatcher_SRC}")
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
nextcloud_add_benchmark(LargeSync "syncenginetestutils.h")
|
||||
nextcloud_add_benchmark(LargeSync "")
|
||||
|
||||
SET(FolderMan_SRC ../src/gui/folderman.cpp)
|
||||
list(APPEND FolderMan_SRC ../src/gui/folder.cpp )
|
||||
|
@ -106,7 +110,7 @@ list(APPEND RemoteWipe_SRC ${RemoteWipe_SRC})
|
|||
list(APPEND RemoteWipe_SRC stubremotewipe.cpp )
|
||||
nextcloud_add_test(RemoteWipe "${RemoteWipe_SRC}")
|
||||
|
||||
nextcloud_add_test(OAuth "syncenginetestutils.h;../src/gui/creds/oauth.cpp")
|
||||
nextcloud_add_test(OAuth "../src/gui/creds/oauth.cpp")
|
||||
|
||||
configure_file(test_journal.db "${PROJECT_BINARY_DIR}/bin/test_journal.db" COPYONLY)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ macro(nextcloud_add_test test_class additional_cpp)
|
|||
set_target_properties(${OWNCLOUD_TEST_CLASS}Test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
|
||||
|
||||
target_link_libraries(${OWNCLOUD_TEST_CLASS}Test
|
||||
${APPLICATION_EXECUTABLE}sync
|
||||
${APPLICATION_EXECUTABLE}sync syncenginetestutils
|
||||
Qt5::Core Qt5::Test Qt5::Xml Qt5::Network Qt5::Qml Qt5::Quick
|
||||
)
|
||||
|
||||
|
@ -37,7 +37,7 @@ macro(nextcloud_add_benchmark test_class additional_cpp)
|
|||
set_target_properties(${OWNCLOUD_TEST_CLASS}Bench PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
|
||||
|
||||
target_link_libraries(${OWNCLOUD_TEST_CLASS}Bench
|
||||
${APPLICATION_EXECUTABLE}sync
|
||||
${APPLICATION_EXECUTABLE}sync syncenginetestutils
|
||||
Qt5::Core Qt5::Test Qt5::Xml Qt5::Network
|
||||
)
|
||||
|
||||
|
|
1009
test/syncenginetestutils.cpp
Normal file
1009
test/syncenginetestutils.cpp
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -113,7 +113,7 @@ private slots:
|
|||
auto successCallback = [](TestCase *tc, const QNetworkRequest &request) {
|
||||
tc->pollRequest = [](TestCase *, const QNetworkRequest &) -> QNetworkReply * { std::abort(); }; // shall no longer be called
|
||||
FileInfo *info = tc->perform();
|
||||
QByteArray body = "{ \"status\":\"finished\", \"ETag\":\"\\\"" + info->etag.toUtf8() + "\\\"\", \"fileId\":\"" + info->fileId + "\"}\n";
|
||||
QByteArray body = "{ \"status\":\"finished\", \"ETag\":\"\\\"" + info->etag + "\\\"\", \"fileId\":\"" + info->fileId + "\"}\n";
|
||||
return new FakePayloadReply(QNetworkAccessManager::GetOperation, request, body, nullptr);
|
||||
};
|
||||
// Callback that never finishes
|
||||
|
|
|
@ -171,7 +171,7 @@ private slots:
|
|||
QCOMPARE(counter, 4);
|
||||
|
||||
if (remote)
|
||||
QCOMPARE(journalRecord(fakeFolder, "A")._etag, fakeFolder.currentRemoteState().find("A")->etag.toUtf8());
|
||||
QCOMPARE(journalRecord(fakeFolder, "A")._etag, fakeFolder.currentRemoteState().find("A")->etag);
|
||||
}
|
||||
cleanup();
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ private slots:
|
|||
QCOMPARE(items[0]->_file, QLatin1String("A"));
|
||||
SyncJournalFileRecord record;
|
||||
QVERIFY(fakeFolder.syncJournal().getFileRecord(QByteArray("A/a0"), &record));
|
||||
QCOMPARE(record._etag, fakeFolder.remoteModifier().find("A/a0")->etag.toUtf8());
|
||||
QCOMPARE(record._etag, fakeFolder.remoteModifier().find("A/a0")->etag);
|
||||
};
|
||||
auto connection = connect(&fakeFolder.syncEngine(), &SyncEngine::aboutToPropagate, checkEtagUpdated);
|
||||
QVERIFY(fakeFolder.syncOnce());
|
||||
|
|
Loading…
Reference in a new issue