Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
5379420c
Commit
5379420c
authored
Jun 05, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored a bit. Extracted the code which checks for
test suite selection to a function.
parent
16254c32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
28 deletions
+43
-28
runner.c
test/test-automation/runner.c
+43
-28
No files found.
test/test-automation/runner.c
View file @
5379420c
...
...
@@ -315,8 +315,6 @@ ParseOptions(int argc, char *argv[])
memset
(
selected_suite_name
,
0
,
NAME_BUFFER_SIZE
);
strcpy
(
selected_suite_name
,
suiteName
);
printf
(
"%s
\n
"
,
selected_suite_name
);
}
else
{
printf
(
"runner: unknown command '%s'
\n
"
,
arg
);
...
...
@@ -328,27 +326,18 @@ ParseOptions(int argc, char *argv[])
/*!
* Entry point for test runner
* Tests if the given test suite is selected for execution.
* If only_selected_suite flag is zero, then all the suites are
* automatically selected. If the flags is non-zero, only the suite
* which matches the selected suite is selected.
*
* \param argc Count of command line arguments
* \param argv Array of commond lines arguments
* \param testSuiteName Name of the test suite
*
* \return 1 if given suite is selected, otherwise 0
*/
int
main
(
int
argc
,
char
*
argv
[])
{
ParseOptions
(
argc
,
argv
);
// print: Testing against SDL version fuu (rev: bar) if verbose == true
int
failureCount
=
0
,
passCount
=
0
;
const
Uint32
startTicks
=
SDL_GetTicks
();
char
**
testSuiteNames
=
ScanForTestSuites
();
char
*
testSuiteName
=
NULL
;
int
suiteCounter
=
0
;
for
(
testSuiteName
=
testSuiteNames
[
suiteCounter
];
testSuiteName
;
testSuiteName
=
testSuiteNames
[
++
suiteCounter
])
{
SuiteIsSelected
(
char
*
testSuiteName
)
{
int
retVal
=
1
;
if
(
only_selected_suite
)
{
// extract the suite name. Rips the tests/ and file suffix from the suite name
...
...
@@ -367,9 +356,38 @@ main(int argc, char *argv[])
memset
(
buffer
,
0
,
NAME_BUFFER_SIZE
);
memcpy
(
buffer
,
testSuiteName
+
6
,
length
);
if
(
SDL_strncmp
(
selected_suite_name
,
buffer
,
NAME_BUFFER_SIZE
)
!=
0
)
{
continue
;
retVal
=
SDL_strncmp
(
selected_suite_name
,
buffer
,
NAME_BUFFER_SIZE
)
==
0
;
}
return
retVal
;
}
/*!
* Entry point for test runner
*
* \param argc Count of command line arguments
* \param argv Array of commond lines arguments
*/
int
main
(
int
argc
,
char
*
argv
[])
{
ParseOptions
(
argc
,
argv
);
// print: Testing against SDL version fuu (rev: bar) if verbose == true
int
failureCount
=
0
,
passCount
=
0
;
const
Uint32
startTicks
=
SDL_GetTicks
();
char
**
testSuiteNames
=
ScanForTestSuites
();
char
*
testSuiteName
=
NULL
;
int
suiteCounter
=
0
;
for
(
testSuiteName
=
testSuiteNames
[
suiteCounter
];
testSuiteName
;
testSuiteName
=
testSuiteNames
[
++
suiteCounter
])
{
// if the current suite isn't selected, go to next suite
if
(
SuiteIsSelected
(
testSuiteName
)
==
0
)
{
continue
;
}
void
*
suite
=
LoadTestSuite
(
testSuiteName
);
...
...
@@ -378,12 +396,9 @@ main(int argc, char *argv[])
TestCaseReference
*
reference
=
NULL
;
int
counter
=
0
;
for
(
reference
=
tests
[
counter
];
reference
;
reference
=
tests
[
++
counter
])
{
if
(
only_selected_test
)
{
if
(
SDL_strncmp
(
selected_test_name
,
reference
->
name
,
NAME_BUFFER_SIZE
)
!=
0
)
{
if
(
only_selected_test
&&
SDL_strncmp
(
selected_test_name
,
reference
->
name
,
NAME_BUFFER_SIZE
)
!=
0
)
{
continue
;
}
}
if
(
reference
->
enabled
==
TEST_DISABLED
)
{
printf
(
"Test %s (in %s) disabled. Omitting...
\n
"
,
reference
->
name
,
testSuiteName
);
...
...
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