Merge other top-level C code
[platform/upstream/libvpx.git] / test / test_libvpx.cc
1 /*
2  *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #include <string>
11 #include "vpx_config.h"
12 #if ARCH_X86 || ARCH_X86_64
13 extern "C" {
14 #include "vpx_ports/x86.h"
15 }
16 #endif
17 #include "third_party/googletest/src/include/gtest/gtest.h"
18
19 static void append_gtest_filter(const char *str) {
20   std::string filter = ::testing::FLAGS_gtest_filter;
21   filter += str;
22   ::testing::FLAGS_gtest_filter = filter;
23 }
24
25 int main(int argc, char **argv) {
26   ::testing::InitGoogleTest(&argc, argv);
27
28 #if ARCH_X86 || ARCH_X86_64
29   int simd_caps = x86_simd_caps();
30   if (!(simd_caps & HAS_MMX))
31     append_gtest_filter(":-MMX/*");
32   if (!(simd_caps & HAS_SSE))
33     append_gtest_filter(":-SSE/*");
34   if (!(simd_caps & HAS_SSE2))
35     append_gtest_filter(":-SSE2/*");
36   if (!(simd_caps & HAS_SSE3))
37     append_gtest_filter(":-SSE3/*");
38   if (!(simd_caps & HAS_SSSE3))
39     append_gtest_filter(":-SSSE3/*");
40   if (!(simd_caps & HAS_SSE4_1))
41     append_gtest_filter(":-SSE4_1/*");
42 #endif
43
44   return RUN_ALL_TESTS();
45 }