Little fixes here and there.
authorMarkus Kauppila <markus.kauppila@gmail.com>
Thu, 26 May 2011 19:57:03 +0300
changeset 5669 d6873237c96d
parent 5668 3a9b790c00e9
child 5670 bdaa6299e107
Little fixes here and there.
test/test-automation/Makefile.am
test/test-automation/runner.c
test/test-automation/tests/Makefile.am
test/test-automation/tests/SDL_test.h
test/test-automation/tests/test.c
--- a/test/test-automation/Makefile.am	Thu May 26 19:19:46 2011 +0300
+++ b/test/test-automation/Makefile.am	Thu May 26 19:57:03 2011 +0300
@@ -9,6 +9,7 @@
 
 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
 
 
--- a/test/test-automation/runner.c	Thu May 26 19:19:46 2011 +0300
+++ b/test/test-automation/runner.c	Thu May 26 19:57:03 2011 +0300
@@ -91,8 +91,6 @@
 	// print: Testing againts SDL version fuu (rev: bar)
 
 	int failureCount = 0, passCount = 0;
-	char *testname = NULL;
-	int counter = 0;
 
 	char *libName = "libtest";
 
@@ -100,15 +98,19 @@
 
 	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();
--- a/test/test-automation/tests/Makefile.am	Thu May 26 19:19:46 2011 +0300
+++ b/test/test-automation/tests/Makefile.am	Thu May 26 19:57:03 2011 +0300
@@ -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
 
--- a/test/test-automation/tests/SDL_test.h	Thu May 26 19:19:46 2011 +0300
+++ b/test/test-automation/tests/SDL_test.h	Thu May 26 19:57:03 2011 +0300
@@ -24,10 +24,10 @@
 #include <SDL/SDL.h>
 
 typedef struct TestCaseReference {
+	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, ... */
-	char *name;         /* "Func2Stress" */
-	char *description;  /* "This test beats the crap out of func2()" */
 } TestCaseReference;
 
 void TestInit();
--- a/test/test-automation/tests/test.c	Thu May 26 19:19:46 2011 +0300
+++ b/test/test-automation/tests/test.c	Thu May 26 19:57:03 2011 +0300
@@ -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},