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

Commit

Permalink
Little fixes here and there.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed May 26, 2011
1 parent 8572e97 commit 32ed1b2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
3 changes: 2 additions & 1 deletion test/test-automation/Makefile.am
Expand Up @@ -9,6 +9,7 @@ runner_LDFLAGS = `sdl-config --libs`

install: install-tests
install-tests:
cp -f tests/.libs/*.dylib tests/
-cp -f tests/.libs/*.dylib tests/ 2> /dev/null
-cp -f tests/.libs/*.so tests/ 2> /dev/null


20 changes: 11 additions & 9 deletions test/test-automation/runner.c
Expand Up @@ -91,24 +91,26 @@ int main(int argc, char *argv[]) {
// print: Testing againts SDL version fuu (rev: bar)

int failureCount = 0, passCount = 0;
char *testname = NULL;
int counter = 0;

char *libName = "libtest";

const Uint32 startTicks = SDL_GetTicks();

void *library = LoadLibrary();
TestCaseReference **tests = QueryTestCases(library);
if(tests == NULL) {
printf("It's null\n");
} else {
printf("It's NOT null\n");
}
printf("%s name\n", tests[1]->name);

TestCaseReference *reference = NULL;
int counter = 0;

printf("DEBUG: Starting to run test\n");
fflush(stdout);

for(reference = tests[counter]; reference; reference = tests[++counter]) {
// segfaults immediately after trying to access name -> out of bounds
// all the values of reference is garbage.
char *testname = reference->name;
//char *testname = reference; // for some reason this works

for(testname = tests[counter]; testname; testname = tests[++counter]) {
printf("Running %s (in %s):\n", testname, libName);

int childpid = fork();
Expand Down
5 changes: 3 additions & 2 deletions test/test-automation/tests/Makefile.am
@@ -1,8 +1,9 @@
lib_LTLIBRARIES = libtest.la
libtest_la_SOURCES = test.c sdl_test.c
libtest_la_SOURCES = test.c SDL_test.c
libtest_la_CLAGS = -fPIC -g
libtest_la_LDFLAGS = `sdl-config --libs`

distclean-local:
rm *.dylib
-rm *.dylib
-rm *.so

4 changes: 2 additions & 2 deletions test/test-automation/tests/SDL_test.h
Expand Up @@ -24,10 +24,10 @@
#include <SDL/SDL.h>

typedef struct TestCaseReference {
int enabled; /* Set to TEST_ENABLED or TEST_DISABLED */
long requirements; /* Set to TEST_REQUIRES_OPENGL, TEST_REQUIRES_AUDIO, ... */
char *name; /* "Func2Stress" */
char *description; /* "This test beats the crap out of func2()" */
int enabled; /* Set to TEST_ENABLED or TEST_DISABLED */
long requirements; /* Set to TEST_REQUIRES_OPENGL, TEST_REQUIRES_AUDIO, ... */
} TestCaseReference;

void TestInit();
Expand Down
7 changes: 0 additions & 7 deletions test/test-automation/tests/test.c
Expand Up @@ -27,13 +27,6 @@

#include "SDL_test.h"

/*
TestCaseReference references[] = {
{.name = "hello", .description = "desc", .enabled = 1, .requirements = 0 }
};
*/


TestCaseReference *references[] = {
{"hello", "description", 1, 0},
{"hello2", "description", 1, 0},
Expand Down

0 comments on commit 32ed1b2

Please sign in to comment.