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
ed4e1582
Commit
ed4e1582
authored
Jul 28, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made run seed more file name friendly.
parent
9e514b68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
19 deletions
+53
-19
install-tests.sh
test/test-automation/build-scripts/install-tests.sh
+2
-0
plain_logger.c
test/test-automation/plain_logger.c
+16
-3
runner.c
test/test-automation/runner.c
+32
-16
xml_logger.c
test/test-automation/xml_logger.c
+3
-0
No files found.
test/test-automation/build-scripts/install-tests.sh
View file @
ed4e1582
...
...
@@ -21,4 +21,6 @@ do
cp
-f
"
$suite
/.libs/lib
$suite
.
$EXT
"
$DIRECTORY
done
sudo cp
.libs/libtest.0.dylib /usr/local/lib/libtest.0.dylib
echo
"Test suites installed."
test/test-automation/plain_logger.c
View file @
ed4e1582
...
...
@@ -27,12 +27,17 @@ static FILE *logFile;
int
Output
(
const
int
currentIndentLevel
,
const
char
*
message
,
...)
{
if
(
logFile
==
NULL
)
{
fprintf
(
stderr
,
"logfile is NULL
\n
"
);
exit
(
3
);
}
int
indent
=
0
;
for
(
;
indent
<
currentIndentLevel
;
++
indent
)
{
fprintf
(
logFile
,
" "
);
// \todo make configurable?
}
char
buffer
[
1024
];
char
buffer
[
1024
];
memset
(
buffer
,
0
,
1024
);
va_list
list
;
...
...
@@ -41,17 +46,22 @@ Output(const int currentIndentLevel, const char *message, ...)
SDL_vsnprintf
(
buffer
,
1024
,
message
,
list
);
va_end
(
list
);
fprintf
(
logFile
,
"%s
\n
"
,
buffer
);
fflush
(
logFile
);
}
void
PlainRunStarted
(
int
parameterCount
,
char
*
runnerParameters
[],
char
*
runSeed
,
time_t
eventTime
,
LoggerData
*
data
)
{
if
(
data
==
NULL
)
{
fprintf
(
stderr
,
"Logger data is NULL
\n
"
);
exit
(
3
);
}
// Set up the logging destination
if
(
data
->
stdoutEnabled
)
{
if
(
data
->
stdoutEnabled
==
1
)
{
logFile
=
stdout
;
}
else
{
logFile
=
fopen
(
data
->
filename
,
"w"
);
...
...
@@ -61,6 +71,7 @@ PlainRunStarted(int parameterCount, char *runnerParameters[], char *runSeed,
}
}
level
=
data
->
level
;
//printf("Debug: %d == %d\n", level, data->level);
...
...
@@ -87,6 +98,8 @@ PlainRunEnded(int testCount, int suiteCount, int testPassCount, int testFailCoun
Output
(
indentLevel
,
"%d tests passed"
,
testPassCount
);
Output
(
indentLevel
,
"%d tests failed"
,
testFailCount
);
Output
(
indentLevel
,
"%d tests skipped"
,
testSkippedCount
);
fclose
(
logFile
);
}
void
...
...
test/test-automation/runner.c
View file @
ed4e1582
...
...
@@ -77,7 +77,8 @@ static int universal_timeout_enabled = 0;
static
int
enable_verbose_logger
=
0
;
//! Flag for using user supplied run seed
static
int
userRunSeed
=
0
;
//! Whether or not logger should log to stdout instead of file
static
int
log_stdout_enabled
=
0
;
//!< Size of the test and suite name buffers
#define NAME_BUFFER_SIZE 1024
...
...
@@ -119,10 +120,6 @@ char *userExecKey = NULL;
//! How man time a test will be invocated
int
testInvocationCount
=
1
;
//! Whether or not logger should log to stdout instead of file
static
int
log_stdout_enabled
=
0
;
//! Stores the basename for log files
char
log_basename
[
NAME_BUFFER_SIZE
];
...
...
@@ -859,9 +856,23 @@ GenerateRunSeed(const int length)
int
counter
=
0
;
for
(
;
counter
<
length
;
++
counter
)
{
int
number
=
abs
(
utl_random
(
&
randomContext
));
seed
[
counter
]
=
(
char
)
(
number
%
(
127
-
34
))
+
34
;
char
ch
=
(
char
)
(
number
%
(
122
-
48
))
+
48
;
// Remove all the special characters so the run seed
// can be used to form a valid filename.
// A lot more characters are skipped than necessary.
if
(
ch
>=
58
&&
ch
<=
64
)
{
ch
=
65
;
}
if
(
ch
>=
91
&&
ch
<=
96
)
{
ch
=
97
;
}
seed
[
counter
]
=
ch
;
}
seed
[
counter
]
=
'\0'
;
return
seed
;
}
...
...
@@ -878,11 +889,12 @@ SetUpLogger()
fprintf
(
stderr
,
"Error: Logger data structure not allocated."
);
return
NULL
;
}
memset
(
loggerData
,
0
,
sizeof
(
LoggerData
));
loggerData
->
level
=
(
enable_verbose_logger
?
VERBOSE
:
STANDARD
);
if
(
log_stdout_enabled
)
{
loggerData
->
stdoutEnabled
=
SDL_TRUE
;
if
(
log_stdout_enabled
==
1
)
{
loggerData
->
stdoutEnabled
=
1
;
loggerData
->
filename
=
NULL
;
}
else
{
const
char
*
extension
=
(
xml_enabled
?
"xml"
:
"log"
);
...
...
@@ -1037,6 +1049,7 @@ ParseOptions(int argc, char *argv[])
exit
(
1
);
}
memset
(
log_directory
,
0
,
NAME_BUFFER_SIZE
);
memcpy
(
log_directory
,
dirString
,
SDL_strlen
(
dirString
));
}
else
if
(
SDL_strcmp
(
arg
,
"--logfile"
)
==
0
)
{
...
...
@@ -1050,6 +1063,7 @@ ParseOptions(int argc, char *argv[])
exit
(
1
);
}
memset
(
log_basename
,
0
,
NAME_BUFFER_SIZE
);
memcpy
(
log_basename
,
fileString
,
SDL_strlen
(
fileString
));
}
else
if
(
SDL_strcmp
(
arg
,
"--log-stdout"
)
==
0
)
{
...
...
@@ -1241,6 +1255,11 @@ main(int argc, char *argv[])
RunStarted
(
argc
,
argv
,
runSeed
,
time
(
0
),
loggerData
);
// logger data is no longer used
SDL_free
(
loggerData
->
filename
);
SDL_free
(
loggerData
);
/*
// validate the parsed command options
if(execute_inproc && universal_timeout_enabled) {
Log(time(0), "Test timeout is not supported with in-proc execution.");
...
...
@@ -1248,16 +1267,12 @@ main(int argc, char *argv[])
universal_timeout_enabled = 0;
universal_timeout = -1;
}
/*
}
*/
/*
if(userExecKey && testInvocationCount > 1 || userRunSeed) {
printf("The given combination of command line options doesn't make sense\n");
printf("--exec-key should only be used to rerun failed fuzz tests\n");
}*/
// logger data is no longer used
SDL_free
(
loggerData
->
filename
);
SDL_free
(
loggerData
);
char
*
currentSuiteName
=
NULL
;
int
suiteStartTime
=
SDL_GetTicks
();
...
...
@@ -1293,9 +1308,8 @@ main(int argc, char *argv[])
if
(
userExecKey
!=
NULL
)
{
globalExecKey
=
userExecKey
;
}
else
{
char
*
execKey
=
GenerateExecKey
(
runSeed
,
testItem
->
suiteName
,
globalExecKey
=
GenerateExecKey
(
runSeed
,
testItem
->
suiteName
,
testItem
->
testName
,
currentIteration
);
globalExecKey
=
execKey
;
}
TestStarted
(
testItem
->
testName
,
testItem
->
suiteName
,
...
...
@@ -1311,10 +1325,12 @@ main(int argc, char *argv[])
currentIteration
--
;
/*
if(userExecKey != NULL) {
SDL_free(globalExecKey);
}
globalExecKey = NULL;
*/
}
}
...
...
@@ -1325,7 +1341,7 @@ main(int argc, char *argv[])
}
UnloadTestCases
(
testCases
);
UnloadTestSuites
(
suites
);
UnloadTestSuites
(
suites
);
// crashes here with -ts case1
const
Uint32
endTicks
=
SDL_GetTicks
();
const
double
totalRunTime
=
(
endTicks
-
startTicks
)
/
1000
.
0
f
;
...
...
test/test-automation/xml_logger.c
View file @
ed4e1582
...
...
@@ -257,6 +257,9 @@ XMLRunEnded(int testCount, int suiteCount, int testPassCount, int testFailCount,
output
=
XMLCloseDocument
(
documentRoot
);
XMLOutputter
(
--
indentLevel
,
YES
,
output
);
// close the log file
fclose
(
logFile
);
}
void
...
...
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