From a70c5c1f3d4df56187f9c804a690e12d7349753a Mon Sep 17 00:00:00 2001 From: Markus Kauppila Date: Sat, 6 Aug 2011 18:00:10 +0300 Subject: [PATCH] Runner is automatically installed to . --- test/test-automation/Makefile.am | 6 +++-- .../build-scripts/install-runner.sh | 8 +++++++ test/test-automation/src/runner/runner.c | 24 +++++++++++++------ 3 files changed, 29 insertions(+), 9 deletions(-) create mode 100755 test/test-automation/build-scripts/install-runner.sh diff --git a/test/test-automation/Makefile.am b/test/test-automation/Makefile.am index 618034aa7..74aa0a3ca 100644 --- a/test/test-automation/Makefile.am +++ b/test/test-automation/Makefile.am @@ -9,8 +9,10 @@ SUBDIRS = src/libtest src/runner \ tests/testrwops \ tests/testrender -all-local: install-tests -install: install-tests +all-local: install +install: install-runner install-tests +install-runner: + $(SHELL) build-scripts/install-runner.sh install-tests: $(SHELL) build-scripts/install-tests.sh diff --git a/test/test-automation/build-scripts/install-runner.sh b/test/test-automation/build-scripts/install-runner.sh new file mode 100755 index 000000000..575f888e4 --- /dev/null +++ b/test/test-automation/build-scripts/install-runner.sh @@ -0,0 +1,8 @@ +#! /bin/bash + +#echo "Installing test suites to $DIRECTORY" + +cp src/runner/.libs/runner . +chmod u+x runner + +echo "Runner installed." diff --git a/test/test-automation/src/runner/runner.c b/test/test-automation/src/runner/runner.c index e6df6d1fb..3c1bc2786 100644 --- a/test/test-automation/src/runner/runner.c +++ b/test/test-automation/src/runner/runner.c @@ -234,7 +234,7 @@ ScanForTestSuites(char *directoryName, char *extension) while(entry = readdir(directory)) { // discards . and .. and hidden files starting with . - if(strlen(entry->d_name) > 2 && entry->d_name[0] != '.') { + if(strlen(entry->d_name) > 2 && entry->d_name[0] != '.' && entry->d_type == DT_REG) { const char *delimiters = "."; char *name = strtok(entry->d_name, delimiters); char *ext = strtok(NULL, delimiters); @@ -360,9 +360,14 @@ UnloadTestSuites(TestSuiteReference *suites) { TestSuiteReference *ref = suites; while(ref) { - SDL_free(ref->name); - SDL_free(ref->directoryPath); - SDL_UnloadObject(ref->library); + if(ref->name) + SDL_free(ref->name); + + if(ref->directoryPath) + SDL_free(ref->directoryPath); + + if(ref->library) + SDL_UnloadObject(ref->library); TestSuiteReference *temp = ref->next; SDL_free(ref); @@ -480,9 +485,14 @@ UnloadTestCases(TestCase *testCases) { TestCase *ref = testCases; while(ref) { - SDL_free(ref->testName); - SDL_free(ref->suiteName); - SDL_free(ref->description); + if(ref->testName) + SDL_free(ref->testName); + + if(ref->suiteName) + SDL_free(ref->suiteName); + + if(ref->description) + SDL_free(ref->description); TestCase *temp = ref->next; SDL_free(ref);