2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
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.
12 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
14 #include "config/aom_config.h"
22 #include "aom_ports/arm.h"
24 #if AOM_ARCH_X86 || AOM_ARCH_X86_64
25 #include "aom_ports/x86.h"
29 extern void av1_rtcd();
30 extern void aom_dsp_rtcd();
31 extern void aom_scale_rtcd();
34 #if AOM_ARCH_ARM || AOM_ARCH_X86 || AOM_ARCH_X86_64
35 static 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
) {
47 flag_value
+= search_terminators
[pos
];
50 GTEST_FLAG_SET(filter
, flag_value
);
52 #endif // AOM_ARCH_ARM || AOM_ARCH_X86 || AOM_ARCH_X86_64
53 #endif // !CONFIG_SHARED
55 int main(int argc
, char **argv
) {
56 ::testing::InitGoogleTest(&argc
, argv
);
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");
67 const int caps
= aom_arm_cpu_caps();
68 if (!(caps
& HAS_NEON
)) append_negative_gtest_filter("NEON");
69 #endif // AOM_ARCH_ARM
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
84 // Shared library builds don't support whitebox tests that exercise internal
89 #endif // !CONFIG_SHARED
91 return RUN_ALL_TESTS();