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
58ff8223
Commit
58ff8223
authored
May 23, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tiny changes to runner
parent
850eb7ba
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
29 deletions
+92
-29
.hgignore
test/test-automation/.hgignore
+1
-0
asserts.c
test/test-automation/asserts.c
+36
-0
asserts.h
test/test-automation/asserts.h
+0
-1
runner.c
test/test-automation/runner.c
+55
-28
No files found.
test/test-automation/.hgignore
View file @
58ff8223
...
@@ -21,3 +21,4 @@ runner
...
@@ -21,3 +21,4 @@ runner
# for Eclipse
# for Eclipse
.project
.project
.cproject
.cproject
.settings
test/test-automation/asserts.c
0 → 100644
View file @
58ff8223
/*
Copyright (C) 2011 Markus Kauppila <markus.kauppila@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _ASSERTS_C
#define _ASSERTS_C
#include "asserts.h"
#include <stdlib.h>
void
assertEquals
(
Uint32
expected
,
Uint32
actual
)
{
if
(
expected
!=
actual
)
{
exit
(
1
);
}
}
#endif
test/test-automation/asserts.h
View file @
58ff8223
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
#include <SDL/SDL.h>
#include <SDL/SDL.h>
void
assertEquals
(
Uint32
expected
,
Uint32
actual
);
void
assertEquals
(
Uint32
expected
,
Uint32
actual
);
#endif
#endif
test/test-automation/runner.c
View file @
58ff8223
...
@@ -18,48 +18,50 @@
...
@@ -18,48 +18,50 @@
3. This notice may not be removed or altered from any source distribution.
3. This notice may not be removed or altered from any source distribution.
*/
*/
#include "SDL/SDL
_loadso
.h"
#include "SDL/SDL.h"
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/types.h>
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
int
pid
=
getpid
();
int
testsFailed
=
0
,
testsPassed
=
0
;
// Handle command line arguments
// print: Testing againts SDL version fuu (rev: bar)
int
failureCount
=
0
,
passCount
=
0
;
const
Uint32
startTicks
=
SDL_GetTicks
();
char
*
libName
=
"libtest.so"
;
char
*
libName
=
"libtest.so"
;
printf
(
"%d: Loading .so containing tests
\n
"
,
pid
);
void
*
library
=
SDL_LoadObject
(
libName
);
void
*
library
=
SDL_LoadObject
(
libName
);
if
(
library
==
NULL
)
{
if
(
library
==
NULL
)
{
printf
(
"Loading %s failed
\n
"
,
libName
);
printf
(
"Loading %s failed
\n
"
,
libName
);
printf
(
"%s
\n
"
,
SDL_GetError
());
printf
(
"%s
\n
"
,
SDL_GetError
());
}
}
printf
(
"%d: Asking for the test case names
\n
"
,
pid
);
const
char
**
(
*
suite
)(
void
);
char
**
(
*
suite
)(
void
);
suite
=
(
const
char
**
(
*
)(
void
))
SDL_LoadFunction
(
library
,
"suite"
);
suite
=
(
char
**
(
*
)(
void
))
SDL_LoadFunction
(
library
,
"suite"
);
if
(
suite
==
NULL
)
{
if
(
suite
==
NULL
)
{
printf
(
"
%d: Retrieving test names failed, suite == NULL
\n
"
,
pid
);
printf
(
"
Retrieving test names failed, suite == NULL
\n
"
);
printf
(
"%s
\n
"
,
SDL_GetError
());
printf
(
"%s
\n
"
,
SDL_GetError
());
}
else
{
}
else
{
char
**
tests
=
suite
();
c
onst
c
har
**
tests
=
suite
();
char
*
testname
=
NULL
;
char
*
testname
=
NULL
;
int
counter
=
0
;
int
counter
=
0
;
for
(;
(
testname
=
tests
[
counter
]);
++
counter
)
{
for
(;
(
testname
=
(
char
*
)
tests
[
counter
]);
++
counter
)
{
int
childpid
=
fork
();
int
childpid
=
fork
();
if
(
childpid
==
0
)
{
pid
=
getpid
();
printf
(
"%d: Loading test: %s
\n
"
,
pid
,
testname
);
if
(
childpid
==
0
)
{
void
(
*
test
)(
void
*
arg
);
void
(
*
test
)(
void
*
arg
);
test
=
(
void
(
*
)(
void
*
))
SDL_LoadFunction
(
library
,
testname
);
test
=
(
void
(
*
)(
void
*
))
SDL_LoadFunction
(
library
,
testname
);
if
(
test
==
NULL
)
{
if
(
test
==
NULL
)
{
printf
(
"
%d: Loading test failed, tests == NULL
\n
"
,
pid
);
printf
(
"
Loading test failed, tests == NULL
\n
"
);
printf
(
"%s
\n
"
,
SDL_GetError
());
printf
(
"%s
\n
"
,
SDL_GetError
());
}
else
{
}
else
{
test
(
0x0
);
test
(
0x0
);
...
@@ -69,29 +71,54 @@ int main(int argc, char *argv[]) {
...
@@ -69,29 +71,54 @@ int main(int argc, char *argv[]) {
int
stat_lock
=
-
1
;
int
stat_lock
=
-
1
;
int
child
=
wait
(
&
stat_lock
);
int
child
=
wait
(
&
stat_lock
);
char
*
errorMsg
=
NULL
;
int
passed
=
-
1
;
if
(
WIFEXITED
(
stat_lock
))
{
if
(
WIFEXITED
(
stat_lock
))
{
int
rv
=
WEXITSTATUS
(
stat_lock
);
int
returnValue
=
WEXITSTATUS
(
stat_lock
);
printf
(
"%d: %d exited normally with value %d
\n
"
,
pid
,
child
,
rv
);
testsPassed
++
;
if
(
returnValue
==
0
)
{
passed
=
1
;
}
else
{
passed
=
0
;
}
}
else
if
(
WIFSIGNALED
(
stat_lock
))
{
}
else
if
(
WIFSIGNALED
(
stat_lock
))
{
int
signal
=
WTERMSIG
(
stat_lock
);
int
signal
=
WTERMSIG
(
stat_lock
);
printf
(
"%d: %d was killed by signal nro %d
\n
"
,
pid
,
child
,
signal
);
//printf("%d: %d was killed by signal nro %d\n", pid, child, signal);
//errorMsg =
errorMsg
=
SDL_malloc
(
256
*
sizeof
(
char
));
sprintf
(
errorMsg
,
"was aborted due to signal nro %d"
,
signal
);
testsFailed
++
;
passed
=
0
;
}
else
if
(
WIFSTOPPED
(
stat_lock
))
{
}
else
if
(
WIFSTOPPED
(
stat_lock
))
{
//int signal = WSTOPSIG(stat_lock);
//int signal = WSTOPSIG(stat_lock);
//printf("%d: %d was stopped by signal nro %d\n", pid, child, signal);
//printf("%d: %d was stopped by signal nro %d\n", pid, child, signal);
}
}
printf
(
"%s (in %s):"
,
testname
,
libName
);
if
(
passed
)
{
passCount
++
;
printf
(
"
\t
ok
\n
"
);
}
else
{
failureCount
++
;
printf
(
"
\t
failed
\n
"
);
if
(
errorMsg
)
{
printf
(
"
\t
%s
\n
"
,
errorMsg
);
SDL_free
(
errorMsg
);
}
}
}
}
}
}
}
}
printf
(
"%d: all tests executed
\n
"
,
pid
);
printf
(
"%d: %d tests passed
\n
"
,
pid
,
testsPassed
);
printf
(
"%d: %d tests failed
\n
"
,
pid
,
testsFailed
);
SDL_UnloadObject
(
library
);
SDL_UnloadObject
(
library
);
const
Uint32
endTicks
=
SDL_GetTicks
();
printf
(
"Ran %d tests in %0.3f seconds.
\n
"
,
(
passCount
+
failureCount
),
(
endTicks
-
startTicks
)
/
1000
.
0
f
);
printf
(
"all tests executed
\n
"
);
printf
(
"%d tests passed
\n
"
,
passCount
);
printf
(
"%d tests failed
\n
"
,
failureCount
);
return
0
;
return
0
;
}
}
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