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.
16 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
18 #include "./aom_config.h"
19 #if ARCH_X86 || ARCH_X86_64
20 #include "aom_ports/x86.h"
24 extern void av1_rtcd();
26 extern void aom_dsp_rtcd();
27 extern void aom_scale_rtcd();
30 #if ARCH_X86 || ARCH_X86_64
31 static void append_negative_gtest_filter(const char *str
) {
32 std::string filter
= ::testing::FLAGS_gtest_filter
;
33 // Negative patterns begin with one '-' followed by a ':' separated list.
34 if (filter
.find('-') == std::string::npos
) filter
+= '-';
35 // OPT.* matches TEST() functions
36 // OPT/* matches TEST_P() functions
37 // OPT_* matches tests which have been manually sharded.
38 // We do not match OPT* because of SSE/SSE2 collisions.
39 const char *search_terminators
= "./_";
40 for (size_t pos
= 0; pos
< strlen(search_terminators
); ++pos
) {
43 filter
+= search_terminators
[pos
];
46 ::testing::FLAGS_gtest_filter
= filter
;
48 #endif // ARCH_X86 || ARCH_X86_64
50 int main(int argc
, char **argv
) {
51 ::testing::InitGoogleTest(&argc
, argv
);
53 #if ARCH_X86 || ARCH_X86_64
54 const int simd_caps
= x86_simd_caps();
55 if (!(simd_caps
& HAS_MMX
)) append_negative_gtest_filter("MMX");
56 if (!(simd_caps
& HAS_SSE
)) append_negative_gtest_filter("SSE");
57 if (!(simd_caps
& HAS_SSE2
)) append_negative_gtest_filter("SSE2");
58 if (!(simd_caps
& HAS_SSE3
)) append_negative_gtest_filter("SSE3");
59 if (!(simd_caps
& HAS_SSSE3
)) append_negative_gtest_filter("SSSE3");
60 if (!(simd_caps
& HAS_SSE4_1
)) append_negative_gtest_filter("SSE4_1");
61 if (!(simd_caps
& HAS_AVX
)) append_negative_gtest_filter("AVX");
62 if (!(simd_caps
& HAS_AVX2
)) append_negative_gtest_filter("AVX2");
63 #endif // ARCH_X86 || ARCH_X86_64
66 // Shared library builds don't support whitebox tests
67 // that exercise internal symbols.
74 #endif // !CONFIG_SHARED
76 return RUN_ALL_TESTS();