11b362b15af34006e6a11974088a46d42b903418eJohann/* 21b362b15af34006e6a11974088a46d42b903418eJohann * Copyright (c) 2012 The WebM project authors. All Rights Reserved. 31b362b15af34006e6a11974088a46d42b903418eJohann * 41b362b15af34006e6a11974088a46d42b903418eJohann * Use of this source code is governed by a BSD-style license 51b362b15af34006e6a11974088a46d42b903418eJohann * that can be found in the LICENSE file in the root of the source 61b362b15af34006e6a11974088a46d42b903418eJohann * tree. An additional intellectual property rights grant can be found 71b362b15af34006e6a11974088a46d42b903418eJohann * in the file PATENTS. All contributing project authors may 81b362b15af34006e6a11974088a46d42b903418eJohann * be found in the AUTHORS file in the root of the source tree. 91b362b15af34006e6a11974088a46d42b903418eJohann */ 101b362b15af34006e6a11974088a46d42b903418eJohann#include <string> 111184aebb761cbeac9124c37189a80a1a58f04b6bhkuang#include "./vpx_config.h" 12ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#if ARCH_X86 || ARCH_X86_64 131b362b15af34006e6a11974088a46d42b903418eJohann#include "vpx_ports/x86.h" 141b362b15af34006e6a11974088a46d42b903418eJohann#endif 15b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanianextern "C" { 16ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#if CONFIG_VP8 17ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuangextern void vp8_rtcd(); 18ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#endif 19ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#if CONFIG_VP9 20ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuangextern void vp9_rtcd(); 21ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#endif 22ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang} 231b362b15af34006e6a11974088a46d42b903418eJohann#include "third_party/googletest/src/include/gtest/gtest.h" 241b362b15af34006e6a11974088a46d42b903418eJohann 25b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanianstatic void append_negative_gtest_filter(const char *str) { 261b362b15af34006e6a11974088a46d42b903418eJohann std::string filter = ::testing::FLAGS_gtest_filter; 27b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian // Negative patterns begin with one '-' followed by a ':' separated list. 28b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian if (filter.find('-') == std::string::npos) filter += '-'; 291b362b15af34006e6a11974088a46d42b903418eJohann filter += str; 301b362b15af34006e6a11974088a46d42b903418eJohann ::testing::FLAGS_gtest_filter = filter; 311b362b15af34006e6a11974088a46d42b903418eJohann} 321b362b15af34006e6a11974088a46d42b903418eJohann 331b362b15af34006e6a11974088a46d42b903418eJohannint main(int argc, char **argv) { 341b362b15af34006e6a11974088a46d42b903418eJohann ::testing::InitGoogleTest(&argc, argv); 351b362b15af34006e6a11974088a46d42b903418eJohann 361b362b15af34006e6a11974088a46d42b903418eJohann#if ARCH_X86 || ARCH_X86_64 371b362b15af34006e6a11974088a46d42b903418eJohann const int simd_caps = x86_simd_caps(); 38ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang if (!(simd_caps & HAS_MMX)) 39b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian append_negative_gtest_filter(":MMX/*"); 40ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang if (!(simd_caps & HAS_SSE)) 41b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian append_negative_gtest_filter(":SSE/*"); 42ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang if (!(simd_caps & HAS_SSE2)) 43b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian append_negative_gtest_filter(":SSE2/*"); 44ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang if (!(simd_caps & HAS_SSE3)) 45b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian append_negative_gtest_filter(":SSE3/*"); 46ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang if (!(simd_caps & HAS_SSSE3)) 47b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian append_negative_gtest_filter(":SSSE3/*"); 48ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang if (!(simd_caps & HAS_SSE4_1)) 49b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian append_negative_gtest_filter(":SSE4_1/*"); 505ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang if (!(simd_caps & HAS_AVX)) 51b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian append_negative_gtest_filter(":AVX/*"); 525ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang if (!(simd_caps & HAS_AVX2)) 53b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian append_negative_gtest_filter(":AVX2/*"); 541b362b15af34006e6a11974088a46d42b903418eJohann#endif 551b362b15af34006e6a11974088a46d42b903418eJohann 56ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#if !CONFIG_SHARED 571184aebb761cbeac9124c37189a80a1a58f04b6bhkuang// Shared library builds don't support whitebox tests 581184aebb761cbeac9124c37189a80a1a58f04b6bhkuang// that exercise internal symbols. 591184aebb761cbeac9124c37189a80a1a58f04b6bhkuang 60ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#if CONFIG_VP8 61ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang vp8_rtcd(); 62ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#endif 63ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#if CONFIG_VP9 64ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang vp9_rtcd(); 65ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#endif 66ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#endif 67ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 681b362b15af34006e6a11974088a46d42b903418eJohann return RUN_ALL_TESTS(); 691b362b15af34006e6a11974088a46d42b903418eJohann} 70