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
6ab0dd49
Commit
6ab0dd49
authored
Jul 18, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to logging system.
parent
6e2972bd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
12 deletions
+31
-12
logger.h
test/test-automation/logger.h
+1
-1
plain_logger.c
test/test-automation/plain_logger.c
+10
-1
plain_logger.h
test/test-automation/plain_logger.h
+1
-1
runner.c
test/test-automation/runner.c
+5
-5
testdummy.c
test/test-automation/testdummy/testdummy.c
+1
-1
xml_logger.c
test/test-automation/xml_logger.c
+12
-2
xml_logger.h
test/test-automation/xml_logger.h
+1
-1
No files found.
test/test-automation/logger.h
View file @
6ab0dd49
...
@@ -51,7 +51,7 @@ typedef void (*AssertWithValuesFp)(const char *assertName, int assertResult,
...
@@ -51,7 +51,7 @@ typedef void (*AssertWithValuesFp)(const char *assertName, int assertResult,
typedef
void
(
*
AssertSummaryFp
)(
int
numAsserts
,
int
numAssertsFailed
,
typedef
void
(
*
AssertSummaryFp
)(
int
numAsserts
,
int
numAssertsFailed
,
int
numAssertsPass
,
time_t
eventTime
);
int
numAssertsPass
,
time_t
eventTime
);
typedef
void
(
*
LogFp
)(
const
char
*
logMessage
,
time_t
eventTime
);
typedef
void
(
*
LogFp
)(
time_t
eventTime
,
char
*
fmt
,
...
);
/*! Function pointers to actual logging function implementations */
/*! Function pointers to actual logging function implementations */
...
...
test/test-automation/plain_logger.c
View file @
6ab0dd49
...
@@ -136,8 +136,17 @@ PlainAssertSummary(int numAsserts, int numAssertsFailed, int numAssertsPass, tim
...
@@ -136,8 +136,17 @@ PlainAssertSummary(int numAsserts, int numAssertsFailed, int numAssertsPass, tim
}
}
void
void
PlainLog
(
const
char
*
logMessage
,
time_t
eventTime
)
PlainLog
(
time_t
eventTime
,
char
*
fmt
,
...
)
{
{
// create the log message
va_list
args
;
char
logMessage
[
1024
];
memset
(
logMessage
,
0
,
sizeof
(
logMessage
));
va_start
(
args
,
fmt
);
SDL_vsnprintf
(
logMessage
,
sizeof
(
logMessage
),
fmt
,
args
);
va_end
(
args
);
Output
(
indentLevel
,
"%s"
,
logMessage
);
Output
(
indentLevel
,
"%s"
,
logMessage
);
}
}
...
...
test/test-automation/plain_logger.h
View file @
6ab0dd49
...
@@ -113,6 +113,6 @@ void PlainAssertSummary(int numAsserts, int numAssertsFailed, int numAssertsPass
...
@@ -113,6 +113,6 @@ void PlainAssertSummary(int numAsserts, int numAssertsFailed, int numAssertsPass
* \param logMessage Message to be logged
* \param logMessage Message to be logged
* \param eventTime Timestamp for log message
* \param eventTime Timestamp for log message
*/
*/
void
PlainLog
(
const
char
*
logMessage
,
time_t
eventTime
);
void
PlainLog
(
time_t
eventTime
,
char
*
fmt
,
...
);
#endif
#endif
test/test-automation/runner.c
View file @
6ab0dd49
...
@@ -557,6 +557,7 @@ LoadQuitTestInvironmentFunction(void *suite) {
...
@@ -557,6 +557,7 @@ LoadQuitTestInvironmentFunction(void *suite) {
return
testEnvQuit
;
return
testEnvQuit
;
}
}
/*!
/*!
* Loads function that returns failed assert count in the current
* Loads function that returns failed assert count in the current
* test environment
* test environment
...
@@ -643,7 +644,7 @@ RunTest(TestCase *testItem)
...
@@ -643,7 +644,7 @@ RunTest(TestCase *testItem)
{
{
if
(
testItem
->
timeout
>
0
||
universal_timeout
>
0
)
{
if
(
testItem
->
timeout
>
0
||
universal_timeout
>
0
)
{
if
(
execute_inproc
)
{
if
(
execute_inproc
)
{
Log
(
"Test asked for timeout which is not supported."
,
time
(
0
)
);
Log
(
time
(
0
),
"Test asked for timeout which is not supported."
);
}
}
else
{
else
{
SetTestTimeout
(
testItem
->
timeout
,
KillHungTestInChildProcess
);
SetTestTimeout
(
testItem
->
timeout
,
KillHungTestInChildProcess
);
...
@@ -700,7 +701,6 @@ ExecuteTest(TestCase *testItem) {
...
@@ -700,7 +701,6 @@ ExecuteTest(TestCase *testItem) {
}
}
/*!
/*!
* If using out-of-proc execution of tests. This function
* If using out-of-proc execution of tests. This function
* will handle the return value of the child process
* will handle the return value of the child process
...
@@ -721,7 +721,7 @@ HandleChildProcessReturnValue(int stat_lock)
...
@@ -721,7 +721,7 @@ HandleChildProcessReturnValue(int stat_lock)
}
else
if
(
WIFSIGNALED
(
stat_lock
))
{
}
else
if
(
WIFSIGNALED
(
stat_lock
))
{
int
signal
=
WTERMSIG
(
stat_lock
);
int
signal
=
WTERMSIG
(
stat_lock
);
// \todo add this to logger (add signal number)
// \todo add this to logger (add signal number)
Log
(
"FAILURE: test was aborted due to signal
\n
"
,
time
(
0
)
);
Log
(
time
(
0
),
"FAILURE: test was aborted due to %d
\n
"
,
signal
);
returnValue
=
1
;
returnValue
=
1
;
}
}
...
@@ -972,8 +972,8 @@ main(int argc, char *argv[])
...
@@ -972,8 +972,8 @@ main(int argc, char *argv[])
RunStarted
(
argc
,
argv
,
time
(
0
),
loggerData
);
RunStarted
(
argc
,
argv
,
time
(
0
),
loggerData
);
if
(
execute_inproc
&&
universal_timeout_enabled
)
{
if
(
execute_inproc
&&
universal_timeout_enabled
)
{
Log
(
"Test timeout is not supported with in-proc execution."
,
time
(
0
)
);
Log
(
time
(
0
),
"Test timeout is not supported with in-proc execution."
);
Log
(
"Timeout will be disabled..."
,
time
(
0
)
);
Log
(
time
(
0
),
"Timeout will be disabled..."
);
universal_timeout_enabled
=
0
;
universal_timeout_enabled
=
0
;
universal_timeout
=
-
1
;
universal_timeout
=
-
1
;
...
...
test/test-automation/testdummy/testdummy.c
View file @
6ab0dd49
...
@@ -95,7 +95,7 @@ void
...
@@ -95,7 +95,7 @@ void
dummycase2
(
void
*
arg
)
dummycase2
(
void
*
arg
)
{
{
char
*
msg
=
"eello"
;
char
*
msg
=
"eello"
;
//
msg[0] = 'H';
msg
[
0
]
=
'H'
;
AssertTrue
(
1
,
"Assert message"
);
AssertTrue
(
1
,
"Assert message"
);
}
}
...
...
test/test-automation/xml_logger.c
View file @
6ab0dd49
...
@@ -571,15 +571,25 @@ XMLAssertSummary(int numAsserts, int numAssertsFailed,
...
@@ -571,15 +571,25 @@ XMLAssertSummary(int numAsserts, int numAssertsFailed,
}
}
void
void
XMLLog
(
const
char
*
logMessage
,
time_t
eventTime
)
XMLLog
(
time_t
eventTime
,
char
*
fmt
,
...
)
{
{
// create the log message
va_list
args
;
char
logMessage
[
1024
];
memset
(
logMessage
,
0
,
sizeof
(
logMessage
));
va_start
(
args
,
fmt
);
SDL_vsnprintf
(
logMessage
,
sizeof
(
logMessage
),
fmt
,
args
);
va_end
(
args
);
char
*
output
=
XMLOpenElement
(
logElementName
);
char
*
output
=
XMLOpenElement
(
logElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
// log message
// log message
output
=
XMLOpenElement
(
messageElementName
);
output
=
XMLOpenElement
(
messageElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
// fix this here!
output
=
XMLAddContent
(
logMessage
);
output
=
XMLAddContent
(
logMessage
);
XMLOutputter
(
indentLevel
,
NO
,
output
);
XMLOutputter
(
indentLevel
,
NO
,
output
);
...
...
test/test-automation/xml_logger.h
View file @
6ab0dd49
...
@@ -109,6 +109,6 @@ void XMLAssertSummary(int numAsserts, int numAssertsFailed, int numAssertsPass,
...
@@ -109,6 +109,6 @@ void XMLAssertSummary(int numAsserts, int numAssertsFailed, int numAssertsPass,
* \param logMessage Message to be logged
* \param logMessage Message to be logged
* \param eventTime Timestamp for log message
* \param eventTime Timestamp for log message
*/
*/
void
XMLLog
(
const
char
*
logMessage
,
time_t
eventTime
);
void
XMLLog
(
time_t
eventTime
,
char
*
fmt
,
...
);
#endif
#endif
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