Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ssu
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mer-core
ssu
Commits
aef653bf
Commit
aef653bf
authored
Jun 25, 2019
by
sage
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jb46366' into 'master'
Jb46366 See merge request
!28
parents
026a2fd3
030f8806
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
1 deletion
+36
-1
libssu/ssudeviceinfo.cpp
libssu/ssudeviceinfo.cpp
+19
-1
tests/ut_deviceinfo/deviceinfotest.cpp
tests/ut_deviceinfo/deviceinfotest.cpp
+11
-0
tests/ut_deviceinfo/deviceinfotest.h
tests/ut_deviceinfo/deviceinfotest.h
+1
-0
tests/ut_deviceinfo/testdata/board-mappings.ini
tests/ut_deviceinfo/testdata/board-mappings.ini
+5
-0
No files found.
libssu/ssudeviceinfo.cpp
View file @
aef653bf
...
...
@@ -52,6 +52,8 @@ QString SsuDeviceInfo::adaptationVariables(const QString &adaptationName, QHash<
{
SsuLog
*
ssuLog
=
SsuLog
::
instance
();
QStringList
adaptationRepoList
=
adaptationRepos
();
QString
model
=
deviceVariant
(
true
);
// special handling for adaptation-repositories
// - check if repo is in right format (adaptation\d*)
// - check if the configuration has that many adaptation repos
...
...
@@ -74,7 +76,6 @@ QString SsuDeviceInfo::adaptationVariables(const QString &adaptationName, QHash<
storageHash
->
insert
(
"adaptation"
,
adaptationRepo
);
ssuLog
->
print
(
LOG_DEBUG
,
"Found first adaptation "
+
adaptationName
);
QString
model
=
deviceVariant
(
true
);
QHash
<
QString
,
QString
>
h
;
// add global variables for this model
...
...
@@ -97,6 +98,23 @@ QString SsuDeviceInfo::adaptationVariables(const QString &adaptationName, QHash<
return
"adaptation"
;
}
// If adaptation has defined repository-specific-variables and it matches to the
// repository name then also get those variables.
else
if
(
boardMappings
->
contains
(
model
+
"/repository-specific-variables"
))
{
QStringList
sections
=
boardMappings
->
value
(
model
+
"/repository-specific-variables"
).
toStringList
();
if
(
sections
.
contains
(
model
+
"-"
+
adaptationName
))
{
QHash
<
QString
,
QString
>
h
;
variableSection
(
model
+
"-"
+
adaptationName
,
&
h
);
QHash
<
QString
,
QString
>::
const_iterator
i
=
h
.
constBegin
();
while
(
i
!=
h
.
constEnd
())
{
storageHash
->
insert
(
i
.
key
(),
i
.
value
());
i
++
;
}
}
}
return
adaptationName
;
}
...
...
tests/ut_deviceinfo/deviceinfotest.cpp
View file @
aef653bf
...
...
@@ -26,6 +26,17 @@ void DeviceInfoTest::testAdaptationVariables()
QCOMPARE
(
repoName
,
QString
(
"adaptation"
));
}
void
DeviceInfoTest
::
testFeatureVariables
()
{
SsuDeviceInfo
deviceInfo
(
"N950"
);
QHash
<
QString
,
QString
>
featureVariables
;
QString
repoName
=
deviceInfo
.
adaptationVariables
(
"feature1"
,
&
featureVariables
);
QHash
<
QString
,
QString
>
featureVariablesExpected
;
featureVariablesExpected
[
"feature"
]
=
"test"
;
QCOMPARE
(
featureVariables
,
featureVariablesExpected
);
QCOMPARE
(
repoName
,
QString
(
"feature1"
));
}
void
DeviceInfoTest
::
testDeviceUid
()
{
QVERIFY2
(
!
SsuDeviceInfo
().
deviceUid
().
isEmpty
(),
"No method to get device UID on this platform"
);
...
...
tests/ut_deviceinfo/deviceinfotest.h
View file @
aef653bf
...
...
@@ -16,6 +16,7 @@ class DeviceInfoTest: public QObject
private
slots
:
void
testAdaptationVariables
();
void
testFeatureVariables
();
void
testDeviceUid
();
void
testVariableSection
();
void
testValue
();
...
...
tests/ut_deviceinfo/testdata/board-mappings.ini
View file @
aef653bf
...
...
@@ -16,6 +16,7 @@ N950=N9
family
=
n950-n9
adaptation-repos
=
n9xx-common,n950-n9
variables
=
n9
repository-specific-variables
=
N9-feature1
[var-n9]
foo-n9
=
foo-n9-val
...
...
@@ -49,3 +50,7 @@ bar2 = bar2Val
[var-baz]
variables
=
foo, bar
[var-N9-feature1]
feature
=
test
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment