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
891b80a6
Commit
891b80a6
authored
Jul 04, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added command option --version
parent
ec1a464d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
21 deletions
+36
-21
plain_logger.c
test/test-automation/plain_logger.c
+23
-14
runner.c
test/test-automation/runner.c
+12
-6
xml_logger.c
test/test-automation/xml_logger.c
+1
-1
No files found.
test/test-automation/plain_logger.c
View file @
891b80a6
...
...
@@ -9,17 +9,24 @@
#include "plain_logger.h"
static
int
indentLevel
;
/*!
* Prints out the output of the logger
*
* \param message The message to be printed out
*/
int
Output
(
const
char
*
message
,
...)
Output
(
const
int
currentIdentLevel
,
const
char
*
message
,
...)
{
va_list
list
;
va_start
(
list
,
message
);
int
ident
=
0
;
for
(
;
ident
<
currentIdentLevel
;
++
ident
)
{
fprintf
(
stdout
,
" "
);
// \todo make configurable?
}
char
buffer
[
1024
];
SDL_vsnprintf
(
buffer
,
sizeof
(
buffer
),
message
,
list
);
...
...
@@ -46,30 +53,32 @@ void
PlainRunEnded
(
int
testCount
,
int
suiteCount
,
int
testPassCount
,
int
testFailCount
,
time_t
endTime
,
double
totalRuntime
)
{
Output
(
"
\n
Ran %d tests in %0.5f seconds from %d suites."
,
Output
(
indentLevel
,
"
\n
Ran %d tests in %0.5f seconds from %d suites."
,
testCount
,
totalRuntime
,
suiteCount
);
Output
(
"%d tests passed"
,
testPassCount
);
Output
(
"%d tests failed"
,
testFailCount
);
Output
(
indentLevel
,
"%d tests passed"
,
testPassCount
);
Output
(
indentLevel
,
"%d tests failed"
,
testFailCount
);
}
void
PlainSuiteStarted
(
const
char
*
suiteName
,
time_t
eventTime
)
{
Output
(
"Executing tests from %s"
,
suiteName
);
Output
(
indentLevel
++
,
"Executing tests from %s"
,
suiteName
);
}
void
PlainSuiteEnded
(
int
testsPassed
,
int
testsFailed
,
int
testsSkipped
,
time_t
endTime
,
double
totalRuntime
)
{
Output
(
"Suite executed. %d passed, %d failed and %d skipped"
,
testsPassed
,
testsFailed
,
testsSkipped
);
Output
(
--
indentLevel
,
"Suite executed. %d passed, %d failed and %d skipped. Total runtime %0.5f seconds"
,
testsPassed
,
testsFailed
,
testsSkipped
,
totalRuntime
);
Output
(
indentLevel
,
""
);
}
void
PlainTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
const
char
*
testDescription
,
time_t
startTime
)
{
Output
(
"%s (in %s) started"
,
testName
,
suiteName
);
Output
(
indentLevel
++
,
"%s (in %s) started"
,
testName
,
suiteName
);
}
void
...
...
@@ -78,12 +87,12 @@ PlainTestEnded(const char *testName, const char *suiteName,
{
if
(
testResult
)
{
if
(
testResult
==
2
)
{
Output
(
"%s: failed -> no assert"
,
testName
);
Output
(
--
indentLevel
,
"%s: failed -> no assert"
,
testName
);
}
else
{
Output
(
"%s: failed"
,
testName
);
Output
(
--
indentLevel
,
"%s: failed"
,
testName
);
}
}
else
{
Output
(
"%s: ok"
,
testName
);
Output
(
--
indentLevel
,
"%s: ok"
,
testName
);
}
}
...
...
@@ -92,7 +101,7 @@ PlainAssert(const char *assertName, int assertResult, const char *assertMessage,
time_t
eventTime
)
{
const
char
*
result
=
(
assertResult
)
?
"passed"
:
"failed"
;
Output
(
"%s: %s"
,
assertName
,
assertMessage
);
Output
(
indentLevel
,
"%s: %s"
,
assertName
,
assertMessage
);
}
void
...
...
@@ -100,20 +109,20 @@ PlainAssertWithValues(const char *assertName, int assertResult, const char *asse
int
actualValue
,
int
excpected
,
time_t
eventTime
)
{
const
char
*
result
=
(
assertResult
)
?
"passed"
:
"failed"
;
Output
(
"%s %d: %s"
,
assertName
,
assertResult
,
assertMessage
);
Output
(
indentLevel
,
"%s %d: %s"
,
assertName
,
assertResult
,
assertMessage
);
}
void
PlainAssertSummary
(
int
numAsserts
,
int
numAssertsFailed
,
int
numAssertsPass
,
time_t
eventTime
)
{
Output
(
"Assert summary: %d failed, %d passed (total: %d)"
,
Output
(
indentLevel
,
"Assert summary: %d failed, %d passed (total: %d)"
,
numAssertsFailed
,
numAssertsPass
,
numAsserts
);
}
void
PlainLog
(
const
char
*
logMessage
,
time_t
eventTime
)
{
Output
(
"%s %d"
,
logMessage
,
eventTime
);
Output
(
indentLevel
,
"%s %d"
,
logMessage
,
eventTime
);
}
#endif
test/test-automation/runner.c
View file @
891b80a6
...
...
@@ -28,6 +28,8 @@
#include <sys/types.h>
#include "config.h"
#include "SDL_test.h"
#include "logger.h"
...
...
@@ -547,7 +549,7 @@ ExecuteTest(TestCase *testItem) {
* Prints usage information
*/
void
p
rintUsage
()
{
P
rintUsage
()
{
printf
(
"Usage: ./runner [--in-proc] [--suite SUITE] [--test TEST]
\n
"
);
printf
(
" [--name-contains SUBSTR] [--show-tests]
\n
"
);
printf
(
" [--xml] [--xsl [STYLESHEET]] [--help]
\n
"
);
...
...
@@ -597,7 +599,7 @@ ParseOptions(int argc, char *argv[])
testName
=
argv
[
++
i
];
}
else
{
printf
(
"runner: test name is missing
\n
"
);
p
rintUsage
();
P
rintUsage
();
exit
(
1
);
}
...
...
@@ -625,7 +627,7 @@ ParseOptions(int argc, char *argv[])
substring
=
argv
[
++
i
];
}
else
{
printf
(
"runner: substring of test name is missing
\n
"
);
p
rintUsage
();
P
rintUsage
();
exit
(
1
);
}
...
...
@@ -640,20 +642,24 @@ ParseOptions(int argc, char *argv[])
suiteName
=
argv
[
++
i
];
}
else
{
printf
(
"runner: suite name is missing
\n
"
);
p
rintUsage
();
P
rintUsage
();
exit
(
1
);
}
memset
(
selected_suite_name
,
0
,
NAME_BUFFER_SIZE
);
strcpy
(
selected_suite_name
,
suiteName
);
}
else
if
(
SDL_strcmp
(
arg
,
"--version"
)
==
0
)
{
fprintf
(
stdout
,
"SDL test harness (version %s)
\n
"
,
PACKAGE_VERSION
);
exit
(
0
);
}
else
if
(
SDL_strcmp
(
arg
,
"--help"
)
==
0
||
SDL_strcmp
(
arg
,
"-h"
)
==
0
)
{
p
rintUsage
();
P
rintUsage
();
exit
(
0
);
}
else
{
printf
(
"runner: unknown command '%s'
\n
"
,
arg
);
p
rintUsage
();
P
rintUsage
();
exit
(
0
);
}
}
...
...
test/test-automation/xml_logger.c
View file @
891b80a6
...
...
@@ -85,7 +85,7 @@ XMLOutputter(const int currentIdentLevel,
if
(
ValidateString
(
message
))
{
int
ident
=
0
;
for
(
;
ident
<
currentIdentLevel
&&
prevEOL
;
++
ident
)
{
printf
(
" "
);
// \todo make configurable?
fprintf
(
stdout
,
" "
);
// \todo make configurable?
}
prevEOL
=
EOL
;
...
...
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