1/* 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10#include <string> 11#include "./vpx_config.h" 12#if ARCH_X86_32 || ARCH_X86_64 13#include "vpx_ports/x86.h" 14#endif 15extern "C" { 16#if CONFIG_VP8 17extern void vp8_rtcd(); 18#endif 19#if CONFIG_VP9 20extern void vp9_rtcd(); 21#endif 22} 23#include "third_party/googletest/src/include/gtest/gtest.h" 24 25static void append_negative_gtest_filter(const char *str) { 26 std::string filter = ::testing::FLAGS_gtest_filter; 27 // Negative patterns begin with one '-' followed by a ':' separated list. 28 if (filter.find('-') == std::string::npos) filter += '-'; 29 filter += str; 30 ::testing::FLAGS_gtest_filter = filter; 31} 32 33int main(int argc, char **argv) { 34 ::testing::InitGoogleTest(&argc, argv); 35 36#if ARCH_X86_32 || ARCH_X86_64 37 const int simd_caps = x86_simd_caps(); 38 if (!(simd_caps & HAS_MMX)) 39 append_negative_gtest_filter(":MMX/*"); 40 if (!(simd_caps & HAS_SSE)) 41 append_negative_gtest_filter(":SSE/*"); 42 if (!(simd_caps & HAS_SSE2)) 43 append_negative_gtest_filter(":SSE2/*"); 44 if (!(simd_caps & HAS_SSE3)) 45 append_negative_gtest_filter(":SSE3/*"); 46 if (!(simd_caps & HAS_SSSE3)) 47 append_negative_gtest_filter(":SSSE3/*"); 48 if (!(simd_caps & HAS_SSE4_1)) 49 append_negative_gtest_filter(":SSE4_1/*"); 50 if (!(simd_caps & HAS_AVX)) 51 append_negative_gtest_filter(":AVX/*"); 52 if (!(simd_caps & HAS_AVX2)) 53 append_negative_gtest_filter(":AVX2/*"); 54#endif 55 56#if !CONFIG_SHARED 57// Shared library builds don't support whitebox tests 58// that exercise internal symbols. 59 60#if CONFIG_VP8 61 vp8_rtcd(); 62#endif 63#if CONFIG_VP9 64 vp9_rtcd(); 65#endif 66#endif 67 68 return RUN_ALL_TESTS(); 69} 70