diff options
author | Andrew Christian <andrew.christian@nokia.com> | 2012-03-01 16:25:51 +0100 |
---|---|---|
committer | Chris Craig <ext-chris.craig@nokia.com> | 2012-03-06 17:31:52 +0100 |
commit | 5dd2bde59a18dea49b80afb0c2e6cf4827d79def (patch) | |
tree | 3ac696131d7791afc7443ecea003ebee1035388b /tests/auto/processmanager/tst_processmanager.cpp | |
parent | f47aab326b583bc8a44c8e0702257667918f3faf (diff) |
Added prefork library and factory
* Prefork library parses command line arguments and creates
appropriate master and child processes connected by
pipes.
* PreforkProcessBackendFactory retrieves information about
child processes from prefork library and exposes those
children as remote process manager objects.
* Linux test case added to start a master and child object
using prefork library and run all standard tests.
Change-Id: Ic76da3eb8237744dd075f55db80f46f35550c73f
Reviewed-by: Chris Craig <ext-chris.craig@nokia.com>
Diffstat (limited to 'tests/auto/processmanager/tst_processmanager.cpp')
-rw-r--r-- | tests/auto/processmanager/tst_processmanager.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/processmanager/tst_processmanager.cpp b/tests/auto/processmanager/tst_processmanager.cpp index 3cc2cf2..cd1a3a4 100644 --- a/tests/auto/processmanager/tst_processmanager.cpp +++ b/tests/auto/processmanager/tst_processmanager.cpp @@ -814,6 +814,42 @@ static void forkLauncherTest( clientFunc func, infoFunc infoFixup=0 ) #endif } +static void preforkLauncherTest( clientFunc func, infoFunc infoFixup=0 ) +{ +#if defined(Q_OS_LINUX) + QProcess *remote = new QProcess; + QString socketName = QLatin1String("/tmp/preforklauncher"); + remote->setProcessChannelMode(QProcess::ForwardedChannels); + QStringList args; + args << "--" << "testPreforkLauncher/testPreforkLauncher" << socketName + << "--" << "testForkLauncher/testForkLauncher"; + qDebug() << "Trying to run: testPrefork/testPrefork" << args; + remote->start("testPrefork/testPrefork", args); + QVERIFY(remote->waitForStarted()); + waitForSocket(socketName); + + ProcessBackendManager *manager = new ProcessBackendManager; + SocketProcessBackendFactory *factory = new SocketProcessBackendFactory; + factory->setSocketName(socketName); + manager->addFactory(factory); + + ProcessInfo info; + info.setValue("program", "testClient/testClient"); + if (infoFixup) + infoFixup(info); + fixUidGid(info); + func(manager, info, writeLine); + + delete manager; + delete remote; +#else + Q_UNUSED(func); + Q_UNUSED(infoFixup); +#endif +} + + + @@ -905,6 +941,17 @@ private slots: void forkLauncherOomChangeBefore() { forkLauncherTest(oomChangeBeforeClient); } void forkLauncherOomChangeAfter() { forkLauncherTest(oomChangeAfterClient); } + void preforkLauncherStartAndStop() { preforkLauncherTest(startAndStopClient); } + void preforkLauncherStartAndStopMultiple() { preforkLauncherTest(startAndStopMultiple); } + void preforkLauncherStartAndKill() { preforkLauncherTest(startAndKillClient); } + void preforkLauncherStartAndKillTough() { preforkLauncherTest(startAndKillClient, makeTough); } + void preforkLauncherStartAndCrash() { preforkLauncherTest(startAndCrashClient); } + void preforkLauncherEcho() { preforkLauncherTest(echoClient); } + void preforkLauncherPriorityChangeBefore() { preforkLauncherTest(priorityChangeBeforeClient); } + void preforkLauncherPriorityChangeAfter() { preforkLauncherTest(priorityChangeAfterClient); } + void preforkLauncherOomChangeBefore() { preforkLauncherTest(oomChangeBeforeClient); } + void preforkLauncherOomChangeAfter() { preforkLauncherTest(oomChangeAfterClient); } + void prelaunchChildAbort(); void frontend(); |