Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
ut_ssuurlresolver: initial commit
- Loading branch information
Showing
10 changed files
with
209 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @file main.cpp | ||
* @copyright 2012 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2012 | ||
*/ | ||
|
||
#include <QtTest/QtTest> | ||
|
||
#include "ssuurlresolvertest.h" | ||
|
||
int main(int argc, char **argv){ | ||
SsuUrlResolverTest ssuUrlResolverTest; | ||
|
||
if (QTest::qExec(&ssuUrlResolverTest, argc, argv)) | ||
return 1; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* @file ssuurlresolvertest.cpp | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2013 | ||
*/ | ||
|
||
#include "ssuurlresolvertest.h" | ||
|
||
#include <stdlib.h> | ||
#include <zypp/media/UrlResolverPlugin.h> | ||
|
||
#include <QtTest/QtTest> | ||
|
||
/** | ||
* @class SsuUrlResolverTest | ||
* @brief Tests libzypp UrlResolverPlugin plugin compatibility | ||
* | ||
* This test verifies the UrlResolverPlugin works well with installed version of libzypp. | ||
*/ | ||
|
||
void SsuUrlResolverTest::initTestCase(){ | ||
setenv("LD_PRELOAD", qPrintable(QString("%1/libsandboxhook.so").arg(TESTS_PATH)), 1); | ||
setenv("SSU_TESTS_SANDBOX", qPrintable(QString("%1/configroot").arg(TESTS_DATA_PATH)), 1); | ||
} | ||
|
||
void SsuUrlResolverTest::test_data(){ | ||
QTest::addColumn<QString>("input"); | ||
QTest::addColumn<QString>("expected"); | ||
|
||
QTest::newRow("basic") | ||
<< "plugin:ssu?repo=mer-core&debug&arch=i586" | ||
<< "https://packages.testing.com//mer/i586/debug/?credentials=example"; | ||
} | ||
|
||
void SsuUrlResolverTest::test(){ | ||
QFETCH(QString, input); | ||
QFETCH(QString, expected); | ||
|
||
zypp::media::UrlResolverPlugin::HeaderList customHeaders; | ||
const QString resolved = QString::fromStdString( | ||
zypp::media::UrlResolverPlugin::resolveUrl(input.toStdString(), customHeaders).asString()); | ||
|
||
QCOMPARE(resolved, expected); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* @file ssuurlresolvertest.h | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2013 | ||
*/ | ||
|
||
#ifndef _SSUURLRESOLVERTEST_H | ||
#define _SSUURLRESOLVERTEST_H | ||
|
||
#include <QObject> | ||
|
||
class SsuUrlResolverTest: public QObject { | ||
Q_OBJECT | ||
|
||
private slots: | ||
void initTestCase(); | ||
void test_data(); | ||
void test(); | ||
|
||
private: | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[file.exists] | ||
SDK=/mer-sdk-chroot | ||
|
||
[systeminfo.equals] | ||
|
||
[cpuinfo.contains] | ||
N900=Nokia RX-51 board | ||
N950=Nokia RM-680 board | ||
N9=Nokia RM-696 board | ||
|
||
[arch.equals] | ||
generic-x86=i586 | ||
|
||
[variants] | ||
N950=N9 | ||
|
||
[N9] | ||
family=n950-n9 | ||
adaptation-repos=n9xx-common,n950-n9 | ||
|
||
[N900] | ||
family=n900 | ||
adaptation-repos=n9xx-common,n900 | ||
|
||
[SDK] | ||
|
||
[generic-x86] | ||
family=x86 | ||
adaptation-repos=x86 | ||
|
||
[UNKNOWN] | ||
family=UNKNOWN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[all] | ||
credentials=jolla | ||
credentials-url=https://%(ssuRegDomain)/%(ssuRegPath)/%1/credentials.xml | ||
register-url=https://%(ssuRegDomain)/%(ssuRegPath)/%1/register.xml | ||
|
||
[release] | ||
mer-core=https://%(packagesDomain)/%(release)/mer/%(arch)/%(debugSplit)/ | ||
|
||
[rnd] | ||
mer-core=https://%(packagesDomain)/mer/%(release)/builds/%(arch)/%(debugSplit)/ | ||
|
||
[devel-flavour] | ||
flavour-pattern= | ||
|
||
[release-flavour] | ||
flavour-pattern=:/release | ||
|
||
[testing-flavour] | ||
flavour-pattern=:/testing | ||
|
||
[example-domain] | ||
dumpDomain=dump.example.com | ||
packagesDomain=packages.example.com | ||
ssuRegDomain=ssu.example.com | ||
ssuRegPath=ssu/device | ||
|
||
# fallback if domain is not matched or not set | ||
[default-domain] | ||
dumpDomain=dump.testing.com | ||
packagesDomain=packages.testing.com | ||
ssuRegDomain=ssu.testing.com | ||
ssuRegPath=ssu/device |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[General] | ||
initialized=true | ||
flavour=testing | ||
registered=false | ||
rndRelease=latest | ||
release= | ||
adaptation= | ||
ca-certificate= | ||
credentials-scope=example | ||
|
||
[repository-urls] | ||
|
||
[repository-url-variables] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
HEADERS = \ | ||
ssuurlresolvertest.h \ | ||
|
||
SOURCES = \ | ||
main.cpp \ | ||
ssuurlresolvertest.cpp \ | ||
|
||
TEMPLATE = app | ||
TARGET = ut_ssuurlresolver | ||
|
||
LIBS += \ | ||
-lssu \ | ||
-lzypp \ | ||
|
||
CONFIG -= app_bundle | ||
CONFIG += console qtestlib | ||
QT -= gui | ||
QT += network testlib | ||
|
||
!include( ../tests.pri ) { error("Unable to find tests include") } | ||
|
||
unix:target.path = $${PREFIX}/$$TESTS_PATH | ||
INSTALLS += target | ||
|
||
test_data_etc.path = $${TESTS_DATA_PATH}/configroot/etc/ssu | ||
test_data_etc.files = \ | ||
$${PWD}/testdata/ssu.ini \ | ||
|
||
test_data_usr_share.path = $${TESTS_DATA_PATH}/configroot/usr/share/ssu | ||
test_data_usr_share.files = \ | ||
$${PWD}/testdata/ssu-defaults.ini \ | ||
$${PWD}/testdata/repos.ini \ | ||
$${PWD}/testdata/board-mappings.ini \ | ||
|
||
INSTALLS += test_data_etc test_data_usr_share | ||
|
||
!include( ../../buildpath.pri ) { error("Unable to find build path specification") } |