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
c003533b
Commit
c003533b
authored
Jul 06, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the interface between tests suites and logger.
Note: breaks the linux build.
parent
f51d1376
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
645 deletions
+54
-645
SDL_test.c
test/test-automation/SDL_test.c
+2
-12
SDL_test.h
test/test-automation/SDL_test.h
+3
-1
logger.c
test/test-automation/logger.c
+0
-54
logger.h
test/test-automation/logger.h
+1
-0
plain_logger.c
test/test-automation/plain_logger.c
+0
-2
runner.c
test/test-automation/runner.c
+48
-6
Makefile.in
test/test-automation/testplatform/Makefile.in
+0
-570
No files found.
test/test-automation/SDL_test.c
View file @
c003533b
...
@@ -39,16 +39,8 @@ int _testAssertsFailed;
...
@@ -39,16 +39,8 @@ int _testAssertsFailed;
int
_testAssertsPassed
;
int
_testAssertsPassed
;
void
void
_TestCaseInit
(
const
int
enableXMLLogging
)
_TestCaseInit
()
{
{
// setup logging functions
// rather afwul way to do it, but function pointers didn't work
if
(
enableXMLLogging
)
{
SetupXMLLogger
();
}
else
{
SetupPlainLogger
();
}
_testReturnValue
=
0
;
_testReturnValue
=
0
;
_testAssertsFailed
=
0
;
_testAssertsFailed
=
0
;
_testAssertsPassed
=
0
;
_testAssertsPassed
=
0
;
...
@@ -82,7 +74,7 @@ AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
...
@@ -82,7 +74,7 @@ AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
_testReturnValue
=
1
;
_testReturnValue
=
1
;
_testAssertsFailed
++
;
_testAssertsFailed
++
;
}
else
{
}
else
{
AssertWithValues
(
"AssertEquals"
,
1
,
"AssertEquals passed"
,
AssertWithValues
(
"AssertEquals"
,
1
,
"AssertEquals passed"
,
actual
,
expected
,
time
(
0
));
actual
,
expected
,
time
(
0
));
_testAssertsPassed
++
;
_testAssertsPassed
++
;
...
@@ -122,7 +114,6 @@ AssertPass(char *message, ...)
...
@@ -122,7 +114,6 @@ AssertPass(char *message, ...)
SDL_vsnprintf
(
buf
,
sizeof
(
buf
),
message
,
args
);
SDL_vsnprintf
(
buf
,
sizeof
(
buf
),
message
,
args
);
va_end
(
args
);
va_end
(
args
);
//printf("AssertPass: %s\n", buf);
Assert
(
"AssertPass"
,
1
,
buf
,
time
(
0
));
Assert
(
"AssertPass"
,
1
,
buf
,
time
(
0
));
_testAssertsPassed
++
;
_testAssertsPassed
++
;
...
@@ -138,7 +129,6 @@ AssertFail(char *message, ...)
...
@@ -138,7 +129,6 @@ AssertFail(char *message, ...)
SDL_vsnprintf
(
buf
,
sizeof
(
buf
),
message
,
args
);
SDL_vsnprintf
(
buf
,
sizeof
(
buf
),
message
,
args
);
va_end
(
args
);
va_end
(
args
);
//printf("AssertFail: %s\n", buf);
Assert
(
"AssertFail"
,
0
,
buf
,
time
(
0
));
Assert
(
"AssertFail"
,
0
,
buf
,
time
(
0
));
_testAssertsFailed
++
;
_testAssertsFailed
++
;
...
...
test/test-automation/SDL_test.h
View file @
c003533b
...
@@ -29,6 +29,8 @@ extern int _testReturnValue;
...
@@ -29,6 +29,8 @@ extern int _testReturnValue;
extern
int
_testAssertsFailed
;
extern
int
_testAssertsFailed
;
extern
int
_testAssertsPassed
;
extern
int
_testAssertsPassed
;
extern
AssertFp
testAssert
;
// \todo Should these be consts?
// \todo Should these be consts?
#define TEST_ENABLED 1
#define TEST_ENABLED 1
#define TEST_DISABLED 0
#define TEST_DISABLED 0
...
@@ -56,7 +58,7 @@ typedef struct TestCaseReference {
...
@@ -56,7 +58,7 @@ typedef struct TestCaseReference {
*
*
* \param enableXMLLogging Whether or not enable xml logging
* \param enableXMLLogging Whether or not enable xml logging
*/
*/
void
_TestCaseInit
(
const
int
enableXMLLogging
);
void
_TestCaseInit
();
/*!
/*!
* Deinitializes and exits the test case
* Deinitializes and exits the test case
...
...
test/test-automation/logger.c
View file @
c003533b
...
@@ -10,58 +10,4 @@
...
@@ -10,58 +10,4 @@
#include "xml_logger.h"
#include "xml_logger.h"
#include "plain_logger.h"
#include "plain_logger.h"
//! Pointers to selected logger implementation
RunStartedFp
RunStarted
=
0
;
RunEndedFp
RunEnded
=
0
;
SuiteStartedFp
SuiteStarted
=
0
;
SuiteEndedFp
SuiteEnded
=
0
;
TestStartedFp
TestStarted
=
0
;
TestEndedFp
TestEnded
=
0
;
AssertFp
Assert
=
0
;
AssertWithValuesFp
AssertWithValues
=
0
;
AssertSummaryFp
AssertSummary
=
0
;
LogFp
Log
=
0
;
/*!
* Sets up the XML logger
*/
int
SetupXMLLogger
()
{
RunStarted
=
XMLRunStarted
;
RunEnded
=
XMLRunEnded
;
SuiteStarted
=
XMLSuiteStarted
;
SuiteEnded
=
XMLSuiteEnded
;
TestStarted
=
XMLTestStarted
;
TestEnded
=
XMLTestEnded
;
Assert
=
XMLAssert
;
AssertWithValues
=
XMLAssertWithValues
;
AssertSummary
=
XMLAssertSummary
;
Log
=
XMLLog
;
}
/*!
* Sets up the plain logger
*/
int
SetupPlainLogger
()
{
RunStarted
=
PlainRunStarted
;
RunEnded
=
PlainRunEnded
;
SuiteStarted
=
PlainSuiteStarted
;
SuiteEnded
=
PlainSuiteEnded
;
TestStarted
=
PlainTestStarted
;
TestEnded
=
PlainTestEnded
;
Assert
=
PlainAssert
;
AssertWithValues
=
PlainAssertWithValues
;
AssertSummary
=
PlainAssertSummary
;
Log
=
PlainLog
;
}
test/test-automation/logger.h
View file @
c003533b
...
@@ -55,6 +55,7 @@ typedef void (*LogFp)(const char *logMessage, time_t eventTime);
...
@@ -55,6 +55,7 @@ typedef void (*LogFp)(const char *logMessage, time_t eventTime);
/*! Function pointers to actual logging function implementations */
/*! Function pointers to actual logging function implementations */
extern
RunStartedFp
RunStarted
;
extern
RunStartedFp
RunStarted
;
extern
RunEndedFp
RunEnded
;
extern
RunEndedFp
RunEnded
;
extern
SuiteStartedFp
SuiteStarted
;
extern
SuiteStartedFp
SuiteStarted
;
...
...
test/test-automation/plain_logger.c
View file @
c003533b
...
@@ -9,8 +9,6 @@
...
@@ -9,8 +9,6 @@
#include "logger_helpers.h"
#include "logger_helpers.h"
#include "plain_logger.h"
#include "plain_logger.h"
static
int
indentLevel
;
static
int
indentLevel
;
/*!
/*!
...
...
test/test-automation/runner.c
View file @
c003533b
...
@@ -31,12 +31,15 @@
...
@@ -31,12 +31,15 @@
#include "config.h"
#include "config.h"
#include "SDL_test.h"
#include "SDL_test.h"
#include "plain_logger.h"
#include "xml_logger.h"
#include "logger.h"
#include "logger.h"
//!< Function pointer to a test case function
//!< Function pointer to a test case function
typedef
void
(
*
TestCaseFp
)(
void
*
arg
);
typedef
void
(
*
TestCaseFp
)(
void
*
arg
);
//!< Function pointer to a test case init function
//!< Function pointer to a test case init function
typedef
void
(
*
TestCaseInitFp
)(
const
int
);
typedef
void
(
*
TestCaseInitFp
)(
void
);
//!< Function pointer to a test case quit function
//!< Function pointer to a test case quit function
typedef
int
(
*
TestCaseQuitFp
)(
void
);
typedef
int
(
*
TestCaseQuitFp
)(
void
);
...
@@ -117,6 +120,18 @@ TestCaseInitFp LoadTestCaseInitFunction(void *suite);
...
@@ -117,6 +120,18 @@ TestCaseInitFp LoadTestCaseInitFunction(void *suite);
TestCaseQuitFp
LoadTestCaseQuitFunction
(
void
*
suite
);
TestCaseQuitFp
LoadTestCaseQuitFunction
(
void
*
suite
);
TestCaseReference
**
QueryTestCaseReferences
(
void
*
library
);
TestCaseReference
**
QueryTestCaseReferences
(
void
*
library
);
/*! Pointers to selected logger implementation */
RunStartedFp
RunStarted
=
NULL
;
RunEndedFp
RunEnded
=
NULL
;
SuiteStartedFp
SuiteStarted
=
NULL
;
SuiteEndedFp
SuiteEnded
=
NULL
;
TestStartedFp
TestStarted
=
NULL
;
TestEndedFp
TestEnded
=
NULL
;
AssertFp
Assert
=
NULL
;
AssertWithValuesFp
AssertWithValues
=
NULL
;
AssertSummaryFp
AssertSummary
=
NULL
;
LogFp
Log
=
NULL
;
/*!
/*!
* Goes through the previously loaded test suites and
* Goes through the previously loaded test suites and
...
@@ -501,7 +516,8 @@ HandleChildProcessReturnValue(int stat_lock)
...
@@ -501,7 +516,8 @@ HandleChildProcessReturnValue(int stat_lock)
returnValue
=
WEXITSTATUS
(
stat_lock
);
returnValue
=
WEXITSTATUS
(
stat_lock
);
}
else
if
(
WIFSIGNALED
(
stat_lock
))
{
}
else
if
(
WIFSIGNALED
(
stat_lock
))
{
int
signal
=
WTERMSIG
(
stat_lock
);
int
signal
=
WTERMSIG
(
stat_lock
);
fprintf
(
stderr
,
"FAILURE: test was aborted due to signal no %d
\n
"
,
signal
);
// \todo add this to logger
//fprintf(stderr, "FAILURE: test was aborted due to signal no %d\n", signal);
returnValue
=
1
;
returnValue
=
1
;
}
}
...
@@ -520,7 +536,7 @@ int
...
@@ -520,7 +536,7 @@ int
ExecuteTest
(
TestCase
*
testItem
)
{
ExecuteTest
(
TestCase
*
testItem
)
{
int
retVal
=
1
;
int
retVal
=
1
;
if
(
execute_inproc
)
{
if
(
execute_inproc
)
{
testItem
->
testCaseInit
(
xml_enabled
);
testItem
->
testCaseInit
();
testItem
->
testCase
(
0x0
);
testItem
->
testCase
(
0x0
);
...
@@ -528,7 +544,7 @@ ExecuteTest(TestCase *testItem) {
...
@@ -528,7 +544,7 @@ ExecuteTest(TestCase *testItem) {
}
else
{
}
else
{
int
childpid
=
fork
();
int
childpid
=
fork
();
if
(
childpid
==
0
)
{
if
(
childpid
==
0
)
{
testItem
->
testCaseInit
(
xml_enabled
);
testItem
->
testCaseInit
();
testItem
->
testCase
(
0x0
);
testItem
->
testCase
(
0x0
);
...
@@ -692,7 +708,20 @@ main(int argc, char *argv[])
...
@@ -692,7 +708,20 @@ main(int argc, char *argv[])
void
*
loggerData
=
NULL
;
void
*
loggerData
=
NULL
;
if
(
xml_enabled
)
{
if
(
xml_enabled
)
{
SetupXMLLogger
();
RunStarted
=
XMLRunStarted
;
RunEnded
=
XMLRunEnded
;
SuiteStarted
=
XMLSuiteStarted
;
SuiteEnded
=
XMLSuiteEnded
;
TestStarted
=
XMLTestStarted
;
TestEnded
=
XMLTestEnded
;
Assert
=
XMLAssert
;
AssertWithValues
=
XMLAssertWithValues
;
AssertSummary
=
XMLAssertSummary
;
Log
=
XMLLog
;
char
*
sheet
=
NULL
;
char
*
sheet
=
NULL
;
if
(
xsl_enabled
)
{
if
(
xsl_enabled
)
{
...
@@ -705,7 +734,20 @@ main(int argc, char *argv[])
...
@@ -705,7 +734,20 @@ main(int argc, char *argv[])
loggerData
=
sheet
;
loggerData
=
sheet
;
}
else
{
}
else
{
SetupPlainLogger
();
RunStarted
=
PlainRunStarted
;
RunEnded
=
PlainRunEnded
;
SuiteStarted
=
PlainSuiteStarted
;
SuiteEnded
=
PlainSuiteEnded
;
TestStarted
=
PlainTestStarted
;
TestEnded
=
PlainTestEnded
;
Assert
=
PlainAssert
;
AssertWithValues
=
PlainAssertWithValues
;
AssertSummary
=
PlainAssertSummary
;
Log
=
PlainLog
;
}
}
const
Uint32
startTicks
=
SDL_GetTicks
();
const
Uint32
startTicks
=
SDL_GetTicks
();
...
...
test/test-automation/testplatform/Makefile.in
deleted
100644 → 0
View file @
f51d1376
This diff is collapsed.
Click to expand it.
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