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
e6997f70
Commit
e6997f70
authored
Jul 28, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed an issue with fuzzing seeds.
parent
ed4e1582
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
30 deletions
+29
-30
install-tests.sh
test/test-automation/build-scripts/install-tests.sh
+1
-1
fuzzer.c
test/test-automation/fuzzer/fuzzer.c
+12
-15
fuzzer.h
test/test-automation/fuzzer/fuzzer.h
+2
-2
logger.h
test/test-automation/logger.h
+2
-2
plain_logger.c
test/test-automation/plain_logger.c
+1
-1
plain_logger.h
test/test-automation/plain_logger.h
+1
-1
runner.c
test/test-automation/runner.c
+8
-6
xml_logger.c
test/test-automation/xml_logger.c
+1
-1
xml_logger.h
test/test-automation/xml_logger.h
+1
-1
No files found.
test/test-automation/build-scripts/install-tests.sh
View file @
e6997f70
...
@@ -21,6 +21,6 @@ do
...
@@ -21,6 +21,6 @@ do
cp
-f
"
$suite
/.libs/lib
$suite
.
$EXT
"
$DIRECTORY
cp
-f
"
$suite
/.libs/lib
$suite
.
$EXT
"
$DIRECTORY
done
done
sudo cp
.libs/libtest.0.dylib /usr/local/lib/libtest.0.dylib
#
sudo cp .libs/libtest.0.dylib /usr/local/lib/libtest.0.dylib
echo
"Test suites installed."
echo
"Test suites installed."
test/test-automation/fuzzer/fuzzer.c
View file @
e6997f70
...
@@ -7,14 +7,14 @@
...
@@ -7,14 +7,14 @@
//! context for test-specific random number generator
//! context for test-specific random number generator
static
RND_CTX
rndContext
;
static
RND_CTX
rndContext
;
char
*
int
GenerateExecKey
(
char
*
runSeed
,
char
*
suiteName
,
GenerateExecKey
(
char
*
runSeed
,
char
*
suiteName
,
char
*
testName
,
int
iterationNumber
)
char
*
testName
,
int
iterationNumber
)
{
{
if
(
runSeed
==
NULL
||
suiteName
==
NULL
||
if
(
runSeed
==
NULL
||
suiteName
==
NULL
||
testName
==
NULL
||
iterationNumber
<
0
)
{
testName
==
NULL
||
iterationNumber
<
0
)
{
fprintf
(
stderr
,
"Error: Incorrect parameter given to GenerateExecKey function
\n
"
);
fprintf
(
stderr
,
"Error: Incorrect parameter given to GenerateExecKey function
\n
"
);
return
NULL
;
return
-
1
;
}
}
char
iterationString
[
256
];
char
iterationString
[
256
];
...
@@ -34,14 +34,12 @@ GenerateExecKey(char *runSeed, char *suiteName,
...
@@ -34,14 +34,12 @@ GenerateExecKey(char *runSeed, char *suiteName,
char
*
buffer
=
SDL_malloc
(
entireString
);
char
*
buffer
=
SDL_malloc
(
entireString
);
if
(
!
buffer
)
{
if
(
!
buffer
)
{
return
NULL
;
return
-
1
;
}
}
SDL_snprintf
(
buffer
,
entireString
,
"%s/%s/%s/%d"
,
runSeed
,
suiteName
,
SDL_snprintf
(
buffer
,
entireString
,
"%s/%s/%s/%d"
,
runSeed
,
suiteName
,
testName
,
iterationNumber
);
testName
,
iterationNumber
);
//printf("Debug: %s", buffer);
MD5_CTX
md5Context
;
MD5_CTX
md5Context
;
utl_md5Init
(
&
md5Context
);
utl_md5Init
(
&
md5Context
);
...
@@ -50,21 +48,20 @@ GenerateExecKey(char *runSeed, char *suiteName,
...
@@ -50,21 +48,20 @@ GenerateExecKey(char *runSeed, char *suiteName,
SDL_free
(
buffer
);
SDL_free
(
buffer
);
const
int
keyLength
=
SDL_strlen
(
md5Context
.
digest
);
char
*
execKey
=
md5Context
.
digest
;
char
*
key
=
SDL_malloc
(
keyLength
);
SDL_snprintf
(
key
,
keyLength
,
"%s"
,
md5Context
.
digest
);
return
key
;
int
key
=
execKey
[
4
]
<<
24
|
execKey
[
9
]
<<
16
|
execKey
[
13
]
<<
8
|
execKey
[
3
]
<<
0
;
return
abs
(
key
);
}
}
void
void
InitFuzzer
(
char
*
execKey
)
InitFuzzer
(
int
execKey
)
{
{
//int a = execKey[8,9,10,11];
utl_randomInit
(
&
rndContext
,
execKey
,
execKey
/
0xfafafafa
);
int
a
=
execKey
[
8
]
|
execKey
[
9
]
|
execKey
[
10
]
|
execKey
[
11
];
int
b
=
execKey
[
12
]
|
execKey
[
13
]
|
execKey
[
14
]
|
execKey
[
15
];
utl_randomInit
(
&
rndContext
,
a
,
b
);
}
}
void
void
...
...
test/test-automation/fuzzer/fuzzer.h
View file @
e6997f70
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
/*!
/*!
* Inits the fuzzer for a test
* Inits the fuzzer for a test
*/
*/
void
InitFuzzer
(
char
*
execKey
);
void
InitFuzzer
(
int
execKey
);
/*!
/*!
...
@@ -113,6 +113,6 @@ char *RandomAsciiStringWithMaximumLength(int maxLength);
...
@@ -113,6 +113,6 @@ char *RandomAsciiStringWithMaximumLength(int maxLength);
* \return Generated execution key as blob of 16 bytes. It needs be deallocated.
* \return Generated execution key as blob of 16 bytes. It needs be deallocated.
* On error, returns NULL.
* On error, returns NULL.
*/
*/
char
*
GenerateExecKey
(
char
*
runSeed
,
char
*
suiteName
,
char
*
testName
,
int
interationNumber
);
int
GenerateExecKey
(
char
*
runSeed
,
char
*
suiteName
,
char
*
testName
,
int
interationNumber
);
#endif
#endif
test/test-automation/logger.h
View file @
e6997f70
...
@@ -55,7 +55,7 @@ typedef void (*SuiteEndedFp)(int testsPassed, int testsFailed, int testsSkipped,
...
@@ -55,7 +55,7 @@ typedef void (*SuiteEndedFp)(int testsPassed, int testsFailed, int testsSkipped,
time_t
endTime
,
double
totalRuntime
);
time_t
endTime
,
double
totalRuntime
);
typedef
void
(
*
TestStartedFp
)(
const
char
*
testName
,
const
char
*
suiteName
,
typedef
void
(
*
TestStartedFp
)(
const
char
*
testName
,
const
char
*
suiteName
,
const
char
*
testDescription
,
char
*
execKey
,
time_t
startTime
);
const
char
*
testDescription
,
int
execKey
,
time_t
startTime
);
typedef
void
(
*
TestEndedFp
)(
const
char
*
testName
,
const
char
*
suiteName
,
int
testResult
,
typedef
void
(
*
TestEndedFp
)(
const
char
*
testName
,
const
char
*
suiteName
,
int
testResult
,
time_t
endTime
,
double
totalRuntime
);
time_t
endTime
,
double
totalRuntime
);
...
@@ -86,7 +86,7 @@ extern AssertSummaryFp AssertSummary;
...
@@ -86,7 +86,7 @@ extern AssertSummaryFp AssertSummary;
extern
LogFp
Log
;
extern
LogFp
Log
;
//! \todo move these two away from here
//! \todo move these two away from here
extern
char
*
globalExecKey
;
extern
int
globalExecKey
;
//! Run seed for harness
//! Run seed for harness
extern
char
*
runSeed
;
extern
char
*
runSeed
;
...
...
test/test-automation/plain_logger.c
View file @
e6997f70
...
@@ -119,7 +119,7 @@ PlainSuiteEnded(int testsPassed, int testsFailed, int testsSkipped,
...
@@ -119,7 +119,7 @@ PlainSuiteEnded(int testsPassed, int testsFailed, int testsSkipped,
void
void
PlainTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
PlainTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
const
char
*
testDescription
,
char
*
execKey
,
time_t
startTime
)
const
char
*
testDescription
,
int
execKey
,
time_t
startTime
)
{
{
Output
(
indentLevel
++
,
"Executing test: %s (in %s). Exec key: %X"
,
testName
,
suiteName
,
execKey
);
Output
(
indentLevel
++
,
"Executing test: %s (in %s). Exec key: %X"
,
testName
,
suiteName
,
execKey
);
}
}
...
...
test/test-automation/plain_logger.h
View file @
e6997f70
...
@@ -60,7 +60,7 @@ void PlainSuiteEnded(int testsPassed, int testsFailed, int testsSkipped,
...
@@ -60,7 +60,7 @@ void PlainSuiteEnded(int testsPassed, int testsFailed, int testsSkipped,
* \param startTime When the test started to execute
* \param startTime When the test started to execute
*/
*/
void
PlainTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
void
PlainTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
const
char
*
testDescription
,
char
*
execKey
,
time_t
startTime
);
const
char
*
testDescription
,
int
execKey
,
time_t
startTime
);
/*!
/*!
* Prints information about the test test that was just executed
* Prints information about the test test that was just executed
...
...
test/test-automation/runner.c
View file @
e6997f70
...
@@ -112,10 +112,10 @@ char *runSeed = NULL;
...
@@ -112,10 +112,10 @@ char *runSeed = NULL;
//! Variable is used to pass the generated execution key to a test
//! Variable is used to pass the generated execution key to a test
char
*
globalExecKey
=
NULL
;
int
globalExecKey
=
0
;
//! Execution key that user supplied via command options
//! Execution key that user supplied via command options
char
*
userExecKey
=
NULL
;
int
userExecKey
=
0
;
//! How man time a test will be invocated
//! How man time a test will be invocated
int
testInvocationCount
=
1
;
int
testInvocationCount
=
1
;
...
@@ -716,7 +716,7 @@ CheckTestRequirements(TestCase *testCase)
...
@@ -716,7 +716,7 @@ CheckTestRequirements(TestCase *testCase)
* \param test result
* \param test result
*/
*/
int
int
RunTest
(
TestCase
*
testCase
,
char
*
execKey
)
RunTest
(
TestCase
*
testCase
,
int
execKey
)
{
{
if
(
!
testCase
)
{
if
(
!
testCase
)
{
return
-
1
;
return
-
1
;
...
@@ -765,7 +765,7 @@ RunTest(TestCase *testCase, char *execKey)
...
@@ -765,7 +765,7 @@ RunTest(TestCase *testCase, char *execKey)
* \return The return value of the test. Zero means success, non-zero failure.
* \return The return value of the test. Zero means success, non-zero failure.
*/
*/
int
int
ExecuteTest
(
TestCase
*
testItem
,
char
*
execKey
)
{
ExecuteTest
(
TestCase
*
testItem
,
int
execKey
)
{
int
retVal
=
-
1
;
int
retVal
=
-
1
;
if
(
execute_inproc
)
{
if
(
execute_inproc
)
{
...
@@ -1121,7 +1121,9 @@ ParseOptions(int argc, char *argv[])
...
@@ -1121,7 +1121,9 @@ ParseOptions(int argc, char *argv[])
exit
(
1
);
exit
(
1
);
}
}
userExecKey
=
execKeyString
;
// \todo User given string should be handled as a string
// representing a hex digit
userExecKey
=
atoi
(
execKeyString
);
}
}
else
if
(
SDL_strcmp
(
arg
,
"--test"
)
==
0
||
SDL_strcmp
(
arg
,
"-t"
)
==
0
)
{
else
if
(
SDL_strcmp
(
arg
,
"--test"
)
==
0
||
SDL_strcmp
(
arg
,
"-t"
)
==
0
)
{
only_selected_test
=
1
;
only_selected_test
=
1
;
...
@@ -1341,7 +1343,7 @@ main(int argc, char *argv[])
...
@@ -1341,7 +1343,7 @@ main(int argc, char *argv[])
}
}
UnloadTestCases
(
testCases
);
UnloadTestCases
(
testCases
);
UnloadTestSuites
(
suites
);
// crashes here with -ts case1
UnloadTestSuites
(
suites
);
const
Uint32
endTicks
=
SDL_GetTicks
();
const
Uint32
endTicks
=
SDL_GetTicks
();
const
double
totalRunTime
=
(
endTicks
-
startTicks
)
/
1000
.
0
f
;
const
double
totalRunTime
=
(
endTicks
-
startTicks
)
/
1000
.
0
f
;
...
...
test/test-automation/xml_logger.c
View file @
e6997f70
...
@@ -351,7 +351,7 @@ XMLSuiteEnded(int testsPassed, int testsFailed, int testsSkipped,
...
@@ -351,7 +351,7 @@ XMLSuiteEnded(int testsPassed, int testsFailed, int testsSkipped,
void
void
XMLTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
XMLTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
const
char
*
testDescription
,
char
*
execKey
,
time_t
startTime
)
const
char
*
testDescription
,
int
execKey
,
time_t
startTime
)
{
{
char
*
output
=
XMLOpenElement
(
testElementName
);
char
*
output
=
XMLOpenElement
(
testElementName
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
...
...
test/test-automation/xml_logger.h
View file @
e6997f70
...
@@ -59,7 +59,7 @@ void XMLSuiteEnded(int testsPassed, int testsFailed, int testsSkipped,
...
@@ -59,7 +59,7 @@ void XMLSuiteEnded(int testsPassed, int testsFailed, int testsSkipped,
* \param startTime When the test started to execute
* \param startTime When the test started to execute
*/
*/
void
XMLTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
void
XMLTestStarted
(
const
char
*
testName
,
const
char
*
suiteName
,
const
char
*
testDescription
,
char
*
execKey
,
time_t
startTime
);
const
char
*
testDescription
,
int
execKey
,
time_t
startTime
);
/*!
/*!
* Prints information about the test test that was just executed in XML
* Prints information about the test test that was just executed 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