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_deviceinfo: initial commit
- Loading branch information
Showing
11 changed files
with
249 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,71 @@ | ||
/** | ||
* @file deviceinfotest.cpp | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2013 | ||
*/ | ||
|
||
#include "deviceinfotest.h" | ||
|
||
#include <QtTest/QtTest> | ||
|
||
#include "libssu/ssudeviceinfo.h" | ||
|
||
void DeviceInfoTest::testAdaptationVariables(){ | ||
SsuDeviceInfo deviceInfo("N950"); | ||
QHash<QString, QString> variables; | ||
QHash<QString, QString> variablesExpected; | ||
variablesExpected["adaptation"] = "n950-n9"; | ||
variablesExpected["foo-n9"] = "foo-n9-val"; | ||
variablesExpected["foo-n950-n9"] = "foo-n950-n9-val"; | ||
|
||
QString repoName = deviceInfo.adaptationVariables("adaptation1", &variables); | ||
|
||
QCOMPARE(variables, variablesExpected); | ||
QCOMPARE(repoName, QString("adaptation")); | ||
} | ||
|
||
void DeviceInfoTest::testDeviceUid(){ | ||
QVERIFY2(!SsuDeviceInfo().deviceUid().isEmpty(), "No method to get device UID on this platform"); | ||
} | ||
|
||
void DeviceInfoTest::testVariableSection(){ | ||
SsuDeviceInfo deviceInfo; | ||
|
||
QHash<QString, QString> fooVars; | ||
QHash<QString, QString> fooVarsExpected; | ||
fooVarsExpected["foo1"] = "foo1Val"; | ||
fooVarsExpected["foo2"] = "foo2Val"; | ||
|
||
deviceInfo.variableSection("foo", &fooVars); | ||
|
||
QCOMPARE(fooVars, fooVarsExpected); | ||
|
||
QHash<QString, QString> barVars; | ||
QHash<QString, QString> barVarsExpected; | ||
barVarsExpected["bar1"] = "bar1Val"; | ||
barVarsExpected["bar2"] = "bar2Val"; | ||
|
||
deviceInfo.variableSection("bar", &barVars); | ||
|
||
QCOMPARE(barVars, barVarsExpected); | ||
|
||
QHash<QString, QString> bazVars; | ||
QHash<QString, QString> bazVarsExpected; | ||
bazVarsExpected["foo1"] = "foo1Val"; | ||
bazVarsExpected["foo2"] = "foo2Val"; | ||
bazVarsExpected["bar1"] = "bar1Val"; | ||
bazVarsExpected["bar2"] = "bar2Val"; | ||
|
||
deviceInfo.variableSection("baz", &bazVars); | ||
|
||
QCOMPARE(bazVars, bazVarsExpected); | ||
} | ||
|
||
void DeviceInfoTest::testValue(){ | ||
SsuDeviceInfo deviceInfo("N950"); | ||
QCOMPARE(deviceInfo.value("family").toString(), QString("n950-n9")); | ||
QCOMPARE(deviceInfo.value("adaptation-repos").toStringList(), | ||
QString("n9xx-common,n950-n9").split(',')); | ||
QCOMPARE(deviceInfo.value("foo").toString(), QString("n950-foo")); | ||
} |
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,23 @@ | ||
/** | ||
* @file deviceinfotest.h | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2013 | ||
*/ | ||
|
||
#ifndef _DEVICEINFOTEST_H | ||
#define _DEVICEINFOTEST_H | ||
|
||
#include <QObject> | ||
|
||
class DeviceInfoTest: public QObject { | ||
Q_OBJECT | ||
|
||
private slots: | ||
void testAdaptationVariables(); | ||
void testDeviceUid(); | ||
void testVariableSection(); | ||
void testValue(); | ||
}; | ||
|
||
#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,26 @@ | ||
/** | ||
* @file main.cpp | ||
* @copyright 2012 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2012 | ||
*/ | ||
|
||
#include <QtTest/QtTest> | ||
|
||
#include "libssu/sandbox_p.h" | ||
#include "deviceinfotest.h" | ||
|
||
int main(int argc, char **argv){ | ||
Sandbox sandbox(QString("%1/configroot").arg(TESTS_DATA_PATH), | ||
Sandbox::UseAsSkeleton, Sandbox::ThisProcess); | ||
if (!sandbox.activate()){ | ||
qFatal("Failed to activate sandbox"); | ||
} | ||
|
||
DeviceInfoTest deviceinfoTest; | ||
|
||
if (QTest::qExec(&deviceinfoTest, 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,53 @@ | ||
[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 | ||
variables = n9 | ||
|
||
[var-n9] | ||
foo-n9 = foo-n9-val | ||
|
||
[var-n950-n9] | ||
foo-n950-n9 = foo-n950-n9-val | ||
|
||
[N900] | ||
family=n900 | ||
adaptation-repos=n9xx-common,n900 | ||
|
||
[N950] | ||
foo = n950-foo | ||
|
||
[SDK] | ||
|
||
[generic-x86] | ||
family=x86 | ||
adaptation-repos=x86 | ||
|
||
[UNKNOWN] | ||
family=UNKNOWN | ||
|
||
[var-foo] | ||
foo1 = foo1Val | ||
foo2 = foo2Val | ||
|
||
[var-bar] | ||
bar1 = bar1Val | ||
bar2 = bar2Val | ||
|
||
[var-baz] | ||
variables = foo, bar |
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,18 @@ | ||
[General] | ||
initialized=true | ||
flavour=testing | ||
registered=false | ||
rndRelease=next | ||
release=latest | ||
adaptation= | ||
ca-certificate= | ||
credentials-scope=example | ||
credentials-url-example = http://creden.tia.ls/ | ||
|
||
[credentials-example] | ||
username = example_username | ||
password = example_password | ||
|
||
[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,18 @@ | ||
TARGET = ut_deviceinfo | ||
include(../testapplication.pri) | ||
include(ut_deviceinfo_dependencies.pri) | ||
|
||
HEADERS = \ | ||
deviceinfotest.h \ | ||
|
||
SOURCES = \ | ||
main.cpp \ | ||
deviceinfotest.cpp \ | ||
|
||
test_data_etc.files = \ | ||
testdata/ssu.ini \ | ||
|
||
test_data_usr_share.files = \ | ||
testdata/ssu-defaults.ini \ | ||
testdata/board-mappings.ini \ | ||
testdata/repos.ini \ |
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 @@ | ||
include(../../libssu/libssu.pri) |