1 /* 2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved. 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10 */ 11 12 #include "gtest/gtest.h" 13 14 #include "config/aom_config.h" 15 16 #if !CONFIG_SHARED 17 #include <string.h> 18 19 #include <string> 20 21 #if AOM_ARCH_ARM 22 #include "aom_ports/arm.h" 23 #endif 24 #if AOM_ARCH_X86 || AOM_ARCH_X86_64 25 #include "aom_ports/x86.h" 26 #endif 27 28 extern "C" { 29 extern void av1_rtcd(); 30 extern void aom_dsp_rtcd(); 31 extern void aom_scale_rtcd(); 32 } 33 34 #if AOM_ARCH_ARM || AOM_ARCH_X86 || AOM_ARCH_X86_64 append_negative_gtest_filter(const char * str)35static void append_negative_gtest_filter(const char *str) { 36 std::string flag_value = GTEST_FLAG_GET(filter); 37 // Negative patterns begin with one '-' followed by a ':' separated list. 38 if (flag_value.find('-') == std::string::npos) flag_value += '-'; 39 // OPT.* matches TEST() functions 40 // OPT/* matches TEST_P() functions 41 // OPT_* matches tests which have been manually sharded. 42 // We do not match OPT* because of SSE/SSE2 collisions. 43 const char *search_terminators = "./_"; 44 for (size_t pos = 0; pos < strlen(search_terminators); ++pos) { 45 flag_value += ":"; 46 flag_value += str; 47 flag_value += search_terminators[pos]; 48 flag_value += "*"; 49 } 50 GTEST_FLAG_SET(filter, flag_value); 51 } 52 #endif // AOM_ARCH_ARM || AOM_ARCH_X86 || AOM_ARCH_X86_64 53 #endif // !CONFIG_SHARED 54 main(int argc,char ** argv)55int main(int argc, char **argv) { 56 ::testing::InitGoogleTest(&argc, argv); 57 58 #if !CONFIG_SHARED 59 #if AOM_ARCH_AARCH64 60 const int caps = aom_arm_cpu_caps(); 61 if (!(caps & HAS_ARM_CRC32)) append_negative_gtest_filter("ARM_CRC32"); 62 if (!(caps & HAS_NEON_DOTPROD)) append_negative_gtest_filter("NEON_DOTPROD"); 63 if (!(caps & HAS_NEON_I8MM)) append_negative_gtest_filter("NEON_I8MM"); 64 if (!(caps & HAS_SVE)) append_negative_gtest_filter("SVE"); 65 if (!(caps & HAS_SVE2)) append_negative_gtest_filter("SVE2"); 66 #elif AOM_ARCH_ARM 67 const int caps = aom_arm_cpu_caps(); 68 if (!(caps & HAS_NEON)) append_negative_gtest_filter("NEON"); 69 #endif // AOM_ARCH_ARM 70 71 #if AOM_ARCH_X86 || AOM_ARCH_X86_64 72 const int simd_caps = x86_simd_caps(); 73 if (!(simd_caps & HAS_MMX)) append_negative_gtest_filter("MMX"); 74 if (!(simd_caps & HAS_SSE)) append_negative_gtest_filter("SSE"); 75 if (!(simd_caps & HAS_SSE2)) append_negative_gtest_filter("SSE2"); 76 if (!(simd_caps & HAS_SSE3)) append_negative_gtest_filter("SSE3"); 77 if (!(simd_caps & HAS_SSSE3)) append_negative_gtest_filter("SSSE3"); 78 if (!(simd_caps & HAS_SSE4_1)) append_negative_gtest_filter("SSE4_1"); 79 if (!(simd_caps & HAS_SSE4_2)) append_negative_gtest_filter("SSE4_2"); 80 if (!(simd_caps & HAS_AVX)) append_negative_gtest_filter("AVX"); 81 if (!(simd_caps & HAS_AVX2)) append_negative_gtest_filter("AVX2"); 82 #endif // AOM_ARCH_X86 || AOM_ARCH_X86_64 83 84 // Shared library builds don't support whitebox tests that exercise internal 85 // symbols. 86 av1_rtcd(); 87 aom_dsp_rtcd(); 88 aom_scale_rtcd(); 89 #endif // !CONFIG_SHARED 90 91 return RUN_ALL_TESTS(); 92 } 93