diff --git a/test/test-automation/Makefile.am b/test/test-automation/Makefile.am index 75869f38a..618034aa7 100644 --- a/test/test-automation/Makefile.am +++ b/test/test-automation/Makefile.am @@ -1,31 +1,19 @@ ACLOCAL_AMFLAGS = -I acinclude -I build-scripts -SUBDIRS = testdummy testrect testplatform testaudio testsurface testrwops testrender -runnerdir = . - -bin_PROGRAMS = runner -runner_SOURCES = runner.c support.c -##nobase_runner_HEADERS = fuzzer.h logger.h plain_logger.h xml_logger.h xml.h -runner_CLAGS = -W -Wall -Wextra -g `sdl-config --cflags` -DSDL_NO_COMPAT -runner_LDADD = libtest.la -runner_LDFLAGS = `sdl-config --libs` -## -I .libs/libtest.so - -lib_LTLIBRARIES = libtest.la -libtest_la_SOURCES = SDL_test.c logger_helpers.c plain_logger.c xml_logger.c xml.c \ - common/common.c common/img_blit.c common/img_blitblend.c common/img_face.c common/img_primitives.c common/img_primitivesblend.c \ - fuzzer/utl_crc32.c fuzzer/utl_md5.c fuzzer/utl_random.c fuzzer/fuzzer.c -libtest_la_CLAGS = -fPIC -g -libtest_la_LDFLAGS = `sdl-config --libs` - -libtest: libtest.la - echo "Test library compiled." +SUBDIRS = src/libtest src/runner \ + tests/testdummy \ + tests/testrect \ + tests/testplatform \ + tests/testaudio \ + tests/testsurface \ + tests/testrwops \ + tests/testrender all-local: install-tests install: install-tests install-tests: $(SHELL) build-scripts/install-tests.sh +clean: clean-local: - -rm -Rf tests/ docs/ - + echo "clean-local is obsolete" diff --git a/test/test-automation/build-scripts/install-tests.sh b/test/test-automation/build-scripts/install-tests.sh index 7a82f2d6e..76478ac97 100755 --- a/test/test-automation/build-scripts/install-tests.sh +++ b/test/test-automation/build-scripts/install-tests.sh @@ -5,7 +5,7 @@ EXT="error" #echo "Installing test suites to $DIRECTORY" -rm -Rfv $DIRECTORY > /dev/null 2>&1 +#rm -Rfv $DIRECTORY/ > /dev/null 2>&1 mkdir $DIRECTORY > /dev/null 2>&1 PLATFORM="$(uname)" @@ -18,7 +18,7 @@ fi # TODO: put the test in an array for suite in "testdummy" "testplatform" "testrect" "testaudio" "testsurface" "testrwops" "testrender" do - cp -f "$suite/.libs/lib$suite.$EXT" $DIRECTORY + cp -f "$DIRECTORY/$suite/.libs/lib$suite.$EXT" $DIRECTORY done #sudo cp .libs/libtest.0.dylib /usr/local/lib/libtest.0.dylib diff --git a/test/test-automation/configure.ac b/test/test-automation/configure.ac index 5c2b99cc6..b55fa57c1 100644 --- a/test/test-automation/configure.ac +++ b/test/test-automation/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.65]) AC_INIT([runner], [0.01], [markus.kauppila@gmail.com]) -AC_CONFIG_SRCDIR([runner.c]) +AC_CONFIG_SRCDIR([src/runner/runner.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR(acinclude) AC_CONFIG_AUX_DIR(build-scripts) @@ -33,13 +33,15 @@ CFLAGS="-g" AC_FUNC_FORK AC_CONFIG_FILES([Makefile - testdummy/Makefile - testrect/Makefile - testplatform/Makefile - testaudio/Makefile - testsurface/Makefile - testrwops/Makefile - testrender/Makefile]) + src/runner/Makefile + src/libtest/Makefile + tests/testdummy/Makefile + tests/testrect/Makefile + tests/testplatform/Makefile + tests/testaudio/Makefile + tests/testsurface/Makefile + tests/testrwops/Makefile + tests/testrender/Makefile]) AC_OUTPUT diff --git a/test/test-automation/SDL_test.h b/test/test-automation/include/SDL_test.h similarity index 95% rename from test/test-automation/SDL_test.h rename to test/test-automation/include/SDL_test.h index 5de42f820..81ce651a3 100644 --- a/test/test-automation/SDL_test.h +++ b/test/test-automation/include/SDL_test.h @@ -21,12 +21,11 @@ #ifndef _SDL_TEST_H #define _SDL_TEST_H -#include "logger.h" +#include "../src/runner/logger.h" -#include "common/common.h" -#include "common/images.h" - -#include "fuzzer/fuzzer.h" +#include "../src/libtest/common/common.h" +#include "../src/libtest/common/images.h" +#include "../src/libtest/fuzzer/fuzzer.h" #define TEST_ENABLED 1 #define TEST_DISABLED 0 diff --git a/test/test-automation/SDL_test.c b/test/test-automation/src/libtest/SDL_test.c similarity index 98% rename from test/test-automation/SDL_test.c rename to test/test-automation/src/libtest/SDL_test.c index 6feff93da..4098e7a88 100644 --- a/test/test-automation/SDL_test.c +++ b/test/test-automation/src/libtest/SDL_test.c @@ -24,10 +24,12 @@ #include -#include "logger.h" #include "fuzzer/fuzzer.h" -#include "SDL_test.h" +#include "../runner/logger.h" + +#include "../../include/SDL_test.h" + /*! \brief return value of test case. Non-zero value means that the test failed */ int _testReturnValue; diff --git a/test/test-automation/common/common.c b/test/test-automation/src/libtest/common/common.c similarity index 100% rename from test/test-automation/common/common.c rename to test/test-automation/src/libtest/common/common.c diff --git a/test/test-automation/common/common.h b/test/test-automation/src/libtest/common/common.h similarity index 100% rename from test/test-automation/common/common.h rename to test/test-automation/src/libtest/common/common.h diff --git a/test/test-automation/common/images.h b/test/test-automation/src/libtest/common/images.h similarity index 100% rename from test/test-automation/common/images.h rename to test/test-automation/src/libtest/common/images.h diff --git a/test/test-automation/common/img_blit.c b/test/test-automation/src/libtest/common/img_blit.c similarity index 100% rename from test/test-automation/common/img_blit.c rename to test/test-automation/src/libtest/common/img_blit.c diff --git a/test/test-automation/common/img_blitblend.c b/test/test-automation/src/libtest/common/img_blitblend.c similarity index 100% rename from test/test-automation/common/img_blitblend.c rename to test/test-automation/src/libtest/common/img_blitblend.c diff --git a/test/test-automation/common/img_face.c b/test/test-automation/src/libtest/common/img_face.c similarity index 100% rename from test/test-automation/common/img_face.c rename to test/test-automation/src/libtest/common/img_face.c diff --git a/test/test-automation/common/img_primitives.c b/test/test-automation/src/libtest/common/img_primitives.c similarity index 100% rename from test/test-automation/common/img_primitives.c rename to test/test-automation/src/libtest/common/img_primitives.c diff --git a/test/test-automation/common/img_primitivesblend.c b/test/test-automation/src/libtest/common/img_primitivesblend.c similarity index 100% rename from test/test-automation/common/img_primitivesblend.c rename to test/test-automation/src/libtest/common/img_primitivesblend.c diff --git a/test/test-automation/fuzzer/fuzzer.c b/test/test-automation/src/libtest/fuzzer/fuzzer.c similarity index 99% rename from test/test-automation/fuzzer/fuzzer.c rename to test/test-automation/src/libtest/fuzzer/fuzzer.c index 53d171818..ebf082e88 100644 --- a/test/test-automation/fuzzer/fuzzer.c +++ b/test/test-automation/src/libtest/fuzzer/fuzzer.c @@ -2,7 +2,7 @@ #include #include -#include "../SDL_test.h" +#include "../../../include/SDL_test.h" #include "fuzzer.h" diff --git a/test/test-automation/fuzzer/fuzzer.h b/test/test-automation/src/libtest/fuzzer/fuzzer.h similarity index 100% rename from test/test-automation/fuzzer/fuzzer.h rename to test/test-automation/src/libtest/fuzzer/fuzzer.h diff --git a/test/test-automation/fuzzer/utl_crc32.c b/test/test-automation/src/libtest/fuzzer/utl_crc32.c similarity index 100% rename from test/test-automation/fuzzer/utl_crc32.c rename to test/test-automation/src/libtest/fuzzer/utl_crc32.c diff --git a/test/test-automation/fuzzer/utl_crc32.h b/test/test-automation/src/libtest/fuzzer/utl_crc32.h similarity index 100% rename from test/test-automation/fuzzer/utl_crc32.h rename to test/test-automation/src/libtest/fuzzer/utl_crc32.h diff --git a/test/test-automation/fuzzer/utl_md5.c b/test/test-automation/src/libtest/fuzzer/utl_md5.c similarity index 100% rename from test/test-automation/fuzzer/utl_md5.c rename to test/test-automation/src/libtest/fuzzer/utl_md5.c diff --git a/test/test-automation/fuzzer/utl_md5.h b/test/test-automation/src/libtest/fuzzer/utl_md5.h similarity index 100% rename from test/test-automation/fuzzer/utl_md5.h rename to test/test-automation/src/libtest/fuzzer/utl_md5.h diff --git a/test/test-automation/fuzzer/utl_random.c b/test/test-automation/src/libtest/fuzzer/utl_random.c similarity index 100% rename from test/test-automation/fuzzer/utl_random.c rename to test/test-automation/src/libtest/fuzzer/utl_random.c diff --git a/test/test-automation/fuzzer/utl_random.h b/test/test-automation/src/libtest/fuzzer/utl_random.h similarity index 100% rename from test/test-automation/fuzzer/utl_random.h rename to test/test-automation/src/libtest/fuzzer/utl_random.h diff --git a/test/test-automation/logger_helpers.c b/test/test-automation/src/libtest/logger_helpers.c similarity index 100% rename from test/test-automation/logger_helpers.c rename to test/test-automation/src/libtest/logger_helpers.c diff --git a/test/test-automation/logger_helpers.h b/test/test-automation/src/libtest/logger_helpers.h similarity index 100% rename from test/test-automation/logger_helpers.h rename to test/test-automation/src/libtest/logger_helpers.h diff --git a/test/test-automation/plain_logger.c b/test/test-automation/src/libtest/plain_logger.c similarity index 98% rename from test/test-automation/plain_logger.c rename to test/test-automation/src/libtest/plain_logger.c index 2e51dfaf6..b318c0074 100644 --- a/test/test-automation/plain_logger.c +++ b/test/test-automation/src/libtest/plain_logger.c @@ -4,10 +4,12 @@ #include "stdio.h" -#include "Logger.h" +#include "../../include/SDL_test.h" + +#include "../runner/logger.h" + #include "logger_helpers.h" #include "plain_logger.h" -#include "SDL_test.h" /*! Current indentationt level */ static int indentLevel; diff --git a/test/test-automation/plain_logger.h b/test/test-automation/src/libtest/plain_logger.h similarity index 99% rename from test/test-automation/plain_logger.h rename to test/test-automation/src/libtest/plain_logger.h index 52fe02eda..969aeb6c8 100644 --- a/test/test-automation/plain_logger.h +++ b/test/test-automation/src/libtest/plain_logger.h @@ -1,8 +1,8 @@ #ifndef _PLAIN_LOGGER_H #define _PLAIN_LOGGER_H -#include "logger.h" #include +#include "../runner/logger.h" /*! diff --git a/test/test-automation/xml.c b/test/test-automation/src/libtest/xml.c similarity index 100% rename from test/test-automation/xml.c rename to test/test-automation/src/libtest/xml.c diff --git a/test/test-automation/xml.h b/test/test-automation/src/libtest/xml.h similarity index 99% rename from test/test-automation/xml.h rename to test/test-automation/src/libtest/xml.h index fbe4367b8..98d02f866 100644 --- a/test/test-automation/xml.h +++ b/test/test-automation/src/libtest/xml.h @@ -21,8 +21,6 @@ #ifndef _XML_H #define _XML_H -#include "logger.h" - /*! Defines attribute for XML elements */ typedef struct Attribute { const char *attribute; diff --git a/test/test-automation/xml_logger.c b/test/test-automation/src/libtest/xml_logger.c similarity index 99% rename from test/test-automation/xml_logger.c rename to test/test-automation/src/libtest/xml_logger.c index e13c7d226..93e51678c 100644 --- a/test/test-automation/xml_logger.c +++ b/test/test-automation/src/libtest/xml_logger.c @@ -24,11 +24,12 @@ #include -#include "Logger.h" +#include "../../include/SDL_test.h" + +#include "../runner/logger.h" + #include "xml.h" #include "logger_helpers.h" -#include "SDL_test.h" - #include "xml_logger.h" /*! Static strings for XML elements */ diff --git a/test/test-automation/xml_logger.h b/test/test-automation/src/libtest/xml_logger.h similarity index 99% rename from test/test-automation/xml_logger.h rename to test/test-automation/src/libtest/xml_logger.h index f2f1a76dd..16521d726 100644 --- a/test/test-automation/xml_logger.h +++ b/test/test-automation/src/libtest/xml_logger.h @@ -3,7 +3,7 @@ #include -#include "logger.h" +#include "../runner/logger.h" /*! * Prints out information about starting the test run in XML diff --git a/test/test-automation/logger.h b/test/test-automation/src/runner/logger.h similarity index 100% rename from test/test-automation/logger.h rename to test/test-automation/src/runner/logger.h diff --git a/test/test-automation/runner.c b/test/test-automation/src/runner/runner.c similarity index 99% rename from test/test-automation/runner.c rename to test/test-automation/src/runner/runner.c index 5e6ea7869..e6df6d1fb 100644 --- a/test/test-automation/runner.c +++ b/test/test-automation/src/runner/runner.c @@ -29,14 +29,14 @@ #include #include -#include "fuzzer/fuzzer.h" +#include "../../include/SDL_test.h" +#include "../../config.h" -#include "config.h" +#include "../libtest/fuzzer/fuzzer.h" -#include "SDL_test.h" +#include "../libtest/plain_logger.h" +#include "../libtest/xml_logger.h" -#include "plain_logger.h" -#include "xml_logger.h" #include "logger.h" #include "support.h" @@ -228,7 +228,7 @@ ScanForTestSuites(char *directoryName, char *extension) directory = opendir(directoryName); if(!directory) { fprintf(stderr, "Failed to open test suite directory: %s\n", directoryName); - perror("Error message: "); + perror("Error message"); exit(2); } diff --git a/test/test-automation/support.c b/test/test-automation/src/runner/support.c similarity index 100% rename from test/test-automation/support.c rename to test/test-automation/src/runner/support.c diff --git a/test/test-automation/support.h b/test/test-automation/src/runner/support.h similarity index 100% rename from test/test-automation/support.h rename to test/test-automation/src/runner/support.h diff --git a/test/test-automation/testplatform/testplatform.c b/test/test-automation/testplatform/testplatform.c deleted file mode 100644 index 9c1797870..000000000 --- a/test/test-automation/testplatform/testplatform.c +++ /dev/null @@ -1,508 +0,0 @@ -/** - * Original code: automated SDL platform test written by Edgar Simo "bobbens" - * Extended and updated by aschiffler at ferzkopp dot net - */ - -#include - -#include - -#include "../SDL_test.h" - -/* Test cases */ -static const TestCaseReference test1 = - (TestCaseReference){ "platform_testTypes", "Tests predefined types", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test2 = - (TestCaseReference){ "platform_testEndianessAndSwap", "Tests endianess and swap functions", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test3 = - (TestCaseReference){ "platform_testGetFunctions", "Tests various SDL_GetXYZ functions", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test4 = - (TestCaseReference){ "platform_testHasFunctions", "Tests various SDL_HasXYZ functions", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test5 = - (TestCaseReference){ "platform_testGetVersion", "Tests SDL_GetVersion function", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test6 = - (TestCaseReference){ "platform_testSDLVersion", "Tests SDL_VERSION macro", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test7 = - (TestCaseReference){ "platform_testDefaultInit", "Tests default SDL_Init", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test8 = - (TestCaseReference){ "platform_testGetSetClearError", "Tests SDL_Get/Set/ClearError", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test9 = - (TestCaseReference){ "platform_testSetErrorEmptyInput", "Tests SDL_SetError with empty input", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test10 = - (TestCaseReference){ "platform_testSetErrorInvalidInput", "Tests SDL_SetError with invalid input", TEST_ENABLED, 0, 0 }; - -static const TestCaseReference test11 = - (TestCaseReference){ "platform_testGetPowerInfo", "Tests SDL_GetPowerInfo function", TEST_ENABLED, 0, 0 }; - -/* Test suite */ -extern const TestCaseReference *testSuite[] = { - &test1, &test2, &test3, &test4, &test5, &test6, &test7, &test8, &test9, &test10, &test11, NULL -}; - -TestCaseReference **QueryTestSuite() { - return (TestCaseReference **)testSuite; -} - -/** - * @brief Compare sizes of types. - * - * @note Watcom C flags these as Warning 201: "Unreachable code" if you just - * compare them directly, so we push it through a function to keep the - * compiler quiet. --ryan. - */ -static int _compareSizeOfType( size_t sizeoftype, size_t hardcodetype ) -{ - return sizeoftype != hardcodetype; -} - -/** - * @brief Tests type sizes. - */ -int platform_testTypes(void *arg) -{ - int ret; - - ret = _compareSizeOfType( sizeof(Uint8), 1 ); - AssertTrue( ret == 0, "sizeof(Uint8) = %lu, expected 1", sizeof(Uint8) ); - - ret = _compareSizeOfType( sizeof(Uint16), 2 ); - AssertTrue( ret == 0, "sizeof(Uint16) = %lu, expected 2", sizeof(Uint16) ); - - ret = _compareSizeOfType( sizeof(Uint32), 4 ); - AssertTrue( ret == 0, "sizeof(Uint32) = %lu, expected 4", sizeof(Uint32) ); - - ret = _compareSizeOfType( sizeof(Uint64), 8 ); - AssertTrue( ret == 0, "sizeof(Uint64) = %lu, expected 8", sizeof(Uint64) ); -} - -/** - * @brief Tests platform endianness and SDL_SwapXY functions. - */ -int platform_testEndianessAndSwap(void *arg) -{ - int real_byteorder; - Uint16 value = 0x1234; - Uint16 value16 = 0xCDAB; - Uint16 swapped16 = 0xABCD; - Uint32 value32 = 0xEFBEADDE; - Uint32 swapped32 = 0xDEADBEEF; - - Uint64 value64, swapped64; - value64 = 0xEFBEADDE; - value64 <<= 32; - value64 |= 0xCDAB3412; - swapped64 = 0x1234ABCD; - swapped64 <<= 32; - swapped64 |= 0xDEADBEEF; - - if ((*((char *) &value) >> 4) == 0x1) { - real_byteorder = SDL_BIG_ENDIAN; - } else { - real_byteorder = SDL_LIL_ENDIAN; - } - - /* Test endianness. */ - AssertTrue( real_byteorder == SDL_BYTEORDER, - "Machine detected as %s endian, appears to be %s endian.", - (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big", - (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big" ); - - /* Test 16 swap. */ - AssertTrue( SDL_Swap16(value16) == swapped16, - "SDL_Swap16(): 16 bit swapped: 0x%X => 0x%X", - value16, SDL_Swap16(value16) ); - - /* Test 32 swap. */ - AssertTrue( SDL_Swap32(value32) == swapped32, - "SDL_Swap32(): 32 bit swapped: 0x%X => 0x%X", - value32, SDL_Swap32(value32) ); - - /* Test 64 swap. */ - AssertTrue( SDL_Swap64(value64) == swapped64, -#ifdef _MSC_VER - "SDL_Swap64(): 64 bit swapped: 0x%I64X => 0x%I64X", -#else - "SDL_Swap64(): 64 bit swapped: 0x%llX => 0x%llX", -#endif - value64, SDL_Swap64(value64) ); -} - -/*! - * \brief Tests SDL_GetXYZ() functions - * \sa - * http://wiki.libsdl.org/moin.cgi/SDL_GetPlatform - * http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCount - * http://wiki.libsdl.org/moin.cgi/SDL_GetCPUCacheLineSize - * http://wiki.libsdl.org/moin.cgi/SDL_GetRevision - * http://wiki.libsdl.org/moin.cgi/SDL_GetRevisionNumber - */ -int platform_testGetFunctions (void *arg) -{ - char *platform; - char *revision; - int ret; - int len; - - platform = (char *)SDL_GetPlatform(); - AssertPass("SDL_GetPlatform()"); - AssertTrue(platform != NULL, "SDL_GetPlatform() != NULL"); - if (platform != NULL) { - len = strlen(platform); - AssertTrue(len > 0, - "SDL_GetPlatform(): expected non-empty platform, was platform: '%s', len: %i", - platform, - len); - } - - ret = SDL_GetCPUCount(); - AssertPass("SDL_GetCPUCount()"); - AssertTrue(ret > 0, - "SDL_GetCPUCount(): expected count > 0, was: %i", - ret); - - ret = SDL_GetCPUCacheLineSize(); - AssertPass("SDL_GetCPUCacheLineSize()"); - AssertTrue(ret >= 0, - "SDL_GetCPUCacheLineSize(): expected size >= 0, was: %i", - ret); - - revision = (char *)SDL_GetRevision(); - AssertPass("SDL_GetRevision()"); - AssertTrue(revision != NULL, "SDL_GetRevision() != NULL"); - - ret = SDL_GetRevisionNumber(); - AssertPass("SDL_GetRevisionNumber()"); -} - -/*! - * \brief Tests SDL_HasXYZ() functions - * \sa - * http://wiki.libsdl.org/moin.cgi/SDL_Has3DNow - * http://wiki.libsdl.org/moin.cgi/SDL_HasAltiVec - * http://wiki.libsdl.org/moin.cgi/SDL_HasMMX - * http://wiki.libsdl.org/moin.cgi/SDL_HasRDTSC - * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE - * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE2 - * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE3 - * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE41 - * http://wiki.libsdl.org/moin.cgi/SDL_HasSSE42 - */ -int platform_testHasFunctions (void *arg) -{ - int ret; - - // TODO: independently determine and compare values as well - - ret = SDL_HasRDTSC(); - AssertPass("SDL_HasRDTSC()"); - - ret = SDL_HasAltiVec(); - AssertPass("SDL_HasAltiVec()"); - - ret = SDL_HasMMX(); - AssertPass("SDL_HasMMX()"); - - ret = SDL_Has3DNow(); - AssertPass("SDL_Has3DNow()"); - - ret = SDL_HasSSE(); - AssertPass("SDL_HasSSE()"); - - ret = SDL_HasSSE2(); - AssertPass("SDL_HasSSE2()"); - - ret = SDL_HasSSE3(); - AssertPass("SDL_HasSSE3()"); - - ret = SDL_HasSSE41(); - AssertPass("SDL_HasSSE41()"); - - ret = SDL_HasSSE42(); - AssertPass("SDL_HasSSE42()"); -} - -/*! - * \brief Tests SDL_GetVersion - * \sa - * http://wiki.libsdl.org/moin.cgi/SDL_GetVersion - */ -int platform_testGetVersion(void *arg) -{ - SDL_version linked; - - SDL_GetVersion(&linked); - AssertTrue( linked.major >= SDL_MAJOR_VERSION, - "SDL_GetVersion(): returned major %i (>= %i)", - linked.major, - SDL_MAJOR_VERSION); - AssertTrue( linked.minor >= SDL_MINOR_VERSION, - "SDL_GetVersion(): returned minor %i (>= %i)", - linked.minor, - SDL_MINOR_VERSION); -} - -/*! - * \brief Tests SDL_VERSION macro - */ -int platform_testSDLVersion(void *arg) -{ - SDL_version compiled; - - SDL_VERSION(&compiled); - AssertTrue( compiled.major >= SDL_MAJOR_VERSION, - "SDL_VERSION() returned major %i (>= %i)", - compiled.major, - SDL_MAJOR_VERSION); - AssertTrue( compiled.minor >= SDL_MINOR_VERSION, - "SDL_VERSION() returned minor %i (>= %i)", - compiled.minor, - SDL_MINOR_VERSION); -} - -/*! - * \brief Tests default SDL_Init - */ -int platform_testDefaultInit(void *arg) -{ - int ret; - int subsystem; - - ret = SDL_Init(0); - AssertTrue( ret == 0, - "SDL_Init(0): returned %i, expected 0, error: %s", - ret, - SDL_GetError()); - - subsystem = SDL_WasInit(0); - AssertTrue( subsystem == 0, - "SDL_WasInit(0): returned %i, expected 0", - ret); - - SDL_Quit(); -} - -/*! - * \brief Tests SDL_Get/Set/ClearError - * \sa - * http://wiki.libsdl.org/moin.cgi/SDL_GetError - * http://wiki.libsdl.org/moin.cgi/SDL_SetError - * http://wiki.libsdl.org/moin.cgi/SDL_ClearError - */ -int platform_testGetSetClearError(void *arg) -{ - const char *testError = "Testing"; - char *lastError; - int len; - - SDL_ClearError(); - AssertPass("SDL_ClearError()"); - - lastError = (char *)SDL_GetError(); - AssertPass("SDL_GetError()"); - AssertTrue(lastError != NULL, - "SDL_GetError() != NULL"); - if (lastError != NULL) - { - len = strlen(lastError); - AssertTrue(len == 0, - "SDL_GetError(): no message expected, len: %i", len); - } - - SDL_SetError("%s", testError); - AssertPass("SDL_SetError()"); - lastError = (char *)SDL_GetError(); - AssertTrue(lastError != NULL, - "SDL_GetError() != NULL"); - if (lastError != NULL) - { - len = strlen(lastError); - AssertTrue(len == strlen(testError), - "SDL_GetError(): expected message len %i, was len: %i", - strlen(testError), - len); - AssertTrue(strcmp(lastError, testError) == 0, - "SDL_GetError(): expected message %s, was message: %s", - testError, - lastError); - } - - // Clean up - SDL_ClearError(); -} - -/*! - * \brief Tests SDL_SetError with empty input - * \sa - * http://wiki.libsdl.org/moin.cgi/SDL_SetError - */ -int platform_testSetErrorEmptyInput(void *arg) -{ - const char *testError = ""; - char *lastError; - int len; - - SDL_SetError("%s", testError); - AssertPass("SDL_SetError()"); - lastError = (char *)SDL_GetError(); - AssertTrue(lastError != NULL, - "SDL_GetError() != NULL"); - if (lastError != NULL) - { - len = strlen(lastError); - AssertTrue(len == strlen(testError), - "SDL_GetError(): expected message len %i, was len: %i", - strlen(testError), - len); - AssertTrue(strcmp(lastError, testError) == 0, - "SDL_GetError(): expected message '%s', was message: '%s'", - testError, - lastError); - } - - // Clean up - SDL_ClearError(); -} - -/*! - * \brief Tests SDL_SetError with invalid input - * \sa - * http://wiki.libsdl.org/moin.cgi/SDL_SetError - */ -int platform_testSetErrorInvalidInput(void *arg) -{ - const char *testError = NULL; - const char *probeError = "Testing"; - char *lastError; - int len; - - // Reset - SDL_ClearError(); - - // Check for no-op - SDL_SetError(testError); - AssertPass("SDL_SetError()"); - lastError = (char *)SDL_GetError(); - AssertTrue(lastError != NULL, - "SDL_GetError() != NULL"); - if (lastError != NULL) - { - len = strlen(lastError); - AssertTrue(len == 0, - "SDL_GetError(): expected message len 0, was len: %i", - 0, - len); - AssertTrue(strcmp(lastError, "") == 0, - "SDL_GetError(): expected message '', was message: '%s'", - lastError); - } - - // Set - SDL_SetError(probeError); - - // Check for no-op - SDL_SetError(testError); - AssertPass("SDL_SetError()"); - lastError = (char *)SDL_GetError(); - AssertTrue(lastError != NULL, - "SDL_GetError() != NULL"); - if (lastError != NULL) - { - len = strlen(lastError); - AssertTrue(len == strlen(probeError), - "SDL_GetError(): expected message len %i, was len: %i", - strlen(probeError), - len); - AssertTrue(strcmp(lastError, probeError) == 0, - "SDL_GetError(): expected message '%s', was message: '%s'", - probeError, - lastError); - } - - // Clean up - SDL_ClearError(); -} - -/*! - * \brief Tests SDL_GetPowerInfo - * \sa - * http://wiki.libsdl.org/moin.cgi/SDL_GetPowerInfo - */ -int platform_testGetPowerInfo(void *arg) -{ - SDL_PowerState state; - SDL_PowerState stateAgain; - int secs; - int secsAgain; - int pct; - int pctAgain; - - state = SDL_GetPowerInfo(&secs, &pct); - AssertPass("SDL_GetPowerInfo()"); - AssertTrue( - state==SDL_POWERSTATE_UNKNOWN || - state==SDL_POWERSTATE_ON_BATTERY || - state==SDL_POWERSTATE_NO_BATTERY || - state==SDL_POWERSTATE_CHARGING || - state==SDL_POWERSTATE_CHARGED, - "SDL_GetPowerInfo(): state %i is one of the expected values", - (int)state); - - if (state==SDL_POWERSTATE_ON_BATTERY) - { - AssertTrue( - secs >= 0, - "SDL_GetPowerInfo(): on battery, secs >= 0, was: %i", - secs); - AssertTrue( - (pct >= 0) && (pct <= 100), - "SDL_GetPowerInfo(): on battery, pct=[0,100], was: %i", - pct); - } - - if (state==SDL_POWERSTATE_UNKNOWN || - state==SDL_POWERSTATE_NO_BATTERY) - { - AssertTrue( - secs == -1, - "SDL_GetPowerInfo(): no battery, secs == -1, was: %i", - secs); - AssertTrue( - pct == -1, - "SDL_GetPowerInfo(): no battery, pct == -1, was: %i", - pct); - } - - // Partial return value variations - stateAgain = SDL_GetPowerInfo(&secsAgain, NULL); - AssertTrue( - state==stateAgain, - "State %i returned when only 'secs' requested", - stateAgain); - AssertTrue( - secs==secsAgain, - "Value %i matches when only 'secs' requested", - secsAgain); - stateAgain = SDL_GetPowerInfo(NULL, &pctAgain); - AssertTrue( - state==stateAgain, - "State %i returned when only 'pct' requested", - stateAgain); - AssertTrue( - pct==pctAgain, - "Value %i matches when only 'pct' requested", - pctAgain); - stateAgain = SDL_GetPowerInfo(NULL, NULL); - AssertTrue( - state==stateAgain, - "State %i returned when no value requested", - stateAgain); -} diff --git a/test/test-automation/testaudio/Makefile.am b/test/test-automation/tests/testaudio/Makefile.am similarity index 55% rename from test/test-automation/testaudio/Makefile.am rename to test/test-automation/tests/testaudio/Makefile.am index ee9a0d14d..e8feb34c0 100644 --- a/test/test-automation/testaudio/Makefile.am +++ b/test/test-automation/tests/testaudio/Makefile.am @@ -1,4 +1,4 @@ lib_LTLIBRARIES = libtestaudio.la libtestaudio_la_SOURCES = testaudio.c libtestaudio_la_CLAGS = -fPIC -g -libtestaudio_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la +libtestaudio_la_LDFLAGS = `sdl-config --libs` -I ../../src/libtest/.libs/libtest.la diff --git a/test/test-automation/testaudio/testaudio.c b/test/test-automation/tests/testaudio/testaudio.c similarity index 98% rename from test/test-automation/testaudio/testaudio.c rename to test/test-automation/tests/testaudio/testaudio.c index b608ce53f..0664e19e6 100644 --- a/test/test-automation/testaudio/testaudio.c +++ b/test/test-automation/tests/testaudio/testaudio.c @@ -6,7 +6,7 @@ #include -#include "../SDL_test.h" +#include "../../include/SDL_test.h" /* Test cases */ static const TestCaseReference test1 = diff --git a/test/test-automation/testdummy/Makefile.am b/test/test-automation/tests/testdummy/Makefile.am similarity index 55% rename from test/test-automation/testdummy/Makefile.am rename to test/test-automation/tests/testdummy/Makefile.am index cfd098c17..51e29dc53 100644 --- a/test/test-automation/testdummy/Makefile.am +++ b/test/test-automation/tests/testdummy/Makefile.am @@ -1,4 +1,4 @@ lib_LTLIBRARIES = libtestdummy.la libtestdummy_la_SOURCES = testdummy.c libtestdummy_la_CLAGS = -fPIC -g -libtestdummy_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la +libtestdummy_la_LDFLAGS = `sdl-config --libs` -I ../../src/libtest/.libs/libtest.la diff --git a/test/test-automation/testdummy/testdummy.c b/test/test-automation/tests/testdummy/testdummy.c similarity index 98% rename from test/test-automation/testdummy/testdummy.c rename to test/test-automation/tests/testdummy/testdummy.c index 7af5d5036..698c41462 100644 --- a/test/test-automation/testdummy/testdummy.c +++ b/test/test-automation/tests/testdummy/testdummy.c @@ -29,8 +29,7 @@ #include -#include "../SDL_test.h" -//#include "fuzzer/fuzzer.h" +#include "../../include/SDL_test.h" /* Test case references */ static const TestCaseReference test1 = diff --git a/test/test-automation/testplatform/Makefile.am b/test/test-automation/tests/testplatform/Makefile.am similarity index 57% rename from test/test-automation/testplatform/Makefile.am rename to test/test-automation/tests/testplatform/Makefile.am index 82818e719..d0fec212e 100644 --- a/test/test-automation/testplatform/Makefile.am +++ b/test/test-automation/tests/testplatform/Makefile.am @@ -1,4 +1,4 @@ lib_LTLIBRARIES = libtestplatform.la libtestplatform_la_SOURCES = testplatform.c libtestplatform_la_CLAGS = -fPIC -g -libtestplatform_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la +libtestplatform_la_LDFLAGS = `sdl-config --libs` -I ../../src/libtest/.libs/libtest.la diff --git a/test/test-automation/testrect/Makefile.am b/test/test-automation/tests/testrect/Makefile.am similarity index 54% rename from test/test-automation/testrect/Makefile.am rename to test/test-automation/tests/testrect/Makefile.am index 27219bea2..b80651287 100644 --- a/test/test-automation/testrect/Makefile.am +++ b/test/test-automation/tests/testrect/Makefile.am @@ -1,4 +1,4 @@ lib_LTLIBRARIES = libtestrect.la libtestrect_la_SOURCES = testrect.c libtestrect_la_CLAGS = -fPIC -g -libtestrect_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la +libtestrect_la_LDFLAGS = `sdl-config --libs` -I ../../src/libtest/.libs/libtest.la diff --git a/test/test-automation/testrect/testrect.c b/test/test-automation/tests/testrect/testrect.c similarity index 99% rename from test/test-automation/testrect/testrect.c rename to test/test-automation/tests/testrect/testrect.c index 014d6c8bd..7d973444e 100644 --- a/test/test-automation/testrect/testrect.c +++ b/test/test-automation/tests/testrect/testrect.c @@ -6,7 +6,7 @@ #include -#include "../SDL_test.h" +#include "../../include/SDL_test.h" /* Test cases */ static const TestCaseReference test1 = diff --git a/test/test-automation/testrender/Makefile.am b/test/test-automation/tests/testrender/Makefile.am similarity index 56% rename from test/test-automation/testrender/Makefile.am rename to test/test-automation/tests/testrender/Makefile.am index 8605b7e4f..64495ea15 100644 --- a/test/test-automation/testrender/Makefile.am +++ b/test/test-automation/tests/testrender/Makefile.am @@ -1,4 +1,4 @@ lib_LTLIBRARIES = libtestrender.la libtestrender_la_SOURCES = testrender.c libtestrender_la_CLAGS = -fPIC -g -libtestrender_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la +libtestrender_la_LDFLAGS = `sdl-config --libs` -I ../../src/libtest/.libs/libtest.la diff --git a/test/test-automation/testrender/testrender.c b/test/test-automation/tests/testrender/testrender.c similarity index 94% rename from test/test-automation/testrender/testrender.c rename to test/test-automation/tests/testrender/testrender.c index 0d4771583..d20a26cb7 100644 --- a/test/test-automation/testrender/testrender.c +++ b/test/test-automation/tests/testrender/testrender.c @@ -7,7 +7,7 @@ #include -#include "../SDL_test.h" +#include "../../include/SDL_test.h" diff --git a/test/test-automation/testrwops/Makefile.am b/test/test-automation/tests/testrwops/Makefile.am similarity index 55% rename from test/test-automation/testrwops/Makefile.am rename to test/test-automation/tests/testrwops/Makefile.am index 8e3a2feb3..534253ab2 100644 --- a/test/test-automation/testrwops/Makefile.am +++ b/test/test-automation/tests/testrwops/Makefile.am @@ -1,4 +1,4 @@ lib_LTLIBRARIES = libtestrwops.la libtestrwops_la_SOURCES = testrwops.c libtestrwops_la_CLAGS = -fPIC -g -libtestrwops_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la +libtestrwops_la_LDFLAGS = `sdl-config --libs` -I ../../src/libtest/.libs/libtest.la diff --git a/test/test-automation/testrwops/testrwops.c b/test/test-automation/tests/testrwops/testrwops.c similarity index 94% rename from test/test-automation/testrwops/testrwops.c rename to test/test-automation/tests/testrwops/testrwops.c index 93ed992f7..68ee13fc8 100644 --- a/test/test-automation/testrwops/testrwops.c +++ b/test/test-automation/tests/testrwops/testrwops.c @@ -7,7 +7,7 @@ #include -#include "../SDL_test.h" +#include "../../include/SDL_test.h" diff --git a/test/test-automation/testsurface/Makefile.am b/test/test-automation/tests/testsurface/Makefile.am similarity index 56% rename from test/test-automation/testsurface/Makefile.am rename to test/test-automation/tests/testsurface/Makefile.am index 27826d5d8..f132ba21a 100644 --- a/test/test-automation/testsurface/Makefile.am +++ b/test/test-automation/tests/testsurface/Makefile.am @@ -1,4 +1,4 @@ lib_LTLIBRARIES = libtestsurface.la libtestsurface_la_SOURCES = testsurface.c libtestsurface_la_CLAGS = -fPIC -g -libtestsurface_la_LDFLAGS = `sdl-config --libs` -I ../.libs/libtest.la +libtestsurface_la_LDFLAGS = `sdl-config --libs` -I ../../src/libtest/.libs/libtest.la diff --git a/test/test-automation/testsurface/testsurface.c b/test/test-automation/tests/testsurface/testsurface.c similarity index 99% rename from test/test-automation/testsurface/testsurface.c rename to test/test-automation/tests/testsurface/testsurface.c index 6de92aab2..fd8b57a7a 100644 --- a/test/test-automation/testsurface/testsurface.c +++ b/test/test-automation/tests/testsurface/testsurface.c @@ -3,12 +3,11 @@ */ #include +#include #include -#include "../SDL_test.h" - -#include +#include "../../include/SDL_test.h" /* Test case references */ static const TestCaseReference test1 =