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