Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Merged two heads.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed Jul 21, 2011
2 parents fa0b564 + 2d1a635 commit 8c7f144
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 22 deletions.
13 changes: 12 additions & 1 deletion test/test-automation/Makefile.am
Expand Up @@ -3,10 +3,21 @@ ACLOCAL_AMFLAGS = -I acinclude -I build-scripts
SUBDIRS = testdummy testrect testplatform testaudio testsurface

bin_PROGRAMS = runner
runner_SOURCES = runner.c SDL_test.c xml_logger.c plain_logger.c xml.c logger_helpers.c support.c
runner_SOURCES = runner.c support.c
runner_CLAGS = -W -Wall -Wextra -g `sdl-config --cflags` -DSDL_NO_COMPAT
runner_LDADD = libtest.la
runner_LDFLAGS = `sdl-config --libs`

lib_LTLIBRARIES = libtest.la
libtest_la_SOURCES = SDL_test.c logger_helpers.c plain_logger.c xml_logger.c xml.c \
common/common.c common/img_blit.c common/img_blitblend.c common/img_face.c common/img_primitives.c common/img_primitivesblend.c
libtest_la_CLAGS = -fPIC -g
libtest_la_LDFLAGS = `sdl-config --libs`

libtest: libtest.la
echo "Test library compiled."

all-local: install-tests
install: install-tests
install-tests:
$(SHELL) build-scripts/install-tests.sh
Expand Down
2 changes: 1 addition & 1 deletion test/test-automation/configure.ac
Expand Up @@ -44,4 +44,4 @@ echo ""
echo "========================================"
echo ""
echo "./configure ready!"
echo "you're ready to run: 'make && make install'"
echo "you're ready to run: 'make libtest && make'"
27 changes: 20 additions & 7 deletions test/test-automation/runner.c
Expand Up @@ -585,29 +585,39 @@ LoadCountFailedAssertsFunction(void *suite) {
* \param timeout Timeout interval in seconds!
* \param callback Function that will be called after timeout has elapsed
*/
void SetTestTimeout(int timeout, void (*callback)(int))
void
SetTestTimeout(int timeout, void (*callback)(int))
{
if(callback == NULL) {
fprintf(stderr, "Error: timeout callback can't be NULL");
}

if(timeout < 0) {
fprintf(stderr, "Error: timeout value must be bigger than zero.");
}

#if 0
int tm = (timeout > universal_timeout ? timeout : universal_timeout);

#if 1
/* Init SDL timer if not initialized before */
if(SDL_WasInit(SDL_INIT_TIMER) == 0) {
if(SDL_InitSubSystem(SDL_INIT_TIMER)) {
fprintf(stderr, "Error: Failed to init timer subsystem");
fprintf(stderr, "%s\n", SDL_GetError());
}
}

/* Note:
* SDL_Init(SDL_INIT_TIMER) should be successfully called before using this
*/
int timeoutInMilliseconds = timeout * 1000;
int timeoutInMilliseconds = tm * 1000;

SDL_TimerID timerID = SDL_AddTimer(timeoutInMilliseconds, callback, 0x0);
if(timerID == NULL) {
fprintf(stderr, "Error: Creation of SDL timer failed.\n");
fprintf(stderr, "%s\n", SDL_GetError());
fprintf(stderr, "Error: %s\n", SDL_GetError());
}
#else

int tm = (timeout > universal_timeout ? timeout : universal_timeout);

signal(SIGALRM, callback);
alarm((unsigned int) tm);
#endif
Expand Down Expand Up @@ -1075,5 +1085,8 @@ main(int argc, char *argv[])
RunEnded(totalTestPassCount + totalTestFailureCount, suiteCounter,
totalTestPassCount, totalTestFailureCount, totalTestSkipCount, time(0), totalRunTime);

// Some SDL subsystem might be init'ed so shut them down
SDL_Quit();

return (totalTestFailureCount ? 1 : 0);
}
2 changes: 1 addition & 1 deletion test/test-automation/style.xsl
Expand Up @@ -181,7 +181,7 @@ div, h1 {
<span class="title">Statistics:</span><br/>
<div class="statistics">
<span>Executed </span> <xsl:value-of select="testlog/numSuites"/> test suites. <br/>
<span>Tests in total: </span> <xsl:value-of select="testlog/numTests"/> (passed: <xsl:value-of select="testlog/numPassedTests"/>, failed: <xsl:value-of select="testlog/numFailedTests"/>)
<span>Tests in total: </span> <xsl:value-of select="testlog/numTests"/> (passed: <xsl:value-of select="testlog/numPassedTests"/>, failed: <xsl:value-of select="testlog/numFailedTests"/>, skipped: <xsl:value-of select="testlog/numSkippedTests"/>)
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions test/test-automation/testaudio/Makefile.am
@@ -1,4 +1,4 @@
lib_LTLIBRARIES = libtestaudio.la
libtestaudio_la_SOURCES = testaudio.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
libtestaudio_la_SOURCES = testaudio.c
libtestaudio_la_CLAGS = -fPIC -g
libtestaudio_la_LDFLAGS = `sdl-config --libs`
libtestaudio_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la
4 changes: 2 additions & 2 deletions test/test-automation/testdummy/Makefile.am
@@ -1,4 +1,4 @@
lib_LTLIBRARIES = libtestdummy.la
libtestdummy_la_SOURCES = testdummy.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
libtestdummy_la_SOURCES = testdummy.c
libtestdummy_la_CLAGS = -fPIC -g
libtestdummy_la_LDFLAGS = `sdl-config --libs`
libtestdummy_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la
2 changes: 1 addition & 1 deletion test/test-automation/testdummy/testdummy.c
Expand Up @@ -95,7 +95,7 @@ void
dummycase2(void *arg)
{
char *msg = "eello";
msg[0] = 'H';
//msg[0] = 'H';
AssertTrue(1, "Assert message");
}

Expand Down
4 changes: 2 additions & 2 deletions test/test-automation/testplatform/Makefile.am
@@ -1,4 +1,4 @@
lib_LTLIBRARIES = libtestplatform.la
libtestplatform_la_SOURCES = testplatform.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
libtestplatform_la_SOURCES = testplatform.c
libtestplatform_la_CLAGS = -fPIC -g
libtestplatform_la_LDFLAGS = `sdl-config --libs`
libtestplatform_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la
4 changes: 2 additions & 2 deletions test/test-automation/testrect/Makefile.am
@@ -1,4 +1,4 @@
lib_LTLIBRARIES = libtestrect.la
libtestrect_la_SOURCES = testrect.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
libtestrect_la_SOURCES = testrect.c
libtestrect_la_CLAGS = -fPIC -g
libtestrect_la_LDFLAGS = `sdl-config --libs`
libtestrect_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la
5 changes: 2 additions & 3 deletions test/test-automation/testsurface/Makefile.am
@@ -1,5 +1,4 @@
lib_LTLIBRARIES = libtestsurface.la
libtestsurface_la_SOURCES = testsurface.c ../SDL_test.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c \
../common/common.c ../common/img_blit.c ../common/img_blitblend.c ../common/img_face.c ../common/img_primitives.c ../common/img_primitivesblend.c
libtestsurface_la_SOURCES = testsurface.c
libtestsurface_la_CLAGS = -fPIC -g
libtestsurface_la_LDFLAGS = `sdl-config --libs`
libtestsurface_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la

0 comments on commit 8c7f144

Please sign in to comment.