summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Isdale <keith.isdale@nokia.com>2010-08-03 14:51:02 +1000
committerKeith Isdale <keith.isdale@nokia.com>2010-08-03 14:51:02 +1000
commit0575890e3282a496a68e9f428994a09ed0aadcb4 (patch)
tree94f78d3acd33b4fbb9dbaaf8fe5dac1ee7018902
parent40d2b818e3299e8af6b7a7349871411fe026734c (diff)
Support running tests on Maemo6
Document via -help the newly added options to qtuitestrunner Support specifying the ssh port to use, see qtuitestrunner -help Make use of defines in *config.h file instead of hard coded values
-rw-r--r--libqsystemtest/maemotestcontrol.cpp17
-rw-r--r--libqsystemtest/qsystemtest.cpp26
-rw-r--r--qtuitest_config.h8
3 files changed, 44 insertions, 7 deletions
diff --git a/libqsystemtest/maemotestcontrol.cpp b/libqsystemtest/maemotestcontrol.cpp
index 07e5079..074767d 100644
--- a/libqsystemtest/maemotestcontrol.cpp
+++ b/libqsystemtest/maemotestcontrol.cpp
@@ -3,6 +3,7 @@
#include <QTime>
#include <QTimer>
#include <QApplication>
+#include <QDebug>
namespace Core {
class SshConnection;
@@ -61,8 +62,19 @@ bool MaemoTestControl::startApplication( const QString &application, const QStri
{
Q_UNUSED(environment);
Q_UNUSED(arguments);
- QString cmd = "run-standalone.sh " + application;
- if (styleQtUITest) cmd += " -style qtuitest";
+ // for Maemo5 applications need to be run with run-standalone.sh
+ // however for Maemo6 we still need to set the variables
+ // in .profile eg DISPLAY=:0
+ QString cmd = QString("( "
+ "if [ -x /usr/bin/run-standalone.sh ]; then "
+ "%1 /usr/bin/run-standalone.sh %2 %3; "
+ "else "
+ ". $HOME/.profile; "
+ "%1 %2 %3; "
+ "fi )")
+ .arg(environment.join(" "))
+ .arg(application)
+ .arg(styleQtUITest?"-style qtuitest":"");
runBlockingCommand( CustomCommand, cmd, 10000);
reply = reply_txt;
@@ -174,6 +186,7 @@ void MaemoTestControl::handleProcessFinished(int exitStatus)
if (exitStatus != SshRemoteProcess::ExitedNormally
|| m_testProcess->exitCode() != 0) {
reply_ok = false;
+ reply_txt += m_deviceTestOutput;
reply_txt += tr("Remote process failed: %1\n")
.arg(m_testProcess->errorString());
} else if (control_mode == ConfigCheck) {
diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp
index 3535df2..506521b 100644
--- a/libqsystemtest/qsystemtest.cpp
+++ b/libqsystemtest/qsystemtest.cpp
@@ -252,8 +252,8 @@ QSystemTest::QSystemTest()
, m_expect_app_close(false)
{
m_env.clear();
- ssh_param.host = "127.0.0.1";
- ssh_param.port = 22;
+ ssh_param.host = DEFAULT_AUT_HOST;
+ ssh_param.port = DEFAULT_AUTSSH_PORT;
device_controller = 0;
QTestIDE::instance()->setSystemTest(this);
@@ -2235,7 +2235,10 @@ void QSystemTest::startApplication( const QString &application, const QStringLis
if (!connectToAut(timeout)) {
device_controller->killApplications();
- fail(QString("Could not connect to remote process '%1'.").arg(app));
+ 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();
}
@@ -2611,6 +2614,14 @@ void QSystemTest::processCommandLine( QStringList &args )
it.remove();
ssh_param.pwd = "";
ssh_param.authType = Core::SshConnectionParameters::AuthByKey;
+ } else if ( !arg.compare("-autsshport", Qt::CaseInsensitive) ) {
+ it.remove();
+ if (!it.hasNext()) qFatal("Expected a value after %s", qPrintable(arg));
+ bool ok;
+ ssh_param.port = it.next().toUShort( &ok );
+ if (!ok)
+ qFatal("%s is not a valid port specifier", qPrintable(it.value()));
+ it.remove();
} else if ( !arg.compare("-autport", Qt::CaseInsensitive) ) {
it.remove();
if (!it.hasNext()) qFatal("Expected a value after %s", qPrintable(arg));
@@ -2845,10 +2856,15 @@ void QSystemTest::printUsage() const
qWarning(
" System test options:\n"
" -authost <host> : Specify the IP address or host name of the machine on which the AUT is running.\n"
- " By default, the system test will connect to 127.0.0.1.\n"
+ " By default, the system test will connect to %s. \n"
" -autport <port> : Use QTUITEST_DEFAULT_OPTIONS environment variable to specify autport option and value.\n"
" Specify the port on which the AUT is listening for a system test connection.\n"
" Defaults to %d. \n"
+ " -autsshport <port>: Specify the port to use when ssh'ing to authost.\n"
+ " Defaults to %d. \n"
+ " -username : Specify the user name when ssh'ing to authost.\n"
+ " -pwd : Specify the password when ssh'ing to authost.\n"
+ " -private-key : Specify the ssh private key when ssh'ing to authost.\n"
" -keepaut : Leave the AUT running after the system test finishes.\n"
" By default, if the system test launches the AUT, it will kill the AUT when testing\n"
" completes.\n"
@@ -2870,7 +2886,7 @@ void QSystemTest::printUsage() const
" applications. For example, pass -env DISPLAY=:123 to run tested \n"
" applications on a different X server.\n"
" -targetID : Specify the target identifier for system under test, defaults to \'default\' or $QTUITEST_TARGETID if set\n"
- , DEFAULT_AUT_PORT
+ , DEFAULT_AUT_HOST, DEFAULT_AUTSSH_PORT, DEFAULT_AUT_PORT
);
}
//#endif
diff --git a/qtuitest_config.h b/qtuitest_config.h
index a2959c1..cc97a4d 100644
--- a/qtuitest_config.h
+++ b/qtuitest_config.h
@@ -5,4 +5,12 @@
#define DEFAULT_AUT_PORT 5656
#endif
+#ifndef DEFAULT_AUTSSH_PORT
+#define DEFAULT_AUTSSH_PORT 22
+#endif
+
+#ifndef DEFAULT_AUT_HOST
+#define DEFAULT_AUT_HOST "127.0.0.1"
+#endif
+
#endif