Testing out implementation for skipping unsupported test
authorMarkus Kauppila <markus.kauppila@gmail.com>
Mon, 18 Jul 2011 22:26:26 +0300
changeset 5772a6c404e897af
parent 5771 3f908b34b645
child 5773 a610795fd8fe
Testing out implementation for skipping unsupported test
automatically.
include/SDL_revision.h
test/test-automation/Makefile.am
test/test-automation/SDL_test.h
test/test-automation/runner.c
test/test-automation/support.c
test/test-automation/support.h
test/test-automation/testaudio/testaudio.c
     1.1 --- a/include/SDL_revision.h	Mon Jul 18 17:16:38 2011 +0300
     1.2 +++ b/include/SDL_revision.h	Mon Jul 18 22:26:26 2011 +0300
     1.3 @@ -1,2 +1,2 @@
     1.4 -#define SDL_REVISION "hg-5546:cd2167525827"
     1.5 -#define SDL_REVISION_NUMBER 5546
     1.6 +#define SDL_REVISION "hg-5659:3f908b34b645"
     1.7 +#define SDL_REVISION_NUMBER 5659
     2.1 --- a/test/test-automation/Makefile.am	Mon Jul 18 17:16:38 2011 +0300
     2.2 +++ b/test/test-automation/Makefile.am	Mon Jul 18 22:26:26 2011 +0300
     2.3 @@ -3,7 +3,7 @@
     2.4  SUBDIRS = testdummy testrect testplatform testaudio testsurface
     2.5  
     2.6  bin_PROGRAMS = runner
     2.7 -runner_SOURCES = runner.c SDL_test.c xml_logger.c plain_logger.c xml.c logger_helpers.c
     2.8 +runner_SOURCES = runner.c SDL_test.c xml_logger.c plain_logger.c xml.c logger_helpers.c support.c
     2.9  runner_CLAGS = -W -Wall -Wextra -g `sdl-config --cflags` -DSDL_NO_COMPAT
    2.10  runner_LDFLAGS = `sdl-config --libs` 
    2.11  
     3.1 --- a/test/test-automation/SDL_test.h	Mon Jul 18 17:16:38 2011 +0300
     3.2 +++ b/test/test-automation/SDL_test.h	Mon Jul 18 22:26:26 2011 +0300
     3.3 @@ -21,8 +21,6 @@
     3.4  #ifndef _SDL_TEST_H
     3.5  #define _SDL_TEST_H
     3.6  
     3.7 -#include <SDL/SDL.h>
     3.8 -
     3.9  #include "logger.h"
    3.10  
    3.11  #include "common/common.h"
    3.12 @@ -39,6 +37,7 @@
    3.13  #define TEST_ENABLED  1
    3.14  #define TEST_DISABLED 0
    3.15  
    3.16 +//! Definition of all the possible test results
    3.17  #define TEST_RESULT_PASS			0
    3.18  #define TEST_RESULT_FAILURE			1
    3.19  #define TEST_RESULT_NO_ASSERT		2
    3.20 @@ -46,6 +45,9 @@
    3.21  #define TEST_RESULT_KILLED			4
    3.22  #define TEST_RESULT_SETUP_FAILURE	5
    3.23  
    3.24 +//! Definitions for test requirements
    3.25 +#define TEST_REQUIRES_AUDIO 1
    3.26 +
    3.27  /*!
    3.28   * Holds information about a test case
    3.29   */
     4.1 --- a/test/test-automation/runner.c	Mon Jul 18 17:16:38 2011 +0300
     4.2 +++ b/test/test-automation/runner.c	Mon Jul 18 22:26:26 2011 +0300
     4.3 @@ -35,6 +35,7 @@
     4.4  #include "plain_logger.h"
     4.5  #include "xml_logger.h"
     4.6  #include "logger.h"
     4.7 +#include "support.h"
     4.8  
     4.9  //!< Function pointer to a test case function
    4.10  typedef void (*TestCaseFp)(void *arg);
    4.11 @@ -438,6 +439,12 @@
    4.12  		}
    4.13  	}
    4.14  
    4.15 +	if(testReference->requirements & TEST_REQUIRES_AUDIO) {
    4.16 +		//printf("Debug: checking for audio support.\n");
    4.17 +		retVal = PlatformSupportsAudio();
    4.18 +		//printf("Debug: Audio support: %d\n", retVal);
    4.19 +	}
    4.20 +
    4.21  	return retVal;
    4.22  }
    4.23  
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/test-automation/support.c	Mon Jul 18 22:26:26 2011 +0300
     5.3 @@ -0,0 +1,51 @@
     5.4 +/*
     5.5 +  Copyright (C) 2011 Markus Kauppila <markus.kauppila@gmail.com>
     5.6 +
     5.7 +  This software is provided 'as-is', without any express or implied
     5.8 +  warranty.  In no event will the authors be held liable for any damages
     5.9 +  arising from the use of this software.
    5.10 +
    5.11 +  Permission is granted to anyone to use this software for any purpose,
    5.12 +  including commercial applications, and to alter it and redistribute it
    5.13 +  freely, subject to the following restrictions:
    5.14 +
    5.15 +  1. The origin of this software must not be misrepresented; you must not
    5.16 +     claim that you wrote the original software. If you use this software
    5.17 +     in a product, an acknowledgment in the product documentation would be
    5.18 +     appreciated but is not required.
    5.19 +  2. Altered source versions must be plainly marked as such, and must not be
    5.20 +     misrepresented as being the original software.
    5.21 +  3. This notice may not be removed or altered from any source distribution.
    5.22 +*/
    5.23 +
    5.24 +#include "support.h"
    5.25 +
    5.26 +#include <SDL/SDL_config.h>
    5.27 +
    5.28 +int
    5.29 +PlatformSupportsAudio()
    5.30 +{
    5.31 +	int retValue = 0;
    5.32 +
    5.33 +#ifdef SDL_AUDIO_DRIVER_COREAUDIO
    5.34 +	retValue = 1;
    5.35 +#endif
    5.36 +#ifdef SDL_AUDIO_DRIVER_OSS
    5.37 +	retValue = 1;
    5.38 +#endif
    5.39 +
    5.40 +	return retValue;
    5.41 +}
    5.42 +
    5.43 +/*
    5.44 +int
    5.45 +PlatformSupportsOpenGL() {
    5.46 +	int retValue = 0;
    5.47 +#define SDL_VIDEO_OPENGL
    5.48 +	retValue = 1;
    5.49 +#endif
    5.50 +
    5.51 +	return retValue;
    5.52 +}
    5.53 +
    5.54 +*/
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/test/test-automation/support.h	Mon Jul 18 22:26:26 2011 +0300
     6.3 @@ -0,0 +1,31 @@
     6.4 +/*
     6.5 +  Copyright (C) 2011 Markus Kauppila <markus.kauppila@gmail.com>
     6.6 +
     6.7 +  This software is provided 'as-is', without any express or implied
     6.8 +  warranty.  In no event will the authors be held liable for any damages
     6.9 +  arising from the use of this software.
    6.10 +
    6.11 +  Permission is granted to anyone to use this software for any purpose,
    6.12 +  including commercial applications, and to alter it and redistribute it
    6.13 +  freely, subject to the following restrictions:
    6.14 +
    6.15 +  1. The origin of this software must not be misrepresented; you must not
    6.16 +     claim that you wrote the original software. If you use this software
    6.17 +     in a product, an acknowledgment in the product documentation would be
    6.18 +     appreciated but is not required.
    6.19 +  2. Altered source versions must be plainly marked as such, and must not be
    6.20 +     misrepresented as being the original software.
    6.21 +  3. This notice may not be removed or altered from any source distribution.
    6.22 +*/
    6.23 +
    6.24 +#ifndef _SUPPORT_H
    6.25 +#define _SUPPORT_H
    6.26 +
    6.27 +/*!
    6.28 + * Checks if platform supports audio.
    6.29 + *
    6.30 + * \return 1 if audio is supported, otherwise 0
    6.31 + */
    6.32 +int PlatformSupportsAudio();
    6.33 +
    6.34 +#endif
     7.1 --- a/test/test-automation/testaudio/testaudio.c	Mon Jul 18 17:16:38 2011 +0300
     7.2 +++ b/test/test-automation/testaudio/testaudio.c	Mon Jul 18 22:26:26 2011 +0300
     7.3 @@ -8,18 +8,18 @@
     7.4  
     7.5  #include "../SDL_test.h"
     7.6  
     7.7 -/* Test casess */
     7.8 +/* Test cases */
     7.9  static const TestCaseReference test1 =
    7.10 -		(TestCaseReference){ "audio_printOutputDevices", "Checks available output (non-capture) device names.", TEST_ENABLED, 0, 0};
    7.11 +		(TestCaseReference){ "audio_printOutputDevices", "Checks available output (non-capture) device names.", TEST_ENABLED, TEST_REQUIRES_AUDIO, 0};
    7.12  
    7.13  static const TestCaseReference test2 =
    7.14 -		(TestCaseReference){ "audio_printInputDevices", "Checks available input (capture) device names.", TEST_ENABLED, 0, 0};
    7.15 +		(TestCaseReference){ "audio_printInputDevices", "Checks available input (capture) device names.", TEST_ENABLED, TEST_REQUIRES_AUDIO, 0};
    7.16  
    7.17  static const TestCaseReference test3 =
    7.18 -		(TestCaseReference){ "audio_printAudioDrivers", "Checks available audio driver names.", TEST_ENABLED, 0, 0};
    7.19 +		(TestCaseReference){ "audio_printAudioDrivers", "Checks available audio driver names.", TEST_ENABLED, TEST_REQUIRES_AUDIO, 0};
    7.20  
    7.21  static const TestCaseReference test4 =
    7.22 -		(TestCaseReference){ "audio_printCurrentAudioDriver", "Checks current audio driver name with initialized audio.", TEST_ENABLED, 0, 0};
    7.23 +		(TestCaseReference){ "audio_printCurrentAudioDriver", "Checks current audio driver name with initialized audio.", TEST_ENABLED, TEST_REQUIRES_AUDIO, 0};
    7.24  
    7.25  /* Test suite */
    7.26  extern const TestCaseReference *testSuite[] =  {