summaryrefslogtreecommitdiffstats
path: root/tools/qtestlib/wince
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2009-07-02 00:16:20 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2009-07-02 05:19:16 (GMT)
commitcdfb2ed5096053314c0e23482609a1a491636ac1 (patch)
tree88020a25b0a5c9cb554c50c8593ea38e4f23b078 /tools/qtestlib/wince
parent6c9647f6673fd5738001c5bbe416b116442fbc41 (diff)
downloadQt-cdfb2ed5096053314c0e23482609a1a491636ac1.zip
Qt-cdfb2ed5096053314c0e23482609a1a491636ac1.tar.gz
Qt-cdfb2ed5096053314c0e23482609a1a491636ac1.tar.bz2
Improve cetest error reporting.
Reviewed-by: Michael Goddard
Diffstat (limited to 'tools/qtestlib/wince')
-rw-r--r--tools/qtestlib/wince/cetest/activesyncconnection.cpp6
-rw-r--r--tools/qtestlib/wince/cetest/remoteconnection.cpp32
-rw-r--r--tools/qtestlib/wince/cetest/remoteconnection.h2
3 files changed, 38 insertions, 2 deletions
diff --git a/tools/qtestlib/wince/cetest/activesyncconnection.cpp b/tools/qtestlib/wince/cetest/activesyncconnection.cpp
index e8ca8f2..76e4a41 100644
--- a/tools/qtestlib/wince/cetest/activesyncconnection.cpp
+++ b/tools/qtestlib/wince/cetest/activesyncconnection.cpp
@@ -113,6 +113,8 @@ bool ActiveSyncConnection::copyFileToDevice(const QString &localSource, const QS
CeCloseHandle(deviceHandle);
return true;
}
+ } else {
+ qWarning("Could not open %s: %s", qPrintable(localSource), qPrintable(file.errorString()));
}
return false;
}
@@ -120,7 +122,7 @@ bool ActiveSyncConnection::copyFileToDevice(const QString &localSource, const QS
deleteFile(deviceDest);
HANDLE deviceHandle = CeCreateFile(deviceDest.utf16(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (deviceHandle == INVALID_HANDLE_VALUE) {
- debugOutput(QString::fromLatin1(" Could not create target file"), 2);
+ qWarning("Could not create %s: %s", qPrintable(deviceDest), strwinerror(CeGetLastError()).constData());
return false;
}
@@ -144,7 +146,7 @@ bool ActiveSyncConnection::copyFileToDevice(const QString &localSource, const QS
if (toWrite == 0)
break;
if (!CeWriteFile(deviceHandle, data.data() , toWrite, &written, NULL)) {
- debugOutput(QString::fromLatin1(" Could not write File"), 2);
+ qWarning("Could not write to %s: %s", qPrintable(deviceDest), strwinerror(CeGetLastError()).constData());
return false;
}
currentPos += written;
diff --git a/tools/qtestlib/wince/cetest/remoteconnection.cpp b/tools/qtestlib/wince/cetest/remoteconnection.cpp
index 547b211..75788e2 100644
--- a/tools/qtestlib/wince/cetest/remoteconnection.cpp
+++ b/tools/qtestlib/wince/cetest/remoteconnection.cpp
@@ -41,6 +41,38 @@
#include "remoteconnection.h"
+QByteArray strwinerror(DWORD errorcode)
+{
+ QByteArray out(512, 0);
+
+ DWORD ok = FormatMessageA(
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ 0,
+ errorcode,
+ 0,
+ out.data(),
+ out.size(),
+ 0
+ );
+
+ if (!ok) {
+ qsnprintf(out.data(), out.size(),
+ "(error %d; additionally, error %d while looking up error string)",
+ (int)errorcode, (int)GetLastError());
+ }
+ else {
+ out.resize(qstrlen(out.constData()));
+ if (out.endsWith("\r\n"))
+ out.chop(2);
+
+ /* Append error number to error message for good measure */
+ out.append(" (");
+ out.append(QByteArray::number((int)errorcode));
+ out.append(")");
+ }
+ return out;
+}
+
AbstractRemoteConnection::AbstractRemoteConnection()
{
}
diff --git a/tools/qtestlib/wince/cetest/remoteconnection.h b/tools/qtestlib/wince/cetest/remoteconnection.h
index 9c3e63d..f517009 100644
--- a/tools/qtestlib/wince/cetest/remoteconnection.h
+++ b/tools/qtestlib/wince/cetest/remoteconnection.h
@@ -79,4 +79,6 @@ public:
virtual bool execute(QString program, QString arguments = QString(), int timeout = -1, int *returnValue = NULL) = 0;
};
+QByteArray strwinerror(DWORD);
+
#endif