tools/qtestlib/wince/cetest/main.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   127         " -project-delete   : Delete the project file(s) after execution\n"
   127         " -project-delete   : Delete the project file(s) after execution\n"
   128         " -delete           : Delete everything deployed after execution\n"
   128         " -delete           : Delete everything deployed after execution\n"
   129         " -conf             : Specify location of qt.conf file\n"
   129         " -conf             : Specify location of qt.conf file\n"
   130         " -f <file>         : Specify project file\n"
   130         " -f <file>         : Specify project file\n"
   131         " -cache <file>     : Specify .qmake.cache file to use\n"
   131         " -cache <file>     : Specify .qmake.cache file to use\n"
       
   132         " -d                : Increase qmake debugging \n"
   132         " -timeout <value>  : Specify a timeout value after which the test will be terminated\n"
   133         " -timeout <value>  : Specify a timeout value after which the test will be terminated\n"
   133         "                     -1 specifies waiting forever (default)\n"
   134         "                     -1 specifies waiting forever (default)\n"
   134         "                      0 specifies starting the process detached\n"
   135         "                      0 specifies starting the process detached\n"
   135         "                     >0 wait <value> seconds\n"
   136         "                     >0 wait <value> seconds\n"
   136         "\n";
   137         "\n";
   214             if (++i == arguments.size()) {
   215             if (++i == arguments.size()) {
   215                 cout << "Error: No cache file specified!" << endl;
   216                 cout << "Error: No cache file specified!" << endl;
   216                 return -1;
   217                 return -1;
   217             }
   218             }
   218             cacheFile = arguments.at(i);
   219             cacheFile = arguments.at(i);
       
   220         } else if (arguments.at(i).toLower() == QLatin1String("-d")) {
       
   221             Option::debug_level++;
   219         } else if (arguments.at(i).toLower() == QLatin1String("-timeout")) {
   222         } else if (arguments.at(i).toLower() == QLatin1String("-timeout")) {
   220             if (++i == arguments.size()) {
   223             if (++i == arguments.size()) {
   221                 cout << "Error: No timeout value specified!" << endl;
   224                 cout << "Error: No timeout value specified!" << endl;
   222                 return -1;
   225                 return -1;
   223             }
   226             }
   233         if (!QFileInfo(proFile).exists()) {
   236         if (!QFileInfo(proFile).exists()) {
   234             cout << "Error: Could not find project file in current directory." << endl;
   237             cout << "Error: Could not find project file in current directory." << endl;
   235             return -1;
   238             return -1;
   236         }
   239         }
   237         debugOutput(QString::fromLatin1("Using Project File:").append(proFile),1);
   240         debugOutput(QString::fromLatin1("Using Project File:").append(proFile),1);
       
   241     }else {
       
   242         if (!QFileInfo(proFile).exists()) {
       
   243             cout << "Error: Project file does not exist " << qPrintable(proFile) << endl;
       
   244             return -1;
       
   245         }
   238     }
   246     }
   239 
   247 
   240     Option::before_user_vars.append("CONFIG+=build_pass");
   248     Option::before_user_vars.append("CONFIG+=build_pass");
   241 
   249 
   242     // read target and deployment rules
   250     // read target and deployment rules passing the .pro to use instead of
   243     int qmakeArgc = 1;
   251     //      relying on qmake guessing the .pro to use
   244     char* qmakeArgv[] = { "qmake.exe" };
   252     int qmakeArgc = 2;
       
   253     QByteArray ba(QFile::encodeName(proFile));
       
   254     char* proFileEncodedName =  ba.data();
       
   255     char* qmakeArgv[2] = { "qmake.exe", proFileEncodedName };
       
   256 
   245     Option::qmake_mode = Option::QMAKE_GENERATE_NOTHING;
   257     Option::qmake_mode = Option::QMAKE_GENERATE_NOTHING;
   246     Option::output_dir = qmake_getpwd();
   258     Option::output_dir = qmake_getpwd();
   247     if (!cacheFile.isEmpty())
   259     if (!cacheFile.isEmpty())
   248         Option::mkfile::cachefile = cacheFile;
   260         Option::mkfile::cachefile = cacheFile;
   249     int ret = Option::init(qmakeArgc, qmakeArgv);
   261     int ret = Option::init(qmakeArgc, qmakeArgv);
   264     // If .pro specifies to be one mode only, we need to accept this
   276     // If .pro specifies to be one mode only, we need to accept this
   265     if (project.isActiveConfig("debug"))
   277     if (project.isActiveConfig("debug"))
   266         TestConfiguration::testDebug = true;
   278         TestConfiguration::testDebug = true;
   267     else
   279     else
   268         TestConfiguration::testDebug = false;
   280         TestConfiguration::testDebug = false;
       
   281 
       
   282     // determine what is the real mkspec to use if the default mkspec is being used
       
   283     if (Option::mkfile::qmakespec.endsWith("/default"))
       
   284         project.values("QMAKESPEC") = project.values("QMAKESPEC_ORIGINAL");
       
   285     else
       
   286         project.values("QMAKESPEC") = QStringList() << Option::mkfile::qmakespec;
       
   287 
       
   288    // ensure that QMAKESPEC is non-empty .. to meet requirements of QList::at()
       
   289    if (project.values("QMAKESPEC").isEmpty()){
       
   290        cout << "Error: QMAKESPEC not set after parsing " << qPrintable(proFile) << endl;
       
   291        return -1;
       
   292    }
       
   293 
       
   294    // ensure that QT_CE_C_RUNTIME is non-empty .. to meet requirements of QList::at()
       
   295    if (project.values("QT_CE_C_RUNTIME").isEmpty()){
       
   296        cout << "Error: QT_CE_C_RUNTIME not defined in mkspec/qconfig.pri " << qPrintable(project.values("QMAKESPEC").join(" "));
       
   297        return -1;
       
   298    }
   269 
   299 
   270     QString destDir = project.values("DESTDIR").join(" ");
   300     QString destDir = project.values("DESTDIR").join(" ");
   271     if (!destDir.isEmpty()) {
   301     if (!destDir.isEmpty()) {
   272         if (QDir::isRelativePath(destDir)) {
   302         if (QDir::isRelativePath(destDir)) {
   273             QFileInfo fi(proFile);
   303             QFileInfo fi(proFile);