Mercurial > trustbridge
diff ui/tests/cinstprocesstest.cpp @ 151:0df62decff90
Test if uninstall is handled as instruction
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 24 Mar 2014 17:45:09 +0000 |
parents | a99339d0dce8 |
children | 37c9653b8755 |
line wrap: on
line diff
--- a/ui/tests/cinstprocesstest.cpp Mon Mar 24 17:23:42 2014 +0000 +++ b/ui/tests/cinstprocesstest.cpp Mon Mar 24 17:45:09 2014 +0000 @@ -17,11 +17,19 @@ return installerProcess; } +#define VERIFY_PROC_DEBUG(x) \ + if (! x ) { \ + qDebug() << "Stdout:" << proc->readAllStandardOutput(); \ + qDebug() << "Stderr:" << proc->readAllStandardError(); \ + qDebug() << "Exit code: " << proc->exitCode(); \ + } \ + QVERIFY(x) + void finishVerify(QProcess *proc, int exitCode) { proc->closeWriteChannel(); proc->waitForFinished(); - QVERIFY(proc->exitStatus() == QProcess::NormalExit); - QVERIFY(proc->exitCode() == exitCode); + VERIFY_PROC_DEBUG(proc->exitStatus() == QProcess::NormalExit); + VERIFY_PROC_DEBUG(proc->exitCode() == exitCode); delete proc; } @@ -38,7 +46,7 @@ installerProcess->write("\r\n"); } - finishVerify(installerProcess, 0); + finishVerify(installerProcess, NO_ERROR); } void CinstProcessTest::initTestCase() { @@ -106,7 +114,6 @@ QProcess* installerProcess = startCinstProcess(); QVERIFY(installerProcess->state() == QProcess::Running); - /* I: as instruction */ installerProcess->write("-----BEGIN CERTIFICATE LIST-----\r\n"); installerProcess->write(validList.rawData().toLatin1()); installerProcess->write("-----END CERTIFICATE LIST-----\r\n"); @@ -116,4 +123,17 @@ finishVerify(installerProcess, ERR_INVALID_INSTRUCTIONS); } +void CinstProcessTest::testUninstall() { + QProcess* installerProcess = startCinstProcess(); + QVERIFY(installerProcess->state() == QProcess::Running); + + installerProcess->write("-----BEGIN CERTIFICATE LIST-----\r\n"); + installerProcess->write(validList.rawData().toLatin1()); + installerProcess->write("-----END CERTIFICATE LIST-----\r\n"); + + installerProcess->write("UNINSTALL\r\n"); + + finishVerify(installerProcess, NO_ERROR); +} + QTEST_GUILESS_MAIN (CinstProcessTest);