From 33b42e12ab711a094b5fa03a084f4f79fb92accf Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Wed, 29 Apr 2020 10:47:41 -0500 Subject: [PATCH] retry retry absl Identical to https://skia-review.googlesource.com/c/skia/+/286070. Bug: skia:10165 Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-arm-Debug-Chromebook_GLES;skia/skia.primary:Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Release-All-TSAN,Build-Debian10-Clang-arm64-Debug-Android_ASAN Change-Id: I0ec9d5f6875768e665f444e1ada211d3da537678 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322976 Commit-Queue: Mike Klein Reviewed-by: John Stiles --- BUILD.gn | 1 + DEPS | 1 + gn/tests.gni | 1 + tests/AbseilTest.cpp | 37 +++++++++++++++++++++++++++++++++++++ third_party/absl/BUILD.gn | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 tests/AbseilTest.cpp create mode 100644 third_party/absl/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn index f601666ba0..26a6ec9aee 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1881,6 +1881,7 @@ if (skia_enable_tools) { "modules/skparagraph:tests", "modules/sksg:tests", "modules/skshaper", + "//third_party/absl", "//third_party/libpng", "//third_party/libwebp", "//third_party/zlib", diff --git a/DEPS b/DEPS index 01e805689d..6cc2393566 100644 --- a/DEPS +++ b/DEPS @@ -7,6 +7,7 @@ vars = { deps = { "buildtools" : "https://chromium.googlesource.com/chromium/buildtools.git@505de88083136eefd056e5ee4ca0f01fe9b33de8", "common" : "https://skia.googlesource.com/common.git@9737551d7a52c3db3262db5856e6bcd62c462b92", + "third_party/externals/abseil-cpp" : "https://chromium.googlesource.com/external/github.com/abseil/abseil-cpp.git@1a02b7a2054c24f900dab796edb812f9260b51a6", "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@77e3d0ae97b620d8980049f0c8572a981bd2963d", "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b", # Dawn requires jinja2 and markupsafe for the code generator, and glslang and shaderc for SPIRV compilation. diff --git a/gn/tests.gni b/gn/tests.gni index dd4ff9bde6..fb8e303d5c 100644 --- a/gn/tests.gni +++ b/gn/tests.gni @@ -8,6 +8,7 @@ _tests = get_path_info("../tests", "abspath") tests_sources = [ "$_tests/AAClipTest.cpp", + "$_tests/AbseilTest.cpp", "$_tests/AdvancedBlendTest.cpp", "$_tests/AndroidCodecTest.cpp", "$_tests/AnimatedImageTest.cpp", diff --git a/tests/AbseilTest.cpp b/tests/AbseilTest.cpp new file mode 100644 index 0000000000..f726687c66 --- /dev/null +++ b/tests/AbseilTest.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2020 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "tests/Test.h" +#ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK + +#include +#include +#include + +DEF_TEST(AbseilTest, reporter) { + // Tests that Abseil can be compiled, linked and run. Can be removed once Abseil is in use + // elsewhere. + const void* nullVoid = nullptr; + const std::string kStringToHash = absl::Substitute("$0 $1 $2 $3", "absl", 0, false, nullVoid); + REPORTER_ASSERT(reporter, kStringToHash == "absl 0 false NULL"); + + const size_t hashValue = absl::Hash{}(kStringToHash); + REPORTER_ASSERT(reporter, hashValue != 0); + + absl::btree_map m; + m[42] = 47; + m[41] = 46; + + int expected_key = 41, + expected_val = 46; + for (auto [k,v] : m) { + REPORTER_ASSERT(reporter, k == expected_key++); + REPORTER_ASSERT(reporter, v == expected_val++); + } +} + +#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK diff --git a/third_party/absl/BUILD.gn b/third_party/absl/BUILD.gn new file mode 100644 index 0000000000..be5a04bd07 --- /dev/null +++ b/third_party/absl/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright 2020 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("../third_party.gni") + +third_party("absl") { + public_include_dirs = [ "../externals/abseil-cpp" ] + + # We have been bitten by blindly adding parts of Abseil in the past, + # so please vet each new source file you add here carefully. If you're + # not sure what you're looking for, please R += mtklein@google.com. + # + # In particular, please do not add absl::Mutex or dynamic_annotations.cc. + sources = [ + "../externals/abseil-cpp/absl/base/internal/raw_logging.cc", + "../externals/abseil-cpp/absl/base/internal/throw_delegate.cc", + "../externals/abseil-cpp/absl/hash/internal/city.cc", + "../externals/abseil-cpp/absl/hash/internal/hash.cc", + "../externals/abseil-cpp/absl/numeric/int128.cc", + "../externals/abseil-cpp/absl/strings/ascii.cc", + "../externals/abseil-cpp/absl/strings/charconv.cc", + "../externals/abseil-cpp/absl/strings/escaping.cc", + "../externals/abseil-cpp/absl/strings/internal/charconv_bigint.cc", + "../externals/abseil-cpp/absl/strings/internal/charconv_parse.cc", + "../externals/abseil-cpp/absl/strings/internal/escaping.cc", + "../externals/abseil-cpp/absl/strings/internal/memutil.cc", + "../externals/abseil-cpp/absl/strings/internal/utf8.cc", + "../externals/abseil-cpp/absl/strings/match.cc", + "../externals/abseil-cpp/absl/strings/numbers.cc", + "../externals/abseil-cpp/absl/strings/str_cat.cc", + "../externals/abseil-cpp/absl/strings/substitute.cc", + ] +}