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
9de66a17
Commit
9de66a17
authored
Jul 29, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed problem in ScanForTestSuites concerning hidden
files. Plus other little fixes.
parent
7b89865b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
20 deletions
+26
-20
runner.c
test/test-automation/runner.c
+26
-20
No files found.
test/test-automation/runner.c
View file @
9de66a17
...
...
@@ -219,11 +219,12 @@ ScanForTestSuites(char *directoryName, char *extension)
if
(
!
directory
)
{
fprintf
(
stderr
,
"Failed to open test suite directory: %s
\n
"
,
directoryName
);
perror
(
"Error message"
);
exit
(
1
);
exit
(
2
);
}
while
(
entry
=
readdir
(
directory
))
{
if
(
strlen
(
entry
->
d_name
)
>
2
)
{
// discards . and ..
// discards . and .. and hidden files starting with .
if
(
strlen
(
entry
->
d_name
)
>
2
&&
entry
->
d_name
[
0
]
!=
'.'
)
{
const
char
*
delimiters
=
"."
;
char
*
name
=
strtok
(
entry
->
d_name
,
delimiters
);
char
*
ext
=
strtok
(
NULL
,
delimiters
);
...
...
@@ -234,7 +235,7 @@ ScanForTestSuites(char *directoryName, char *extension)
ok
=
SDL_strncmp
(
selected_suite_name
,
name
,
NAME_BUFFER_SIZE
)
==
0
;
}
if
(
ok
&&
SDL_str
cmp
(
ext
,
extension
)
==
0
)
{
if
(
ok
&&
SDL_str
ncmp
(
ext
,
extension
,
SDL_strlen
(
extension
)
)
==
0
)
{
// create test suite reference
TestSuiteReference
*
reference
=
(
TestSuiteReference
*
)
SDL_malloc
(
sizeof
(
TestSuiteReference
));
if
(
reference
==
NULL
)
{
...
...
@@ -366,9 +367,8 @@ LoadTestCases(TestSuiteReference *suites)
TestCaseReference
*
testReference
=
NULL
;
int
counter
=
0
;
for
(
testReference
=
tests
[
counter
];
testReference
;
testReference
=
tests
[
++
counter
])
{
void
*
suite
=
suiteReference
->
library
;
for
(
testReference
=
tests
[
counter
];
testReference
;
testReference
=
tests
[
++
counter
])
{
//void *suite = suiteReference->library;
// Load test case functions
InitTestInvironmentFp
initTestEnvironment
=
LoadInitTestInvironmentFunction
(
suiteReference
->
library
);
...
...
@@ -874,7 +874,7 @@ GenerateRunSeed(const int length)
int
number
=
abs
(
utl_random
(
&
randomContext
));
char
ch
=
(
char
)
(
number
%
(
122
-
48
))
+
48
;
//
Remove
all the special characters so the run seed
//
Skip
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
)
{
...
...
@@ -1154,7 +1154,7 @@ ParseOptions(int argc, char *argv[])
}
memset
(
selected_test_name
,
0
,
NAME_BUFFER_SIZE
);
str
cpy
(
selected_test_name
,
testName
);
str
ncpy
(
selected_test_name
,
testName
,
NAME_BUFFER_SIZE
);
}
else
if
(
SDL_strcmp
(
arg
,
"--xsl"
)
==
0
)
{
xsl_enabled
=
1
;
...
...
@@ -1182,7 +1182,7 @@ ParseOptions(int argc, char *argv[])
}
memset
(
testcase_name_substring
,
0
,
NAME_BUFFER_SIZE
);
str
cpy
(
testcase_name_substring
,
substring
);
str
ncpy
(
testcase_name_substring
,
strdup
(
substring
),
NAME_BUFFER_SIZE
);
}
else
if
(
SDL_strcmp
(
arg
,
"--suite"
)
==
0
||
SDL_strcmp
(
arg
,
"-s"
)
==
0
)
{
only_selected_suite
=
1
;
...
...
@@ -1233,6 +1233,10 @@ main(int argc, char *argv[])
memcpy
(
log_basename
,
(
void
*
)
DEFAULT_LOG_FILENAME
,
SDL_strlen
(
DEFAULT_LOG_FILENAME
));
memcpy
(
log_directory
,
(
void
*
)
DEFAULT_LOG_DIRECTORY
,
SDL_strlen
(
DEFAULT_LOG_DIRECTORY
));
memset
(
selected_test_name
,
0
,
NAME_BUFFER_SIZE
);
memset
(
selected_suite_name
,
0
,
NAME_BUFFER_SIZE
);
memset
(
testcase_name_substring
,
0
,
NAME_BUFFER_SIZE
);
ParseOptions
(
argc
,
argv
);
char
*
testSuiteName
=
NULL
;
...
...
@@ -1248,16 +1252,26 @@ main(int argc, char *argv[])
runSeed
=
GenerateRunSeed
(
16
);
if
(
runSeed
==
NULL
)
{
fprintf
(
stderr
,
"Error: Generating harness seed failed
\n
"
);
return
1
;
return
2
;
}
}
const
Uint32
startTicks
=
SDL_GetTicks
();
TestSuiteReference
*
suites
=
ScanForTestSuites
(
DEFAULT_TEST_DIRECTORY
,
extension
);
if
(
suites
==
NULL
)
{
fprintf
(
stderr
,
"No test suites loaded.
\n
"
);
fprintf
(
stderr
,
"Compile you suites and install them to tests/
\n
"
);
return
2
;
}
suites
=
LoadTestSuites
(
suites
);
TestCase
*
testCases
=
LoadTestCases
(
suites
);
if
(
testCases
==
NULL
)
{
fprintf
(
stderr
,
"Found zero test cases
\n
"
);
fprintf
(
stderr
,
"Check out your command line options
\n
"
);
return
2
;
}
// if --show-tests option is given, only print tests and exit
if
(
only_print_tests
)
{
...
...
@@ -1271,13 +1285,13 @@ main(int argc, char *argv[])
LoggerData
*
loggerData
=
SetUpLogger
();
RunStarted
(
argc
,
argv
,
runSeed
,
time
(
0
),
loggerData
);
if
(
log_stdout_enabled
==
0
)
{
printf
(
"Runner is executing the tests.
\n
"
);
printf
(
"Test report is created to: %s
\n
"
,
loggerData
->
filename
);
}
RunStarted
(
argc
,
argv
,
runSeed
,
time
(
0
),
loggerData
);
// logger data is no longer used
SDL_free
(
loggerData
->
filename
);
SDL_free
(
loggerData
);
...
...
@@ -1349,14 +1363,6 @@ main(int argc, char *argv[])
TestEnded
(
testItem
->
testName
,
testItem
->
suiteName
,
retVal
,
time
(
0
),
testTotalRuntime
);
currentIteration
--
;
/*
if(userExecKey != NULL) {
SDL_free(globalExecKey);
}
globalExecKey = NULL;
*/
}
}
...
...
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