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
82d0a869
Commit
82d0a869
authored
Jul 19, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refined test skipping.
parent
e1681066
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
17 deletions
+51
-17
runner.c
test/test-automation/runner.c
+39
-17
support.c
test/test-automation/support.c
+12
-0
No files found.
test/test-automation/runner.c
View file @
82d0a869
...
...
@@ -439,12 +439,6 @@ FilterTestCase(TestCaseReference *testReference)
}
}
if
(
testReference
->
requirements
&
TEST_REQUIRES_AUDIO
)
{
//printf("Debug: checking for audio support.\n");
retVal
=
PlatformSupportsAudio
();
//printf("Debug: Audio support: %d\n", retVal);
}
return
retVal
;
}
...
...
@@ -638,6 +632,29 @@ KillHungTestInChildProcess(int signum)
exit
(
TEST_RESULT_KILLED
);
}
/*!
* Checks if given test case can be executed on the current platform.
*
* \param testCase Test to be checked
* \returns 1 if test is runnable, otherwise 0. On error returns -1
*/
int
CheckTestRequirements
(
TestCase
*
testCase
)
{
int
retVal
=
1
;
if
(
testCase
==
NULL
)
{
fprintf
(
stderr
,
"TestCase parameter can't be NULL"
);
return
-
1
;
}
if
(
testCase
->
requirements
&
TEST_REQUIRES_AUDIO
)
{
retVal
=
PlatformSupportsAudio
();
}
return
retVal
;
}
/*
* Execute a test. Loads the test, executes it and
...
...
@@ -647,35 +664,40 @@ KillHungTestInChildProcess(int signum)
* \param test result
*/
int
RunTest
(
TestCase
*
test
Item
)
RunTest
(
TestCase
*
test
Case
)
{
if
(
testItem
->
timeout
>
0
||
universal_timeout
>
0
)
{
int
runnable
=
CheckTestRequirements
(
testCase
);
if
(
runnable
!=
1
)
{
return
TEST_RESULT_SKIPPED
;
}
if
(
testCase
->
timeout
>
0
||
universal_timeout
>
0
)
{
if
(
execute_inproc
)
{
Log
(
time
(
0
),
"Test asked for timeout which is not supported."
);
}
else
{
SetTestTimeout
(
test
Item
->
timeout
,
KillHungTestInChildProcess
);
SetTestTimeout
(
test
Case
->
timeout
,
KillHungTestInChildProcess
);
}
}
test
Item
->
initTestEnvironment
();
test
Case
->
initTestEnvironment
();
if
(
test
Item
->
testSetUp
)
{
test
Item
->
testSetUp
(
0x0
);
if
(
test
Case
->
testSetUp
)
{
test
Case
->
testSetUp
(
0x0
);
}
int
cntFailedAsserts
=
test
Item
->
countFailedAsserts
();
int
cntFailedAsserts
=
test
Case
->
countFailedAsserts
();
if
(
cntFailedAsserts
!=
0
)
{
return
TEST_RESULT_SETUP_FAILURE
;
}
test
Item
->
testCase
(
0x0
);
test
Case
->
testCase
(
0x0
);
if
(
test
Item
->
testTearDown
)
{
test
Item
->
testTearDown
(
0x0
);
if
(
test
Case
->
testTearDown
)
{
test
Case
->
testTearDown
(
0x0
);
}
return
test
Item
->
quitTestEnvironment
();
return
test
Case
->
quitTestEnvironment
();
}
...
...
test/test-automation/support.c
View file @
82d0a869
...
...
@@ -37,7 +37,19 @@ PlatformSupportsAudio()
return
retValue
;
}
/*
Example of implementing new PlatformSupportXXX functions. The function
should return 1 if the feature is supported. Otherwise return 0.
Add call to the implemented function to runner.c in function
CheckTestRequirements. Use the current implementation as a guide.
Also add TEST_REQUIRES_XXX to SDL_test.h and use it in your tests
TestCaseReference. In this case, you'd add TEST_REQUIRES_OPENGL to
SDL_test.h
int
PlatformSupportsOpenGL() {
int retValue = 0;
...
...
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