QSql tests: Remove Windows CE and clean up code.
Use the newly introduced QSysInfo::machineHostName() to determine the host name in the shared header, removing the need to link against the winsocket library. All Windows-specific .pro sections can then be removed. Task-number: QTBUG-51673 Change-Id: Iba990b886b16addd210639871065abde6de96516 Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
This commit is contained in:
parent
e82bdee165
commit
2ec7f2cfed
@ -3,9 +3,3 @@ TARGET = tst_qsql
|
||||
SOURCES += tst_qsql.cpp
|
||||
|
||||
QT = core-private sql-private testlib
|
||||
|
||||
wince {
|
||||
DEPLOYMENT_PLUGIN += qsqlite
|
||||
}
|
||||
mingw: LIBS += -lws2_32
|
||||
|
||||
|
@ -3,17 +3,3 @@ TARGET = tst_qsqldatabase
|
||||
SOURCES += tst_qsqldatabase.cpp
|
||||
|
||||
QT = core sql testlib core-private sql-private
|
||||
|
||||
win32: {
|
||||
!wince: LIBS += -lws2_32
|
||||
else: LIBS += -lws2
|
||||
}
|
||||
|
||||
wince {
|
||||
DEPLOYMENT_PLUGIN += qsqlite
|
||||
|
||||
testData.files = testdata
|
||||
testData.path = .
|
||||
|
||||
DEPLOYMENT += testData
|
||||
}
|
||||
|
@ -43,20 +43,6 @@
|
||||
#include <QtSql/private/qsqldriver_p.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
# include <qt_windows.h>
|
||||
# if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
# include <winsock2.h>
|
||||
# endif
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if defined(Q_OS_WINRT)
|
||||
static inline int qgethostname(char *name, int) { qstrcpy(name, "localhost"); return 9; }
|
||||
#else
|
||||
# define qgethostname gethostname
|
||||
#endif
|
||||
|
||||
#define CHECK_DATABASE( db ) \
|
||||
if ( !db.isValid() ) { qFatal( "db is Invalid" ); }
|
||||
|
||||
@ -71,16 +57,10 @@ static QString qGetHostName()
|
||||
{
|
||||
static QString hostname;
|
||||
|
||||
if ( !hostname.isEmpty() )
|
||||
return hostname;
|
||||
|
||||
char hn[257];
|
||||
|
||||
if ( qgethostname( hn, 255 ) == 0 ) {
|
||||
hn[256] = '\0';
|
||||
hostname = QString::fromLatin1( hn );
|
||||
hostname.replace( QLatin1Char( '.' ), QLatin1Char( '_' ) );
|
||||
hostname.replace( QLatin1Char( '-' ), QLatin1Char( '_' ) );
|
||||
if (hostname.isEmpty()) {
|
||||
hostname = QSysInfo::machineHostName();
|
||||
hostname.replace(QLatin1Char( '.' ), QLatin1Char( '_' ));
|
||||
hostname.replace(QLatin1Char( '-' ), QLatin1Char( '_' ));
|
||||
}
|
||||
|
||||
return hostname;
|
||||
|
@ -3,16 +3,3 @@ TARGET = tst_qsqldriver
|
||||
SOURCES += tst_qsqldriver.cpp
|
||||
|
||||
QT = core sql testlib core-private sql-private
|
||||
|
||||
wince {
|
||||
plugFiles.files = ../../../plugins/sqldrivers
|
||||
plugFiles.path = .
|
||||
DEPLOYMENT += plugFiles
|
||||
LIBS += -lws2
|
||||
} else {
|
||||
mingw {
|
||||
LIBS += -lws2_32
|
||||
} else:win32 {
|
||||
LIBS += ws2_32.lib
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,3 @@ CONFIG += testcase
|
||||
SOURCES += tst_qsqlquery.cpp
|
||||
|
||||
QT = core sql testlib core-private sql-private
|
||||
|
||||
win32:!wince: LIBS += -lws2_32
|
||||
|
||||
wince {
|
||||
plugFiles.files = ../../../plugins/sqldrivers
|
||||
plugFiles.path = .
|
||||
DEPLOYMENT += plugFiles
|
||||
LIBS += -lws2
|
||||
}
|
||||
|
@ -3,14 +3,3 @@ TARGET = tst_qsqlthread
|
||||
SOURCES += tst_qsqlthread.cpp
|
||||
|
||||
QT = core sql testlib core-private sql-private
|
||||
|
||||
|
||||
wince {
|
||||
plugFiles.files = ../../../plugins/sqldrivers
|
||||
plugFiles.path = .
|
||||
DEPLOYMENT += plugFiles
|
||||
LIBS += -lws2
|
||||
} else {
|
||||
win32:LIBS += -lws2_32
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,3 @@ TARGET = tst_qsqlquerymodel
|
||||
SOURCES += tst_qsqlquerymodel.cpp
|
||||
|
||||
QT += widgets sql testlib core-private sql-private
|
||||
|
||||
wince {
|
||||
DEPLOYMENT_PLUGIN += qsqlite
|
||||
LIBS += -lws2
|
||||
} else {
|
||||
win32:LIBS += -lws2_32
|
||||
}
|
||||
|
||||
|
@ -3,16 +3,3 @@ TARGET = tst_qsqlrelationaltablemodel
|
||||
SOURCES += tst_qsqlrelationaltablemodel.cpp
|
||||
|
||||
QT = core sql testlib core-private sql-private
|
||||
|
||||
wince {
|
||||
plugFiles.files = ../../../plugins/sqldrivers
|
||||
plugFiles.path = .
|
||||
DEPLOYMENT += plugFiles
|
||||
LIBS += -lws2
|
||||
} else {
|
||||
mingw {
|
||||
LIBS += -lws2_32
|
||||
} else:win32 {
|
||||
LIBS += ws2_32.lib
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,3 @@ TARGET = tst_qsqltablemodel
|
||||
SOURCES += tst_qsqltablemodel.cpp
|
||||
|
||||
QT = core core-private sql sql-private testlib
|
||||
|
||||
wince {
|
||||
plugFiles.files = ../../../plugins/sqldrivers
|
||||
plugFiles.path = .
|
||||
DEPLOYMENT += plugFiles
|
||||
LIBS += -lws2
|
||||
} else {
|
||||
win32:LIBS += -lws2_32
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user