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
46f39ab2
Commit
46f39ab2
authored
Jul 25, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Logger logs harness seed and test execution keys in hex representation.
parent
279a841b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
71 additions
and
32 deletions
+71
-32
fuzzer.c
test/test-automation/fuzzer/fuzzer.c
+2
-2
fuzzer.h
test/test-automation/fuzzer/fuzzer.h
+12
-12
logger.h
test/test-automation/logger.h
+1
-1
logger_helpers.c
test/test-automation/logger_helpers.c
+22
-2
logger_helpers.h
test/test-automation/logger_helpers.h
+2
-0
plain_logger.c
test/test-automation/plain_logger.c
+4
-3
plain_logger.h
test/test-automation/plain_logger.h
+3
-2
runner.c
test/test-automation/runner.c
+1
-2
style.xsl
test/test-automation/style.xsl
+3
-2
testdummy.c
test/test-automation/testdummy/testdummy.c
+2
-2
xml_logger.c
test/test-automation/xml_logger.c
+16
-3
xml_logger.h
test/test-automation/xml_logger.h
+3
-1
No files found.
test/test-automation/fuzzer/fuzzer.c
View file @
46f39ab2
...
@@ -50,7 +50,7 @@ GenerateExecKey(CRC32_CTX crcContext, char *runSeed, char *suiteName,
...
@@ -50,7 +50,7 @@ GenerateExecKey(CRC32_CTX crcContext, char *runSeed, char *suiteName,
utl_crc32Calc
(
&
crcContext
,
md5Context
.
digest
,
sizeof
(
md5Context
.
digest
),
&
result
);
utl_crc32Calc
(
&
crcContext
,
md5Context
.
digest
,
sizeof
(
md5Context
.
digest
),
&
result
);
return
result
;
return
abs
(
result
);
// makes sure that the key is positive
}
}
void
void
...
@@ -135,7 +135,7 @@ RandomAsciiStringWithMaximumLength(int maxSize)
...
@@ -135,7 +135,7 @@ RandomAsciiStringWithMaximumLength(int maxSize)
int
counter
=
0
;
int
counter
=
0
;
for
(
;
counter
<
size
;
++
counter
)
{
for
(
;
counter
<
size
;
++
counter
)
{
char
character
=
(
char
)
Random
Positive
IntegerInRange
(
1
,
127
);
char
character
=
(
char
)
RandomIntegerInRange
(
1
,
127
);
string
[
counter
]
=
character
;
string
[
counter
]
=
character
;
}
}
...
...
test/test-automation/fuzzer/fuzzer.h
View file @
46f39ab2
...
@@ -54,6 +54,18 @@ int RandomInteger();
...
@@ -54,6 +54,18 @@ int RandomInteger();
int
RandomPositiveInteger
();
int
RandomPositiveInteger
();
/*!
* todo add markup
*/
int
RandomUint8BoundaryValue
();
/*!
* todo add markup
*/
int
RandomInt8BoundaryValue
();
/*!
/*!
* Returns integer in range [min, max]. Min and max
* Returns integer in range [min, max]. Min and max
* value can be negative values as long as min is smaller than max.
* value can be negative values as long as min is smaller than max.
...
@@ -90,18 +102,6 @@ char *RandomAsciiString();
...
@@ -90,18 +102,6 @@ char *RandomAsciiString();
char
*
RandomAsciiStringWithMaximumLength
(
int
maxLength
);
char
*
RandomAsciiStringWithMaximumLength
(
int
maxLength
);
/*!
* todo add markup
*/
int
RandomUint8BoundaryValue
();
/*!
* todo add markup
*/
int
RandomInt8BoundaryValue
();
/*!
/*!
* Generates execution key (used for random seed) for a test
* Generates execution key (used for random seed) for a test
*
*
...
...
test/test-automation/logger.h
View file @
46f39ab2
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
* logging interface. See the headers of implementations (plain_logger.h or
* logging interface. See the headers of implementations (plain_logger.h or
* xml_logger.h) for more information.
* xml_logger.h) for more information.
*/
*/
typedef
void
(
*
RunStartedFp
)(
int
parameterCount
,
char
*
runnerParameters
[],
time_t
eventTime
,
void
*
data
);
typedef
void
(
*
RunStartedFp
)(
int
parameterCount
,
char
*
runnerParameters
[],
char
*
runSeed
,
time_t
eventTime
,
void
*
data
);
typedef
void
(
*
RunEndedFp
)(
int
testCount
,
int
suiteCount
,
int
testPassCount
,
int
testFailCount
,
typedef
void
(
*
RunEndedFp
)(
int
testCount
,
int
suiteCount
,
int
testPassCount
,
int
testFailCount
,
int
testSkippedCount
,
time_t
endTime
,
double
totalRuntime
);
int
testSkippedCount
,
time_t
endTime
,
double
totalRuntime
);
...
...
test/test-automation/logger_helpers.c
View file @
46f39ab2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#include "logger_helpers.h"
#include "logger_helpers.h"
/*!
/*!
* Helper function
s
. Turns the given integer in to a string
* Helper function. Turns the given integer in to a string
*
*
* Note: uses static buffer internally, so the return value
* Note: uses static buffer internally, so the return value
* isn't valid after the next call of this function. If you
* isn't valid after the next call of this function. If you
...
@@ -23,7 +23,27 @@ char *IntToString(const int integer) {
...
@@ -23,7 +23,27 @@ char *IntToString(const int integer) {
}
}
/*!
/*!
* Helper functions. Turns the given double value in to a string
* Helper function. Turns the given integer in to a string in
* hex format.
*
* Note: uses static buffer internally, so the return value
* isn't valid after the next call of this function. If you
* want to retain the return value, make a copy of it
*
* \param integer The converted integer
* \returns Given integer as string in hex fomat
*/
char
*
IntToHexString
(
const
int
integer
)
{
static
char
buffer
[
256
];
// malloc might work better
memset
(
buffer
,
0
,
sizeof
(
buffer
));
SDL_snprintf
(
buffer
,
sizeof
(
buffer
),
"%X"
,
integer
);
return
buffer
;
}
/*!
* Helper function. Turns the given double value in to a string
*
*
* Note: uses static buffer internally, so the return value
* Note: uses static buffer internally, so the return value
* isn't valid after the next call of this function. If you
* isn't valid after the next call of this function. If you
...
...
test/test-automation/logger_helpers.h
View file @
46f39ab2
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
char
*
IntToString
(
const
int
integer
);
char
*
IntToString
(
const
int
integer
);
char
*
IntToHexString
(
const
int
integer
);
char
*
DoubleToString
(
const
double
decimal
);
char
*
DoubleToString
(
const
double
decimal
);
char
*
TimestampToString
(
const
time_t
timestamp
);
char
*
TimestampToString
(
const
time_t
timestamp
);
...
...
test/test-automation/plain_logger.c
View file @
46f39ab2
...
@@ -37,10 +37,11 @@ Output(const int currentIndentLevel, const char *message, ...)
...
@@ -37,10 +37,11 @@ Output(const int currentIndentLevel, const char *message, ...)
}
}
void
void
PlainRunStarted
(
int
parameterCount
,
char
*
runnerParameters
[],
time_t
eventTime
,
PlainRunStarted
(
int
parameterCount
,
char
*
runnerParameters
[],
char
*
runSeed
,
void
*
data
)
time_t
eventTime
,
void
*
data
)
{
{
Output
(
indentLevel
,
"Test run started at %s"
,
TimestampToString
(
eventTime
));
Output
(
indentLevel
,
"Test run started at %s"
,
TimestampToString
(
eventTime
));
Output
(
indentLevel
,
"Fuzzer seed is %s"
,
runSeed
);
Output
(
indentLevel
,
"Runner parameters: "
);
Output
(
indentLevel
,
"Runner parameters: "
);
int
counter
=
0
;
int
counter
=
0
;
...
@@ -83,7 +84,7 @@ void
...
@@ -83,7 +84,7 @@ void
PlainTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
PlainTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
const
char
*
testDescription
,
int
execKey
,
time_t
startTime
)
const
char
*
testDescription
,
int
execKey
,
time_t
startTime
)
{
{
Output
(
indentLevel
++
,
"Executing test: %s (in %s). Exec
ution key: %d
"
,
testName
,
suiteName
,
execKey
);
Output
(
indentLevel
++
,
"Executing test: %s (in %s). Exec
key: %X
"
,
testName
,
suiteName
,
execKey
);
}
}
void
void
...
...
test/test-automation/plain_logger.h
View file @
46f39ab2
...
@@ -8,12 +8,13 @@
...
@@ -8,12 +8,13 @@
*
*
* \param parameterCount How many parameters were given
* \param parameterCount How many parameters were given
* \param runnerParameters What parameters were given to the runner
* \param runnerParameters What parameters were given to the runner
* \param runSeed Fuzzer seed of the harness
* \param eventTime When the execution started
* \param eventTime When the execution started
* \param data Any additional data logger needs
* \param data Any additional data logger needs
*
*
*/
*/
void
PlainRunStarted
(
int
parameterCount
,
char
*
runnerParameters
[],
time_t
eventTime
,
void
PlainRunStarted
(
int
parameterCount
,
char
*
runnerParameters
[],
char
*
runSeed
,
void
*
data
);
time_t
eventTime
,
void
*
data
);
/*!
/*!
* Prints out information about ending the test run.
* Prints out information about ending the test run.
...
...
test/test-automation/runner.c
View file @
46f39ab2
...
@@ -1052,7 +1052,6 @@ main(int argc, char *argv[])
...
@@ -1052,7 +1052,6 @@ main(int argc, char *argv[])
// print: Testing against SDL version fuu (rev: bar) if verbose == true
// print: Testing against SDL version fuu (rev: bar) if verbose == true
char
*
testSuiteName
=
NULL
;
char
*
testSuiteName
=
NULL
;
int
suiteCounter
=
0
;
int
suiteCounter
=
0
;
...
@@ -1081,7 +1080,7 @@ main(int argc, char *argv[])
...
@@ -1081,7 +1080,7 @@ main(int argc, char *argv[])
return
0
;
return
0
;
}
}
RunStarted
(
argc
,
argv
,
time
(
0
),
loggerData
);
RunStarted
(
argc
,
argv
,
runSeed
,
time
(
0
),
loggerData
);
if
(
execute_inproc
&&
universal_timeout_enabled
)
{
if
(
execute_inproc
&&
universal_timeout_enabled
)
{
Log
(
time
(
0
),
"Test timeout is not supported with in-proc execution."
);
Log
(
time
(
0
),
"Test timeout is not supported with in-proc execution."
);
...
...
test/test-automation/style.xsl
View file @
46f39ab2
...
@@ -169,8 +169,8 @@ div, h1 {
...
@@ -169,8 +169,8 @@ div, h1 {
<h1>
Test Report
</h1>
<h1>
Test Report
</h1>
<div>
<div>
<span
class=
"title"
>
Start time:
</span><xsl:value-of
select=
"testlog/startTime"
/><br/>
<span
class=
"title"
>
Start time:
</span><xsl:value-of
select=
"testlog/startTime"
/><br/>
<!-- and ended at <xsl:value-of select="testlog/endTime"/>.<br/>-->
<span
class=
"title"
>
Total runtime:
</span><xsl:value-of
select=
"testlog/totalRuntime"
/>
seconds.
<br/>
<span
class=
"title"
>
Total runtime:
</span><xsl:value-of
select=
"testlog/totalRuntime"
/>
seconds.
<br/>
<span
class=
"title"
>
Fuzz seed:
</span><xsl:value-of
select=
"testlog/seed"
/><br/>
<span
class=
"title"
>
Harness parameters:
</span>
<span
class=
"title"
>
Harness parameters:
</span>
<span
xml:space=
"preserve"
>
<span
xml:space=
"preserve"
>
<xsl:for-each
select=
"testlog/parameters/parameter"
>
<xsl:for-each
select=
"testlog/parameters/parameter"
>
...
@@ -184,7 +184,6 @@ div, h1 {
...
@@ -184,7 +184,6 @@ div, h1 {
<span>
Tests in total:
</span>
<xsl:value-of
select=
"testlog/numTests"
/>
(passed:
<xsl:value-of
select=
"testlog/numPassedTests"
/>
, failed:
<xsl:value-of
select=
"testlog/numFailedTests"
/>
, skipped:
<xsl:value-of
select=
"testlog/numSkippedTests"
/>
)
<span>
Tests in total:
</span>
<xsl:value-of
select=
"testlog/numTests"
/>
(passed:
<xsl:value-of
select=
"testlog/numPassedTests"
/>
, failed:
<xsl:value-of
select=
"testlog/numFailedTests"
/>
, skipped:
<xsl:value-of
select=
"testlog/numSkippedTests"
/>
)
</div>
</div>
</div>
</div>
<div>
<div>
<br/>
<br/>
<span
class=
"bigtitle"
>
Test Results
</span><br/>
<span
class=
"bigtitle"
>
Test Results
</span><br/>
...
@@ -214,6 +213,7 @@ div, h1 {
...
@@ -214,6 +213,7 @@ div, h1 {
(
<xsl:value-of
select=
"resultDescription"
/>
)
(
<xsl:value-of
select=
"resultDescription"
/>
)
</span>
</span>
</xsl:if>
</xsl:if>
- exec-key:
<xsl:value-of
select=
"executionKey"
/>
(Total runtime:
<xsl:value-of
select=
"totalRuntime"
/>
seconds)
<br/>
(Total runtime:
<xsl:value-of
select=
"totalRuntime"
/>
seconds)
<br/>
Description:
<span
class=
"description"
>
<xsl:value-of
select=
"description"
/>
</span><br/>
Description:
<span
class=
"description"
>
<xsl:value-of
select=
"description"
/>
</span><br/>
<span
class=
"switch show-asserts"
uid=
"{generate-id(assertSummary)}"
>
[Show Assert Summary]
</span><br/>
<span
class=
"switch show-asserts"
uid=
"{generate-id(assertSummary)}"
>
[Show Assert Summary]
</span><br/>
...
@@ -242,6 +242,7 @@ div, h1 {
...
@@ -242,6 +242,7 @@ div, h1 {
</body>
</body>
</html>
</html>
</xsl:template>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>
test/test-automation/testdummy/testdummy.c
View file @
46f39ab2
...
@@ -91,7 +91,7 @@ dummycase1(void *arg)
...
@@ -91,7 +91,7 @@ dummycase1(void *arg)
{
{
AssertEquals
(
5
,
5
,
"Assert message"
);
AssertEquals
(
5
,
5
,
"Assert message"
);
for
(;
1
;)
{
for
(;
0
;)
{
Log
(
0
,
"uint8: %d"
,
RandomUint8BoundaryValue
());
Log
(
0
,
"uint8: %d"
,
RandomUint8BoundaryValue
());
Log
(
0
,
"int8: %d"
,
RandomInt8BoundaryValue
());
Log
(
0
,
"int8: %d"
,
RandomInt8BoundaryValue
());
...
@@ -100,7 +100,7 @@ dummycase1(void *arg)
...
@@ -100,7 +100,7 @@ dummycase1(void *arg)
for
(;
0
;)
{
for
(;
0
;)
{
int
min
=
-
5
;
int
min
=
-
5
;
int
max
=
5
;
int
max
=
5
;
int
random
=
Random
Positive
IntegerInRange
(
min
,
max
);
int
random
=
RandomIntegerInRange
(
min
,
max
);
if
(
random
<
min
||
random
>
max
)
{
if
(
random
<
min
||
random
>
max
)
{
AssertFail
(
"Generated incorrect integer"
);
AssertFail
(
"Generated incorrect integer"
);
}
}
...
...
test/test-automation/xml_logger.c
View file @
46f39ab2
...
@@ -35,6 +35,7 @@ const char *documentRoot = "testlog";
...
@@ -35,6 +35,7 @@ const char *documentRoot = "testlog";
const
char
*
parametersElementName
=
"parameters"
;
const
char
*
parametersElementName
=
"parameters"
;
const
char
*
parameterElementName
=
"parameter"
;
const
char
*
parameterElementName
=
"parameter"
;
const
char
*
startTimeElementName
=
"startTime"
;
const
char
*
startTimeElementName
=
"startTime"
;
const
char
*
seedElementName
=
"seed"
;
const
char
*
execKeyElementName
=
"executionKey"
;
const
char
*
execKeyElementName
=
"executionKey"
;
const
char
*
numSuitesElementName
=
"numSuites"
;
const
char
*
numSuitesElementName
=
"numSuites"
;
const
char
*
numTestElementName
=
"numTests"
;
const
char
*
numTestElementName
=
"numTests"
;
...
@@ -109,14 +110,15 @@ XMLOutputter(const int currentIndentLevel,
...
@@ -109,14 +110,15 @@ XMLOutputter(const int currentIndentLevel,
}
}
void
void
XMLRunStarted
(
int
parameterCount
,
char
*
runnerParameters
[],
time_t
eventTime
,
XMLRunStarted
(
int
parameterCount
,
char
*
runnerParameters
[],
char
*
runSeed
,
void
*
data
)
time_t
eventTime
,
void
*
data
)
{
{
char
*
xslStylesheet
=
(
char
*
)
data
;
char
*
xslStylesheet
=
(
char
*
)
data
;
char
*
output
=
XMLOpenDocument
(
documentRoot
,
xslStylesheet
);
char
*
output
=
XMLOpenDocument
(
documentRoot
,
xslStylesheet
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
// log harness parameters
output
=
XMLOpenElement
(
parametersElementName
);
output
=
XMLOpenElement
(
parametersElementName
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
...
@@ -137,6 +139,17 @@ XMLRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime,
...
@@ -137,6 +139,17 @@ XMLRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime,
output
=
XMLCloseElement
(
parametersElementName
);
output
=
XMLCloseElement
(
parametersElementName
);
XMLOutputter
(
--
indentLevel
,
YES
,
output
);
XMLOutputter
(
--
indentLevel
,
YES
,
output
);
// log seed
output
=
XMLOpenElement
(
seedElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
output
=
XMLAddContent
(
runSeed
);
XMLOutputter
(
indentLevel
,
NO
,
output
);
output
=
XMLCloseElement
(
seedElementName
);
XMLOutputter
(
--
indentLevel
,
YES
,
output
);
// log start time
output
=
XMLOpenElement
(
startTimeElementName
);
output
=
XMLOpenElement
(
startTimeElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
...
@@ -340,7 +353,7 @@ XMLTestStarted(const char *testName, const char *suiteName,
...
@@ -340,7 +353,7 @@ XMLTestStarted(const char *testName, const char *suiteName,
output
=
XMLOpenElement
(
execKeyElementName
);
output
=
XMLOpenElement
(
execKeyElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
output
=
XMLAddContent
(
IntToString
(
execKey
));
output
=
XMLAddContent
(
IntTo
Hex
String
(
execKey
));
XMLOutputter
(
indentLevel
,
NO
,
output
);
XMLOutputter
(
indentLevel
,
NO
,
output
);
output
=
XMLCloseElement
(
execKeyElementName
);
output
=
XMLCloseElement
(
execKeyElementName
);
...
...
test/test-automation/xml_logger.h
View file @
46f39ab2
...
@@ -8,10 +8,12 @@
...
@@ -8,10 +8,12 @@
*
*
* \param parameterCount How many parameters were given
* \param parameterCount How many parameters were given
* \param runnerParameters What parameters were given to the runner
* \param runnerParameters What parameters were given to the runner
* \param runSeed Fuzzer seed of the harness
* \param eventTime When the execution started
* \param eventTime When the execution started
* \param data Any additional data logger needs
* \param data Any additional data logger needs
*/
*/
void
XMLRunStarted
(
int
parameterCount
,
char
*
runnerParameters
[],
time_t
eventTime
,
void
*
data
);
void
XMLRunStarted
(
int
parameterCount
,
char
*
runnerParameters
[],
char
*
runSeed
,
time_t
eventTime
,
void
*
data
);
/*!
/*!
* Prints out information about ending the test run in XML
* Prints out information about ending the test run in XML
...
...
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