diff options
author | Markus Kauppila <markus.kauppila@gmail.com> | 2011-07-18 22:26:26 +0300 |
---|---|---|
committer | Markus Kauppila <markus.kauppila@gmail.com> | 2011-07-18 22:26:26 +0300 |
commit | 9932ea0a03fa0e524d4e092957f726ee65b2452a (patch) | |
tree | 810a72605836271574f37121596b540fc2b08119 | |
parent | 7d9bdb201b4e053b436d2b2e395b00fc13d6326b (diff) |
Testing out implementation for skipping unsupported test
automatically.
-rw-r--r-- | include/SDL_revision.h | 4 | ||||
-rw-r--r-- | test/test-automation/Makefile.am | 2 | ||||
-rw-r--r-- | test/test-automation/SDL_test.h | 6 | ||||
-rw-r--r-- | test/test-automation/runner.c | 7 | ||||
-rw-r--r-- | test/test-automation/support.c | 51 | ||||
-rw-r--r-- | test/test-automation/support.h | 31 | ||||
-rw-r--r-- | test/test-automation/testaudio/testaudio.c | 10 |
7 files changed, 101 insertions, 10 deletions
diff --git a/include/SDL_revision.h b/include/SDL_revision.h index a88e2aa45e..6e455f11a4 100644 --- a/include/SDL_revision.h +++ b/include/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-5546:cd2167525827" -#define SDL_REVISION_NUMBER 5546 +#define SDL_REVISION "hg-5659:3f908b34b645" +#define SDL_REVISION_NUMBER 5659 diff --git a/test/test-automation/Makefile.am b/test/test-automation/Makefile.am index 5c1c26f3d9..b76e3a186d 100644 --- a/test/test-automation/Makefile.am +++ b/test/test-automation/Makefile.am @@ -3,7 +3,7 @@ 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 +runner_SOURCES = runner.c SDL_test.c xml_logger.c plain_logger.c xml.c logger_helpers.c support.c runner_CLAGS = -W -Wall -Wextra -g `sdl-config --cflags` -DSDL_NO_COMPAT runner_LDFLAGS = `sdl-config --libs` diff --git a/test/test-automation/SDL_test.h b/test/test-automation/SDL_test.h index 26a40c170c..428d2dee41 100644 --- a/test/test-automation/SDL_test.h +++ b/test/test-automation/SDL_test.h @@ -21,8 +21,6 @@ #ifndef _SDL_TEST_H #define _SDL_TEST_H -#include <SDL/SDL.h> - #include "logger.h" #include "common/common.h" @@ -39,6 +37,7 @@ extern AssertFp testAssert; #define TEST_ENABLED 1 #define TEST_DISABLED 0 +//! Definition of all the possible test results #define TEST_RESULT_PASS 0 #define TEST_RESULT_FAILURE 1 #define TEST_RESULT_NO_ASSERT 2 @@ -46,6 +45,9 @@ extern AssertFp testAssert; #define TEST_RESULT_KILLED 4 #define TEST_RESULT_SETUP_FAILURE 5 +//! Definitions for test requirements +#define TEST_REQUIRES_AUDIO 1 + /*! * Holds information about a test case */ diff --git a/test/test-automation/runner.c b/test/test-automation/runner.c index 612d958953..7b8dd0ae77 100644 --- a/test/test-automation/runner.c +++ b/test/test-automation/runner.c @@ -35,6 +35,7 @@ #include "plain_logger.h" #include "xml_logger.h" #include "logger.h" +#include "support.h" //!< Function pointer to a test case function typedef void (*TestCaseFp)(void *arg); @@ -438,6 +439,12 @@ FilterTestCase(TestCaseReference *testReference) } } + if(testReference->requirements & TEST_REQUIRES_AUDIO) { + //printf("Debug: checking for audio support.\n"); + retVal = PlatformSupportsAudio(); + //printf("Debug: Audio support: %d\n", retVal); + } + return retVal; } diff --git a/test/test-automation/support.c b/test/test-automation/support.c new file mode 100644 index 0000000000..e620c772cd --- /dev/null +++ b/test/test-automation/support.c @@ -0,0 +1,51 @@ +/* + 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. +*/ + +#include "support.h" + +#include <SDL/SDL_config.h> + +int +PlatformSupportsAudio() +{ + int retValue = 0; + +#ifdef SDL_AUDIO_DRIVER_COREAUDIO + retValue = 1; +#endif +#ifdef SDL_AUDIO_DRIVER_OSS + retValue = 1; +#endif + + return retValue; +} + +/* +int +PlatformSupportsOpenGL() { + int retValue = 0; +#define SDL_VIDEO_OPENGL + retValue = 1; +#endif + + return retValue; +} + +*/ diff --git a/test/test-automation/support.h b/test/test-automation/support.h new file mode 100644 index 0000000000..2218ccaa58 --- /dev/null +++ b/test/test-automation/support.h @@ -0,0 +1,31 @@ +/* + 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 _SUPPORT_H +#define _SUPPORT_H + +/*! + * Checks if platform supports audio. + * + * \return 1 if audio is supported, otherwise 0 + */ +int PlatformSupportsAudio(); + +#endif diff --git a/test/test-automation/testaudio/testaudio.c b/test/test-automation/testaudio/testaudio.c index c4ce4c07a3..b608ce53fb 100644 --- a/test/test-automation/testaudio/testaudio.c +++ b/test/test-automation/testaudio/testaudio.c @@ -8,18 +8,18 @@ #include "../SDL_test.h" -/* Test casess */ +/* Test cases */ static const TestCaseReference test1 = - (TestCaseReference){ "audio_printOutputDevices", "Checks available output (non-capture) device names.", TEST_ENABLED, 0, 0}; + (TestCaseReference){ "audio_printOutputDevices", "Checks available output (non-capture) device names.", TEST_ENABLED, TEST_REQUIRES_AUDIO, 0}; static const TestCaseReference test2 = - (TestCaseReference){ "audio_printInputDevices", "Checks available input (capture) device names.", TEST_ENABLED, 0, 0}; + (TestCaseReference){ "audio_printInputDevices", "Checks available input (capture) device names.", TEST_ENABLED, TEST_REQUIRES_AUDIO, 0}; static const TestCaseReference test3 = - (TestCaseReference){ "audio_printAudioDrivers", "Checks available audio driver names.", TEST_ENABLED, 0, 0}; + (TestCaseReference){ "audio_printAudioDrivers", "Checks available audio driver names.", TEST_ENABLED, TEST_REQUIRES_AUDIO, 0}; static const TestCaseReference test4 = - (TestCaseReference){ "audio_printCurrentAudioDriver", "Checks current audio driver name with initialized audio.", TEST_ENABLED, 0, 0}; + (TestCaseReference){ "audio_printCurrentAudioDriver", "Checks current audio driver name with initialized audio.", TEST_ENABLED, TEST_REQUIRES_AUDIO, 0}; /* Test suite */ extern const TestCaseReference *testSuite[] = { |