summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago.santos@nokia.com>2011-01-14 08:30:39 (GMT)
committeraxis <qt-info@nokia.com>2011-01-14 10:46:54 (GMT)
commitd4479f37edd5d38455399d31799de57aa08e62e3 (patch)
treeb7ce78303878ecf7afce20e7ba4ba1d172f1f125 /tools
parent606294044df3cf318bd6bb6f2e73389d84e3a032 (diff)
downloadQt-d4479f37edd5d38455399d31799de57aa08e62e3.zip
Qt-d4479f37edd5d38455399d31799de57aa08e62e3.tar.gz
Qt-d4479f37edd5d38455399d31799de57aa08e62e3.tar.bz2
No longer copy the executable file to phone by default
The user needs to explicitly use -u or --upload to do that. Task-number: QTBUG-16625 Merge-request: 2548 Signed-off-by: axis <qt-info@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/runonphone/main.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp
index 93b087b..618e401 100644
--- a/tools/runonphone/main.cpp
+++ b/tools/runonphone/main.cpp
@@ -62,6 +62,7 @@ void printUsage(QTextStream& outstream, QString exeName)
<< "-t, --timeout <milliseconds> terminate test if timeout occurs" << endl
<< "-v, --verbose show debugging output" << endl
<< "-q, --quiet hide progress messages" << endl
+ << "-u, --upload <local file> upload executable file to phone" << endl
<< "-d, --download <remote file> <local file> copy file from phone to PC after running test" << endl
<< "--nocrashlog Don't capture call stack if test crashes" << endl
<< "--crashlogpath <dir> Path to save crash logs (default=working dir)" << endl
@@ -84,6 +85,7 @@ int main(int argc, char *argv[])
QStringList args = QCoreApplication::arguments();
QTextStream outstream(stdout);
QTextStream errstream(stderr);
+ QString uploadLocalFile;
QString downloadRemoteFile;
QString downloadLocalFile;
int loglevel=1;
@@ -112,6 +114,18 @@ int main(int argc, char *argv[])
return 1;
}
}
+ else if (arg == "--upload" || arg == "-u") {
+ CHECK_PARAMETER_EXISTS
+ uploadLocalFile = it.next();
+ if (!QFileInfo(uploadLocalFile).exists()) {
+ errstream << "Executable file (" << uploadLocalFile << ") doesn't exist" << endl;
+ return 1;
+ }
+ if (!(QFileInfo(uploadLocalFile).suffix() == "exe")) {
+ errstream << "File (" << uploadLocalFile << ") must be an executable" << endl;
+ return 1;
+ }
+ }
else if (arg == "--download" || arg == "-d") {
CHECK_PARAMETER_EXISTS
downloadRemoteFile = it.next();
@@ -147,12 +161,18 @@ int main(int argc, char *argv[])
}
}
- if (exeFile.isEmpty() && sisFile.isEmpty() &&
+ if (exeFile.isEmpty() && sisFile.isEmpty() && uploadLocalFile.isEmpty() &&
(downloadLocalFile.isEmpty() || downloadRemoteFile.isEmpty())) {
printUsage(outstream, args[0]);
return 1;
}
+ if (!uploadLocalFile.isEmpty() && (!downloadLocalFile.isEmpty() || !downloadRemoteFile.isEmpty())) {
+ errstream << "Upload option can't be used together with download" << endl;
+ printUsage(outstream, args[0]);
+ return 1;
+ }
+
if (serialPortName.isEmpty()) {
if (loglevel > 0)
outstream << "Detecting serial ports" << endl;
@@ -182,19 +202,20 @@ int main(int argc, char *argv[])
QScopedPointer<trk::Launcher> launcher;
launcher.reset(new trk::Launcher(trk::Launcher::ActionPingOnly));
- QFileInfo info(exeFile);
+ QFileInfo exeInfo(exeFile);
+ QFileInfo uploadInfo(uploadLocalFile);
if (!sisFile.isEmpty()) {
launcher->addStartupActions(trk::Launcher::ActionCopyInstall);
launcher->setCopyFileName(sisFile, "c:\\data\\testtemp.sis");
launcher->setInstallFileName("c:\\data\\testtemp.sis");
}
- else if (info.exists()) {
+ else if (!uploadLocalFile.isEmpty() && uploadInfo.exists()) {
launcher->addStartupActions(trk::Launcher::ActionCopy);
- launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + info.fileName());
+ launcher->setCopyFileName(uploadLocalFile, QString("c:\\sys\\bin\\") + uploadInfo.fileName());
}
if (!exeFile.isEmpty()) {
launcher->addStartupActions(trk::Launcher::ActionRun);
- launcher->setFileName(QString("c:\\sys\\bin\\") + info.fileName());
+ launcher->setFileName(QString("c:\\sys\\bin\\") + exeInfo.fileName());
launcher->setCommandLineArgs(cmdLine);
}
if (!downloadRemoteFile.isEmpty() && !downloadLocalFile.isEmpty()) {