summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/environmentvariable/environmentvariable.pro22
-rw-r--r--tests/environmentvariable/environmentvariabletest.cpp101
-rw-r--r--tests/environmentvariable/environmentvariabletest.h52
-rw-r--r--tests/extractarchiveoperationtest/extractarchiveoperationtest.cpp168
-rw-r--r--tests/extractarchiveoperationtest/extractarchiveoperationtest.h57
-rw-r--r--tests/extractarchiveoperationtest/extractarchiveoperationtest.pro21
-rw-r--r--tests/fileengineclient/fileengineclient.cpp182
-rw-r--r--tests/fileengineclient/fileengineclient.pro17
-rw-r--r--tests/fileengineserver/fileengineserver.cpp43
-rw-r--r--tests/fileengineserver/fileengineserver.pro15
-rw-r--r--tests/test-installer/BatchSubstitute.bat20
-rw-r--r--tests/test-installer/auto_installations_script.qs77
-rw-r--r--tests/test-installer/create-test-installer.bat76
-rw-r--r--tests/test-installer/create-test-installer.sh1
-rw-r--r--tests/test-noarchive.7z190
-rw-r--r--tests/test1.7zbin0 -> 282 bytes
-rw-r--r--tests/test2.7zbin0 -> 629 bytes
-rw-r--r--tests/tests.pro7
18 files changed, 1049 insertions, 0 deletions
diff --git a/tests/environmentvariable/environmentvariable.pro b/tests/environmentvariable/environmentvariable.pro
new file mode 100644
index 000000000..036a4ff02
--- /dev/null
+++ b/tests/environmentvariable/environmentvariable.pro
@@ -0,0 +1,22 @@
+TEMPLATE = app
+TARGET = tst_environmentvariable
+
+DESTDIR = bin
+
+CONFIG -= app_bundle
+
+QT += testlib script
+QT -= gui
+
+INCLUDEPATH += ../../installerbuilder/libinstaller ..
+DEPENDPATH += ../../installerbuilder/libinstaller ../../installerbuilder/common
+
+include(../../installerbuilder/libinstaller/libinstaller.pri)
+
+SOURCES = environmentvariabletest.cpp
+HEADERS = environmentvariabletest.h
+
+LIBS = -L../../installerbuilder/lib -linstaller $$LIBS
+win32:LIBS += ole32.lib oleaut32.lib user32.lib
+win32:OBJECTS_DIR = .obj
+
diff --git a/tests/environmentvariable/environmentvariabletest.cpp b/tests/environmentvariable/environmentvariabletest.cpp
new file mode 100644
index 000000000..b3088cfb2
--- /dev/null
+++ b/tests/environmentvariable/environmentvariabletest.cpp
@@ -0,0 +1,101 @@
+/**************************************************************************
+**
+** This file is part of Installer Framework
+**
+** Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "environmentvariabletest.h"
+#include "environmentvariablesoperation.h"
+
+#include "init.h"
+
+#include <kdupdaterapplication.h>
+
+#include <QDir>
+#include <QDirIterator>
+#include <QFileInfo>
+#include <QStack>
+#include <QSettings>
+
+EnvironmentVariableTest::EnvironmentVariableTest()
+{
+ QInstaller::init();
+}
+
+void EnvironmentVariableTest::testPersistentNonSystem()
+{
+#ifndef Q_OS_WIN
+ QSKIP("This operation only works on Windows",SkipSingle);
+#endif
+ KDUpdater::Application app;
+ QString key = QLatin1String("IFW_TestKey");
+ QString value = QLatin1String("IFW_TestValue");
+ QInstaller::EnvironmentVariableOperation op;
+ op.setArguments( QStringList() << key
+ << value
+ << QLatin1String("true")
+ << QLatin1String("false"));
+ const bool ok = op.performOperation();
+
+ QVERIFY2(ok, qPrintable(op.errorString()));
+
+ // Verify now...
+ QSettings settings("HKEY_CURRENT_USER\\Environment", QSettings::NativeFormat);
+ QVERIFY(value == settings.value(key).toString());
+
+ // Remove the setting
+ QEXPECT_FAIL("", "Undo Operation not implemented yet", Continue);
+ QVERIFY(op.undoOperation());
+
+ //QVERIFY(settings.value(key).toString().isEmpty());
+ settings.remove(key);
+}
+
+void EnvironmentVariableTest::testNonPersistentNonSystem()
+{
+#ifndef Q_OS_WIN
+ QSKIP("This operation only works on Windows",SkipSingle);
+#endif
+ KDUpdater::Application app;
+ QString key = QLatin1String("IFW_TestKey");
+ QString value = QLatin1String("IFW_TestValue");
+ QInstaller::EnvironmentVariableOperation op;
+ op.setArguments( QStringList() << key
+ << value
+ << QLatin1String("false")
+ << QLatin1String("false"));
+ const bool ok = op.performOperation();
+
+ QVERIFY2(ok, qPrintable(op.errorString()));
+
+ QString comp = qgetenv(qPrintable(key));
+ QCOMPARE(value, comp);
+}
+
+QTEST_MAIN(EnvironmentVariableTest)
diff --git a/tests/environmentvariable/environmentvariabletest.h b/tests/environmentvariable/environmentvariabletest.h
new file mode 100644
index 000000000..1a9fb5e45
--- /dev/null
+++ b/tests/environmentvariable/environmentvariabletest.h
@@ -0,0 +1,52 @@
+/**************************************************************************
+**
+** This file is part of Installer Framework
+**
+** Copyright (c) 2010-2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef EXTRACTIONARCHIVEOPERATIONTEST_H
+#define EXTRACTIONARCHIVEOPERATIONTEST_H
+
+#include <QObject>
+
+#include <QtTest/QtTest>
+
+class EnvironmentVariableTest : public QObject
+{
+ Q_OBJECT
+
+public:
+ EnvironmentVariableTest();
+
+private Q_SLOTS:
+ void testPersistentNonSystem();
+ void testNonPersistentNonSystem();
+};
+
+#endif // EXTRACTARCHIVEOPERATIONTEST_H
diff --git a/tests/extractarchiveoperationtest/extractarchiveoperationtest.cpp b/tests/extractarchiveoperationtest/extractarchiveoperationtest.cpp
new file mode 100644
index 000000000..e898f919b
--- /dev/null
+++ b/tests/extractarchiveoperationtest/extractarchiveoperationtest.cpp
@@ -0,0 +1,168 @@
+/**************************************************************************
+**
+** This file is part of Installer Framework
+**
+** Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "extractarchiveoperationtest.h"
+#include "extractarchiveoperation.h"
+
+#include "init.h"
+
+#include <kdupdaterapplication.h>
+
+#include <QDir>
+#include <QDirIterator>
+#include <QFileInfo>
+#include <QStack>
+
+ExtractArchiveOperationTest::ExtractArchiveOperationTest()
+{
+ QInstaller::init();
+}
+
+void ExtractArchiveOperationTest::init(const QString &outdir)
+{
+ if (QDir(outdir).exists()) {
+ QFAIL("output directory already exists!");
+ QVERIFY(false);
+ }
+ QDir cd(QDir::current());
+ QVERIFY(cd.mkdir(outdir));
+}
+
+static bool recursiveRemove(const QString &path, QString *errorMsg)
+{
+ if (errorMsg)
+ errorMsg->clear();
+ if (!QFileInfo(path).exists())
+ return true;
+ bool error = false;
+ QString msg;
+ //first, delete all non-dir files
+ QDirIterator it(path, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ const QString n = it.next();
+ if (!QFileInfo(n).isDir()) {
+ QFile file(n);
+ if (!file.remove()) {
+ error = true;
+ msg = file.errorString();
+ }
+ }
+ }
+
+ QStack<QString> dirs;
+ QDirIterator it2(path, QDirIterator::Subdirectories);
+ while (it2.hasNext()) {
+ const QString n = it2.next();
+ if (!n.endsWith(QLatin1String( "/." ) ) && !n.endsWith( QLatin1String( "/.." )))
+ dirs.push(n);
+ }
+ while (!dirs.isEmpty()) {
+ const QString n = dirs.top();
+ dirs.pop();
+ if (!QDir(n).rmdir(QDir::currentPath() + QLatin1String("/") + n)) {
+ error = true;
+ msg = QObject::tr("Could not remove folder %1").arg(n);
+ qDebug() << msg;
+ }
+ }
+
+ if (!QDir(path).rmdir(QDir::currentPath() + QLatin1String("/") + path)) {
+ error = true;
+ msg = QObject::tr("Could not remove folder %1: Unknown error").arg(path);
+ }
+
+ if (errorMsg)
+ *errorMsg = msg;
+ return !error;
+}
+
+void ExtractArchiveOperationTest::cleanup(const QString &dir)
+{
+ QDir d(dir);
+ QString msg;
+ const bool removed = recursiveRemove(dir, &msg);
+ if (!removed)
+ qCritical() << msg;
+ QVERIFY(removed);
+}
+
+void ExtractArchiveOperationTest::testExtraction()
+{
+ const QString outdir = QLatin1String("test-extract-out" );
+ init(outdir);
+ KDUpdater::Application app;
+ QInstaller::ExtractArchiveOperation op;
+ op.setArguments(QStringList() << QLatin1String("qt-bin-test.7z") << outdir);
+ const bool ok = op.performOperation();
+ if (!ok) {
+ qCritical() << "Extraction failed:" << op.errorString();
+ QFAIL("Extraction failed");
+ }
+ cleanup(outdir);
+}
+
+void ExtractArchiveOperationTest::testExtractionErrors()
+{
+ const QString outdir = QLatin1String("test-extract-out");
+ init(outdir);
+ KDUpdater::Application app;
+ QInstaller::ExtractArchiveOperation op;
+ op.setArguments(QStringList() << QLatin1String("qt-bin-test.7z") << outdir);
+ const bool ok = op.performOperation();
+ if (!ok) {
+ qCritical() << "Extraction failed:" << op.errorString();
+ QFAIL("Extraction failed");
+ }
+ cleanup(outdir);
+
+}
+
+void ExtractArchiveOperationTest::testInvalidArchive()
+{
+ const QString outdir = QLatin1String("test-extract-out");
+ init(outdir);
+ KDUpdater::Application app;
+ QInstaller::ExtractArchiveOperation op;
+ op.setArguments(QStringList() << QLatin1String("test-noarchive.7z") << outdir);
+ const bool ok = op.performOperation();
+ if (ok) {
+ qCritical() << "ExtractArchiveOperation does not report error on extracting invalid archive";
+ QFAIL("Extraction failed");
+ }
+ QVERIFY(op.error() != QInstaller::ExtractArchiveOperation::NoError);
+ const QString str = op.errorString();
+ qDebug() << str;
+ QVERIFY(!str.isEmpty());
+ cleanup(outdir);
+}
+
+QTEST_MAIN(ExtractArchiveOperationTest)
diff --git a/tests/extractarchiveoperationtest/extractarchiveoperationtest.h b/tests/extractarchiveoperationtest/extractarchiveoperationtest.h
new file mode 100644
index 000000000..5ace60e70
--- /dev/null
+++ b/tests/extractarchiveoperationtest/extractarchiveoperationtest.h
@@ -0,0 +1,57 @@
+/**************************************************************************
+**
+** This file is part of Installer Framework
+**
+** Copyright (c) 2010-2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef EXTRACTIONARCHIVEOPERATIONTEST_H
+#define EXTRACTIONARCHIVEOPERATIONTEST_H
+
+#include <QObject>
+
+#include <QtTest/QtTest>
+
+class ExtractArchiveOperationTest : public QObject
+{
+ Q_OBJECT
+
+public:
+ ExtractArchiveOperationTest();
+
+private Q_SLOTS:
+ void testExtraction();
+ void testInvalidArchive();
+ void testExtractionErrors();
+
+private:
+ void init(const QString &);
+ void cleanup(const QString &);
+};
+
+#endif // EXTRACTARCHIVEOPERATIONTEST_H
diff --git a/tests/extractarchiveoperationtest/extractarchiveoperationtest.pro b/tests/extractarchiveoperationtest/extractarchiveoperationtest.pro
new file mode 100644
index 000000000..ce3551e1d
--- /dev/null
+++ b/tests/extractarchiveoperationtest/extractarchiveoperationtest.pro
@@ -0,0 +1,21 @@
+TEMPLATE = app
+TARGET = extractarchiveoperationtest
+
+DESTDIR = bin
+
+CONFIG -= app_bundle
+
+QT += testlib script
+QT -= gui
+
+INCLUDEPATH += ../../installerbuilder/libinstaller ..
+DEPENDPATH += ../../installerbuilder/libinstaller ../../installerbuilder/common
+
+include(../../installerbuilder/libinstaller/libinstaller.pri)
+
+SOURCES = extractarchiveoperationtest.cpp
+HEADERS = extractarchiveoperationtest.h
+
+LIBS = -L../../installerbuilder/lib -linstaller $$LIBS
+win32:LIBS += ole32.lib oleaut32.lib user32.lib
+win32:OBJECTS_DIR = .obj
diff --git a/tests/fileengineclient/fileengineclient.cpp b/tests/fileengineclient/fileengineclient.cpp
new file mode 100644
index 000000000..33f8fff53
--- /dev/null
+++ b/tests/fileengineclient/fileengineclient.cpp
@@ -0,0 +1,182 @@
+/**************************************************************************
+**
+** This file is part of Installer Framework
+**
+** Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include <fsengineclient.h>
+
+#include <QProcess>
+#include <QApplication>
+#include <QThread>
+#include <QDebug>
+
+class OutputHandler : public QObject
+{
+ Q_OBJECT
+
+public:
+ OutputHandler(QProcess* processWrapper, QObject *parent = 0)
+ : QObject (parent)
+ {
+ m_process = processWrapper;
+ QObject::connect(m_process, SIGNAL(readyRead()),
+ this, SLOT(readProcessOutput()), Qt::DirectConnection );
+ }
+ void clearSavedOutPut() { m_savedOutPut.clear(); }
+ QByteArray savedOutPut() { return m_savedOutPut; }
+
+public slots:
+ void readProcessOutput()
+ {
+ Q_ASSERT(m_process);
+ Q_ASSERT(QThread::currentThread() == m_process->thread());
+ if (QThread::currentThread() != m_process->thread()) {
+ qDebug() << Q_FUNC_INFO << QLatin1String(" can only be called from the same thread as the process is.") ;
+ }
+ const QByteArray output = m_process->readAll();
+ if( !output.isEmpty() ) {
+ m_savedOutPut.append(output);
+ qDebug() << output;
+ }
+ }
+
+private:
+ QProcess* m_process;
+ QByteArray m_savedOutPut;
+};
+
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+
+ QString fileName(QLatin1String("give_me_some_output.bat"));
+ QFile file(fileName);
+ if (file.exists() && !file.remove()) {
+ qFatal( qPrintable( QString("something is wrong, can not delete: %1").arg(file.fileName()) ) );
+ return -1;
+ }
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+ {
+ qFatal( qPrintable( QString("something is wrong, can not open for writing to: %1").arg(file.fileName()) ) );
+ return -2;
+ }
+
+ QTextStream out(&file);
+ out << QLatin1String("echo mega test output");
+ if (!file.flush())
+ {
+ qFatal( qPrintable( QString("something is wrong, can not write to: %1").arg(file.fileName()) ) );
+ return -3;
+ }
+ file.close();
+
+
+//first run as a normal QProcess
+ QByteArray firstOutPut;
+ {
+ QProcess process;
+ OutputHandler outputer(&process);
+
+ process.start(fileName);
+ qDebug() << "1";
+ {
+ const QByteArray output = process.readAll();
+ if( !output.isEmpty() ) {
+ qDebug() << output;
+ }
+ }
+ process.waitForStarted();
+ qDebug() << "2";
+ {
+ const QByteArray output = process.readAll();
+ if( !output.isEmpty() ) {
+ qDebug() << output;
+ }
+ }
+ process.waitForFinished();
+ qDebug() << "3";
+ {
+ const QByteArray output = process.readAll();
+ if( !output.isEmpty() ) {
+ qDebug() << output;
+ }
+ }
+ firstOutPut = outputer.savedOutPut();
+ }
+//first run as a normal QProcess
+ QByteArray secondOutPut;
+ {
+ FSEngineClientHandler::instance().enableTestMode();
+ FSEngineClientHandler::instance().init(39999);
+ FSEngineClientHandler::instance().setActive(true);
+
+ QProcess process;
+ OutputHandler outputer(&process);
+
+ process.start(fileName);
+ qDebug() << "1";
+ {
+ const QByteArray output = process.readAll();
+ if( !output.isEmpty() ) {
+ qDebug() << output;
+ }
+ }
+ process.waitForStarted();
+ qDebug() << "2";
+ {
+ const QByteArray output = process.readAll();
+ if( !output.isEmpty() ) {
+ qDebug() << output;
+ }
+ }
+ process.waitForFinished();
+ qDebug() << "3";
+ {
+ const QByteArray output = process.readAll();
+ if( !output.isEmpty() ) {
+ qDebug() << output;
+ }
+ }
+ secondOutPut = outputer.savedOutPut();
+ }
+
+ if (firstOutPut != secondOutPut) {
+ qFatal( qPrintable( QString("Test failed: output is different between a normal QProcess and QProcessWrapper").arg(file.fileName()) ) );
+ return -2;
+ } else {
+ qDebug() << QLatin1String("Test OK: QProcess works as expected.");
+ }
+
+ return app.exec();
+}
+
+#include "fileengineclient.moc"
diff --git a/tests/fileengineclient/fileengineclient.pro b/tests/fileengineclient/fileengineclient.pro
new file mode 100644
index 000000000..8946813ae
--- /dev/null
+++ b/tests/fileengineclient/fileengineclient.pro
@@ -0,0 +1,17 @@
+TEMPLATE = app
+DEPENDPATH += . .. ../../installerbuilder/common
+INCLUDEPATH += . ..
+
+DESTDIR = ../../installerbuilder/bin
+
+CONFIG += console
+CONFIG -= app_bundle
+
+QT += network
+
+include(../../installerbuilder/libinstaller/libinstaller.pri)
+
+# Input
+SOURCES += fileengineclient.cpp
+
+LIBS = -L../../installerbuilder/lib -linstaller $$LIBS
diff --git a/tests/fileengineserver/fileengineserver.cpp b/tests/fileengineserver/fileengineserver.cpp
new file mode 100644
index 000000000..a1e2d121c
--- /dev/null
+++ b/tests/fileengineserver/fileengineserver.cpp
@@ -0,0 +1,43 @@
+/**************************************************************************
+**
+** This file is part of Installer Framework
+**
+** Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include <fsengineserver.h>
+
+#include <QApplication>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ FSEngineServer server(39999);
+ server.enableTestMode();
+ return app.exec();
+}
diff --git a/tests/fileengineserver/fileengineserver.pro b/tests/fileengineserver/fileengineserver.pro
new file mode 100644
index 000000000..89cd0ffc9
--- /dev/null
+++ b/tests/fileengineserver/fileengineserver.pro
@@ -0,0 +1,15 @@
+TEMPLATE = app
+DEPENDPATH += . .. ../../installerbuilder/common
+INCLUDEPATH += . ..
+
+DESTDIR = ../../installerbuilder/bin
+
+CONFIG += console
+CONFIG -= app_bundle
+
+include(../../installerbuilder/libinstaller/libinstaller.pri)
+
+# Input
+SOURCES += fileengineserver.cpp
+
+LIBS = -L../../installerbuilder/lib -linstaller $$LIBS
diff --git a/tests/test-installer/BatchSubstitute.bat b/tests/test-installer/BatchSubstitute.bat
new file mode 100644
index 000000000..99bffdcb0
--- /dev/null
+++ b/tests/test-installer/BatchSubstitute.bat
@@ -0,0 +1,20 @@
+@echo off
+REM -- Prepare the Command Processor --
+SETLOCAL ENABLEEXTENSIONS
+SETLOCAL DISABLEDELAYEDEXPANSION
+
+::BatchSubstitude - parses a File line by line and replaces a substring"
+::syntax: BatchSubstitude.bat OldStr NewStr File
+:: OldStr [in] - string to be replaced
+:: NewStr [in] - string to replace with
+:: File [in] - file to be parsed
+:$changed 20100115
+:$source http://www.dostips.com
+if "%~1"=="" findstr "^::" "%~f0"&GOTO:EOF
+for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
+ set "line=%%B"
+ if defined line (
+ call set "line=echo.%%line:%~1=%~2%%"
+ for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
+ ) ELSE echo.
+)
diff --git a/tests/test-installer/auto_installations_script.qs b/tests/test-installer/auto_installations_script.qs
new file mode 100644
index 000000000..35960c3b5
--- /dev/null
+++ b/tests/test-installer/auto_installations_script.qs
@@ -0,0 +1,77 @@
+var installerTargetDirectory="c:\\auto-test-installation";
+
+function Controller()
+{
+ installer.autoRejectMessageBoxes;
+ installer.setMessageBoxAutomaticAnswer( "OverwriteTargetDirectory", QMessageBox.Yes);
+ //maybe we want something like this
+ //installer.execute("D:\\cleanup_directory.bat", new Array(installerTargetDirectory));
+ installer.setMessageBoxAutomaticAnswer( "stopProcessesForUpdates", QMessageBox.Ignore);
+}
+
+
+Controller.prototype.IntroductionPageCallback = function()
+{
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.TargetDirectoryPageCallback = function()
+{
+ var page = gui.pageWidgetByObjectName("TargetDirectoryPage");
+ page.TargetDirectoryLineEdit.setText(installerTargetDirectory);
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.ComponentSelectionPageCallback = function()
+{
+ var page = gui.pageWidgetByObjectName("ComponentSelectionPage");
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.LicenseAgreementPageCallback = function()
+{
+ var page = gui.pageWidgetByObjectName("LicenseAgreementPage");
+ page.AcceptLicenseRadioButton.setChecked( true);
+ gui.clickButton(buttons.NextButton);
+}
+
+////in the current installer we don't have this
+//Controller.prototype.DynamicQtGuiPageCallback = function()
+//{
+// var page = gui.pageWidgetByObjectName("DynamicQtGuiPage");
+// page.checkBoxLib.setChecked( false);
+// gui.clickButton(buttons.NextButton);
+//}
+
+////in the current installer we don't have this
+//Controller.prototype.DynamicErrorPageCallback = function()
+//{
+// var page = gui.pageWidgetByObjectName("DynamicErrorPage");
+// page.checkBoxMakeSure.setChecked( true);
+// gui.clickButton(buttons.NextButton);
+//}
+
+Controller.prototype.StartMenuDirectoryPageCallback = function()
+{
+ var page = gui.pageWidgetByObjectName("StartMenuDirectoryPage");
+ //page.LineEdit.text = "test";
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.ReadyForInstallationPageCallback = function()
+{
+ gui.clickButton(buttons.NextButton);
+}
+
+
+Controller.prototype.PerformInstallationPageCallback = function()
+{
+ var page = gui.pageWidgetByObjectName("PerformInstallationPage");
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.FinishedPageCallback = function()
+{
+ var page = gui.pageWidgetByObjectName("FinishedPage");
+ gui.clickButton(buttons.FinishButton);
+}
diff --git a/tests/test-installer/create-test-installer.bat b/tests/test-installer/create-test-installer.bat
new file mode 100644
index 000000000..866e41f4c
--- /dev/null
+++ b/tests/test-installer/create-test-installer.bat
@@ -0,0 +1,76 @@
+IF "%1" EQU "" (
+ set OFFLINE_INSTALLER=true
+ set ONLINE_INSTALLER=true
+ set REPOGEN=true
+ set TEST_ONLINE_INSTALLER=false
+ set TEST_OFFLINE_INSTALLER=false
+) else (
+ set OFFLINE_INSTALLER=false
+ set ONLINE_INSTALLER=false
+ set REPOGEN=false
+ set TEST_ONLINE_INSTALLER=false
+ set TEST_OFFLINE_INSTALLER=false
+)
+
+for %%i in (%1,%2,%3,%4,%5,%6,%7,%8,%9) DO (
+ IF "%%i" EQU "offline" (
+ set OFFLINE_INSTALLER=true
+ )
+ IF "%%i" EQU "online" (
+ set ONLINE_INSTALLER=true
+ )
+ IF "%%i" EQU "repogen" (
+ set REPOGEN=true
+ )
+ IF "%%i" EQU "test_online" (
+ set TEST_ONLINE_INSTALLER=true
+ )
+ IF "%%i" EQU "test_offline" (
+ set TEST_OFFLINE_INSTALLER=true
+ )
+)
+
+set AUTO_INSTALLATION_SCRIPT=--script %CD%\auto_installations_script.qs
+
+set BINARY_PATH_RELATIVE=%CD%\..\..\installerbuilder\bin
+pushd .
+cd %BINARY_PATH_RELATIVE%
+set BINARY_PATH_ABSOLUTE=%CD%
+popd
+
+set LOCAL_REPOSITORY=file:///%BINARY_PATH_ABSOLUTE%/repository
+set LOCAL_REPOSITORY_PATH=%LOCAL_REPOSITORY:\=/%
+
+call BatchSubstitute.bat http://www.xxxx.com/repository %LOCAL_REPOSITORY_PATH% ..\..\examples\testapp\config\config.xml > ..\..\examples\testapp\config\config.xml_new
+
+copy /Y ..\..\examples\testapp\config\config.xml ..\..\examples\testapp\config\config.xml_old
+move /Y ..\..\examples\testapp\config\config.xml_new ..\..\examples\testapp\config\config.xml
+
+IF "%OFFLINE_INSTALLER%" EQU "true" (
+ echo create offline installer
+ ..\..\installerbuilder\bin\binarycreator -t ..\..\installerbuilder\bin\installerbase.exe -v -p ..\..\examples\testapp\packages -c ..\..\examples\testapp\config --offline-only ..\..\installerbuilder\bin\test-installer-offline.exe com.nokia.testapp
+ IF errorlevel 1 pause ELSE echo ...done
+)
+
+IF "%ONLINE_INSTALLER%" EQU "true" (
+ echo create online installer
+ ..\..\installerbuilder\bin\binarycreator -t ..\..\installerbuilder\bin\installerbase.exe -v -n -p ..\..\examples\testapp\packages -c ..\..\examples\testapp\config ..\..\installerbuilder\bin\test-installer-online.exe com.nokia.testapp
+ IF errorlevel 1 pause ELSE echo ...done
+)
+
+IF "%REPOGEN%" EQU "true" (
+ echo create online repository
+ IF exist ..\..\installerbuilder\bin\repository rmdir /S /Q ..\..\installerbuilder\bin\repository
+ ..\..\installerbuilder\bin\repogen.exe -p ..\..\examples\testapp\packages -c ..\..\examples\testapp\config ..\..\installerbuilder\bin\repository com.nokia.testapp
+ IF errorlevel 1 pause ELSE echo ...done
+)
+
+IF "%TEST_OFFLINE_INSTALLER%" EQU "true" (
+ ..\..\installerbuilder\bin\test-installer-offline.exe --verbose %AUTO_INSTALLATION_SCRIPT%
+)
+
+IF "%TEST_ONLINE_INSTALLER%" EQU "true" (
+ ..\..\installerbuilder\bin\test-installer-online.exe --verbose %AUTO_INSTALLATION_SCRIPT%
+)
+
+copy /Y ..\..\examples\testapp\config\config.xml_old ..\..\examples\testapp\config\config.xml
diff --git a/tests/test-installer/create-test-installer.sh b/tests/test-installer/create-test-installer.sh
new file mode 100644
index 000000000..21889d50d
--- /dev/null
+++ b/tests/test-installer/create-test-installer.sh
@@ -0,0 +1 @@
+../../installerbuilder/bin/binarycreator -t ../../installerbuilder/bin/installerbase -v -p ../../examples/testapp/packages -c ../../examples/testapp/config test-installer --offline-only com.nokia.testapp
diff --git a/tests/test-noarchive.7z b/tests/test-noarchive.7z
new file mode 100644
index 000000000..963107aca
--- /dev/null
+++ b/tests/test-noarchive.7z
@@ -0,0 +1,190 @@
+#!/bin/bash
+
+PRODUCT=SDKINSTALLER
+Product=SDKInstaller
+product=sdkinstaller
+
+VERSION=0.0.1
+
+default_prefix=/usr/local/KDAB/$Product-$VERSION
+
+hide_symbols=yes
+shared=yes
+debug=no
+release=yes
+prefix=
+unittests=no
+
+STATIC_BUILD_SUPPORTED=false
+
+function die {
+ echo "$1" 1>&2
+ exit 1
+}
+
+
+function usage {
+ [ -z "$1" ] || echo "$0: unknown option \"$1\"" 1>&2
+ echo "usage: $0 [options]" 1>&2
+ cat <<EOF 1>&2
+where options include:
+
+EOF
+if [ "$INSTALLATION_SUPPORTED" = "true" ]; then
+ cat <<EOF 1>&2
+ -prefix <path>
+ install $Product into <path>
+EOF
+fi
+cat <<EOF 1>&2
+
+ -release / -debug
+ build in debug/release mode
+EOF
+if [ "$STATIC_BUILD_SUPPORTED" = "true" ]; then
+ cat <<EOF 1>&2
+
+ -static / -shared
+ build static/shared libraries
+EOF
+fi
+cat <<EOF 1>&2
+
+ -[no-]hide-symbols (Unix only)
+ reduce the number of exported symbols
+
+ -[no-]unittests
+ enable/disable compiled-in unittests
+
+EOF
+ exit 1
+}
+
+if [ -z "$QTDIR" ] ; then
+ QTDIR="$(qmake -query QT_INSTALL_PREFIX)"
+ if [ $? -ne 0 ] ; then
+ QTDIR=
+ fi
+fi
+
+[ -z "$QTDIR" ] && die "You need QTDIR defined, or qmake in the PATH"
+
+while [ $# -ne 0 ] ; do
+ case "$1" in
+ -prefix)
+ shift
+ if [ $# -eq 0 ] ; then
+ echo "-prefix needs an argument" 2>&1
+ usage
+ fi
+ prefix="$1"
+ ;;
+ -no-hide-symbols)
+ hide_symbols=no
+ ;;
+ -hide-symbols)
+ hide_symbols=yes
+ ;;
+ -no-unittests)
+ unittests=no
+ ;;
+ -unittests)
+ unittests=yes
+ ;;
+ -shared)
+ shared=yes
+ ;;
+ -static)
+ if [ "$STATIC_BUILD_SUPPORTED" != "true" ]; then
+ echo "Static build not supported, -static option not allowed" 2>&1
+ usage
+ fi
+ shared=no
+ ;;
+ -debug)
+ debug=yes
+ release=no
+ ;;
+ -release)
+ debug=no
+ release=yes
+ ;;
+ *)
+ usage "$1"
+ ;;
+ esac
+ shift
+done
+
+find . -name debug -o -name release -o -name Makefile\* | xargs rm -rf
+
+if [ -f src/src.pro ] ; then
+ rm -rf lib bin
+fi
+
+if [ -z "$prefix" ] ; then
+ prefix="$default_prefix"
+fi
+
+echo -n > ".qmake.cache"
+(
+ echo "CONFIG += ${product}_target"
+
+# The following disabled to make debug builds work again:
+# echo '!contains($$list($$[QT_VERSION]), 4.2.*):CONFIG += debug_and_release build_all'
+# [ "$debug" = "yes" ] && echo "else:CONFIG -=release += debug"
+# [ "$release" = "yes" ] && echo "else:CONFIG -=debug += release"
+
+ if [ "$debug" = "yes" ]; then
+ echo "CONFIG -= release"
+ echo "CONFIG += debug"
+ echo "CONFIG -= debug_and_release"
+ fi
+
+ if [ "$release" = "yes" ]; then
+ echo "CONFIG += release"
+ echo "CONFIG -= debug"
+ echo "CONFIG -= debug_and_release"
+ fi
+
+ [ "$hide_symbols" = "yes" ] && echo "CONFIG += hide_symbols"
+ [ "$unittests" = "yes" ] && echo "CONFIG += unittests"
+
+ if [ "$shared" = "yes" ]; then
+ echo "CONFIG -= static"
+ echo "CONFIG -= staticlib"
+ echo "CONFIG += shared"
+ else
+ echo "CONFIG += static"
+ echo "CONFIG += staticlib"
+ echo "CONFIG -= shared"
+ fi
+
+ if [ -d "$QTDIR/include/Qt/private" ] ; then
+ echo "CONFIG += have_private_qt_headers"
+ echo "INCLUDEPATH += $QTDIR/include/Qt/private"
+ #else
+ #echo "QTDIR must point to an installation that has private headers installed."
+ #echo "Some features will not be available."
+ fi
+echo "${PRODUCT}_INSTALL_PREFIX = $prefix"
+echo "${PRODUCT}_BASE = `pwd`"
+
+) >> ".qmake.cache"
+
+cat <<EOF 1>&2
+$Product v$VERSION configuration:
+
+ Install Prefix.............: $prefix
+ (default: $default_prefix)
+ Debug......................: $debug (default: no)
+ Release....................: $release (default: yes)
+ Compiled-In Unit Tests.....: $unittests (default: no)
+ Restricted symbol export
+ (shared build only)......: $hide_symbols (default: yes)
+
+EOF
+
+$QTDIR/bin/qmake $product.pro -recursive "CONFIG+=pk7zip_library" || die "qmake failed"
+
+echo "Ok, now run make, then make install to install into $prefix"
diff --git a/tests/test1.7z b/tests/test1.7z
new file mode 100644
index 000000000..38a4c53ac
--- /dev/null
+++ b/tests/test1.7z
Binary files differ
diff --git a/tests/test2.7z b/tests/test2.7z
new file mode 100644
index 000000000..99d199695
--- /dev/null
+++ b/tests/test2.7z
Binary files differ
diff --git a/tests/tests.pro b/tests/tests.pro
new file mode 100644
index 000000000..f8eb9fc8b
--- /dev/null
+++ b/tests/tests.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+DESTDIR = bin
+SUBDIRS += extractarchiveoperationtest environmentvariable fileengineclient fileengineserver
+
+unix:test.commands = ./bin/extractarchiveoperationtest
+win32:test.commands = bin\\extractarchiveoperationtest.exe