Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
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
Valentin Platzgummer
qgroundcontrol
Commits
89be3424
Commit
89be3424
authored
Nov 26, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support --unittest::testname
Allows you to run a single unit test from the command line
parent
34414960
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
main.cc
src/main.cc
+3
-3
AutoTest.h
src/qgcunittest/AutoTest.h
+6
-4
No files found.
src/main.cc
View file @
89be3424
...
@@ -112,8 +112,8 @@ int main(int argc, char *argv[])
...
@@ -112,8 +112,8 @@ int main(int argc, char *argv[])
bool
quietWindowsAsserts
=
false
;
// Don't let asserts pop dialog boxes
bool
quietWindowsAsserts
=
false
;
// Don't let asserts pop dialog boxes
CmdLineOpt_t
rgCmdLineOptions
[]
=
{
CmdLineOpt_t
rgCmdLineOptions
[]
=
{
{
"--unittest"
,
&
runUnitTests
},
{
"--unittest"
,
&
runUnitTests
,
QString
()
},
{
"--no-windows-assert-ui"
,
&
quietWindowsAsserts
},
{
"--no-windows-assert-ui"
,
&
quietWindowsAsserts
,
QString
()
},
// Add additional command line option flags here
// Add additional command line option flags here
};
};
...
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
...
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
}
}
// Run the test
// Run the test
int
failures
=
AutoTest
::
run
(
argc
-
1
,
argv
);
int
failures
=
AutoTest
::
run
(
argc
-
1
,
argv
,
rgCmdLineOptions
[
0
].
optionArg
);
if
(
failures
==
0
)
if
(
failures
==
0
)
{
{
qDebug
()
<<
"ALL TESTS PASSED"
;
qDebug
()
<<
"ALL TESTS PASSED"
;
...
...
src/qgcunittest/AutoTest.h
View file @
89be3424
...
@@ -49,15 +49,17 @@ namespace AutoTest
...
@@ -49,15 +49,17 @@ namespace AutoTest
}
}
}
}
inline
int
run
(
int
argc
,
char
*
argv
[])
inline
int
run
(
int
argc
,
char
*
argv
[]
,
QString
&
singleTest
)
{
{
int
ret
=
0
;
int
ret
=
0
;
foreach
(
QObject
*
test
,
testList
())
foreach
(
QObject
*
test
,
testList
())
{
{
if
(
singleTest
.
isEmpty
()
||
singleTest
==
test
->
objectName
())
{
qgcApp
()
->
destroySingletonsForUnitTest
();
qgcApp
()
->
destroySingletonsForUnitTest
();
qgcApp
()
->
createSingletonsForUnitTest
();
qgcApp
()
->
createSingletonsForUnitTest
();
ret
+=
QTest
::
qExec
(
test
,
argc
,
argv
);
ret
+=
QTest
::
qExec
(
test
,
argc
,
argv
);
}
}
}
return
ret
;
return
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