diff options
author | Frank Barchard <fbarchard@google.com> | 2017-03-13 18:06:55 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2017-03-14 01:52:52 +0000 |
commit | 2adb84e39e360723d19c68f315d99e3e0f88318c (patch) | |
tree | be861b22c9c9ae35029864d6aa63aa8a5bb2351b /unit_test/unit_test.cc | |
parent | d59d3fcd1810e40745db7fb95417c1ba1909e4a5 (diff) | |
download | libyuv-2adb84e39e360723d19c68f315d99e3e0f88318c.tar.gz |
make gflags command line parser optional
BUG=libyuv:691
TEST=gn gen out/Release "--args=is_debug=false target_cpu=\"x64\" libyuv_include_tests=true"
Change-Id: Ib481189be884c34d9bbc30bfcf71c7969c6f4dae
Reviewed-on: https://chromium-review.googlesource.com/452736
Reviewed-by: Frank Barchard <fbarchard@google.com>
Commit-Queue: Frank Barchard <fbarchard@google.com>
Diffstat (limited to 'unit_test/unit_test.cc')
-rw-r--r-- | unit_test/unit_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unit_test/unit_test.cc b/unit_test/unit_test.cc index 7f8bcf8f..55297e36 100644 --- a/unit_test/unit_test.cc +++ b/unit_test/unit_test.cc @@ -14,7 +14,9 @@ #include <cstring> +#ifdef LIBYUV_USE_GFLAGS #include "gflags/gflags.h" +#endif // Change this to 1000 for benchmarking. // TODO(fbarchard): Add command line parsing to pass this as option. @@ -22,6 +24,7 @@ unsigned int fastrand_seed = 0xfb; +#ifdef LIBYUV_USE_GFLAGS DEFINE_int32(libyuv_width, 0, "width of test image."); DEFINE_int32(libyuv_height, 0, "height of test image."); DEFINE_int32(libyuv_repeat, 0, "number of times to repeat test."); @@ -29,6 +32,14 @@ DEFINE_int32(libyuv_flags, 0, "cpu flags for reference code. 1 = C, -1 = SIMD"); DEFINE_int32(libyuv_cpu_info, 0, "cpu flags for benchmark code. 1 = C, -1 = SIMD"); +#else +// Disable command line parameters if gflags disabled. +static const int32 FLAGS_libyuv_width = 0; +static const int32 FLAGS_libyuv_height = 0; +static const int32 FLAGS_libyuv_repeat = 0; +static const int32 FLAGS_libyuv_flags = 0; +static const int32 FLAGS_libyuv_cpu_info = 0; +#endif // For quicker unittests, default is 128 x 72. But when benchmarking, // default to 720p. Allow size to specify. @@ -390,9 +401,11 @@ LibYUVBaseTest::LibYUVBaseTest() int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); +#ifdef LIBYUV_USE_GFLAGS // AllowCommandLineParsing allows us to ignore flags passed on to us by // Chromium build bots without having to explicitly disable them. google::AllowCommandLineReparsing(); google::ParseCommandLineFlags(&argc, &argv, true); +#endif return RUN_ALL_TESTS(); } |