diff options
author | Jarkko Poyry <jpoyry@google.com> | 2014-09-02 11:48:52 +0300 |
---|---|---|
committer | Jarkko Poyry <jpoyry@google.com> | 2014-09-10 18:04:33 +0300 |
commit | 3c827367444ee418f129b2c238299f49d3264554 (patch) | |
tree | 62dd09feabba812bdff287366e9593b99007152c /modules/internal | |
parent | 49238d46b847a2099e64118ff22aef9563c8b81f (diff) | |
download | VK-GL-CTS-3c827367444ee418f129b2c238299f49d3264554.tar.gz VK-GL-CTS-3c827367444ee418f129b2c238299f49d3264554.tar.bz2 VK-GL-CTS-3c827367444ee418f129b2c238299f49d3264554.zip |
Import dEQP.
Import drawElements Quality Program from an internal repository.
Bug: 17388917
Change-Id: Ic109fe4a57e31b2a816113d90fbdf51a43e7abeb
Diffstat (limited to 'modules/internal')
65 files changed, 1371 insertions, 0 deletions
diff --git a/modules/internal/CMakeLists.txt b/modules/internal/CMakeLists.txt new file mode 100644 index 000000000..3dd9ad04d --- /dev/null +++ b/modules/internal/CMakeLists.txt @@ -0,0 +1,28 @@ +# drawElements internal tests + +set(DE_INTERNAL_TESTS_SRCS + ditBuildInfoTests.cpp + ditBuildInfoTests.hpp + ditDelibsTests.cpp + ditDelibsTests.hpp + ditFrameworkTests.cpp + ditFrameworkTests.hpp + ditImageCompareTests.cpp + ditImageCompareTests.hpp + ditImageIOTests.cpp + ditImageIOTests.hpp + ditTestCase.cpp + ditTestCase.hpp + ditTestLogTests.cpp + ditTestLogTests.hpp + ditTestPackage.cpp + ditTestPackage.hpp + ) + +set(DE_INTERNAL_TESTS_LIBS + tcutil + ) + +add_deqp_module(de-internal-tests "${DE_INTERNAL_TESTS_SRCS}" "${DE_INTERNAL_TESTS_LIBS}" ditTestPackageEntry.cpp) + +add_data_dir(de-internal-tests data internal/data) diff --git a/modules/internal/data/imagecompare/2_units_2d_cmp.png b/modules/internal/data/imagecompare/2_units_2d_cmp.png Binary files differnew file mode 100644 index 000000000..4413debfe --- /dev/null +++ b/modules/internal/data/imagecompare/2_units_2d_cmp.png diff --git a/modules/internal/data/imagecompare/2_units_2d_ref.png b/modules/internal/data/imagecompare/2_units_2d_ref.png Binary files differnew file mode 100644 index 000000000..8076f4013 --- /dev/null +++ b/modules/internal/data/imagecompare/2_units_2d_ref.png diff --git a/modules/internal/data/imagecompare/4_units_cube_cmp.png b/modules/internal/data/imagecompare/4_units_cube_cmp.png Binary files differnew file mode 100644 index 000000000..f0d7ba51e --- /dev/null +++ b/modules/internal/data/imagecompare/4_units_cube_cmp.png diff --git a/modules/internal/data/imagecompare/4_units_cube_ref.png b/modules/internal/data/imagecompare/4_units_cube_ref.png Binary files differnew file mode 100644 index 000000000..6498da5fb --- /dev/null +++ b/modules/internal/data/imagecompare/4_units_cube_ref.png diff --git a/modules/internal/data/imagecompare/cube_2_cmp.png b/modules/internal/data/imagecompare/cube_2_cmp.png Binary files differnew file mode 100644 index 000000000..934a1f28d --- /dev/null +++ b/modules/internal/data/imagecompare/cube_2_cmp.png diff --git a/modules/internal/data/imagecompare/cube_2_ref.png b/modules/internal/data/imagecompare/cube_2_ref.png Binary files differnew file mode 100644 index 000000000..57938f1b6 --- /dev/null +++ b/modules/internal/data/imagecompare/cube_2_ref.png diff --git a/modules/internal/data/imagecompare/cube_cmp.png b/modules/internal/data/imagecompare/cube_cmp.png Binary files differnew file mode 100644 index 000000000..5f1cd408d --- /dev/null +++ b/modules/internal/data/imagecompare/cube_cmp.png diff --git a/modules/internal/data/imagecompare/cube_nmap_2_cmp.png b/modules/internal/data/imagecompare/cube_nmap_2_cmp.png Binary files differnew file mode 100644 index 000000000..516805533 --- /dev/null +++ b/modules/internal/data/imagecompare/cube_nmap_2_cmp.png diff --git a/modules/internal/data/imagecompare/cube_nmap_2_ref.png b/modules/internal/data/imagecompare/cube_nmap_2_ref.png Binary files differnew file mode 100644 index 000000000..b5943982d --- /dev/null +++ b/modules/internal/data/imagecompare/cube_nmap_2_ref.png diff --git a/modules/internal/data/imagecompare/cube_nmap_cmp.png b/modules/internal/data/imagecompare/cube_nmap_cmp.png Binary files differnew file mode 100644 index 000000000..9d801da53 --- /dev/null +++ b/modules/internal/data/imagecompare/cube_nmap_cmp.png diff --git a/modules/internal/data/imagecompare/cube_nmap_ref.png b/modules/internal/data/imagecompare/cube_nmap_ref.png Binary files differnew file mode 100644 index 000000000..60715b09b --- /dev/null +++ b/modules/internal/data/imagecompare/cube_nmap_ref.png diff --git a/modules/internal/data/imagecompare/cube_ref.png b/modules/internal/data/imagecompare/cube_ref.png Binary files differnew file mode 100644 index 000000000..4f7941d85 --- /dev/null +++ b/modules/internal/data/imagecompare/cube_ref.png diff --git a/modules/internal/data/imagecompare/cube_sphere_2_cmp.png b/modules/internal/data/imagecompare/cube_sphere_2_cmp.png Binary files differnew file mode 100644 index 000000000..09cb155c5 --- /dev/null +++ b/modules/internal/data/imagecompare/cube_sphere_2_cmp.png diff --git a/modules/internal/data/imagecompare/cube_sphere_2_ref.png b/modules/internal/data/imagecompare/cube_sphere_2_ref.png Binary files differnew file mode 100644 index 000000000..826028cd0 --- /dev/null +++ b/modules/internal/data/imagecompare/cube_sphere_2_ref.png diff --git a/modules/internal/data/imagecompare/cube_sphere_cmp.png b/modules/internal/data/imagecompare/cube_sphere_cmp.png Binary files differnew file mode 100644 index 000000000..2ac78f1f5 --- /dev/null +++ b/modules/internal/data/imagecompare/cube_sphere_cmp.png diff --git a/modules/internal/data/imagecompare/cube_sphere_ref.png b/modules/internal/data/imagecompare/cube_sphere_ref.png Binary files differnew file mode 100644 index 000000000..0bddd90bc --- /dev/null +++ b/modules/internal/data/imagecompare/cube_sphere_ref.png diff --git a/modules/internal/data/imagecompare/earth_diffuse_cmp.png b/modules/internal/data/imagecompare/earth_diffuse_cmp.png Binary files differnew file mode 100644 index 000000000..a8a0363c4 --- /dev/null +++ b/modules/internal/data/imagecompare/earth_diffuse_cmp.png diff --git a/modules/internal/data/imagecompare/earth_diffuse_ref.png b/modules/internal/data/imagecompare/earth_diffuse_ref.png Binary files differnew file mode 100644 index 000000000..526d72beb --- /dev/null +++ b/modules/internal/data/imagecompare/earth_diffuse_ref.png diff --git a/modules/internal/data/imagecompare/earth_light_cmp.png b/modules/internal/data/imagecompare/earth_light_cmp.png Binary files differnew file mode 100644 index 000000000..a1045ce76 --- /dev/null +++ b/modules/internal/data/imagecompare/earth_light_cmp.png diff --git a/modules/internal/data/imagecompare/earth_light_ref.png b/modules/internal/data/imagecompare/earth_light_ref.png Binary files differnew file mode 100644 index 000000000..cd548b54f --- /dev/null +++ b/modules/internal/data/imagecompare/earth_light_ref.png diff --git a/modules/internal/data/imagecompare/earth_spot_cmp.png b/modules/internal/data/imagecompare/earth_spot_cmp.png Binary files differnew file mode 100644 index 000000000..3de3803a5 --- /dev/null +++ b/modules/internal/data/imagecompare/earth_spot_cmp.png diff --git a/modules/internal/data/imagecompare/earth_spot_ref.png b/modules/internal/data/imagecompare/earth_spot_ref.png Binary files differnew file mode 100644 index 000000000..f7c9cbe7c --- /dev/null +++ b/modules/internal/data/imagecompare/earth_spot_ref.png diff --git a/modules/internal/data/imagecompare/earth_texture_cmp.png b/modules/internal/data/imagecompare/earth_texture_cmp.png Binary files differnew file mode 100644 index 000000000..48ced61c1 --- /dev/null +++ b/modules/internal/data/imagecompare/earth_texture_cmp.png diff --git a/modules/internal/data/imagecompare/earth_texture_ref.png b/modules/internal/data/imagecompare/earth_texture_ref.png Binary files differnew file mode 100644 index 000000000..5ef1e91dd --- /dev/null +++ b/modules/internal/data/imagecompare/earth_texture_ref.png diff --git a/modules/internal/data/imagecompare/empty_256x256.png b/modules/internal/data/imagecompare/empty_256x256.png Binary files differnew file mode 100644 index 000000000..ef020ee58 --- /dev/null +++ b/modules/internal/data/imagecompare/empty_256x256.png diff --git a/modules/internal/data/imagecompare/lessThan0-reference.png b/modules/internal/data/imagecompare/lessThan0-reference.png Binary files differnew file mode 100644 index 000000000..a4d5e29e8 --- /dev/null +++ b/modules/internal/data/imagecompare/lessThan0-reference.png diff --git a/modules/internal/data/imagecompare/lessThan0-result.png b/modules/internal/data/imagecompare/lessThan0-result.png Binary files differnew file mode 100644 index 000000000..4832c7933 --- /dev/null +++ b/modules/internal/data/imagecompare/lessThan0-result.png diff --git a/modules/internal/data/imagecompare/lessthan_vtx_cmp.png b/modules/internal/data/imagecompare/lessthan_vtx_cmp.png Binary files differnew file mode 100644 index 000000000..0d2f9c55c --- /dev/null +++ b/modules/internal/data/imagecompare/lessthan_vtx_cmp.png diff --git a/modules/internal/data/imagecompare/lessthan_vtx_ref.png b/modules/internal/data/imagecompare/lessthan_vtx_ref.png Binary files differnew file mode 100644 index 000000000..0d2f9c55c --- /dev/null +++ b/modules/internal/data/imagecompare/lessthan_vtx_ref.png diff --git a/modules/internal/data/imagecompare/readpixels_msaa.png b/modules/internal/data/imagecompare/readpixels_msaa.png Binary files differnew file mode 100644 index 000000000..519a083ad --- /dev/null +++ b/modules/internal/data/imagecompare/readpixels_msaa.png diff --git a/modules/internal/data/imagecompare/readpixels_ref.png b/modules/internal/data/imagecompare/readpixels_ref.png Binary files differnew file mode 100644 index 000000000..a67e4d6a6 --- /dev/null +++ b/modules/internal/data/imagecompare/readpixels_ref.png diff --git a/modules/internal/data/imagecompare/refract_frag_cmp.png b/modules/internal/data/imagecompare/refract_frag_cmp.png Binary files differnew file mode 100644 index 000000000..53f926f4e --- /dev/null +++ b/modules/internal/data/imagecompare/refract_frag_cmp.png diff --git a/modules/internal/data/imagecompare/refract_frag_ref.png b/modules/internal/data/imagecompare/refract_frag_ref.png Binary files differnew file mode 100644 index 000000000..1f0f052ab --- /dev/null +++ b/modules/internal/data/imagecompare/refract_frag_ref.png diff --git a/modules/internal/data/imagecompare/refract_vtx_cmp.png b/modules/internal/data/imagecompare/refract_vtx_cmp.png Binary files differnew file mode 100644 index 000000000..f2e59a5c3 --- /dev/null +++ b/modules/internal/data/imagecompare/refract_vtx_cmp.png diff --git a/modules/internal/data/imagecompare/refract_vtx_ref.png b/modules/internal/data/imagecompare/refract_vtx_ref.png Binary files differnew file mode 100644 index 000000000..f343ed3a9 --- /dev/null +++ b/modules/internal/data/imagecompare/refract_vtx_ref.png diff --git a/modules/internal/data/imagecompare/texfilter_cmp.png b/modules/internal/data/imagecompare/texfilter_cmp.png Binary files differnew file mode 100644 index 000000000..e8a5cd347 --- /dev/null +++ b/modules/internal/data/imagecompare/texfilter_cmp.png diff --git a/modules/internal/data/imagecompare/texfilter_ref.png b/modules/internal/data/imagecompare/texfilter_ref.png Binary files differnew file mode 100644 index 000000000..109055023 --- /dev/null +++ b/modules/internal/data/imagecompare/texfilter_ref.png diff --git a/modules/internal/data/imagecompare/texfilter_vtx_linear_cmp.png b/modules/internal/data/imagecompare/texfilter_vtx_linear_cmp.png Binary files differnew file mode 100644 index 000000000..450f25fa2 --- /dev/null +++ b/modules/internal/data/imagecompare/texfilter_vtx_linear_cmp.png diff --git a/modules/internal/data/imagecompare/texfilter_vtx_linear_ref.png b/modules/internal/data/imagecompare/texfilter_vtx_linear_ref.png Binary files differnew file mode 100644 index 000000000..200d8e1a3 --- /dev/null +++ b/modules/internal/data/imagecompare/texfilter_vtx_linear_ref.png diff --git a/modules/internal/data/imagecompare/texfilter_vtx_nearest_cmp.png b/modules/internal/data/imagecompare/texfilter_vtx_nearest_cmp.png Binary files differnew file mode 100644 index 000000000..450f25fa2 --- /dev/null +++ b/modules/internal/data/imagecompare/texfilter_vtx_nearest_cmp.png diff --git a/modules/internal/data/imagecompare/texfilter_vtx_nearest_ref.png b/modules/internal/data/imagecompare/texfilter_vtx_nearest_ref.png Binary files differnew file mode 100644 index 000000000..3f49b2f77 --- /dev/null +++ b/modules/internal/data/imagecompare/texfilter_vtx_nearest_ref.png diff --git a/modules/internal/data/imagecompare/white_256x256.png b/modules/internal/data/imagecompare/white_256x256.png Binary files differnew file mode 100644 index 000000000..8920fa766 --- /dev/null +++ b/modules/internal/data/imagecompare/white_256x256.png diff --git a/modules/internal/data/imageio/rgb24_209x181.png b/modules/internal/data/imageio/rgb24_209x181.png Binary files differnew file mode 100644 index 000000000..f1959345e --- /dev/null +++ b/modules/internal/data/imageio/rgb24_209x181.png diff --git a/modules/internal/data/imageio/rgb24_256x256.png b/modules/internal/data/imageio/rgb24_256x256.png Binary files differnew file mode 100644 index 000000000..61a632d88 --- /dev/null +++ b/modules/internal/data/imageio/rgb24_256x256.png diff --git a/modules/internal/data/imageio/rgba32_207x219.png b/modules/internal/data/imageio/rgba32_207x219.png Binary files differnew file mode 100644 index 000000000..9294bc5d4 --- /dev/null +++ b/modules/internal/data/imageio/rgba32_207x219.png diff --git a/modules/internal/data/imageio/rgba32_256x256.png b/modules/internal/data/imageio/rgba32_256x256.png Binary files differnew file mode 100644 index 000000000..6533a9147 --- /dev/null +++ b/modules/internal/data/imageio/rgba32_256x256.png diff --git a/modules/internal/ditBuildInfoTests.cpp b/modules/internal/ditBuildInfoTests.cpp new file mode 100644 index 000000000..1cbd4c51a --- /dev/null +++ b/modules/internal/ditBuildInfoTests.cpp @@ -0,0 +1,201 @@ +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Build information tests. + *//*--------------------------------------------------------------------*/ + +#include "ditBuildInfoTests.hpp" +#include "tcuTestLog.hpp" +#include "deStringUtil.hpp" + +using tcu::TestLog; + +namespace dit +{ + +static const char* getOsName (int os) +{ + switch (os) + { + case DE_OS_VANILLA: return "DE_OS_VANILLA"; + case DE_OS_WIN32: return "DE_OS_WIN32"; + case DE_OS_UNIX: return "DE_OS_UNIX"; + case DE_OS_WINCE: return "DE_OS_WINCE"; + case DE_OS_OSX: return "DE_OS_OSX"; + case DE_OS_ANDROID: return "DE_OS_ANDROID"; + case DE_OS_SYMBIAN: return "DE_OS_SYMBIAN"; + case DE_OS_IOS: return "DE_OS_IOS"; + default: + return DE_NULL; + } +} + +static const char* getCompilerName (int compiler) +{ + switch (compiler) + { + case DE_COMPILER_VANILLA: return "DE_COMPILER_VANILLA"; + case DE_COMPILER_MSC: return "DE_COMPILER_MSC"; + case DE_COMPILER_GCC: return "DE_COMPILER_GCC"; + case DE_COMPILER_CLANG: return "DE_COMPILER_CLANG"; + default: + return DE_NULL; + } +} + +static const char* getCpuName (int cpu) +{ + switch (cpu) + { + case DE_CPU_VANILLA: return "DE_CPU_VANILLA"; + case DE_CPU_ARM: return "DE_CPU_ARM"; + case DE_CPU_X86: return "DE_CPU_X86"; + case DE_CPU_X86_64: return "DE_CPU_X86_64"; + case DE_CPU_ARM_64: return "DE_CPU_ARM_64"; + case DE_CPU_MIPS: return "DE_CPU_MIPS"; + case DE_CPU_MIPS_64: return "DE_CPU_MIPS_64"; + default: + return DE_NULL; + } +} + +static const char* getEndiannessName (int endianness) +{ + switch (endianness) + { + case DE_BIG_ENDIAN: return "DE_BIG_ENDIAN"; + case DE_LITTLE_ENDIAN: return "DE_LITTLE_ENDIAN"; + default: + return DE_NULL; + } +} + +class BuildInfoStringCase : public tcu::TestCase +{ +public: + BuildInfoStringCase (tcu::TestContext& testCtx, const char* name, const char* valueName, const char* value) + : tcu::TestCase (testCtx, name, valueName) + , m_valueName (valueName) + , m_value (value) + { + } + + IterateResult iterate (void) + { + m_testCtx.getLog() << TestLog::Message << m_valueName << " = " << m_value << TestLog::EndMessage; + m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); + return STOP; + } + +private: + std::string m_valueName; + std::string m_value; +}; + +class BuildEnumCase : public tcu::TestCase +{ +public: + typedef const char* (*GetStringFunc) (int value); + + BuildEnumCase (tcu::TestContext& testCtx, const char* name, const char* varName, int value, GetStringFunc getString) + : tcu::TestCase (testCtx, name, varName) + , m_varName (varName) + , m_value (value) + , m_getString (getString) + { + } + + IterateResult iterate (void) + { + const char* valueName = m_getString(m_value); + const bool isOk = valueName != DE_NULL; + std::string logValue = valueName ? std::string(valueName) : de::toString(m_value); + + m_testCtx.getLog() << TestLog::Message << m_varName << " = " << logValue << TestLog::EndMessage; + + m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL, + isOk ? "Pass" : "No enum name found"); + return STOP; + } + +private: + std::string m_varName; + int m_value; + GetStringFunc m_getString; +}; + +class EndiannessConsistencyCase : public tcu::TestCase +{ +public: + EndiannessConsistencyCase (tcu::TestContext& context, const char* name, const char* description) + : tcu::TestCase(context, name, description) + { + } + + IterateResult iterate (void) + { + const deUint16 multiByte = (deUint16)0x0102; + +#if DE_ENDIANNESS == DE_BIG_ENDIAN + const bool isOk = *((const deUint8*)&multiByte) == (deUint8)0x01; +#elif DE_ENDIANNESS == DE_LITTLE_ENDIAN + const bool isOk = *((const deUint8*)&multiByte) == (deUint8)0x02; +#endif + + m_testCtx.getLog() + << TestLog::Message + << "Verifying DE_ENDIANNESS matches actual behavior" + << TestLog::EndMessage; + + m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL, + isOk ? "Pass" : "Configured endianness inconsistent"); + return STOP; + } +}; + +BuildInfoTests::BuildInfoTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "build_info", "Build Info Tests") +{ +} + +BuildInfoTests::~BuildInfoTests (void) +{ +} + +void BuildInfoTests::init (void) +{ +#if defined(DE_DEBUG) + const bool isDebug = true; +#else + const bool isDebug = false; +#endif + + addChild(new BuildInfoStringCase (m_testCtx, "date", "__DATE__", __DATE__)); + addChild(new BuildInfoStringCase (m_testCtx, "time", "__TIME__", __TIME__)); + addChild(new BuildInfoStringCase (m_testCtx, "de_debug", "DE_DEBUG", isDebug ? "1" : "not defined")); + addChild(new BuildEnumCase (m_testCtx, "de_os", "DE_OS", DE_OS, getOsName)); + addChild(new BuildEnumCase (m_testCtx, "de_cpu", "DE_CPU", DE_CPU, getCpuName)); + addChild(new BuildEnumCase (m_testCtx, "de_compiler", "DE_COMPILER", DE_COMPILER, getCompilerName)); + addChild(new BuildInfoStringCase (m_testCtx, "de_ptr_size", "DE_PTR_SIZE", de::toString(DE_PTR_SIZE).c_str())); + addChild(new BuildEnumCase (m_testCtx, "de_endianness", "DE_ENDIANNESS", DE_ENDIANNESS, getEndiannessName)); + addChild(new EndiannessConsistencyCase (m_testCtx, "de_endianness_consitent", "DE_ENDIANNESS")); +} + +} // dit diff --git a/modules/internal/ditBuildInfoTests.hpp b/modules/internal/ditBuildInfoTests.hpp new file mode 100644 index 000000000..0c19b4ca1 --- /dev/null +++ b/modules/internal/ditBuildInfoTests.hpp @@ -0,0 +1,43 @@ +#ifndef _DITBUILDINFOTESTS_HPP +#define _DITBUILDINFOTESTS_HPP +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Build information tests. + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "tcuTestCase.hpp" + +namespace dit +{ + +class BuildInfoTests : public tcu::TestCaseGroup +{ +public: + BuildInfoTests (tcu::TestContext& testCtx); + ~BuildInfoTests (void); + + void init (void); +}; + +} // dit + +#endif // _DITBUILDINFOTESTS_HPP diff --git a/modules/internal/ditDelibsTests.cpp b/modules/internal/ditDelibsTests.cpp new file mode 100644 index 000000000..5e9533601 --- /dev/null +++ b/modules/internal/ditDelibsTests.cpp @@ -0,0 +1,150 @@ +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief delibs self-tests. + *//*--------------------------------------------------------------------*/ + +#include "ditDelibsTests.hpp" + +// depool +#include "dePoolArray.h" +#include "dePoolHeap.h" +#include "dePoolHash.h" +#include "dePoolSet.h" +#include "dePoolHashSet.h" +#include "dePoolHashArray.h" +#include "dePoolMultiSet.h" + +// dethread +#include "deThreadTest.h" + +// deutil +#include "deTimerTest.h" + +// decpp +#include "deBlockBuffer.hpp" +#include "deFilePath.hpp" +#include "dePoolArray.hpp" +#include "deRingBuffer.hpp" +#include "deSharedPtr.hpp" +#include "deThreadSafeRingBuffer.hpp" +#include "deUniquePtr.hpp" +#include "deRandom.hpp" +#include "deCommandLine.hpp" +#include "deArrayBuffer.hpp" +#include "deStringUtil.hpp" + +namespace dit +{ + +class DepoolTests : public tcu::TestCaseGroup +{ +public: + DepoolTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "depool", "depool self-tests") + { + } + + void init (void) + { + addChild(new SelfCheckCase(m_testCtx, "array", "dePoolArray_selfTest()", dePoolArray_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "heap", "dePoolHeap_selfTest()", dePoolHeap_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "hash", "dePoolHash_selfTest()", dePoolHash_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "set", "dePoolSet_selfTest()", dePoolSet_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "hash_set", "dePoolHashSet_selfTest()", dePoolHashSet_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "hash_array", "dePoolHashArray_selfTest()", dePoolHashArray_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "multi_set", "dePoolMultiSet_selfTest()", dePoolMultiSet_selfTest)); + } +}; + +class DethreadTests : public tcu::TestCaseGroup +{ +public: + DethreadTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "dethread", "dethread self-tests") + { + } + + void init (void) + { + addChild(new SelfCheckCase(m_testCtx, "thread", "deThread_selfTest()", deThread_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "mutex", "deMutex_selfTest()", deMutex_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "semaphore", "deSemaphore_selfTest()", deSemaphore_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "atomic", "deAtomic_selfTest()", deAtomic_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "singleton", "deSingleton_selfTest()", deSingleton_selfTest)); + } +}; + +class DeutilTests : public tcu::TestCaseGroup +{ +public: + DeutilTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "deutil", "deutil self-tests") + { + } + + void init (void) + { + addChild(new SelfCheckCase(m_testCtx, "timer", "deTimer_selfTest()", deTimer_selfTest)); + } +}; + +class DecppTests : public tcu::TestCaseGroup +{ +public: + DecppTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "decpp", "decpp self-tests") + { + } + + void init (void) + { + addChild(new SelfCheckCase(m_testCtx, "block_buffer", "de::BlockBuffer_selfTest()", de::BlockBuffer_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "file_path", "de::FilePath_selfTest()", de::FilePath_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "pool_array", "de::PoolArray_selfTest()", de::PoolArray_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "ring_buffer", "de::RingBuffer_selfTest()", de::RingBuffer_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "shared_ptr", "de::SharedPtr_selfTest()", de::SharedPtr_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "thread_safe_ring_buffer", "de::ThreadSafeRingBuffer_selfTest()", de::ThreadSafeRingBuffer_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "unique_ptr", "de::UniquePtr_selfTest()", de::UniquePtr_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "random", "de::Random_selfTest()", de::Random_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "commandline", "de::cmdline::selfTest()", de::cmdline::selfTest)); + addChild(new SelfCheckCase(m_testCtx, "array_buffer", "de::ArrayBuffer_selfTest()", de::ArrayBuffer_selfTest)); + addChild(new SelfCheckCase(m_testCtx, "string_util", "de::StringUtil_selfTest()", de::StringUtil_selfTest)); + } +}; + +DelibsTests::DelibsTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "delibs", "delibs Tests") +{ +} + +DelibsTests::~DelibsTests (void) +{ +} + +void DelibsTests::init (void) +{ + addChild(new DepoolTests (m_testCtx)); + addChild(new DethreadTests (m_testCtx)); + addChild(new DeutilTests (m_testCtx)); + addChild(new DecppTests (m_testCtx)); +} + +} // dit diff --git a/modules/internal/ditDelibsTests.hpp b/modules/internal/ditDelibsTests.hpp new file mode 100644 index 000000000..209d4e7a5 --- /dev/null +++ b/modules/internal/ditDelibsTests.hpp @@ -0,0 +1,43 @@ +#ifndef _DITDELIBSTESTS_HPP +#define _DITDELIBSTESTS_HPP +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief delibs self-tests. + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "ditTestCase.hpp" + +namespace dit +{ + +class DelibsTests : public tcu::TestCaseGroup +{ +public: + DelibsTests (tcu::TestContext& testCtx); + ~DelibsTests (void); + + void init (void); +}; + +} // dit + +#endif // _DITDELIBSTESTS_HPP diff --git a/modules/internal/ditFrameworkTests.cpp b/modules/internal/ditFrameworkTests.cpp new file mode 100644 index 000000000..3882c45e8 --- /dev/null +++ b/modules/internal/ditFrameworkTests.cpp @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Miscellaneous framework tests. + *//*--------------------------------------------------------------------*/ + +#include "ditFrameworkTests.hpp" + +#include "tcuFloatFormat.hpp" + +namespace dit +{ + +class CommonFrameworkTests : public tcu::TestCaseGroup +{ +public: + CommonFrameworkTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "common", "Tests for the common utility framework") + { + } + + void init (void) + { + addChild(new SelfCheckCase(m_testCtx, "float_format","tcu::FloatFormat_selfTest()", + tcu::FloatFormat_selfTest)); + } +}; + +FrameworkTests::FrameworkTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "framework", "Miscellaneous framework tests") +{ +} + +FrameworkTests::~FrameworkTests (void) +{ +} + +void FrameworkTests::init (void) +{ + addChild(new CommonFrameworkTests(m_testCtx)); +} + +} diff --git a/modules/internal/ditFrameworkTests.hpp b/modules/internal/ditFrameworkTests.hpp new file mode 100644 index 000000000..e5e0ff6c1 --- /dev/null +++ b/modules/internal/ditFrameworkTests.hpp @@ -0,0 +1,43 @@ +#ifndef _DITFRAMEWORKTESTS_HPP +#define _DITFRAMEWORKTESTS_HPP +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Miscellaneous framework tests. + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "ditTestCase.hpp" + +namespace dit +{ + +class FrameworkTests : public tcu::TestCaseGroup +{ +public: + FrameworkTests (tcu::TestContext& testCtx); + ~FrameworkTests (void); + + void init (void); +}; + +} // dit + +#endif // _DITFRAMEWORKTESTS_HPP diff --git a/modules/internal/ditImageCompareTests.cpp b/modules/internal/ditImageCompareTests.cpp new file mode 100644 index 000000000..96e0a5f9d --- /dev/null +++ b/modules/internal/ditImageCompareTests.cpp @@ -0,0 +1,231 @@ +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Image comparison tests. + *//*--------------------------------------------------------------------*/ + +#include "ditImageCompareTests.hpp" +#include "tcuResource.hpp" +#include "tcuImageCompare.hpp" +#include "tcuFuzzyImageCompare.hpp" +#include "tcuImageIO.hpp" +#include "tcuTexture.hpp" +#include "tcuTestLog.hpp" +#include "tcuTextureUtil.hpp" +#include "tcuRGBA.hpp" +#include "deFilePath.hpp" +#include "deClock.h" + +namespace dit +{ + +using tcu::TestLog; + +static const char* BASE_DIR = "data/imagecompare"; + +static void loadImageRGBA8 (tcu::TextureLevel& dst, const tcu::Archive& archive, const char* path) +{ + tcu::TextureLevel tmp; + tcu::ImageIO::loadImage(tmp, archive, path); + + dst.setStorage(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), tmp.getWidth(), tmp.getHeight()); + tcu::copy(dst, tmp); +} + +class FuzzyComparisonMetricCase : public tcu::TestCase +{ +public: + FuzzyComparisonMetricCase (tcu::TestContext& testCtx, const char* name, const char* refImg, const char* cmpImg, const float minBound, const float maxBound) + : tcu::TestCase (testCtx, name, "") + , m_refImg (refImg) + , m_cmpImg (cmpImg) + , m_minBound (minBound) + , m_maxBound (maxBound) + { + } + + IterateResult iterate (void) + { + tcu::TextureLevel refImg; + tcu::TextureLevel cmpImg; + tcu::TextureLevel errorMask; + tcu::FuzzyCompareParams params; + float result = 0.0f; + deUint64 compareTime = 0; + + params.maxSampleSkip = 0; + + tcu::ImageIO::loadImage(refImg, m_testCtx.getArchive(), de::FilePath::join(BASE_DIR, m_refImg).getPath()); + tcu::ImageIO::loadImage(cmpImg, m_testCtx.getArchive(), de::FilePath::join(BASE_DIR, m_cmpImg).getPath()); + + errorMask.setStorage(refImg.getFormat(), refImg.getWidth(), refImg.getHeight(), refImg.getDepth()); + + { + const deUint64 startTime = deGetMicroseconds(); + result = tcu::fuzzyCompare(params, refImg, cmpImg, errorMask); + compareTime = deGetMicroseconds()-startTime; + } + + m_testCtx.getLog() << TestLog::Float("Result", "Result metric", "", QP_KEY_TAG_NONE, result) + << TestLog::Float("MinBound", "Minimum bound", "", QP_KEY_TAG_NONE, m_minBound) + << TestLog::Float("MaxBound", "Maximum bound", "", QP_KEY_TAG_NONE, m_maxBound) + << TestLog::Integer("CompareTime", "Comparison time", "us", QP_KEY_TAG_TIME, compareTime); + + { + const bool isOk = de::inRange(result, m_minBound, m_maxBound); + m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL, + isOk ? "Pass" : "Metric out of bounds"); + } + + return STOP; + } + +private: + const std::string m_refImg; + const std::string m_cmpImg; + const float m_minBound; + const float m_maxBound; +}; + +class BilinearCompareCase : public tcu::TestCase +{ +public: + BilinearCompareCase (tcu::TestContext& testCtx, const char* name, const char* refImg, const char* cmpImg, const tcu::RGBA& threshold, bool expectedResult) + : tcu::TestCase (testCtx, name, "") + , m_refImg (refImg) + , m_cmpImg (cmpImg) + , m_threshold (threshold) + , m_expectedResult (expectedResult) + { + } + + IterateResult iterate (void) + { + tcu::TextureLevel refImg; + tcu::TextureLevel cmpImg; + bool result; + deUint64 compareTime = 0; + + loadImageRGBA8(refImg, m_testCtx.getArchive(), de::FilePath::join(BASE_DIR, m_refImg).getPath()); + loadImageRGBA8(cmpImg, m_testCtx.getArchive(), de::FilePath::join(BASE_DIR, m_cmpImg).getPath()); + + { + const deUint64 startTime = deGetMicroseconds(); + result = tcu::bilinearCompare(m_testCtx.getLog(), "CompareResult", "Image comparison result", refImg, cmpImg, m_threshold, tcu::COMPARE_LOG_EVERYTHING); + compareTime = deGetMicroseconds()-startTime; + } + + m_testCtx.getLog() << TestLog::Integer("CompareTime", "Comparison time", "us", QP_KEY_TAG_TIME, compareTime); + + { + const bool isOk = result == m_expectedResult; + m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL, + isOk ? "Pass" : "Wrong comparison result"); + } + + return STOP; + } + +private: + const std::string m_refImg; + const std::string m_cmpImg; + const tcu::RGBA m_threshold; + const bool m_expectedResult; +}; + +class FuzzyComparisonMetricTests : public tcu::TestCaseGroup +{ +public: + FuzzyComparisonMetricTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "fuzzy_metric", "Fuzzy comparison metrics") + { + } + + void init (void) + { + addChild(new FuzzyComparisonMetricCase(m_testCtx, "identical", "cube_ref.png", "cube_ref.png", 0.0f, 0.000001f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube", "cube_ref.png", "cube_cmp.png", 0.0029f, 0.0031f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_2", "cube_2_ref.png", "cube_2_cmp.png", 0.0134f, 0.0140f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_sphere", "cube_sphere_ref.png", "cube_sphere_cmp.png", 0.0730f, 0.0801f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_nmap", "cube_nmap_ref.png", "cube_nmap_cmp.png", 0.0024f, 0.0025f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_nmap_2", "cube_nmap_2_ref.png", "cube_nmap_2_cmp.png", 0.0172f, 0.0189f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_diffuse", "earth_diffuse_ref.png", "earth_diffuse_cmp.png", 0.0f, 0.00002f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "eath_texture", "earth_texture_ref.png", "earth_texture_cmp.png", 0.0002f, 0.0003f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_spot", "earth_spot_ref.png", "earth_spot_cmp.png", 0.0015f, 0.0018f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_light", "earth_light_ref.png", "earth_light_cmp.png", 1.7050f, 1.7070f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "lessThan0", "lessThan0-reference.png", "lessThan0-result.png", 0.0003f, 0.0004f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_sphere_2", "cube_sphere_2_ref.png", "cube_sphere_2_cmp.png", 0.0207f, 0.0230f)); + addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_to_empty", "earth_spot_ref.png", "empty_256x256.png", 77074.0f, 77076.0f)); + } +}; + +class BilinearCompareTests : public tcu::TestCaseGroup +{ +public: + BilinearCompareTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "bilinear_compare", "Bilinear Image Comparison Tests") + { + } + + void init (void) + { + addChild(new BilinearCompareCase(m_testCtx, "identical", "cube_ref.png", "cube_ref.png", tcu::RGBA(0,0,0,0), true)); + addChild(new BilinearCompareCase(m_testCtx, "empty_to_white", "empty_256x256.png", "white_256x256.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "white_to_empty", "white_256x256.png", "empty_256x256.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "cube", "cube_ref.png", "cube_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "cube_2", "cube_2_ref.png", "cube_2_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "cube_sphere", "cube_sphere_ref.png", "cube_sphere_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "cube_nmap", "cube_nmap_ref.png", "cube_nmap_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "cube_nmap_2", "cube_nmap_2_ref.png", "cube_nmap_2_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "earth_diffuse", "earth_diffuse_ref.png", "earth_diffuse_cmp.png", tcu::RGBA(20,20,20,2), true)); + addChild(new BilinearCompareCase(m_testCtx, "eath_texture", "earth_texture_ref.png", "earth_texture_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "earth_spot", "earth_spot_ref.png", "earth_spot_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "earth_light", "earth_light_ref.png", "earth_light_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "lessThan0", "lessThan0-reference.png", "lessThan0-result.png", tcu::RGBA(36,36,36,2), true)); + addChild(new BilinearCompareCase(m_testCtx, "cube_sphere_2", "cube_sphere_2_ref.png", "cube_sphere_2_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "earth_to_empty", "earth_spot_ref.png", "empty_256x256.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "texfilter", "texfilter_ref.png", "texfilter_cmp.png", tcu::RGBA(7,7,7,2), true)); + addChild(new BilinearCompareCase(m_testCtx, "refract_vtx", "refract_vtx_ref.png", "refract_vtx_cmp.png", tcu::RGBA(7,7,7,2), true)); + addChild(new BilinearCompareCase(m_testCtx, "refract_frag", "refract_frag_ref.png", "refract_frag_cmp.png", tcu::RGBA(7,7,7,2), true)); + addChild(new BilinearCompareCase(m_testCtx, "lessthan_vtx", "lessthan_vtx_ref.png", "lessthan_vtx_cmp.png", tcu::RGBA(7,7,7,2), true)); + addChild(new BilinearCompareCase(m_testCtx, "2_units_2d", "2_units_2d_ref.png", "2_units_2d_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "4_units_cube_vtx", "4_units_cube_ref.png", "4_units_cube_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "texfilter_vtx_nearest", "texfilter_vtx_nearest_ref.png", "texfilter_vtx_nearest_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "texfilter_vtx_linear", "texfilter_vtx_linear_ref.png", "texfilter_vtx_linear_cmp.png", tcu::RGBA(7,7,7,2), false)); + addChild(new BilinearCompareCase(m_testCtx, "readpixels_msaa", "readpixels_ref.png", "readpixels_msaa.png", tcu::RGBA(1,1,1,1), true)); + } +}; + +ImageCompareTests::ImageCompareTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "image_compare", "Image comparison tests") +{ +} + +ImageCompareTests::~ImageCompareTests (void) +{ +} + +void ImageCompareTests::init (void) +{ + addChild(new FuzzyComparisonMetricTests (m_testCtx)); + addChild(new BilinearCompareTests (m_testCtx)); +} + +} // dit diff --git a/modules/internal/ditImageCompareTests.hpp b/modules/internal/ditImageCompareTests.hpp new file mode 100644 index 000000000..d43b10cae --- /dev/null +++ b/modules/internal/ditImageCompareTests.hpp @@ -0,0 +1,43 @@ +#ifndef _DITIMAGECOMPARETESTS_HPP +#define _DITIMAGECOMPARETESTS_HPP +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Image comparison tests. + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "tcuTestCase.hpp" + +namespace dit +{ + +class ImageCompareTests : public tcu::TestCaseGroup +{ +public: + ImageCompareTests (tcu::TestContext& testCtx); + ~ImageCompareTests (void); + + void init (void); +}; + +} // dit + +#endif // _DITIMAGECOMPARETESTS_HPP diff --git a/modules/internal/ditImageIOTests.cpp b/modules/internal/ditImageIOTests.cpp new file mode 100644 index 000000000..fde67f3f5 --- /dev/null +++ b/modules/internal/ditImageIOTests.cpp @@ -0,0 +1,114 @@ +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Image IO tests. + *//*--------------------------------------------------------------------*/ + +#include "ditImageIOTests.hpp" +#include "tcuResource.hpp" +#include "tcuImageIO.hpp" +#include "tcuTexture.hpp" +#include "tcuTestLog.hpp" +#include "tcuFormatUtil.hpp" +#include "deUniquePtr.hpp" +#include "deString.h" + +namespace dit +{ + +using tcu::TestLog; + +// \todo [2013-05-28 pyry] Image output cases! + +class ImageReadCase : public tcu::TestCase +{ +public: + ImageReadCase (tcu::TestContext& testCtx, const char* name, const char* filename, deUint32 expectedHash) + : TestCase (testCtx, name, filename) + , m_filename (filename) + , m_expectedHash (expectedHash) + { + } + + IterateResult iterate (void) + { + m_testCtx.getLog() << TestLog::Message << "Loading image from file '" << m_filename << "'" << TestLog::EndMessage; + + tcu::TextureLevel texture; + tcu::ImageIO::loadImage(texture, m_testCtx.getArchive(), m_filename.c_str()); + + m_testCtx.getLog() << TestLog::Message << "Loaded " << texture.getWidth() << "x" << texture.getHeight() << "x" << texture.getDepth() << " image with format " << texture.getFormat() << TestLog::EndMessage; + + // Check that layout is as expected + TCU_CHECK(texture.getAccess().getRowPitch() == texture.getWidth()*texture.getFormat().getPixelSize()); + TCU_CHECK(texture.getAccess().getSlicePitch() == texture.getAccess().getRowPitch()*texture.getAccess().getHeight()); + + const int imageSize = texture.getAccess().getSlicePitch()*texture.getDepth(); + const deUint32 hash = deMemoryHash(texture.getAccess().getDataPtr(), imageSize); + + if (hash != m_expectedHash) + { + m_testCtx.getLog() << TestLog::Message << "ERROR: expected hash " << tcu::toHex(m_expectedHash) << ", got " << tcu::toHex(hash) << TestLog::EndMessage; + m_testCtx.getLog() << TestLog::Image("Image", "Loaded image", texture.getAccess()); + m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Hash check failed"); + } + else + m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); + + return STOP; + } + +private: + const std::string m_filename; + const deUint32 m_expectedHash; +}; + +class ImageReadTests : public tcu::TestCaseGroup +{ +public: + ImageReadTests (tcu::TestContext& testCtx) + : TestCaseGroup(testCtx, "read", "Image read tests") + { + } + + void init (void) + { + addChild(new ImageReadCase(m_testCtx, "rgb24_256x256", "data/imageio/rgb24_256x256.png", 0x6efad777)); + addChild(new ImageReadCase(m_testCtx, "rgb24_209x181", "data/imageio/rgb24_209x181.png", 0xfd6ea668)); + addChild(new ImageReadCase(m_testCtx, "rgba32_256x256", "data/imageio/rgba32_256x256.png", 0xcf4883da)); + addChild(new ImageReadCase(m_testCtx, "rgba32_207x219", "data/imageio/rgba32_207x219.png", 0x404ba06b)); + } +}; + +ImageIOTests::ImageIOTests(tcu::TestContext& testCtx) + : TestCaseGroup(testCtx, "image_io", "Image read and write tests") +{ +} + +ImageIOTests::~ImageIOTests (void) +{ +} + +void ImageIOTests::init (void) +{ + addChild(new ImageReadTests(m_testCtx)); +} + +} // dit diff --git a/modules/internal/ditImageIOTests.hpp b/modules/internal/ditImageIOTests.hpp new file mode 100644 index 000000000..8253bc36e --- /dev/null +++ b/modules/internal/ditImageIOTests.hpp @@ -0,0 +1,43 @@ +#ifndef _DITIMAGEIOTESTS_HPP +#define _DITIMAGEIOTESTS_HPP +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Image IO tests. + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "tcuTestCase.hpp" + +namespace dit +{ + +class ImageIOTests : public tcu::TestCaseGroup +{ +public: + ImageIOTests (tcu::TestContext& testCtx); + ~ImageIOTests (void); + + void init (void); +}; + +} // dit + +#endif // _DITIMAGEIOTESTS_HPP diff --git a/modules/internal/ditTestCase.cpp b/modules/internal/ditTestCase.cpp new file mode 100644 index 000000000..eb05f9e6d --- /dev/null +++ b/modules/internal/ditTestCase.cpp @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Test case classes for internal tests. + *//*--------------------------------------------------------------------*/ + +#include "deDefs.hpp" + +DE_EMPTY_CPP_FILE diff --git a/modules/internal/ditTestCase.hpp b/modules/internal/ditTestCase.hpp new file mode 100644 index 000000000..b7514898b --- /dev/null +++ b/modules/internal/ditTestCase.hpp @@ -0,0 +1,56 @@ +#ifndef _DITTESTCASE_HPP +#define _DITTESTCASE_HPP +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Test case classes for internal tests. + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "tcuTestCase.hpp" + +namespace dit +{ + +class SelfCheckCase : public tcu::TestCase +{ +public: + typedef void (*Function) (void); + + SelfCheckCase (tcu::TestContext& testCtx, const char* name, const char* desc, Function func) + : tcu::TestCase (testCtx, name, desc) + , m_function (func) + { + } + + IterateResult iterate (void) + { + m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); + m_function(); + return STOP; + } + +private: + Function m_function; +}; + +} // dit + +#endif // _DITTESTCASE_HPP diff --git a/modules/internal/ditTestLogTests.cpp b/modules/internal/ditTestLogTests.cpp new file mode 100644 index 000000000..466061343 --- /dev/null +++ b/modules/internal/ditTestLogTests.cpp @@ -0,0 +1,86 @@ +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Test log output tests. + *//*--------------------------------------------------------------------*/ + +#include "ditTestLogTests.hpp" +#include "tcuTestLog.hpp" + +#include <limits> + +namespace dit +{ + +using tcu::TestLog; + +// \todo [2014-02-25 pyry] Extend with: +// - output of all element types +// - nested element cases (sections, image sets) +// - parse results and verify + +class BasicSampleListCase : public tcu::TestCase +{ +public: + BasicSampleListCase (tcu::TestContext& testCtx) + : TestCase(testCtx, "sample_list", "Basic sample list usage") + { + } + + IterateResult iterate (void) + { + TestLog& log = m_testCtx.getLog(); + + log << TestLog::SampleList("TestSamples", "Test Sample List") + << TestLog::SampleInfo + << TestLog::ValueInfo("NumDrawCalls", "Number of draw calls", "", QP_SAMPLE_VALUE_TAG_PREDICTOR) + << TestLog::ValueInfo("NumOps", "Number of ops in shader", "op", QP_SAMPLE_VALUE_TAG_PREDICTOR) + << TestLog::ValueInfo("RenderTime", "Rendering time", "ms", QP_SAMPLE_VALUE_TAG_RESPONSE) + << TestLog::EndSampleInfo; + + log << TestLog::Sample << 1 << 2 << 2.3 << TestLog::EndSample + << TestLog::Sample << 0 << 0 << 0 << TestLog::EndSample + << TestLog::Sample << 421 << -23 << 0.00001 << TestLog::EndSample + << TestLog::Sample << 2 << 9 << -1e9 << TestLog::EndSample + << TestLog::Sample << std::numeric_limits<deInt64>::max() << std::numeric_limits<deInt64>::min() << -0.0f << TestLog::EndSample + << TestLog::Sample << 0x3355 << 0xf24 << std::numeric_limits<double>::max() << TestLog::EndSample; + + log << TestLog::EndSampleList; + + m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); + return STOP; + } +}; + +TestLogTests::TestLogTests (tcu::TestContext& testCtx) + : TestCaseGroup(testCtx, "testlog", "Test Log Tests") +{ +} + +TestLogTests::~TestLogTests (void) +{ +} + +void TestLogTests::init (void) +{ + addChild(new BasicSampleListCase(m_testCtx)); +} + +} // dit diff --git a/modules/internal/ditTestLogTests.hpp b/modules/internal/ditTestLogTests.hpp new file mode 100644 index 000000000..e49a24935 --- /dev/null +++ b/modules/internal/ditTestLogTests.hpp @@ -0,0 +1,43 @@ +#ifndef _DITTESTLOGTESTS_HPP +#define _DITTESTLOGTESTS_HPP +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Test log output tests. + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "tcuTestCase.hpp" + +namespace dit +{ + +class TestLogTests : public tcu::TestCaseGroup +{ +public: + TestLogTests (tcu::TestContext& testCtx); + ~TestLogTests (void); + + void init (void); +}; + +} // dit + +#endif // _DITTESTLOGTESTS_HPP diff --git a/modules/internal/ditTestPackage.cpp b/modules/internal/ditTestPackage.cpp new file mode 100644 index 000000000..6af0657c9 --- /dev/null +++ b/modules/internal/ditTestPackage.cpp @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * drawElements Quality Program OpenGL ES 2.0 Module + * ------------------------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief drawElements Internal Test Package + *//*--------------------------------------------------------------------*/ + +#include "ditTestPackage.hpp" +#include "ditBuildInfoTests.hpp" +#include "ditDelibsTests.hpp" +#include "ditFrameworkTests.hpp" +#include "ditImageIOTests.hpp" +#include "ditImageCompareTests.hpp" +#include "ditTestLogTests.hpp" + +namespace dit +{ + +class DeqpTests : public tcu::TestCaseGroup +{ +public: + DeqpTests (tcu::TestContext& testCtx) + : tcu::TestCaseGroup(testCtx, "deqp", "dEQP Test Framework Self-tests") + { + } + + void init (void) + { + addChild(new TestLogTests (m_testCtx)); + addChild(new ImageIOTests (m_testCtx)); + addChild(new ImageCompareTests (m_testCtx)); + } +}; + +TestPackage::TestPackage (tcu::TestContext& testCtx) + : tcu::TestPackage (testCtx, "dE-IT", "drawElements Internal Tests") + , m_wrapper (testCtx) + , m_archive (testCtx.getRootArchive(), "internal/") +{ +} + +TestPackage::~TestPackage (void) +{ +} + +void TestPackage::init (void) +{ + addChild(new BuildInfoTests (m_testCtx)); + addChild(new DelibsTests (m_testCtx)); + addChild(new FrameworkTests (m_testCtx)); + addChild(new DeqpTests (m_testCtx)); +} + +void TestPackage::deinit (void) +{ + TestNode::deinit(); +} + +} // dit diff --git a/modules/internal/ditTestPackage.hpp b/modules/internal/ditTestPackage.hpp new file mode 100644 index 000000000..0d08a06f0 --- /dev/null +++ b/modules/internal/ditTestPackage.hpp @@ -0,0 +1,52 @@ +#ifndef _DITTESTPACKAGE_HPP +#define _DITTESTPACKAGE_HPP +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief drawElements Internal Test Package + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "tcuTestPackage.hpp" +#include "tcuResource.hpp" + +namespace dit +{ + +class TestPackage : public tcu::TestPackage +{ +public: + TestPackage (tcu::TestContext& testCtx); + virtual ~TestPackage (void); + + virtual void init (void); + virtual void deinit (void); + + tcu::TestCaseWrapper& getTestCaseWrapper (void) { return m_wrapper; } + tcu::Archive& getArchive (void) { return m_archive; } + +private: + tcu::TestCaseWrapper m_wrapper; + tcu::ResourcePrefix m_archive; +}; + +} // dit + +#endif // _DITTESTPACKAGE_HPP diff --git a/modules/internal/ditTestPackageEntry.cpp b/modules/internal/ditTestPackageEntry.cpp new file mode 100644 index 000000000..54df640f0 --- /dev/null +++ b/modules/internal/ditTestPackageEntry.cpp @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * drawElements Internal Test Module + * --------------------------------- + * + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief dE-IT module entry point. + *//*--------------------------------------------------------------------*/ + +#include "ditTestPackage.hpp" + +// Register package to test executor. + +static tcu::TestPackage* createTestPackage (tcu::TestContext& testCtx) +{ + return new dit::TestPackage(testCtx); +} + +tcu::TestPackageDescriptor g_ditPackageDescriptor("dE-IT", createTestPackage); diff --git a/modules/internal/internal.cmake b/modules/internal/internal.cmake new file mode 100644 index 000000000..105d974ca --- /dev/null +++ b/modules/internal/internal.cmake @@ -0,0 +1 @@ +add_subdirectory(internal) |