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
b4a88b8b
Commit
b4a88b8b
authored
Jul 27, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added randomly generated harness seed.
parent
e7697141
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
3 deletions
+54
-3
logger.h
test/test-automation/logger.h
+1
-1
runner.c
test/test-automation/runner.c
+53
-2
No files found.
test/test-automation/logger.h
View file @
b4a88b8b
...
@@ -40,7 +40,7 @@ typedef struct LoggerData {
...
@@ -40,7 +40,7 @@ typedef struct LoggerData {
* 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
[],
char
*
runSeed
,
time_t
eventTime
,
void
*
data
);
typedef
void
(
*
RunStartedFp
)(
int
parameterCount
,
char
*
runnerParameters
[],
char
*
runSeed
,
time_t
eventTime
,
LoggerData
*
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/runner.c
View file @
b4a88b8b
...
@@ -74,6 +74,8 @@ static int xsl_enabled = 0;
...
@@ -74,6 +74,8 @@ static int xsl_enabled = 0;
static
int
universal_timeout_enabled
=
0
;
static
int
universal_timeout_enabled
=
0
;
//! Flag for enabling verbose logging
//! Flag for enabling verbose logging
static
int
enable_verbose_logger
=
0
;
static
int
enable_verbose_logger
=
0
;
//! Flag for using user supplied run seed
static
int
userRunSeed
=
0
;
//!< Size of the test and suite name buffers
//!< Size of the test and suite name buffers
...
@@ -94,15 +96,20 @@ int universal_timeout = -1;
...
@@ -94,15 +96,20 @@ int universal_timeout = -1;
//! Default directory of the test suites
//! Default directory of the test suites
#define DEFAULT_TEST_DIRECTORY "tests/"
#define DEFAULT_TEST_DIRECTORY "tests/"
//! Fuzzer seed for the harness
char
*
runSeed
=
NULL
;
//! Variable is used to pass the generated execution key to a test
char
*
globalExecKey
=
NULL
;
char
*
globalExecKey
=
NULL
;
char
*
runSeed
=
"seed"
;
//! Execution key that user supplied via command options
char
*
userExecKey
=
NULL
;
char
*
userExecKey
=
NULL
;
//! How man time a test will be invocated
//! How man time a test will be invocated
int
testInvocationCount
=
1
;
int
testInvocationCount
=
1
;
// \todo
move this upper!! (and add comments)
// \todo
add comments
int
totalTestFailureCount
=
0
,
totalTestPassCount
=
0
,
totalTestSkipCount
=
0
;
int
totalTestFailureCount
=
0
,
totalTestPassCount
=
0
,
totalTestSkipCount
=
0
;
int
testFailureCount
=
0
,
testPassCount
=
0
,
testSkipCount
=
0
;
int
testFailureCount
=
0
,
testPassCount
=
0
,
testSkipCount
=
0
;
...
@@ -804,6 +811,40 @@ HandleChildProcessReturnValue(int stat_lock)
...
@@ -804,6 +811,40 @@ HandleChildProcessReturnValue(int stat_lock)
}
}
/*!
* Generates a random run seed for the harness.
*
* \param length The length of the generated seed
*
* \returns The generated seed
*/
char
*
GenerateRunSeed
(
const
int
length
)
{
if
(
length
<=
0
)
{
fprintf
(
stderr
,
"Error: lenght of harness seed can't be less than zero
\n
"
);
return
NULL
;
}
char
*
seed
=
SDL_malloc
(
length
*
sizeof
(
8
));
if
(
seed
==
NULL
)
{
fprintf
(
stderr
,
"Error: malloc for run seed failed
\n
"
);
return
NULL
;
}
RND_CTX
randomContext
;
utl_randomInitTime
(
&
randomContext
);
int
counter
=
0
;
for
(
;
counter
<
length
;
++
counter
)
{
int
number
=
abs
(
utl_random
(
&
randomContext
));
seed
[
counter
]
=
(
char
)
(
number
%
(
127
-
34
))
+
34
;
}
return
seed
;
}
/*!
/*!
* Sets up the logger.
* Sets up the logger.
*
*
...
@@ -943,6 +984,8 @@ ParseOptions(int argc, char *argv[])
...
@@ -943,6 +984,8 @@ ParseOptions(int argc, char *argv[])
universal_timeout
=
atoi
(
timeoutString
);
universal_timeout
=
atoi
(
timeoutString
);
}
}
else
if
(
SDL_strcmp
(
arg
,
"--seed"
)
==
0
)
{
else
if
(
SDL_strcmp
(
arg
,
"--seed"
)
==
0
)
{
userRunSeed
=
1
;
if
(
(
i
+
1
)
<
argc
)
{
if
(
(
i
+
1
)
<
argc
)
{
runSeed
=
argv
[
++
i
];
runSeed
=
argv
[
++
i
];
}
else
{
}
else
{
...
@@ -1077,6 +1120,14 @@ main(int argc, char *argv[])
...
@@ -1077,6 +1120,14 @@ main(int argc, char *argv[])
char
*
extension
=
"dylib"
;
char
*
extension
=
"dylib"
;
#endif
#endif
if
(
userRunSeed
==
0
)
{
runSeed
=
GenerateRunSeed
(
16
);
if
(
runSeed
==
NULL
)
{
fprintf
(
stderr
,
"Error: Generating harness seed failed
\n
"
);
return
1
;
}
}
LoggerData
*
loggerData
=
SetUpLogger
();
LoggerData
*
loggerData
=
SetUpLogger
();
const
Uint32
startTicks
=
SDL_GetTicks
();
const
Uint32
startTicks
=
SDL_GetTicks
();
...
...
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