diff options
Diffstat (limited to 'tools/runonphone/main.cpp')
-rw-r--r-- | tools/runonphone/main.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp index 868a2a8..af349eb 100644 --- a/tools/runonphone/main.cpp +++ b/tools/runonphone/main.cpp @@ -65,7 +65,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 + << "-u, --upload <local file> <remote file> upload 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 @@ -91,6 +91,7 @@ int main(int argc, char *argv[]) QTextStream outstream(stdout); QTextStream errstream(stderr); QString uploadLocalFile; + QString uploadRemoteFile; QString downloadRemoteFile; QString downloadLocalFile; int loglevel=1; @@ -127,10 +128,8 @@ int main(int argc, char *argv[]) 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; - } + CHECK_PARAMETER_EXISTS + uploadRemoteFile = it.next(); } else if (arg == "--download" || arg == "-d") { CHECK_PARAMETER_EXISTS @@ -174,7 +173,8 @@ int main(int argc, char *argv[]) } } - if (exeFile.isEmpty() && sisFile.isEmpty() && uploadLocalFile.isEmpty() && + if (exeFile.isEmpty() && sisFile.isEmpty() && + (uploadLocalFile.isEmpty() || uploadRemoteFile.isEmpty()) && (downloadLocalFile.isEmpty() || downloadRemoteFile.isEmpty())) { printUsage(outstream, args[0]); return 1; @@ -230,8 +230,7 @@ int main(int argc, char *argv[]) } else if (!uploadLocalFile.isEmpty() && uploadInfo.exists()) { codaHandler.setActionType(ActionCopy); - QString dstName = QString("c:\\sys\\bin\\") + uploadInfo.fileName(); - codaHandler.setCopyFileName(uploadLocalFile, dstName); + codaHandler.setCopyFileName(uploadLocalFile, uploadRemoteFile); } if (!exeFile.isEmpty()) { codaHandler.setActionType(ActionRun); @@ -254,19 +253,20 @@ int main(int argc, char *argv[]) } else { launcher.reset(new trk::Launcher(trk::Launcher::ActionPingOnly)); + QStringList srcNames, dstNames; if (!sisFile.isEmpty()) { launcher->addStartupActions(trk::Launcher::ActionCopyInstall); - QStringList srcName(sisFile); - QStringList dstName("c:\\data\\testtemp.sis"); - launcher->setCopyFileNames(srcName, dstName); - launcher->setInstallFileNames(dstName); + srcNames.append(sisFile); + QLatin1String dstName("c:\\data\\testtemp.sis"); + dstNames.append(dstName); + launcher->setInstallFileNames(QStringList(dstName)); } - else if (!uploadLocalFile.isEmpty() && uploadInfo.exists()) { + if (!uploadLocalFile.isEmpty() && uploadInfo.exists()) { launcher->addStartupActions(trk::Launcher::ActionCopy); - QStringList srcName(uploadLocalFile); - QStringList dstName(QString("c:\\sys\\bin\\") + uploadInfo.fileName()); - launcher->setCopyFileNames(srcName, dstName); + srcNames.append(uploadLocalFile); + dstNames.append(uploadRemoteFile); } + launcher->setCopyFileNames(srcNames, dstNames); if (!exeFile.isEmpty()) { launcher->addStartupActions(trk::Launcher::ActionRun); launcher->setFileName(QString("c:\\sys\\bin\\") + info.fileName()); |