Commit fd67b1bf by Jamie Madill

Move implementation unit tests to angle_unittests.

Now that libANGLE is cross-platform, this should work on OSX/Linux and Android. Includes a warning fixes for test comparisons, and fix to our META_ASSERT wrapper macro for clang. BUG=angleproject:773 Change-Id: I6b88a85c62a2e07734ae81fb8276c28c5f8f9f47 Reviewed-on: https://chromium-review.googlesource.com/258300Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent f90353e8
...@@ -139,7 +139,16 @@ namespace gl ...@@ -139,7 +139,16 @@ namespace gl
#endif #endif
// A macro functioning as a compile-time assert to validate constant conditions // A macro functioning as a compile-time assert to validate constant conditions
#if (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__GNUC__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3))
#if (defined(_MSC_VER) && _MSC_VER >= 1600)
#define ANGLE_HAS_STATIC_ASSERT
#elif (defined(__GNUC__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3))
#define ANGLE_HAS_STATIC_ASSERT
#elif defined(__clang__) && __has_feature(cxx_static_assert)
#define ANGLE_HAS_STATIC_ASSERT
#endif
#if defined(ANGLE_HAS_STATIC_ASSERT)
#define META_ASSERT_MSG(condition, msg) static_assert(condition, msg) #define META_ASSERT_MSG(condition, msg) static_assert(condition, msg)
#else #else
#define META_ASSERT_CONCAT(a, b) a ## b #define META_ASSERT_CONCAT(a, b) a ## b
......
...@@ -24,7 +24,7 @@ class FenceSyncImpl; ...@@ -24,7 +24,7 @@ class FenceSyncImpl;
namespace gl namespace gl
{ {
class FenceNV class FenceNV final
{ {
public: public:
explicit FenceNV(rx::FenceNVImpl *impl); explicit FenceNV(rx::FenceNVImpl *impl);
...@@ -36,7 +36,7 @@ class FenceNV ...@@ -36,7 +36,7 @@ class FenceNV
Error finishFence(); Error finishFence();
GLboolean getStatus() const { return mStatus; } GLboolean getStatus() const { return mStatus; }
GLuint getCondition() const { return mCondition; } GLenum getCondition() const { return mCondition; }
private: private:
DISALLOW_COPY_AND_ASSIGN(FenceNV); DISALLOW_COPY_AND_ASSIGN(FenceNV);
...@@ -49,7 +49,7 @@ class FenceNV ...@@ -49,7 +49,7 @@ class FenceNV
GLenum mCondition; GLenum mCondition;
}; };
class FenceSync : public RefCountObject class FenceSync final : public RefCountObject
{ {
public: public:
explicit FenceSync(rx::FenceSyncImpl *impl, GLuint id); explicit FenceSync(rx::FenceSyncImpl *impl, GLuint id);
...@@ -60,7 +60,7 @@ class FenceSync : public RefCountObject ...@@ -60,7 +60,7 @@ class FenceSync : public RefCountObject
Error serverWait(GLbitfield flags, GLuint64 timeout); Error serverWait(GLbitfield flags, GLuint64 timeout);
Error getStatus(GLint *outResult) const; Error getStatus(GLint *outResult) const;
GLuint getCondition() const { return mCondition; } GLenum getCondition() const { return mCondition; }
private: private:
DISALLOW_COPY_AND_ASSIGN(FenceSync); DISALLOW_COPY_AND_ASSIGN(FenceSync);
......
...@@ -262,7 +262,7 @@ void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params) ...@@ -262,7 +262,7 @@ void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
case GL_FENCE_CONDITION_NV: case GL_FENCE_CONDITION_NV:
{ {
*params = fenceObject->getCondition(); *params = static_cast<GLint>(fenceObject->getCondition());
break; break;
} }
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
}, },
'dependencies': 'dependencies':
[ [
'<(angle_path)/src/angle.gyp:libANGLE',
'<(angle_path)/src/angle.gyp:libEGL', '<(angle_path)/src/angle.gyp:libEGL',
'<(angle_path)/src/angle.gyp:libGLESv2', '<(angle_path)/src/angle.gyp:libGLESv2',
'<(angle_path)/tests/tests.gyp:angle_test_support', '<(angle_path)/tests/tests.gyp:angle_test_support',
...@@ -67,11 +66,6 @@ ...@@ -67,11 +66,6 @@
'../include', '../include',
'angle_tests', 'angle_tests',
], ],
'includes':
[
# TODO(kbr): move these to angle_unittests.gypi.
'angle_implementation_unit_tests/angle_implementation_unit_tests.gypi',
],
'sources': 'sources':
[ [
'<@(angle_end2end_tests_sources)', '<@(angle_end2end_tests_sources)',
......
...@@ -108,7 +108,7 @@ TEST(ConfigSetTest, IDs) ...@@ -108,7 +108,7 @@ TEST(ConfigSetTest, IDs)
// Check that there are no gaps and the IDs are in the range [1, N]. // Check that there are no gaps and the IDs are in the range [1, N].
EXPECT_EQ(*std::min_element(ids.begin(), ids.end()), 1); EXPECT_EQ(*std::min_element(ids.begin(), ids.end()), 1);
EXPECT_EQ(*std::max_element(ids.begin(), ids.end()), set.size()); EXPECT_EQ(*std::max_element(ids.begin(), ids.end()), static_cast<EGLint>(set.size()));
} }
TEST(ConfigSetTest, Filtering_BitSizes) TEST(ConfigSetTest, Filtering_BitSizes)
......
...@@ -145,7 +145,7 @@ TEST_F(FenceSyncTest, SetAndGetStatusBehavior) ...@@ -145,7 +145,7 @@ TEST_F(FenceSyncTest, SetAndGetStatusBehavior)
.WillOnce(Return(gl::Error(GL_NO_ERROR))) .WillOnce(Return(gl::Error(GL_NO_ERROR)))
.RetiresOnSaturation(); .RetiresOnSaturation();
mFence->set(GL_SYNC_GPU_COMMANDS_COMPLETE); mFence->set(GL_SYNC_GPU_COMMANDS_COMPLETE);
EXPECT_EQ(GL_SYNC_GPU_COMMANDS_COMPLETE, mFence->getCondition()); EXPECT_EQ(static_cast<GLenum>(GL_SYNC_GPU_COMMANDS_COMPLETE), mFence->getCondition());
// Fake the behavior of testing the fence before and after it's passed. // Fake the behavior of testing the fence before and after it's passed.
EXPECT_CALL(*mImpl, getStatus(_)) EXPECT_CALL(*mImpl, getStatus(_))
.WillOnce(DoAll(SetArgumentPointee<0>(GL_UNSIGNALED), .WillOnce(DoAll(SetArgumentPointee<0>(GL_UNSIGNALED),
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
}, },
'dependencies': 'dependencies':
[ [
'<(angle_path)/src/angle.gyp:libANGLE',
'<(angle_path)/src/angle.gyp:preprocessor', '<(angle_path)/src/angle.gyp:preprocessor',
'<(angle_path)/src/angle.gyp:translator_static', '<(angle_path)/src/angle.gyp:translator_static',
'<(angle_path)/tests/tests.gyp:angle_test_support', '<(angle_path)/tests/tests.gyp:angle_test_support',
...@@ -57,6 +58,10 @@ ...@@ -57,6 +58,10 @@
'../src', '../src',
'../src/compiler/preprocessor', '../src/compiler/preprocessor',
], ],
'includes':
[
'angle_implementation_unit_tests/angle_implementation_unit_tests.gypi',
],
'sources': 'sources':
[ [
'<@(angle_unittests_sources)', '<@(angle_unittests_sources)',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment