Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
main.cpp File Reference

(dc88c6ab0bd4b135adeea134eb94857a68be36d0)

#include <QtCore/QCoreApplication>
#include <QtCore/QDeadlineTimer>
#include <QtCore/qdebug.h>
#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 <QtCore/QFileInfo>
#include <QtCore/QSysInfo>
#include <atomic>
#include <csignal>
#include <functional>
#include <optional>
#include <unistd.h>
Include dependency graph for main.cpp:

Go to the source code of this file.

Classes

struct  Options
struct  TestInfo
struct  TestRunnerSystemSemaphore

Macros

#define EXIT_ERROR   -1

Functions

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 execBundletoolCommand (const QStringList &args, QByteArray *output=nullptr, bool verbose=true)
static void setPackagePath (const QString &path)
static bool execCommand (const QString &command, QByteArray *output=nullptr, bool verbose=true)
static bool parseOptions ()
static void printHelp ()
static bool processAndroidManifest ()
static void setOutputFile (QString file, QString format)
static bool parseTestArgs ()
static int getPid (const QString &package)
static QString runCommandAsUserArgs (const QString &cmd)
static bool isRunning ()
static void waitForStarted ()
static void waitForLoggingStarted ()
static bool setupStdoutLogger ()
static bool stopStdoutLogger ()
static void waitForFinished ()
static void obtainSdkVersion ()
static QString userId ()
static QStringList runningDevices ()
static bool pullResults ()
static QString getAbiLibsPath ()
void printLogcatCrash (const QByteArray &logcat)
void analyseLogcat (const QString &timeStamp, int *exitCode)
static QString getCurrentTimeString ()
static int testExitCode ()
static bool uninstallTestPackage ()
void sigHandler (int signal)
int main (int argc, char *argv[])
 [ctor_close]

Variables

static Options g_options
static TestInfo g_testInfo
TestRunnerSystemSemaphore testRunnerLock

Macro Definition Documentation

◆ EXIT_ERROR

#define EXIT_ERROR   -1

Definition at line 31 of file main.cpp.

Function Documentation

◆ analyseLogcat()

void analyseLogcat ( const QString & timeStamp,
int * exitCode )

Definition at line 705 of file main.cpp.

References g_options, and g_testInfo.

◆ execAdbCommand()

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

Definition at line 107 of file main.cpp.

◆ execBundletoolCommand()

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

Definition at line 119 of file main.cpp.

◆ execCommand() [1/2]

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

Definition at line 137 of file main.cpp.

◆ execCommand() [2/2]

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

Definition at line 74 of file main.cpp.

◆ getAbiLibsPath()

QString getAbiLibsPath ( )
static

Definition at line 641 of file main.cpp.

◆ getCurrentTimeString()

QString getCurrentTimeString ( )
static

Definition at line 787 of file main.cpp.

◆ getPid()

int getPid ( const QString & package)
static

Definition at line 422 of file main.cpp.

◆ isRunning()

bool isRunning ( )
static

Definition at line 450 of file main.cpp.

References g_options, g_testInfo, and TestInfo::pid.

Referenced by waitForFinished().

Here is the caller graph for this function:

◆ main()

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

[ctor_close]

[0] [1]

[main_cpp]

[main.cpp body]

The main function for the string list model example.

Create a default directory model and, using the index-based interface to the model and some QLabel widgets, populate the window's layout with the names of objects in the directory.

[0] //! [1]

[1]

[using a custom style]

[4]

[QApplication subclass]

[2]

[21]

[getter functions]

[0]

[3]

[main]

This creates and populates a model with values from a string list then displays the contents of the model using a QListView widget. [0]

[ctor_close]

[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]

[1]

[1]

[2]

[2]

[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]

[1]

[2]

[2]

[3]

[0]

[1]

[1]

Definition at line 859 of file main.cpp.

References TestRunnerSystemSemaphore::acquire(), g_options, g_testInfo, obtainSdkVersion(), parseOptions(), parseTestArgs(), printHelp(), processAndroidManifest(), pullResults(), TestRunnerSystemSemaphore::release(), setupStdoutLogger(), Options::showLogcatOutput, sigHandler(), stopStdoutLogger(), testExitCode(), testRunnerLock, uninstallTestPackage(), waitForFinished(), waitForLoggingStarted(), and waitForStarted().

Here is the call graph for this function:

◆ obtainSdkVersion()

void obtainSdkVersion ( )
static

Definition at line 553 of file main.cpp.

References g_testInfo, and TestInfo::sdkVersion.

Referenced by main().

Here is the caller graph for this function:

◆ parseOptions()

bool parseOptions ( )
static

Definition at line 145 of file main.cpp.

References g_options, Options::helpRequested, Options::showLogcatOutput, Options::skipAddInstallRoot, Options::timeoutSecs, and Options::verbose.

Referenced by main().

Here is the caller graph for this function:

◆ parseTestArgs()

bool parseTestArgs ( )
static

Definition at line 349 of file main.cpp.

References g_options.

Referenced by main().

Here is the caller graph for this function:

◆ printHelp()

void printHelp ( )
static

Definition at line 253 of file main.cpp.

Referenced by main().

Here is the caller graph for this function:

◆ printLogcatCrash()

void printLogcatCrash ( const QByteArray & logcat)

Definition at line 669 of file main.cpp.

References g_options.

◆ processAndroidManifest()

bool processAndroidManifest ( )
static

Definition at line 307 of file main.cpp.

References g_options.

Referenced by main().

Here is the caller graph for this function:

◆ pullResults()

bool pullResults ( )
static

Definition at line 600 of file main.cpp.

References g_options, and Options::resultsPullRetries.

Referenced by main().

Here is the caller graph for this function:

◆ runCommandAsUserArgs()

QString runCommandAsUserArgs ( const QString & cmd)
static

Definition at line 445 of file main.cpp.

◆ runningDevices()

QStringList runningDevices ( )
static

Definition at line 586 of file main.cpp.

◆ setOutputFile()

void setOutputFile ( QString file,
QString format )
static

Definition at line 331 of file main.cpp.

References g_options.

◆ setPackagePath()

void setPackagePath ( const QString & path)
static

Definition at line 127 of file main.cpp.

References g_options, and Options::helpRequested.

◆ setupStdoutLogger()

bool setupStdoutLogger ( )
static

Definition at line 493 of file main.cpp.

References g_options.

Referenced by main().

Here is the caller graph for this function:

◆ sigHandler()

void sigHandler ( int signal)

Definition at line 846 of file main.cpp.

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

Referenced by main().

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

◆ stopStdoutLogger()

bool stopStdoutLogger ( )
static

Definition at line 512 of file main.cpp.

References g_options.

Referenced by main().

Here is the caller graph for this function:

◆ testExitCode()

int testExitCode ( )
static

Definition at line 802 of file main.cpp.

Referenced by main().

Here is the caller graph for this function:

◆ uninstallTestPackage()

bool uninstallTestPackage ( )
static

Definition at line 817 of file main.cpp.

Referenced by main().

Here is the caller graph for this function:

◆ userId()

QString userId ( )
static

Definition at line 568 of file main.cpp.

References g_testInfo, and TestInfo::sdkVersion.

◆ waitForFinished()

void waitForFinished ( )
static

Definition at line 539 of file main.cpp.

Referenced by main().

Here is the caller graph for this function:

◆ waitForLoggingStarted()

void waitForLoggingStarted ( )
static

Definition at line 480 of file main.cpp.

References g_testInfo.

Referenced by main().

Here is the caller graph for this function:

◆ waitForStarted()

void waitForStarted ( )
static

Definition at line 468 of file main.cpp.

References g_testInfo, and TestInfo::pid.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

◆ g_options

◆ g_testInfo

◆ testRunnerLock

TestRunnerSystemSemaphore testRunnerLock

Definition at line 844 of file main.cpp.

Referenced by main(), and sigHandler().