Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
main.cpp File Reference

(a1b1759abfce0972a75072893148fc8ed7fa6bd2)

#include <QtCore/QCoreApplication>
#include <QtCore/QDeadlineTimer>
#include <QtCore/QDir>
#include <QtCore/QHash>
#include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment>
#include <QtCore/QRegularExpression>
#include <QtCore/QSystemSemaphore>
#include <QtCore/QThread>
#include <QtCore/QXmlStreamReader>
#include <atomic>
#include <csignal>
#include <functional>
#include <unistd.h>
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Classes

struct  Options
 
struct  TestInfo
 
struct  TestRunnerSystemSemaphore
 

Functions

static bool checkJunit (const QByteArray &data)
 
static bool checkTxt (const QByteArray &data)
 
static bool checkCsv (const QByteArray &data)
 
static bool checkXml (const QByteArray &data)
 
static bool checkLightxml (const QByteArray &data)
 
static bool checkTeamcity (const QByteArray &data)
 
static bool checkTap (const QByteArray &data)
 
static bool execCommand (const QString &program, const QStringList &args, QByteArray *output=nullptr, bool verbose=false)
 
static bool execAdbCommand (const QStringList &args, QByteArray *output=nullptr, bool verbose=true)
 
static bool execCommand (const QString &command, QByteArray *output=nullptr, bool verbose=true)
 
static bool parseOptions ()
 
static void printHelp ()
 
static QString packageNameFromAndroidManifest (const QString &androidManifestPath)
 
static QString activityFromAndroidManifest (const QString &androidManifestPath)
 
static void setOutputFile (QString file, QString format)
 
static bool parseTestArgs ()
 
static bool obtainPid ()
 
static bool isRunning ()
 
static void waitForStartedAndFinished ()
 
static void obtainSdkVersion ()
 
static bool pullFiles ()
 
void printLogcat (const QString &formattedTime)
 
static QString getDeviceABI ()
 
void printLogcatCrashBuffer (const QString &formattedTime)
 
static QString getCurrentTimeString ()
 
static bool uninstallTestPackage ()
 
void sigHandler (int signal)
 
int main (int argc, char *argv[])
 [2]
 

Variables

static Options g_options
 
static TestInfo g_testInfo
 
TestRunnerSystemSemaphore testRunnerLock
 

Function Documentation

◆ activityFromAndroidManifest()

static QString activityFromAndroidManifest ( const QString & androidManifestPath)
static

Definition at line 331 of file main.cpp.

References QIODeviceBase::ReadOnly.

Referenced by main().

+ Here is the caller graph for this function:

◆ checkCsv()

static bool checkCsv ( const QByteArray & data)
static

Definition at line 59 of file main.cpp.

References Q_UNUSED.

◆ checkJunit()

static bool checkJunit ( const QByteArray & data)
static

Definition at line 27 of file main.cpp.

◆ checkLightxml()

static bool checkLightxml ( const QByteArray & data)
static

Definition at line 83 of file main.cpp.

References QByteArray::append(), checkXml(), and QByteArray::prepend().

+ Here is the call graph for this function:

◆ checkTap()

static bool checkTap ( const QByteArray & data)
static

Definition at line 101 of file main.cpp.

◆ checkTeamcity()

static bool checkTeamcity ( const QByteArray & data)
static

Definition at line 92 of file main.cpp.

◆ checkTxt()

static bool checkTxt ( const QByteArray & data)
static

Definition at line 49 of file main.cpp.

◆ checkXml()

static bool checkXml ( const QByteArray & data)
static

Definition at line 67 of file main.cpp.

Referenced by checkLightxml().

+ Here is the caller graph for this function:

◆ execAdbCommand()

static bool execAdbCommand ( const QStringList & args,
QByteArray * output = nullptr,
bool verbose = true )
static

Definition at line 186 of file main.cpp.

References args, execCommand(), g_options, and output.

Referenced by getCurrentTimeString(), getDeviceABI(), isRunning(), main(), obtainPid(), obtainSdkVersion(), printLogcat(), pullFiles(), and uninstallTestPackage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ execCommand() [1/2]

static bool execCommand ( const QString & command,
QByteArray * output = nullptr,
bool verbose = true )
static

Definition at line 192 of file main.cpp.

References args, execCommand(), QList< T >::first(), output, and QList< T >::removeOne().

+ Here is the call graph for this function:

◆ execCommand() [2/2]

static bool execCommand ( const QString & program,
const QStringList & args,
QByteArray * output = nullptr,
bool verbose = false )
static

Definition at line 153 of file main.cpp.

References args, g_options, output, qCritical, qDebug, and qPrintable.

Referenced by execAdbCommand(), execCommand(), and main().

+ Here is the caller graph for this function:

◆ getCurrentTimeString()

static QString getCurrentTimeString ( )
static

Definition at line 648 of file main.cpp.

References execAdbCommand(), QString::fromUtf8(), g_testInfo, output, and qWarning.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDeviceABI()

static QString getDeviceABI ( )
static

Definition at line 569 of file main.cpp.

References execAdbCommand(), QString::fromUtf8(), and qWarning.

Referenced by printLogcatCrashBuffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRunning()

static bool isRunning ( )
static

Definition at line 452 of file main.cpp.

References execAdbCommand(), g_options, and output.

Referenced by QLibProxyWrapper::~QLibProxyWrapper(), QQmlProfilerServiceImpl::engineAboutToBeRemoved(), QCocoaEventDispatcherPrivate::ensureNSAppInitialized(), QLibProxyWrapper::getProxies(), QIOSJumpingEventDispatcher::handleRunLoopExit(), QCocoaEventDispatcher::processEvents(), and waitForStartedAndFinished().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main()

int main ( int argc,
char * argv[] )

[2]

[3]

[2]

[printing a custom type]

[printing a custom type] [storing a custom value]

[storing a custom value]

[retrieving a custom value]

[retrieving a custom value]

[0]

[0] [1]

[1]

[0]

[0]

[1]

[1] [2]

[2]

[0]

[0]

[2]

[2]

[22]

[22]

[3]

[3]

[4]

[4]

[10]

[10]

[qcinfo_stream]

[qcinfo_stream]

[11]

[11]

[12]

[12]

[13]

[13]

[qcinfo_printf]

[qcinfo_printf]

[14]

[14]

[15]

[15]

[16]

[16]

[17]

[17]

[0]

[0]

[1]

[1]

[2]

[2]

[Window class using revision]

[Window class using revision]

[0]

[0]

[0]

[0]

[1]

[1]

[2]

[2]

[0]

[0]

[write output] [start stream]

[start stream]

[write element]

[write element]

[finish stream]

[finish stream] [write output]

[1]

[1]

[0]

[0]

[0]

[0] //! [1]

[1]

[0]

[0] //! [1]

[1]

[0]

[0] //! [1]

[1] //! [2]

[2]

[0]

[0]

[1]

[1]

[Adding a resource]

[Adding a resource]

[Inserting an image with a cursor]

[Inserting an image with a cursor]

[Inserting an image using HTML]

[Inserting an image using HTML]

[0]

[0] //! [1]

[1]

Definition at line 705 of file main.cpp.

References TestRunnerSystemSemaphore::acquire(), activityFromAndroidManifest(), execAdbCommand(), execCommand(), QFile::exists(), g_options, g_testInfo, getCurrentTimeString(), obtainSdkVersion(), packageNameFromAndroidManifest(), parseOptions(), parseTestArgs(), printHelp(), printLogcat(), printLogcatCrashBuffer(), pullFiles(), qCritical, qPrintable, TestRunnerSystemSemaphore::release(), sigHandler(), testRunnerLock, QDir::toNativeSeparators(), uninstallTestPackage(), and waitForStartedAndFinished().

+ Here is the call graph for this function:

◆ obtainPid()

static bool obtainPid ( )
static

Definition at line 428 of file main.cpp.

References execAdbCommand(), g_options, g_testInfo, ok, and output.

Referenced by waitForStartedAndFinished().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ obtainSdkVersion()

static void obtainSdkVersion ( )
static

Definition at line 483 of file main.cpp.

References execAdbCommand(), g_testInfo, ok, output, and qCritical.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ packageNameFromAndroidManifest()

static QString packageNameFromAndroidManifest ( const QString & androidManifestPath)
static

Definition at line 317 of file main.cpp.

References QIODeviceBase::ReadOnly.

Referenced by main().

+ Here is the caller graph for this function:

◆ parseOptions()

static bool parseOptions ( )
static

Definition at line 200 of file main.cpp.

References argument, QCoreApplication::arguments(), arguments, QList< T >::at(), Qt::CaseInsensitive, QFile::exists(), g_options, i, QString::isEmpty(), qEnvironmentVariable(), QDir::separator(), QList< T >::size(), and QVariant::toInt().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseTestArgs()

static bool parseTestArgs ( )
static

Definition at line 355 of file main.cpp.

References QString::arg(), arg, file, QString::fromUtf8(), g_options, i, match(), QString::replace(), setOutputFile(), QProcessEnvironment::systemEnvironment(), QString::trimmed(), and var.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printHelp()

static void printHelp ( )
static

Definition at line 276 of file main.cpp.

References QCoreApplication::arguments(), at, qPrintable, and qWarning.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printLogcat()

void printLogcat ( const QString & formattedTime)

Definition at line 545 of file main.cpp.

References execAdbCommand(), g_testInfo, QString::number(), qCritical, qDebug, and qWarning.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printLogcatCrashBuffer()

void printLogcatCrashBuffer ( const QString & formattedTime)

Definition at line 581 of file main.cpp.

References QDir::Dirs, QDir::entryList(), g_options, getDeviceABI(), QDir::NoDotAndDotDot, qCritical, qDebug, and qWarning.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullFiles()

static bool pullFiles ( )
static

Definition at line 498 of file main.cpp.

References QString::arg(), execAdbCommand(), QString::fromUtf8(), g_options, g_testInfo, it, out, output, qCritical, qDebug, ret, QByteArray::simplified(), and QIODeviceBase::WriteOnly.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOutputFile()

static void setOutputFile ( QString file,
QString format )
static

Definition at line 345 of file main.cpp.

References file, and g_options.

Referenced by parseTestArgs().

+ Here is the caller graph for this function:

◆ sigHandler()

void sigHandler ( int signal)

Definition at line 692 of file main.cpp.

References g_testInfo, TestRunnerSystemSemaphore::release(), signal, and testRunnerLock.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uninstallTestPackage()

static bool uninstallTestPackage ( )
static

Definition at line 663 of file main.cpp.

References execAdbCommand(), and g_options.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ waitForStartedAndFinished()

static void waitForStartedAndFinished ( )
static

Definition at line 461 of file main.cpp.

References g_options, g_testInfo, isRunning(), QThread::msleep(), obtainPid(), and qWarning.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ g_options

◆ g_testInfo

◆ testRunnerLock

TestRunnerSystemSemaphore testRunnerLock

Definition at line 690 of file main.cpp.

Referenced by main(), and sigHandler().