diff options
author | Ed Baak <ed.baak@nokia.com> | 2010-08-04 16:12:00 +1000 |
---|---|---|
committer | Ed Baak <ed.baak@nokia.com> | 2010-08-04 16:12:00 +1000 |
commit | b2ca522879615e0cbb97cf94876a3d3fcf3caccf (patch) | |
tree | a9090b5145c20187302f826777c89868df09cdd0 | |
parent | d35eeff3c3c26e5fc94a0e49a57e5706175e8770 (diff) |
Use run environment instead of build environment + cleanup relevant code and error messages
-rw-r--r-- | interpreter/qscriptsystemtest.cpp | 3 | ||||
-rw-r--r-- | libqsystemtest/maemotestcontrol.cpp | 19 | ||||
-rw-r--r-- | libqsystemtest/qsystemtest.cpp | 23 | ||||
-rw-r--r-- | libqsystemtest/qsystemtest.h | 2 |
4 files changed, 33 insertions, 14 deletions
diff --git a/interpreter/qscriptsystemtest.cpp b/interpreter/qscriptsystemtest.cpp index deb4a52..5c55bc3 100644 --- a/interpreter/qscriptsystemtest.cpp +++ b/interpreter/qscriptsystemtest.cpp @@ -669,7 +669,8 @@ int QScriptSystemTest::exec( int argc, char* argv[], char* filename ) int QScriptSystemTest::runTest(const QString &fname, const QStringList ¶meters, const QStringList &environment) { - m_env = environment; + m_run_environment = environment; + filename = fname; QFile file(filename); diff --git a/libqsystemtest/maemotestcontrol.cpp b/libqsystemtest/maemotestcontrol.cpp index 074767d..982abf2 100644 --- a/libqsystemtest/maemotestcontrol.cpp +++ b/libqsystemtest/maemotestcontrol.cpp @@ -92,9 +92,11 @@ bool MaemoTestControl::killApplication( const QString &application, QString &rep void MaemoTestControl::waitForCommandToFinish(int timeout) { + Q_UNUSED(timeout); + QTime t; t.start(); - while (t.elapsed() < 10000 && control_mode != Idle) { + while (t.elapsed() < 12000 && control_mode != Idle) { qApp->processEvents(); } if (control_mode != Idle) { @@ -161,7 +163,7 @@ void MaemoTestControl::handleConnectionError() if (!m_connection) { reply_txt += "Invalid connection\n"; } else { - reply_txt += tr("Could not connect to host: %1:%2 %3 %4\n%5\n") + reply_txt += tr("Could not connect to host: '%1:%2', user: '%3', pwd: '%4', errormessage: '%5'") .arg(ssh_param.host) .arg(ssh_param.port) .arg(ssh_param.uname) @@ -187,7 +189,18 @@ void MaemoTestControl::handleProcessFinished(int exitStatus) || m_testProcess->exitCode() != 0) { reply_ok = false; reply_txt += m_deviceTestOutput; - reply_txt += tr("Remote process failed: %1\n") + QString s; + if (exitStatus == SshRemoteProcess::FailedToStart) s = "Failed-To-Start"; + else if (exitStatus == SshRemoteProcess::KilledBySignal) s = "was Killed-By-Signal"; + else s = "Exited-Normally"; + + reply_txt += tr("Remote process %1, exit-code: %2, '%3:%4', user: '%5', pwd: '%6', errormessage: %7") + .arg(s) + .arg(m_testProcess->exitCode()) + .arg(ssh_param.host) + .arg(ssh_param.port) + .arg(ssh_param.uname) + .arg(ssh_param.pwd) .arg(m_testProcess->errorString()); } else if (control_mode == ConfigCheck) { const QString &output = parseOutput(); diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp index 7b1df0f..22948e1 100644 --- a/libqsystemtest/qsystemtest.cpp +++ b/libqsystemtest/qsystemtest.cpp @@ -250,7 +250,7 @@ QSystemTest::QSystemTest() , m_recording_events(false) , m_expect_app_close(false) { - m_env.clear(); + m_run_environment.clear(); ssh_param.host = DEFAULT_AUT_HOST; ssh_param.port = DEFAULT_AUTSSH_PORT; device_controller = 0; @@ -2232,9 +2232,17 @@ void QSystemTest::startApplication( const QString &application, const QStringLis QString reply; if (device_controller) { - device_controller->startApplication(app, args, true, m_env, reply); + bool ok = device_controller->startApplication(app, args, true, m_run_environment, reply); #ifdef QTCREATOR_QTEST - testOutputPane()->append(reply); + if (!ok) { + if (reply.isEmpty()) + fail(QString("Could not launch application '%1'").arg(app)); + else { + fail(QString("Could not launch application '%1'. Reason: '%2'").arg(app).arg(reply)); + } + return; + } + if (!reply.isEmpty()) testOutputPane()->append(reply); #endif } @@ -2243,10 +2251,6 @@ void QSystemTest::startApplication( const QString &application, const QStringLis if (!connectToAut(timeout)) { device_controller->killApplications(); - if (reply.isEmpty()) - fail(QString("Could not connect to remote process '%1'").arg(app).arg(reply)); - else - fail(QString("Could not connect to remote process '%1'\nProcess output is '%2'").arg(app).arg(reply)); } configTarget(); } @@ -2658,7 +2662,7 @@ void QSystemTest::processCommandLine( QStringList &args ) } else if ( !arg.compare("-env", Qt::CaseInsensitive) ) { it.remove(); if (!it.hasNext()) throwFatal(QString("Expected a value after %1").arg(arg)); - m_env << it.next(); + m_run_environment << it.next(); it.remove(); } else if ( !arg.compare("-targetid", Qt::CaseInsensitive) ) { it.remove(); @@ -2894,7 +2898,8 @@ void QSystemTest::printUsage() const " verification steps. The default is to not use an IDE.\n" " -env VAR=VALUE : Specify additional environment variables to be applied to tested \n" " applications. For example, pass -env DISPLAY=:123 to run tested \n" - " applications on a different X server.\n" + " applications on a different X server. Note that the environment is the 'run' \n" + " environment\n" " -targetID : Specify the target identifier for system under test, defaults to \'default\' or $QTUITEST_TARGETID if set\n" , DEFAULT_AUT_HOST, DEFAULT_AUTSSH_PORT, DEFAULT_AUT_PORT ); diff --git a/libqsystemtest/qsystemtest.h b/libqsystemtest/qsystemtest.h index c6fc7ef..d553cd1 100644 --- a/libqsystemtest/qsystemtest.h +++ b/libqsystemtest/qsystemtest.h @@ -474,7 +474,7 @@ signals: void appBecameIdle(QString const &appName); protected: - QStringList m_env; + QStringList m_run_environment; private: friend class QSystemTestMaster; |