Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 1 | /* |
Krishna Rapaka | 7319db5 | 2021-09-28 20:35:29 -0700 | [diff] [blame] | 2 | * Copyright (c) 2021, Alliance for Open Media. All rights reserved |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 3 | * |
Vibhoothi | 41c6dd7 | 2021-10-12 18:48:26 +0000 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 3-Clause Clear License |
| 5 | * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear |
| 6 | * License was not distributed with this source code in the LICENSE file, you |
| 7 | * can obtain it at aomedia.org/license/software-license/bsd-3-c-c/. If the |
| 8 | * Alliance for Open Media Patent License 1.0 was not distributed with this |
| 9 | * source code in the PATENTS file, you can obtain it at |
| 10 | * aomedia.org/license/patent-license/. |
Johann | 123e8a6 | 2017-12-28 14:40:49 -0800 | [diff] [blame] | 11 | */ |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 12 | |
Johann | c4ec032 | 2017-10-20 10:14:25 -0700 | [diff] [blame] | 13 | #include <string.h> |
| 14 | |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 15 | #include <string> |
Jingning Han | 097d59c | 2015-07-29 14:51:36 -0700 | [diff] [blame] | 16 | |
Tom Finegan | 7a07ece | 2017-02-07 17:14:05 -0800 | [diff] [blame] | 17 | #include "third_party/googletest/src/googletest/include/gtest/gtest.h" |
Jingning Han | 097d59c | 2015-07-29 14:51:36 -0700 | [diff] [blame] | 18 | |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 19 | #include "config/aom_config.h" |
| 20 | |
John Koleszar | 5ebe94f | 2012-12-23 07:20:10 -0800 | [diff] [blame] | 21 | #if ARCH_X86 || ARCH_X86_64 |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 22 | #include "aom_ports/x86.h" |
John Koleszar | 5ebe94f | 2012-12-23 07:20:10 -0800 | [diff] [blame] | 23 | #endif |
James Zern | 002ad40 | 2014-01-18 13:03:31 -0800 | [diff] [blame] | 24 | extern "C" { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 25 | extern void av1_rtcd(); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 26 | extern void aom_dsp_rtcd(); |
| 27 | extern void aom_scale_rtcd(); |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 28 | } |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 29 | |
Johann | 95633d0 | 2015-09-01 12:47:43 -0700 | [diff] [blame] | 30 | #if ARCH_X86 || ARCH_X86_64 |
James Zern | ada9dd7 | 2014-01-10 19:08:44 -0800 | [diff] [blame] | 31 | static void append_negative_gtest_filter(const char *str) { |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 32 | std::string filter = ::testing::FLAGS_gtest_filter; |
James Zern | ada9dd7 | 2014-01-10 19:08:44 -0800 | [diff] [blame] | 33 | // Negative patterns begin with one '-' followed by a ':' separated list. |
| 34 | if (filter.find('-') == std::string::npos) filter += '-'; |
Johann | c4ec032 | 2017-10-20 10:14:25 -0700 | [diff] [blame] | 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) { |
| 41 | filter += ":"; |
| 42 | filter += str; |
| 43 | filter += search_terminators[pos]; |
| 44 | filter += "*"; |
| 45 | } |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 46 | ::testing::FLAGS_gtest_filter = filter; |
| 47 | } |
Johann | 95633d0 | 2015-09-01 12:47:43 -0700 | [diff] [blame] | 48 | #endif // ARCH_X86 || ARCH_X86_64 |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 49 | |
| 50 | int main(int argc, char **argv) { |
| 51 | ::testing::InitGoogleTest(&argc, argv); |
| 52 | |
| 53 | #if ARCH_X86 || ARCH_X86_64 |
John Koleszar | 17b34a1 | 2012-06-22 11:53:04 -0700 | [diff] [blame] | 54 | const int simd_caps = x86_simd_caps(); |
Johann | c4ec032 | 2017-10-20 10:14:25 -0700 | [diff] [blame] | 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"); |
James Zern | eea1d83 | 2018-03-03 12:29:42 -0800 | [diff] [blame] | 61 | if (!(simd_caps & HAS_SSE4_2)) append_negative_gtest_filter("SSE4_2"); |
Johann | c4ec032 | 2017-10-20 10:14:25 -0700 | [diff] [blame] | 62 | if (!(simd_caps & HAS_AVX)) append_negative_gtest_filter("AVX"); |
| 63 | if (!(simd_caps & HAS_AVX2)) append_negative_gtest_filter("AVX2"); |
Johann | 95633d0 | 2015-09-01 12:47:43 -0700 | [diff] [blame] | 64 | #endif // ARCH_X86 || ARCH_X86_64 |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 65 | |
Johann | f152ff6 | 2018-02-08 14:33:07 -0800 | [diff] [blame] | 66 | // Shared library builds don't support whitebox tests that exercise internal |
| 67 | // symbols. |
John Koleszar | 5ebe94f | 2012-12-23 07:20:10 -0800 | [diff] [blame] | 68 | #if !CONFIG_SHARED |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 69 | av1_rtcd(); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 70 | aom_dsp_rtcd(); |
| 71 | aom_scale_rtcd(); |
Johann | 14ef4ae | 2015-04-15 09:27:00 -0400 | [diff] [blame] | 72 | #endif // !CONFIG_SHARED |
John Koleszar | 434336b | 2012-12-06 13:56:25 -0800 | [diff] [blame] | 73 | |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 74 | return RUN_ALL_TESTS(); |
| 75 | } |