Fix the UNIT_TESTING build on Windows

- Put all tests in the bin directory so that DLLs can be loaded
- Add missing exports
- Skip tests that use code depending on zlib
- The "GMT" timezone is named differently, use the int constructor instead

5 tests are still failing, it's not really worth fixing at the moment
since no developper is currently using Windows as its main platform.
This commit is contained in:
Jocelyn Turcotte 2017-02-07 19:31:55 +01:00
parent 611f633ba8
commit b26db062d2
9 changed files with 20 additions and 15 deletions

View file

@ -7,6 +7,8 @@ endif()
project(client)
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(OEM_THEME_DIR "" CACHE STRING "Define directory containing a custom theme")
if ( EXISTS ${OEM_THEME_DIR}/OEM.cmake )
include ( ${OEM_THEME_DIR}/OEM.cmake )

View file

@ -28,7 +28,6 @@ include(ConfigureChecks.cmake)
set(SOURCE_DIR ${CMAKE_SOURCE_DIR})
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
include_directories(${CMAKE_CURRENT_BINARY_DIR})

View file

@ -207,7 +207,7 @@ __attribute__ ((packed))
#endif
;
void csync_file_stat_free(csync_file_stat_t *st);
OCSYNC_EXPORT void csync_file_stat_free(csync_file_stat_t *st);
/*
* context for the treewalk function

View file

@ -56,17 +56,15 @@ int csync_get_statedb_exists(CSYNC *ctx);
*
* @return 0 on success, less than 0 if an error occurred with errno set.
*/
int csync_statedb_load(CSYNC *ctx, const char *statedb, sqlite3 **pdb);
OCSYNC_EXPORT int csync_statedb_load(CSYNC *ctx, const char *statedb, sqlite3 **pdb);
int csync_statedb_close(CSYNC *ctx);
OCSYNC_EXPORT int csync_statedb_close(CSYNC *ctx);
csync_file_stat_t *csync_statedb_get_stat_by_hash(CSYNC *ctx, uint64_t phash);
OCSYNC_EXPORT csync_file_stat_t *csync_statedb_get_stat_by_hash(CSYNC *ctx, uint64_t phash);
csync_file_stat_t *csync_statedb_get_stat_by_inode(CSYNC *ctx, uint64_t inode);
OCSYNC_EXPORT csync_file_stat_t *csync_statedb_get_stat_by_inode(CSYNC *ctx, uint64_t inode);
csync_file_stat_t *csync_statedb_get_stat_by_file_id(CSYNC *ctx, const char *file_id);
char *csync_statedb_get_etag(CSYNC *ctx, uint64_t jHash);
OCSYNC_EXPORT csync_file_stat_t *csync_statedb_get_stat_by_file_id(CSYNC *ctx, const char *file_id);
/**
* @brief Query all files metadata inside and below a path.

View file

@ -1,7 +1,6 @@
# TODO: OSX and LIB_ONLY seem to require this to go to binary dir only
if(NOT TOKEN_AUTH_ONLY)
endif()
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(synclib_NAME ${APPLICATION_EXECUTABLE}sync)

View file

@ -84,7 +84,7 @@ QString OWNCLOUDSYNC_EXPORT longWinPath( const QString& inpath );
*/
time_t OWNCLOUDSYNC_EXPORT getModTime(const QString& filename);
bool setModTime(const QString &filename, time_t modTime);
bool OWNCLOUDSYNC_EXPORT setModTime(const QString &filename, time_t modTime);
/**
* @brief Get the size for a file

View file

@ -12,6 +12,7 @@ macro(owncloud_add_test test_class additional_cpp)
add_executable(${OWNCLOUD_TEST_CLASS}Test test${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp ${additional_cpp})
qt5_use_modules(${OWNCLOUD_TEST_CLASS}Test Test Sql Xml Network)
set_target_properties(${OWNCLOUD_TEST_CLASS}Test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
target_link_libraries(${OWNCLOUD_TEST_CLASS}Test
updater
@ -40,6 +41,7 @@ macro(owncloud_add_benchmark test_class additional_cpp)
add_executable(${OWNCLOUD_TEST_CLASS}Bench benchmarks/bench${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp ${additional_cpp})
qt5_use_modules(${OWNCLOUD_TEST_CLASS}Bench Test Sql Xml Network)
set_target_properties(${OWNCLOUD_TEST_CLASS}Bench PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
target_link_libraries(${OWNCLOUD_TEST_CLASS}Bench
updater

View file

@ -345,7 +345,7 @@ public:
} else
xml.writeEmptyElement(davUri, QStringLiteral("resourcetype"));
auto gmtDate = fileInfo.lastModified.toTimeZone(QTimeZone("GMT"));
auto gmtDate = fileInfo.lastModified.toTimeZone(QTimeZone(0));
auto stringDate = gmtDate.toString("ddd, dd MMM yyyy HH:mm:ss 'GMT'");
xml.writeTextElement(davUri, QStringLiteral("getlastmodified"), stringDate);
xml.writeTextElement(davUri, QStringLiteral("getcontentlength"), QString::number(fileInfo.size));

View file

@ -55,7 +55,6 @@ using namespace OCC;
private slots:
void initTestCase() {
qDebug() << Q_FUNC_INFO;
_root = QDir::tempPath() + "/" + "test_" + QString::number(qrand());
QDir rootDir(_root);
@ -65,7 +64,9 @@ using namespace OCC;
}
void testUploadChecksummingAdler() {
#ifndef ZLIB_FOUND
QSKIP("ZLIB not found.", SkipSingle);
#else
ComputeChecksum *vali = new ComputeChecksum(this);
_expectedType = "Adler32";
vali->setChecksumType(_expectedType);
@ -81,6 +82,7 @@ using namespace OCC;
loop.exec();
delete vali;
#endif
}
void testUploadChecksummingMd5() {
@ -119,7 +121,9 @@ using namespace OCC;
}
void testDownloadChecksummingAdler() {
#ifndef ZLIB_FOUND
QSKIP("ZLIB not found.", SkipSingle);
#else
QByteArray adler = checkSumAdlerC;
adler.append(":");
adler.append(FileSystem::calcAdler32( _testfile ));
@ -143,6 +147,7 @@ using namespace OCC;
QTRY_VERIFY(_errorSeen);
delete vali;
#endif
}