Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
7f8db020
Commit
7f8db020
authored
Jul 18, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(tests): return an error code at program termination, logs tests status
parent
31f2ec67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
MainViewTest.hpp
src/tests/main-view/MainViewTest.hpp
+1
-0
main.cpp
src/tests/main.cpp
+21
-10
No files found.
src/tests/main-view/MainViewTest.hpp
View file @
7f8db020
...
...
@@ -29,6 +29,7 @@ class MainViewTest : public QObject {
public:
MainViewTest
()
=
default
;
~
MainViewTest
()
=
default
;
private
slots
:
void
showManageAccountsPopup
();
...
...
src/tests/main.cpp
View file @
7f8db020
...
...
@@ -46,14 +46,16 @@ int main (int argc, char *argv[]) {
if
(
app
->
isSecondary
())
qFatal
(
"Unable to run test with secondary app."
);
int
testsRet
=
0
;
const
QHash
<
QString
,
QObject
*>
tests
=
initializeTests
();
QObject
*
test
=
nullptr
;
if
(
argc
>
1
)
{
if
(
!
strcmp
(
argv
[
1
],
"self-test"
))
// Execute only self-test.
QTimer
::
singleShot
(
0
,
[
app
]
{
QTest
::
qExec
(
new
SelfTest
(
app
));
QTimer
::
singleShot
(
0
,
[
app
,
&
testsRet
]
{
testsRet
=
QTest
::
qExec
(
new
SelfTest
(
app
));
QCoreApplication
::
quit
();
});
else
{
...
...
@@ -65,18 +67,22 @@ int main (int argc, char *argv[]) {
return
EXIT_FAILURE
;
}
QTimer
::
singleShot
(
0
,
[
app
,
test
,
argc
,
argv
]
{
QTest
::
qExec
(
new
SelfTest
(
app
));
QTest
::
qExec
(
test
,
argc
-
1
,
argv
+
1
);
QTimer
::
singleShot
(
0
,
[
app
,
&
testsRet
,
test
,
argc
,
argv
]
{
testsRet
=
QTest
::
qExec
(
new
SelfTest
(
app
));
if
(
!
testsRet
)
QTest
::
qExec
(
test
,
argc
-
1
,
argv
+
1
);
QCoreApplication
::
quit
();
});
}
}
else
// Execute all tests.
QTimer
::
singleShot
(
0
,
[
app
,
&
tests
]
{
QTest
::
qExec
(
new
SelfTest
(
app
));
for
(
const
auto
&
test
:
tests
)
QTest
::
qExec
(
test
);
QTimer
::
singleShot
(
0
,
[
app
,
&
testsRet
,
&
tests
]
{
testsRet
=
QTest
::
qExec
(
new
SelfTest
(
app
));
if
(
!
testsRet
)
for
(
const
auto
&
test
:
tests
)
{
testsRet
|=
QTest
::
qExec
(
test
);
}
QCoreApplication
::
quit
();
});
...
...
@@ -86,5 +92,10 @@ int main (int argc, char *argv[]) {
for
(
auto
&
test
:
tests
)
delete
test
;
return
ret
;
if
(
testsRet
)
qWarning
()
<<
QStringLiteral
(
"One or many tests are failed. :("
);
else
qInfo
()
<<
QStringLiteral
(
"Tests seems OK. :)"
);
return
testsRet
||
ret
;
}
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