Commit 52747821 by Andy Getzendanner Committed by Copybara-Service

Migrate most RAW_LOGs and RAW_CHECKs in tests to regular LOG and CHECK.

The non-RAW_ versions provide better output but weren't available when most of these tests were written.

There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks.

Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK.

PiperOrigin-RevId: 534584435
Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
parent 79ca5d7a
......@@ -160,8 +160,8 @@ cc_test(
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:exception_testing",
"//absl/base:raw_logging_internal",
"//absl/hash:hash_testing",
"//absl/log:check",
"//absl/memory",
"//absl/strings",
"@com_google_googletest//:gtest_main",
......@@ -255,7 +255,7 @@ cc_test(
":unordered_map_lookup_test",
":unordered_map_members_test",
":unordered_map_modifiers_test",
"//absl/base:raw_logging_internal",
"//absl/log:check",
"//absl/types:any",
"@com_google_googletest//:gtest_main",
],
......@@ -289,7 +289,7 @@ cc_test(
":unordered_set_lookup_test",
":unordered_set_members_test",
":unordered_set_modifiers_test",
"//absl/base:raw_logging_internal",
"//absl/log:check",
"//absl/memory",
"//absl/strings",
"@com_google_googletest//:gtest_main",
......@@ -656,7 +656,6 @@ cc_test(
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:prefetch",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/strings",
"@com_google_googletest//:gtest_main",
......@@ -743,7 +742,7 @@ cc_test(
":layout",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log:check",
"//absl/types:span",
"@com_google_googletest//:gtest_main",
],
......
......@@ -221,16 +221,16 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::counting_allocator
absl::inlined_vector
absl::test_instance_tracker
absl::check
absl::config
absl::core_headers
absl::counting_allocator
absl::exception_testing
absl::hash_testing
absl::inlined_vector
absl::memory
absl::raw_logging_internal
absl::strings
absl::test_instance_tracker
GTest::gmock_main
)
......@@ -300,14 +300,14 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::any
absl::check
absl::flat_hash_map
absl::hash_generator_testing
absl::unordered_map_constructor_test
absl::unordered_map_lookup_test
absl::unordered_map_members_test
absl::unordered_map_modifiers_test
absl::any
absl::raw_logging_internal
GTest::gmock_main
)
......@@ -337,15 +337,15 @@ absl_cc_test(
${ABSL_TEST_COPTS}
"-DUNORDERED_SET_CXX17"
DEPS
absl::check
absl::flat_hash_set
absl::hash_generator_testing
absl::memory
absl::strings
absl::unordered_set_constructor_test
absl::unordered_set_lookup_test
absl::unordered_set_members_test
absl::unordered_set_modifiers_test
absl::memory
absl::raw_logging_internal
absl::strings
GTest::gmock_main
)
......@@ -742,7 +742,6 @@ absl_cc_test(
absl::log
absl::prefetch
absl::raw_hash_set
absl::raw_logging_internal
absl::strings
GTest::gmock_main
)
......@@ -788,9 +787,9 @@ absl_cc_test(
${ABSL_TEST_COPTS}
DEPS
absl::layout
absl::check
absl::config
absl::core_headers
absl::raw_logging_internal
absl::span
GTest::gmock_main
)
......
......@@ -16,12 +16,12 @@
#include <memory>
#include "absl/base/internal/raw_logging.h"
#include "absl/container/internal/hash_generator_testing.h"
#include "absl/container/internal/unordered_map_constructor_test.h"
#include "absl/container/internal/unordered_map_lookup_test.h"
#include "absl/container/internal/unordered_map_members_test.h"
#include "absl/container/internal/unordered_map_modifiers_test.h"
#include "absl/log/check.h"
#include "absl/types/any.h"
namespace absl {
......@@ -40,10 +40,10 @@ struct BeforeMain {
BeforeMain() {
absl::flat_hash_map<int, int> x;
x.insert({1, 1});
ABSL_RAW_CHECK(x.find(0) == x.end(), "x should not contain 0");
CHECK(x.find(0) == x.end()) << "x should not contain 0";
auto it = x.find(1);
ABSL_RAW_CHECK(it != x.end(), "x should contain 1");
ABSL_RAW_CHECK(it->second, "1 should map to 1");
CHECK(it != x.end()) << "x should contain 1";
CHECK(it->second) << "1 should map to 1";
}
};
const BeforeMain before_main;
......
......@@ -16,12 +16,12 @@
#include <vector>
#include "absl/base/internal/raw_logging.h"
#include "absl/container/internal/hash_generator_testing.h"
#include "absl/container/internal/unordered_set_constructor_test.h"
#include "absl/container/internal/unordered_set_lookup_test.h"
#include "absl/container/internal/unordered_set_members_test.h"
#include "absl/container/internal/unordered_set_modifiers_test.h"
#include "absl/log/check.h"
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
......@@ -42,8 +42,8 @@ struct BeforeMain {
BeforeMain() {
absl::flat_hash_set<int> x;
x.insert(1);
ABSL_RAW_CHECK(!x.contains(0), "x should not contain 0");
ABSL_RAW_CHECK(x.contains(1), "x should contain 1");
CHECK(!x.contains(0)) << "x should not contain 0";
CHECK(x.contains(1)) << "x should contain 1";
}
};
const BeforeMain before_main;
......
......@@ -31,12 +31,12 @@
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/internal/exception_testing.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/base/options.h"
#include "absl/container/internal/counting_allocator.h"
#include "absl/container/internal/test_instance_tracker.h"
#include "absl/hash/hash_testing.h"
#include "absl/log/check.h"
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
......@@ -103,13 +103,13 @@ class RefCounted {
}
void Ref() const {
ABSL_RAW_CHECK(count_ != nullptr, "");
CHECK_NE(count_, nullptr);
++(*count_);
}
void Unref() const {
--(*count_);
ABSL_RAW_CHECK(*count_ >= 0, "");
CHECK_GE(*count_, 0);
}
int value_;
......
......@@ -26,7 +26,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/config.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/check.h"
#include "absl/types/span.h"
namespace absl {
......@@ -38,7 +38,7 @@ using ::absl::Span;
using ::testing::ElementsAre;
size_t Distance(const void* from, const void* to) {
ABSL_RAW_CHECK(from <= to, "Distance must be non-negative");
CHECK_LE(from, to) << "Distance must be non-negative";
return static_cast<const char*>(to) - static_cast<const char*>(from);
}
......@@ -366,7 +366,7 @@ TEST(Layout, Sizes) {
}
TEST(Layout, PointerByIndex) {
alignas(max_align_t) const unsigned char p[100] = {};
alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<const int32_t*>(L::Partial().Pointer<0>(p))));
......@@ -447,7 +447,7 @@ TEST(Layout, PointerByIndex) {
}
TEST(Layout, PointerByType) {
alignas(max_align_t) const unsigned char p[100] = {};
alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
......@@ -526,7 +526,7 @@ TEST(Layout, PointerByType) {
}
TEST(Layout, MutablePointerByIndex) {
alignas(max_align_t) unsigned char p[100];
alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<0>(p))));
......@@ -581,7 +581,7 @@ TEST(Layout, MutablePointerByIndex) {
}
TEST(Layout, MutablePointerByType) {
alignas(max_align_t) unsigned char p[100];
alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<int32_t>(p))));
......@@ -647,7 +647,7 @@ TEST(Layout, MutablePointerByType) {
}
TEST(Layout, Pointers) {
alignas(max_align_t) const unsigned char p[100] = {};
alignas(max_align_t) const unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
......@@ -683,7 +683,7 @@ TEST(Layout, Pointers) {
}
TEST(Layout, MutablePointers) {
alignas(max_align_t) unsigned char p[100];
alignas(max_align_t) unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
......@@ -716,7 +716,7 @@ TEST(Layout, MutablePointers) {
}
TEST(Layout, SliceByIndexSize) {
alignas(max_align_t) const unsigned char p[100] = {};
alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
......@@ -744,7 +744,7 @@ TEST(Layout, SliceByIndexSize) {
}
TEST(Layout, SliceByTypeSize) {
alignas(max_align_t) const unsigned char p[100] = {};
alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<int32_t>(p).size());
......@@ -766,7 +766,7 @@ TEST(Layout, SliceByTypeSize) {
}
TEST(Layout, MutableSliceByIndexSize) {
alignas(max_align_t) unsigned char p[100];
alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
......@@ -794,7 +794,7 @@ TEST(Layout, MutableSliceByIndexSize) {
}
TEST(Layout, MutableSliceByTypeSize) {
alignas(max_align_t) unsigned char p[100];
alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<int32_t>(p).size());
......@@ -816,7 +816,7 @@ TEST(Layout, MutableSliceByTypeSize) {
}
TEST(Layout, SliceByIndexData) {
alignas(max_align_t) const unsigned char p[100] = {};
alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
......@@ -939,7 +939,7 @@ TEST(Layout, SliceByIndexData) {
}
TEST(Layout, SliceByTypeData) {
alignas(max_align_t) const unsigned char p[100] = {};
alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
......@@ -1037,7 +1037,7 @@ TEST(Layout, SliceByTypeData) {
}
TEST(Layout, MutableSliceByIndexData) {
alignas(max_align_t) unsigned char p[100];
alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
......@@ -1122,7 +1122,7 @@ TEST(Layout, MutableSliceByIndexData) {
}
TEST(Layout, MutableSliceByTypeData) {
alignas(max_align_t) unsigned char p[100];
alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
......@@ -1268,7 +1268,7 @@ testing::PolymorphicMatcher<TupleMatcher<M...>> Tuple(M... matchers) {
}
TEST(Layout, Slices) {
alignas(max_align_t) const unsigned char p[100] = {};
alignas(max_align_t) const unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
......@@ -1302,7 +1302,7 @@ TEST(Layout, Slices) {
}
TEST(Layout, MutableSlices) {
alignas(max_align_t) unsigned char p[100] = {};
alignas(max_align_t) unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
......
......@@ -40,7 +40,6 @@
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/internal/cycleclock.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/prefetch.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
......@@ -1280,7 +1279,7 @@ ExpectedStats XorSeedExpectedStats() {
{{0.95, 0}, {0.99, 1}, {0.999, 4}, {0.9999, 10}}};
}
}
ABSL_RAW_LOG(FATAL, "%s", "Unknown Group width");
LOG(FATAL) << "Unknown Group width";
return {};
}
......@@ -1376,7 +1375,7 @@ ExpectedStats LinearTransformExpectedStats() {
{{0.95, 0}, {0.99, 1}, {0.999, 6}, {0.9999, 10}}};
}
}
ABSL_RAW_LOG(FATAL, "%s", "Unknown Group width");
LOG(FATAL) << "Unknown Group width";
return {};
}
......
......@@ -122,7 +122,8 @@ cc_test(
"//absl/base",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/log:check",
"//absl/memory",
"//absl/strings",
"@com_google_googletest//:gtest",
......@@ -180,6 +181,7 @@ cc_test(
":stacktrace",
":symbolize",
"//absl/base:raw_logging_internal",
"//absl/log:check",
"//absl/strings",
"@com_google_googletest//:gtest",
],
......@@ -233,7 +235,7 @@ cc_test(
":stack_consumption",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/memory",
"@com_google_googletest//:gtest_main",
],
......@@ -260,7 +262,7 @@ cc_test(
deps = [
":leak_check",
"//absl/base:config",
"//absl/base:raw_logging_internal",
"//absl/log",
"@com_google_googletest//:gtest_main",
],
)
......@@ -277,7 +279,7 @@ cc_binary(
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":leak_check",
"//absl/base:raw_logging_internal",
"//absl/log",
"@com_google_googletest//:gtest_main",
],
)
......@@ -306,7 +308,7 @@ cc_test(
deps = [
":stack_consumption",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log",
"@com_google_googletest//:gtest_main",
],
)
......
......@@ -101,14 +101,15 @@ absl_cc_test(
LINKOPTS
$<$<BOOL:${MSVC}>:-DEBUG>
DEPS
absl::stack_consumption
absl::symbolize
absl::base
absl::check
absl::config
absl::core_headers
absl::log
absl::memory
absl::raw_logging_internal
absl::stack_consumption
absl::strings
absl::symbolize
GTest::gmock
)
......@@ -157,6 +158,7 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::check
absl::failure_signal_handler
absl::stacktrace
absl::symbolize
......@@ -216,8 +218,8 @@ absl_cc_test(
absl::stack_consumption
absl::config
absl::core_headers
absl::log
absl::memory
absl::raw_logging_internal
GTest::gmock_main
)
......@@ -248,6 +250,7 @@ absl_cc_test(
DEPS
absl::leak_check
absl::base
absl::log
GTest::gmock_main
)
......@@ -278,7 +281,7 @@ absl_cc_test(
DEPS
absl::stack_consumption
absl::core_headers
absl::raw_logging_internal
absl::log
GTest::gmock_main
)
......
......@@ -22,11 +22,12 @@
#include <cstring>
#include <fstream>
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/debugging/stacktrace.h"
#include "absl/debugging/symbolize.h"
#include "absl/log/check.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
......@@ -87,7 +88,7 @@ std::string GetTmpDir() {
// This function runs in a fork()ed process on most systems.
void InstallHandlerWithWriteToFileAndRaise(const char* file, int signo) {
error_file = fopen(file, "w");
ABSL_RAW_CHECK(error_file != nullptr, "Failed create error_file");
CHECK_NE(error_file, nullptr) << "Failed create error_file";
absl::FailureSignalHandlerOptions options;
options.writerfn = WriteToErrorFile;
absl::InstallFailureSignalHandler(options);
......
......@@ -19,8 +19,8 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/debugging/internal/stack_consumption.h"
#include "absl/log/log.h"
#include "absl/memory/memory.h"
namespace absl {
......@@ -151,7 +151,7 @@ static const char *DemangleStackConsumption(const char *mangled,
int *stack_consumed) {
g_mangled = mangled;
*stack_consumed = GetSignalHandlerStackConsumption(DemangleSignalHandler);
ABSL_RAW_LOG(INFO, "Stack consumption of Demangle: %d", *stack_consumed);
LOG(INFO) << "Stack consumption of Demangle: " << *stack_consumed;
return g_demangle_result;
}
......
......@@ -20,7 +20,7 @@
#include <string.h>
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
......@@ -33,7 +33,7 @@ static void SimpleSignalHandler(int signo) {
// Never true, but prevents compiler from optimizing buf out.
if (signo == 0) {
ABSL_RAW_LOG(INFO, "%p", static_cast<void*>(buf));
LOG(INFO) << static_cast<void*>(buf);
}
}
......
......@@ -13,9 +13,10 @@
// limitations under the License.
#include <memory>
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/debugging/leak_check.h"
#include "absl/log/log.h"
namespace {
......@@ -25,7 +26,7 @@ TEST(LeakCheckTest, LeakMemory) {
// failed exit code.
char* foo = strdup("lsan should complain about this leaked string");
ABSL_RAW_LOG(INFO, "Should detect leaked string %s", foo);
LOG(INFO) << "Should detect leaked string " << foo;
}
TEST(LeakCheckTest, LeakMemoryAfterDisablerScope) {
......@@ -34,8 +35,7 @@ TEST(LeakCheckTest, LeakMemoryAfterDisablerScope) {
// failed exit code.
{ absl::LeakCheckDisabler disabler; }
char* foo = strdup("lsan should also complain about this leaked string");
ABSL_RAW_LOG(INFO, "Re-enabled leak detection.Should detect leaked string %s",
foo);
LOG(INFO) << "Re-enabled leak detection.Should detect leaked string " << foo;
}
} // namespace
......@@ -16,8 +16,8 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/debugging/leak_check.h"
#include "absl/log/log.h"
namespace {
......@@ -26,7 +26,7 @@ TEST(LeakCheckTest, IgnoreLeakSuppressesLeakedMemoryErrors) {
GTEST_SKIP() << "LeakChecker is not active";
}
auto foo = absl::IgnoreLeak(new std::string("some ignored leaked string"));
ABSL_RAW_LOG(INFO, "Ignoring leaked string %s", foo->c_str());
LOG(INFO) << "Ignoring leaked string " << foo;
}
TEST(LeakCheckTest, LeakCheckDisablerIgnoresLeak) {
......@@ -35,7 +35,7 @@ TEST(LeakCheckTest, LeakCheckDisablerIgnoresLeak) {
}
absl::LeakCheckDisabler disabler;
auto foo = new std::string("some string leaked while checks are disabled");
ABSL_RAW_LOG(INFO, "Ignoring leaked string %s", foo->c_str());
LOG(INFO) << "Ignoring leaked string " << foo;
}
} // namespace
......@@ -29,9 +29,10 @@
#include "absl/base/casts.h"
#include "absl/base/config.h"
#include "absl/base/internal/per_thread_tls.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/optimization.h"
#include "absl/debugging/internal/stack_consumption.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
......@@ -124,15 +125,17 @@ static char try_symbolize_buffer[4096];
// absl::Symbolize() returns false, otherwise returns try_symbolize_buffer with
// the result of absl::Symbolize().
static const char *TrySymbolizeWithLimit(void *pc, int limit) {
ABSL_RAW_CHECK(limit <= sizeof(try_symbolize_buffer),
"try_symbolize_buffer is too small");
CHECK_LE(limit, sizeof(try_symbolize_buffer))
<< "try_symbolize_buffer is too small";
// Use the heap to facilitate heap and buffer sanitizer tools.
auto heap_buffer = absl::make_unique<char[]>(sizeof(try_symbolize_buffer));
bool found = absl::Symbolize(pc, heap_buffer.get(), limit);
if (found) {
ABSL_RAW_CHECK(strnlen(heap_buffer.get(), limit) < limit,
"absl::Symbolize() did not properly terminate the string");
CHECK_LT(static_cast<int>(
strnlen(heap_buffer.get(), static_cast<size_t>(limit))),
limit)
<< "absl::Symbolize() did not properly terminate the string";
strncpy(try_symbolize_buffer, heap_buffer.get(),
sizeof(try_symbolize_buffer) - 1);
try_symbolize_buffer[sizeof(try_symbolize_buffer) - 1] = '\0';
......@@ -155,8 +158,8 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithReturnAddress() {
#if defined(ABSL_HAVE_ATTRIBUTE_NOINLINE)
void *return_address = __builtin_return_address(0);
const char *symbol = TrySymbolize(return_address);
ABSL_RAW_CHECK(symbol != nullptr, "TestWithReturnAddress failed");
ABSL_RAW_CHECK(strcmp(symbol, "main") == 0, "TestWithReturnAddress failed");
CHECK_NE(symbol, nullptr) << "TestWithReturnAddress failed";
CHECK_STREQ(symbol, "main") << "TestWithReturnAddress failed";
std::cout << "TestWithReturnAddress passed" << std::endl;
#endif
}
......@@ -314,8 +317,8 @@ static int FilterElfHeader(struct dl_phdr_info *info, size_t size, void *data) {
TEST(Symbolize, SymbolizeWithMultipleMaps) {
// Force kPadding0 and kPadding1 to be linked in.
if (volatile_bool) {
ABSL_RAW_LOG(INFO, "%s", kPadding0);
ABSL_RAW_LOG(INFO, "%s", kPadding1);
LOG(INFO) << kPadding0;
LOG(INFO) << kPadding1;
}
// Verify we can symbolize everything.
......@@ -463,9 +466,9 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() {
(defined(__i386__) || defined(__x86_64__))
void *pc = non_inline_func();
const char *symbol = TrySymbolize(pc);
ABSL_RAW_CHECK(symbol != nullptr, "TestWithPCInsideNonInlineFunction failed");
ABSL_RAW_CHECK(strcmp(symbol, "non_inline_func") == 0,
"TestWithPCInsideNonInlineFunction failed");
CHECK_NE(symbol, nullptr) << "TestWithPCInsideNonInlineFunction failed";
CHECK_STREQ(symbol, "non_inline_func")
<< "TestWithPCInsideNonInlineFunction failed";
std::cout << "TestWithPCInsideNonInlineFunction passed" << std::endl;
#endif
}
......@@ -475,9 +478,8 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() {
(defined(__i386__) || defined(__x86_64__))
void *pc = inline_func(); // Must be inlined.
const char *symbol = TrySymbolize(pc);
ABSL_RAW_CHECK(symbol != nullptr, "TestWithPCInsideInlineFunction failed");
ABSL_RAW_CHECK(strcmp(symbol, __FUNCTION__) == 0,
"TestWithPCInsideInlineFunction failed");
CHECK_NE(symbol, nullptr) << "TestWithPCInsideInlineFunction failed";
CHECK_STREQ(symbol, __FUNCTION__) << "TestWithPCInsideInlineFunction failed";
std::cout << "TestWithPCInsideInlineFunction passed" << std::endl;
#endif
}
......@@ -519,9 +521,8 @@ __attribute__((target("arm"))) int ArmThumbOverlapArm(int x) {
void ABSL_ATTRIBUTE_NOINLINE TestArmThumbOverlap() {
#if defined(ABSL_HAVE_ATTRIBUTE_NOINLINE)
const char *symbol = TrySymbolize((void *)&ArmThumbOverlapArm);
ABSL_RAW_CHECK(symbol != nullptr, "TestArmThumbOverlap failed");
ABSL_RAW_CHECK(strcmp("ArmThumbOverlapArm()", symbol) == 0,
"TestArmThumbOverlap failed");
CHECK_NE(symbol, nullptr) << "TestArmThumbOverlap failed";
CHECK_STREQ("ArmThumbOverlapArm()", symbol) << "TestArmThumbOverlap failed";
std::cout << "TestArmThumbOverlap passed" << std::endl;
#endif
}
......@@ -584,7 +585,7 @@ int main(int argc, char **argv) {
#if !defined(__EMSCRIPTEN__)
// Make sure kHpageTextPadding is linked into the binary.
if (volatile_bool) {
ABSL_RAW_LOG(INFO, "%s", kHpageTextPadding);
LOG(INFO) << kHpageTextPadding;
}
#endif // !defined(__EMSCRIPTEN__)
......
......@@ -452,8 +452,8 @@ cc_test(
":parse",
":reflection",
":usage_internal",
"//absl/base:raw_logging_internal",
"//absl/base:scoped_set_env",
"//absl/log",
"//absl/strings",
"//absl/types:span",
"@com_google_googletest//:gtest_main",
......
......@@ -374,7 +374,7 @@ absl_cc_test(
absl::flags_parse
absl::flags_reflection
absl::flags_usage_internal
absl::raw_logging_internal
absl::log
absl::scoped_set_env
absl::span
absl::strings
......
......@@ -24,12 +24,12 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/internal/scoped_set_env.h"
#include "absl/flags/flag.h"
#include "absl/flags/internal/parse.h"
#include "absl/flags/internal/usage.h"
#include "absl/flags/reflection.h"
#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
......@@ -150,8 +150,7 @@ const std::string& GetTestTempDir() {
}
if (res->empty()) {
ABSL_INTERNAL_LOG(FATAL,
"Failed to make temporary directory for data files");
LOG(FATAL) << "Failed to make temporary directory for data files";
}
#ifdef _WIN32
......
......@@ -459,7 +459,6 @@ cc_test(
":log_sink_registry",
":scoped_mock_log",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log/internal:test_actions",
"//absl/log/internal:test_helpers",
"//absl/log/internal:test_matchers",
......
......@@ -905,7 +905,6 @@ absl_cc_test(
absl::log_sink
absl::log_sink_registry
absl::log_severity
absl::raw_logging_internal
absl::scoped_mock_log
absl::strings
GTest::gtest_main
......
......@@ -18,7 +18,6 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/internal/test_actions.h"
#include "absl/log/internal/test_helpers.h"
#include "absl/log/internal/test_matchers.h"
......@@ -205,7 +204,7 @@ class ReentrancyTest : public ::testing::Test {
<< "The log is coming from *inside the sink*.";
break;
default:
ABSL_RAW_LOG(FATAL, "Invalid mode %d.\n", static_cast<int>(mode_));
LOG(FATAL) << "Invalid mode " << static_cast<int>(mode_);
}
}
......
......@@ -189,7 +189,7 @@ cc_test(
deps = [
":distributions",
":random",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/numeric:representation",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
......@@ -244,7 +244,7 @@ cc_test(
deps = [
":distributions",
":random",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
......@@ -265,7 +265,7 @@ cc_test(
deps = [
":distributions",
":random",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
......@@ -292,8 +292,8 @@ cc_test(
":distributions",
":random",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/container:flat_hash_map",
"//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
......@@ -314,7 +314,7 @@ cc_test(
":distributions",
":random",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/numeric:representation",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
......@@ -338,7 +338,7 @@ cc_test(
":distributions",
":random",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/numeric:representation",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:sequence_urbg",
......@@ -360,7 +360,7 @@ cc_test(
deps = [
":distributions",
":random",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
......@@ -385,7 +385,7 @@ cc_test(
deps = [
":distributions",
":random",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/numeric:representation",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
......@@ -406,7 +406,7 @@ cc_test(
deps = [
":distributions",
":random",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
......
......@@ -260,13 +260,13 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::log
absl::numeric_representation
absl::random_distributions
absl::random_random
absl::random_internal_distribution_test_util
absl::random_internal_sequence_urbg
absl::random_internal_pcg_engine
absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
......@@ -299,6 +299,7 @@ absl_cc_test(
${ABSL_TEST_COPTS}
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::random_distributions
absl::random_random
absl::raw_logging_internal
......@@ -315,12 +316,13 @@ absl_cc_test(
${ABSL_TEST_COPTS}
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::log
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
......@@ -337,12 +339,12 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::log
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
absl::raw_logging_internal
absl::strings
GTest::gmock
GTest::gtest_main
......@@ -362,10 +364,10 @@ absl_cc_test(
absl::random_random
absl::core_headers
absl::flat_hash_map
absl::log
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
......@@ -383,13 +385,13 @@ absl_cc_test(
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::core_headers
absl::log
absl::numeric_representation
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
......@@ -407,12 +409,12 @@ absl_cc_test(
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::core_headers
absl::log
absl::numeric_representation
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_sequence_urbg
absl::random_random
absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
......@@ -429,12 +431,12 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::log
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
absl::raw_logging_internal
absl::strings
GTest::gmock
GTest::gtest_main
......@@ -450,6 +452,7 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::log
absl::numeric_representation
absl::random_distributions
absl::random_internal_distribution_test_util
......@@ -471,12 +474,12 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::log
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
absl::raw_logging_internal
absl::strings
GTest::gmock
GTest::gtest_main
......@@ -1090,9 +1093,9 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::log
absl::random_internal_explicit_seed_seq
absl::random_internal_randen_engine
absl::raw_logging_internal
absl::strings
absl::time
GTest::gmock
......@@ -1142,10 +1145,10 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::log
absl::random_internal_platform
absl::random_internal_randen_hwaes
absl::random_internal_randen_hwaes_impl
absl::raw_logging_internal
absl::str_format
GTest::gmock
GTest::gtest
......
......@@ -28,7 +28,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/numeric/internal/representation.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
......@@ -107,8 +107,8 @@ TYPED_TEST(BetaDistributionInterfaceTest, SerializeTest) {
};
for (TypeParam alpha : kValues) {
for (TypeParam beta : kValues) {
ABSL_INTERNAL_LOG(
INFO, absl::StrFormat("Smoke test for Beta(%a, %a)", alpha, beta));
LOG(INFO) << absl::StreamFormat("Smoke test for Beta(%a, %a)", alpha,
beta);
param_type param(alpha, beta);
absl::beta_distribution<TypeParam> before(alpha, beta);
......@@ -327,15 +327,13 @@ bool BetaDistributionTest::SingleZTestOnMeanAndVariance(double p,
absl::random_internal::Near("z", z_mean, 0.0, max_err) &&
absl::random_internal::Near("z_variance", z_variance, 0.0, max_err);
if (!pass) {
ABSL_INTERNAL_LOG(
INFO,
absl::StrFormat(
"Beta(%f, %f), "
"mean: sample %f, expect %f, which is %f stddevs away, "
"variance: sample %f, expect %f, which is %f stddevs away.",
alpha_, beta_, m.mean, Mean(),
std::abs(m.mean - Mean()) / mean_stddev, m.variance, Variance(),
std::abs(m.variance - Variance()) / variance_stddev));
LOG(INFO) << "Beta(" << alpha_ << ", " << beta_ << "), mean: sample "
<< m.mean << ", expect " << Mean() << ", which is "
<< std::abs(m.mean - Mean()) / mean_stddev
<< " stddevs away, variance: sample " << m.variance << ", expect "
<< Variance() << ", which is "
<< std::abs(m.variance - Variance()) / variance_stddev
<< " stddevs away.";
}
return pass;
}
......@@ -396,18 +394,15 @@ bool BetaDistributionTest::SingleChiSquaredTest(double p, size_t samples,
const bool pass =
(absl::random_internal::ChiSquarePValue(chi_square, dof) >= p);
if (!pass) {
for (int i = 0; i < cutoffs.size(); i++) {
ABSL_INTERNAL_LOG(
INFO, absl::StrFormat("cutoff[%d] = %f, actual count %d, expected %d",
i, cutoffs[i], counts[i],
static_cast<int>(expected[i])));
}
ABSL_INTERNAL_LOG(
INFO, absl::StrFormat(
"Beta(%f, %f) %s %f, p = %f", alpha_, beta_,
absl::random_internal::kChiSquared, chi_square,
absl::random_internal::ChiSquarePValue(chi_square, dof)));
for (size_t i = 0; i < cutoffs.size(); i++) {
LOG(INFO) << "cutoff[" << i << "] = " << cutoffs[i] << ", actual count "
<< counts[i] << ", expected " << static_cast<int>(expected[i]);
}
LOG(INFO) << "Beta(" << alpha_ << ", " << beta_ << ") "
<< absl::random_internal::kChiSquared << " " << chi_square
<< ", p = "
<< absl::random_internal::ChiSquarePValue(chi_square, dof);
}
return pass;
}
......
......@@ -26,7 +26,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
#include "absl/random/internal/pcg_engine.h"
......@@ -194,7 +194,7 @@ TEST(DiscreteDistributionTest, ChiSquaredTest50) {
absl::StrAppend(&msg, kChiSquared, " p-value ", p_value, "\n");
absl::StrAppend(&msg, "High ", kChiSquared, " value: ", chi_square, " > ",
kThreshold);
ABSL_RAW_LOG(INFO, "%s", msg.c_str());
LOG(INFO) << msg;
FAIL() << msg;
}
}
......
......@@ -29,8 +29,8 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/log/log.h"
#include "absl/numeric/internal/representation.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
......@@ -115,9 +115,8 @@ TYPED_TEST(ExponentialDistributionTypedTest, SerializeTest) {
if (sample < sample_min) sample_min = sample;
}
if (!std::is_same<TypeParam, long double>::value) {
ABSL_INTERNAL_LOG(INFO,
absl::StrFormat("Range {%f}: %f, %f, lambda=%f", lambda,
sample_min, sample_max, lambda));
LOG(INFO) << "Range {" << lambda << "}: " << sample_min << ", "
<< sample_max << ", lambda=" << lambda;
}
std::stringstream ss;
......@@ -219,17 +218,16 @@ bool ExponentialDistributionTests::SingleZTest(const double p,
const bool pass = absl::random_internal::Near("z", z, 0.0, max_err);
if (!pass) {
ABSL_INTERNAL_LOG(
INFO, absl::StrFormat("p=%f max_err=%f\n"
" lambda=%f\n"
" mean=%f vs. %f\n"
" stddev=%f vs. %f\n"
" skewness=%f vs. %f\n"
" kurtosis=%f vs. %f\n"
" z=%f vs. 0",
p, max_err, lambda(), m.mean, mean(),
std::sqrt(m.variance), stddev(), m.skewness,
skew(), m.kurtosis, kurtosis(), z));
// clang-format off
LOG(INFO)
<< "p=" << p << " max_err=" << max_err << "\n"
" lambda=" << lambda() << "\n"
" mean=" << m.mean << " vs. " << mean() << "\n"
" stddev=" << std::sqrt(m.variance) << " vs. " << stddev() << "\n"
" skewness=" << m.skewness << " vs. " << skew() << "\n"
" kurtosis=" << m.kurtosis << " vs. " << kurtosis() << "\n"
" z=" << z << " vs. 0";
// clang-format on
}
return pass;
}
......@@ -274,16 +272,16 @@ double ExponentialDistributionTests::SingleChiSquaredTest() {
double p = absl::random_internal::ChiSquarePValue(chi_square, dof);
if (chi_square > threshold) {
for (int i = 0; i < cutoffs.size(); i++) {
ABSL_INTERNAL_LOG(
INFO, absl::StrFormat("%d : (%f) = %d", i, cutoffs[i], counts[i]));
for (size_t i = 0; i < cutoffs.size(); i++) {
LOG(INFO) << i << " : (" << cutoffs[i] << ") = " << counts[i];
}
ABSL_INTERNAL_LOG(INFO,
absl::StrCat("lambda ", lambda(), "\n", //
" expected ", expected, "\n", //
kChiSquared, " ", chi_square, " (", p, ")\n",
kChiSquared, " @ 0.98 = ", threshold));
// clang-format off
LOG(INFO) << "lambda " << lambda() << "\n"
" expected " << expected << "\n"
<< kChiSquared << " " << chi_square << " (" << p << ")\n"
<< kChiSquared << " @ 0.98 = " << threshold;
// clang-format on
}
return p;
}
......
......@@ -26,8 +26,8 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/log/log.h"
#include "absl/numeric/internal/representation.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
......@@ -116,9 +116,8 @@ TYPED_TEST(GaussianDistributionInterfaceTest, SerializeTest) {
EXPECT_LE(sample, before.max()) << before;
}
if (!std::is_same<TypeParam, long double>::value) {
ABSL_INTERNAL_LOG(
INFO, absl::StrFormat("Range{%f, %f}: %f, %f", mean, stddev,
sample_min, sample_max));
LOG(INFO) << "Range{" << mean << ", " << stddev << "}: " << sample_min
<< ", " << sample_max;
}
std::stringstream ss;
......@@ -240,17 +239,16 @@ bool GaussianDistributionTests::SingleZTest(const double p,
(std::pow(m.skewness, 2.0) + std::pow(m.kurtosis - 3.0, 2.0) / 4.0);
if (!pass || jb > 9.21) {
ABSL_INTERNAL_LOG(
INFO, absl::StrFormat("p=%f max_err=%f\n"
" mean=%f vs. %f\n"
" stddev=%f vs. %f\n"
" skewness=%f vs. %f\n"
" kurtosis=%f vs. %f\n"
" z=%f vs. 0\n"
" jb=%f vs. 9.21",
p, max_err, m.mean, mean(), std::sqrt(m.variance),
stddev(), m.skewness, skew(), m.kurtosis,
kurtosis(), z, jb));
// clang-format off
LOG(INFO)
<< "p=" << p << " max_err=" << max_err << "\n"
" mean=" << m.mean << " vs. " << mean() << "\n"
" stddev=" << std::sqrt(m.variance) << " vs. " << stddev() << "\n"
" skewness=" << m.skewness << " vs. " << skew() << "\n"
" kurtosis=" << m.kurtosis << " vs. " << kurtosis() << "\n"
" z=" << z << " vs. 0\n"
" jb=" << jb << " vs. 9.21";
// clang-format on
}
return pass;
}
......@@ -297,16 +295,16 @@ double GaussianDistributionTests::SingleChiSquaredTest() {
// Log if the chi_square value is above the threshold.
if (chi_square > threshold) {
for (int i = 0; i < cutoffs.size(); i++) {
ABSL_INTERNAL_LOG(
INFO, absl::StrFormat("%d : (%f) = %d", i, cutoffs[i], counts[i]));
for (size_t i = 0; i < cutoffs.size(); i++) {
LOG(INFO) << i << " : (" << cutoffs[i] << ") = " << counts[i];
}
ABSL_INTERNAL_LOG(
INFO, absl::StrCat("mean=", mean(), " stddev=", stddev(), "\n", //
" expected ", expected, "\n", //
kChiSquared, " ", chi_square, " (", p, ")\n", //
kChiSquared, " @ 0.98 = ", threshold));
// clang-format off
LOG(INFO) << "mean=" << mean() << " stddev=" << stddev() << "\n"
" expected " << expected << "\n"
<< kChiSquared << " " << chi_square << " (" << p << ")\n"
<< kChiSquared << " @ 0.98 = " << threshold;
// clang-format on
}
return p;
}
......
......@@ -601,7 +601,7 @@ cc_test(
deps = [
":explicit_seed_seq",
":randen_engine",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/strings",
"//absl/time",
"@com_google_googletest//:gtest_main",
......@@ -646,7 +646,7 @@ cc_test(
":platform",
":randen_hwaes",
":randen_hwaes_impl", # build_cleaner: keep
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/strings:str_format",
"@com_google_googletest//:gtest",
],
......@@ -707,8 +707,10 @@ cc_test(
],
deps = [
":nanobenchmark",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/log:check",
"//absl/strings",
"//absl/strings:str_format",
],
)
......
......@@ -14,8 +14,10 @@
#include "absl/random/internal/nanobenchmark.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_format.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
......@@ -36,16 +38,16 @@ void MeasureDiv(const FuncInput (&inputs)[N]) {
params.max_evals = 6; // avoid test timeout
const size_t num_results = Measure(&Div, nullptr, inputs, N, results, params);
if (num_results == 0) {
ABSL_RAW_LOG(
WARNING,
"WARNING: Measurement failed, should not happen when using "
"PinThreadToCPU unless the region to measure takes > 1 second.\n");
LOG(WARNING)
<< "WARNING: Measurement failed, should not happen when using "
"PinThreadToCPU unless the region to measure takes > 1 second.";
return;
}
for (size_t i = 0; i < num_results; ++i) {
ABSL_RAW_LOG(INFO, "%5zu: %6.2f ticks; MAD=%4.2f%%\n", results[i].input,
results[i].ticks, results[i].variability * 100.0);
ABSL_RAW_CHECK(results[i].ticks != 0.0f, "Zero duration");
LOG(INFO) << absl::StreamFormat("%5u: %6.2f ticks; MAD=%4.2f%%\n",
results[i].input, results[i].ticks,
results[i].variability * 100.0);
CHECK_NE(results[i].ticks, 0.0f) << "Zero duration";
}
}
......@@ -54,7 +56,7 @@ void RunAll(const int argc, char* argv[]) {
int cpu = -1;
if (argc == 2) {
if (!absl::SimpleAtoi(argv[1], &cpu)) {
ABSL_RAW_LOG(FATAL, "The optional argument must be a CPU number >= 0.\n");
LOG(FATAL) << "The optional argument must be a CPU number >= 0.";
}
}
PinThreadToCPU(cpu);
......
......@@ -21,7 +21,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/random/internal/explicit_seed_seq.h"
#include "absl/strings/str_cat.h"
#include "absl/time/clock.h"
......@@ -645,9 +645,8 @@ TEST(RandenTest, IsFastOrSlow) {
}
auto duration = absl::GetCurrentTimeNanos() - start;
ABSL_INTERNAL_LOG(INFO, absl::StrCat(static_cast<double>(duration) /
static_cast<double>(kCount),
"ns"));
LOG(INFO) << static_cast<double>(duration) / static_cast<double>(kCount)
<< "ns";
EXPECT_GT(sum, 0);
EXPECT_GE(duration, kCount); // Should be slower than 1ns per call.
......
......@@ -16,7 +16,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/random/internal/platform.h"
#include "absl/random/internal/randen_detect.h"
#include "absl/random/internal/randen_traits.h"
......@@ -67,32 +67,32 @@ TEST(RandenHwAesTest, Default) {
int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
ABSL_RAW_LOG(INFO, "ABSL_HAVE_ACCELERATED_AES=%d", ABSL_HAVE_ACCELERATED_AES);
ABSL_RAW_LOG(INFO, "ABSL_RANDOM_INTERNAL_AES_DISPATCH=%d",
ABSL_RANDOM_INTERNAL_AES_DISPATCH);
LOG(INFO) << "ABSL_HAVE_ACCELERATED_AES=" << ABSL_HAVE_ACCELERATED_AES;
LOG(INFO) << "ABSL_RANDOM_INTERNAL_AES_DISPATCH="
<< ABSL_RANDOM_INTERNAL_AES_DISPATCH;
#if defined(ABSL_ARCH_X86_64)
ABSL_RAW_LOG(INFO, "ABSL_ARCH_X86_64");
LOG(INFO) << "ABSL_ARCH_X86_64";
#elif defined(ABSL_ARCH_X86_32)
ABSL_RAW_LOG(INFO, "ABSL_ARCH_X86_32");
LOG(INFO) << "ABSL_ARCH_X86_32";
#elif defined(ABSL_ARCH_AARCH64)
ABSL_RAW_LOG(INFO, "ABSL_ARCH_AARCH64");
LOG(INFO) << "ABSL_ARCH_AARCH64";
#elif defined(ABSL_ARCH_ARM)
ABSL_RAW_LOG(INFO, "ABSL_ARCH_ARM");
LOG(INFO) << "ABSL_ARCH_ARM";
#elif defined(ABSL_ARCH_PPC)
ABSL_RAW_LOG(INFO, "ABSL_ARCH_PPC");
LOG(INFO) << "ABSL_ARCH_PPC";
#else
ABSL_RAW_LOG(INFO, "ARCH Unknown");
LOG(INFO) << "ARCH Unknown";
#endif
int x = absl::random_internal::HasRandenHwAesImplementation();
ABSL_RAW_LOG(INFO, "HasRandenHwAesImplementation = %d", x);
LOG(INFO) << "HasRandenHwAesImplementation = " << x;
int y = absl::random_internal::CPUSupportsRandenHwAes();
ABSL_RAW_LOG(INFO, "CPUSupportsRandenHwAes = %d", x);
LOG(INFO) << "CPUSupportsRandenHwAes = " << x;
if (!x || !y) {
ABSL_RAW_LOG(INFO, "Skipping Randen HWAES tests.");
LOG(INFO) << "Skipping Randen HWAES tests.";
return 0;
}
return RUN_ALL_TESTS();
......
......@@ -24,7 +24,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
#include "absl/random/internal/pcg_engine.h"
......@@ -108,8 +108,7 @@ TYPED_TEST(LogUniformIntDistributionTypeTest, SerializeTest) {
if (sample > sample_max) sample_max = sample;
if (sample < sample_min) sample_min = sample;
}
ABSL_INTERNAL_LOG(INFO,
absl::StrCat("Range: ", +sample_min, ", ", +sample_max));
LOG(INFO) << "Range: " << sample_min << ", " << sample_max;
}
}
......@@ -182,16 +181,14 @@ double LogUniformIntChiSquaredTest::ChiSquaredTestImpl() {
const double p = absl::random_internal::ChiSquarePValue(chi_square, dof);
if (chi_square > threshold) {
ABSL_INTERNAL_LOG(INFO, "values");
LOG(INFO) << "values";
for (size_t i = 0; i < buckets.size(); i++) {
ABSL_INTERNAL_LOG(INFO, absl::StrCat(i, ": ", buckets[i]));
LOG(INFO) << i << ": " << buckets[i];
}
ABSL_INTERNAL_LOG(INFO,
absl::StrFormat("trials=%d\n"
"%s(data, %d) = %f (%f)\n"
"%s @ 0.98 = %f",
trials, kChiSquared, dof, chi_square, p,
kChiSquared, threshold));
LOG(INFO) << "trials=" << trials << "\n"
<< kChiSquared << "(data, " << dof << ") = " << chi_square << " ("
<< p << ")\n"
<< kChiSquared << " @ 0.98 = " << threshold;
}
return p;
}
......
......@@ -25,9 +25,9 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/container/flat_hash_map.h"
#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
#include "absl/random/internal/pcg_engine.h"
......@@ -134,8 +134,8 @@ TYPED_TEST(PoissonDistributionInterfaceTest, SerializeTest) {
if (sample < sample_min) sample_min = sample;
}
ABSL_INTERNAL_LOG(INFO, absl::StrCat("Range {", param.mean(), "}: ",
+sample_min, ", ", +sample_max));
LOG(INFO) << "Range {" << param.mean() << "}: " << sample_min << ", "
<< sample_max;
// Validate stream serialization.
std::stringstream ss;
......@@ -188,10 +188,9 @@ class PoissonModel {
}
void LogCDF() {
ABSL_INTERNAL_LOG(INFO, absl::StrCat("CDF (mean = ", mean_, ")"));
LOG(INFO) << "CDF (mean = " << mean_ << ")";
for (const auto c : cdf_) {
ABSL_INTERNAL_LOG(INFO,
absl::StrCat(c.index, ": pmf=", c.pmf, " cdf=", c.cdf));
LOG(INFO) << c.index << ": pmf=" << c.pmf << " cdf=" << c.cdf;
}
}
......@@ -286,16 +285,15 @@ bool PoissonDistributionZTest::SingleZTest(const double p,
const bool pass = absl::random_internal::Near("z", z, 0.0, max_err);
if (!pass) {
ABSL_INTERNAL_LOG(
INFO, absl::StrFormat("p=%f max_err=%f\n"
" mean=%f vs. %f\n"
" stddev=%f vs. %f\n"
" skewness=%f vs. %f\n"
" kurtosis=%f vs. %f\n"
" z=%f",
p, max_err, m.mean, mean(), std::sqrt(m.variance),
stddev(), m.skewness, skew(), m.kurtosis,
kurtosis(), z));
// clang-format off
LOG(INFO)
<< "p=" << p << " max_err=" << max_err << "\n"
" mean=" << m.mean << " vs. " << mean() << "\n"
" stddev=" << std::sqrt(m.variance) << " vs. " << stddev() << "\n"
" skewness=" << m.skewness << " vs. " << skew() << "\n"
" kurtosis=" << m.kurtosis << " vs. " << kurtosis() << "\n"
" z=" << z;
// clang-format on
}
return pass;
}
......@@ -439,17 +437,16 @@ double PoissonDistributionChiSquaredTest::ChiSquaredTestImpl() {
if (chi_square > threshold) {
LogCDF();
ABSL_INTERNAL_LOG(INFO, absl::StrCat("VALUES buckets=", counts.size(),
" samples=", kSamples));
LOG(INFO) << "VALUES buckets=" << counts.size()
<< " samples=" << kSamples;
for (size_t i = 0; i < counts.size(); i++) {
ABSL_INTERNAL_LOG(
INFO, absl::StrCat(cutoffs_[i], ": ", counts[i], " vs. E=", e[i]));
LOG(INFO) << cutoffs_[i] << ": " << counts[i] << " vs. E=" << e[i];
}
ABSL_INTERNAL_LOG(
INFO,
absl::StrCat(kChiSquared, "(data, dof=", dof, ") = ", chi_square, " (",
p, ")\n", " vs.\n", kChiSquared, " @ 0.98 = ", threshold));
LOG(INFO) << kChiSquared << "(data, dof=" << dof << ") = " << chi_square
<< " (" << p << ")\n"
<< " vs.\n"
<< kChiSquared << " @ 0.98 = " << threshold;
}
return p;
}
......
......@@ -24,7 +24,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
#include "absl/random/internal/pcg_engine.h"
......@@ -107,8 +107,7 @@ TYPED_TEST(UniformIntDistributionTest, ParamSerializeTest) {
sample_min = sample;
}
}
std::string msg = absl::StrCat("Range: ", +sample_min, ", ", +sample_max);
ABSL_RAW_LOG(INFO, "%s", msg.c_str());
LOG(INFO) << "Range: " << sample_min << ", " << sample_max;
}
}
......@@ -210,7 +209,7 @@ TYPED_TEST(UniformIntDistributionTest, ChiSquaredTest50) {
absl::StrAppend(&msg, kChiSquared, " p-value ", p_value, "\n");
absl::StrAppend(&msg, "High ", kChiSquared, " value: ", chi_square, " > ",
kThreshold);
ABSL_RAW_LOG(INFO, "%s", msg.c_str());
LOG(INFO) << msg;
FAIL() << msg;
}
}
......
......@@ -26,7 +26,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/numeric/internal/representation.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
......@@ -182,9 +182,8 @@ TYPED_TEST(UniformRealDistributionTest, ParamSerializeTest) {
if (!std::is_same<real_type, long double>::value) {
// static_cast<double>(long double) can overflow.
std::string msg = absl::StrCat("Range: ", static_cast<double>(sample_min),
", ", static_cast<double>(sample_max));
ABSL_RAW_LOG(INFO, "%s", msg.c_str());
LOG(INFO) << "Range: " << static_cast<double>(sample_min) << ", "
<< static_cast<double>(sample_max);
}
}
}
......@@ -324,7 +323,7 @@ TYPED_TEST(UniformRealDistributionTest, ChiSquaredTest50) {
absl::StrAppend(&msg, kChiSquared, " p-value ", p_value, "\n");
absl::StrAppend(&msg, "High ", kChiSquared, " value: ", chi_square, " > ",
kThreshold);
ABSL_RAW_LOG(INFO, "%s", msg.c_str());
LOG(INFO) << msg;
FAIL() << msg;
}
}
......
......@@ -25,7 +25,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/pcg_engine.h"
#include "absl/random/internal/sequence_urbg.h"
......@@ -102,8 +102,7 @@ TYPED_TEST(ZipfDistributionTypedTest, SerializeTest) {
if (sample > sample_max) sample_max = sample;
if (sample < sample_min) sample_min = sample;
}
ABSL_INTERNAL_LOG(INFO,
absl::StrCat("Range: ", +sample_min, ", ", +sample_max));
LOG(INFO) << "Range: " << sample_min << ", " << sample_max;
}
}
......@@ -303,18 +302,15 @@ TEST_P(ZipfTest, ChiSquaredTest) {
// Log if the chi_squared value is above the threshold.
if (chi_square > threshold) {
ABSL_INTERNAL_LOG(INFO, "values");
LOG(INFO) << "values";
for (size_t i = 0; i < expected.size(); i++) {
ABSL_INTERNAL_LOG(INFO, absl::StrCat(points[i], ": ", buckets[i],
" vs. E=", expected[i]));
LOG(INFO) << points[i] << ": " << buckets[i] << " vs. E=" << expected[i];
}
ABSL_INTERNAL_LOG(INFO, absl::StrCat("trials ", trials));
ABSL_INTERNAL_LOG(INFO,
absl::StrCat("mean ", avg, " vs. expected ", mean()));
ABSL_INTERNAL_LOG(INFO, absl::StrCat(kChiSquared, "(data, ", dof, ") = ",
chi_square, " (", p_actual, ")"));
ABSL_INTERNAL_LOG(INFO,
absl::StrCat(kChiSquared, " @ 0.9995 = ", threshold));
LOG(INFO) << "trials " << trials;
LOG(INFO) << "mean " << avg << " vs. expected " << mean();
LOG(INFO) << kChiSquared << "(data, " << dof << ") = " << chi_square << " ("
<< p_actual << ")";
LOG(INFO) << kChiSquared << " @ 0.9995 = " << threshold;
FAIL() << kChiSquared << " value of " << chi_square
<< " is above the threshold.";
}
......
......@@ -774,10 +774,10 @@ cc_test(
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:endian",
"//absl/base:raw_logging_internal",
"//absl/container:fixed_array",
"//absl/hash",
"//absl/log",
"//absl/log:check",
"//absl/random",
"@com_google_googletest//:gtest_main",
],
......@@ -1019,7 +1019,7 @@ cc_test(
":pow10_helper",
":strings",
"//absl/base:config",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/random",
"//absl/random:distributions",
"@com_google_googletest//:gtest_main",
......@@ -1096,7 +1096,7 @@ cc_test(
deps = [
":strings",
"//absl/base:config",
"//absl/base:raw_logging_internal",
"//absl/log:check",
"@com_google_googletest//:gtest_main",
],
)
......@@ -1253,6 +1253,7 @@ cc_test(
":strings",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/types:optional",
"@com_google_googletest//:gtest_main",
],
......
......@@ -317,7 +317,7 @@ absl_cc_test(
absl::core_headers
absl::pow10_helper
absl::config
absl::raw_logging_internal
absl::log
absl::random_random
absl::random_distributions
absl::strings_internal
......@@ -372,9 +372,9 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::strings
absl::check
absl::config
absl::raw_logging_internal
absl::strings
GTest::gmock_main
)
......@@ -516,6 +516,7 @@ absl_cc_test(
absl::strings
absl::str_format_internal
absl::core_headers
absl::log
absl::raw_logging_internal
absl::int128
GTest::gmock_main
......@@ -960,19 +961,20 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::cord
absl::str_format
absl::strings
absl::base
absl::check
absl::config
absl::cord
absl::cord_test_helpers
absl::cordz_test_helpers
absl::core_headers
absl::endian
absl::fixed_array
absl::hash
absl::log
absl::random_random
absl::raw_logging_internal
absl::fixed_array
absl::str_format
absl::strings
GTest::gmock_main
)
......
......@@ -30,10 +30,11 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
#include "absl/base/internal/endian.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/container/fixed_array.h"
#include "absl/hash/hash.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/random/random.h"
#include "absl/strings/cord_test_helpers.h"
#include "absl/strings/cordz_test_helpers.h"
......@@ -210,9 +211,8 @@ class CordTestPeer {
}
static Cord MakeSubstring(Cord src, size_t offset, size_t length) {
ABSL_RAW_CHECK(src.contents_.is_tree(), "Can not be inlined");
ABSL_RAW_CHECK(src.ExpectedChecksum() == absl::nullopt,
"Can not be hardened");
CHECK(src.contents_.is_tree()) << "Can not be inlined";
CHECK(!src.ExpectedChecksum().has_value()) << "Can not be hardened";
Cord cord;
auto* tree = cord_internal::SkipCrcNode(src.contents_.tree());
auto* rep = CordRepSubstring::Create(CordRep::Ref(tree), offset, length);
......@@ -374,7 +374,7 @@ TEST_P(CordTest, GigabyteCordFromExternal) {
for (int i = 0; i < 1024; ++i) {
c.Append(from);
}
ABSL_RAW_LOG(INFO, "Made a Cord with %zu bytes!", c.size());
LOG(INFO) << "Made a Cord with " << c.size() << " bytes!";
// Note: on a 32-bit build, this comes out to 2,818,048,000 bytes.
// Note: on a 64-bit build, this comes out to 171,932,385,280 bytes.
}
......@@ -1247,15 +1247,15 @@ absl::Cord BigCord(size_t len, char v) {
// Splice block into cord.
absl::Cord SpliceCord(const absl::Cord& blob, int64_t offset,
const absl::Cord& block) {
ABSL_RAW_CHECK(offset >= 0, "");
ABSL_RAW_CHECK(offset + block.size() <= blob.size(), "");
CHECK_GE(offset, 0);
CHECK_LE(static_cast<size_t>(offset) + block.size(), blob.size());
absl::Cord result(blob);
result.RemoveSuffix(blob.size() - offset);
result.Append(block);
absl::Cord suffix(blob);
suffix.RemovePrefix(offset + block.size());
result.Append(suffix);
ABSL_RAW_CHECK(blob.size() == result.size(), "");
CHECK_EQ(blob.size(), result.size());
return result;
}
......@@ -1855,7 +1855,7 @@ TEST(CordTest, CordMemoryUsageBTree) {
// windows DLL, we may have ODR like effects on the flag, meaning the DLL
// code will run with the picked up default.
if (!absl::CordTestPeer::Tree(cord1)->IsBtree()) {
ABSL_RAW_LOG(WARNING, "Cord library code not respecting btree flag");
LOG(WARNING) << "Cord library code not respecting btree flag";
return;
}
......@@ -1940,8 +1940,7 @@ TEST_P(CordTest, DiabolicalGrowth) {
std::string value;
absl::CopyCordToString(cord, &value);
EXPECT_EQ(value, expected);
ABSL_RAW_LOG(INFO, "Diabolical size allocated = %zu",
cord.EstimatedMemoryUsage());
LOG(INFO) << "Diabolical size allocated = " << cord.EstimatedMemoryUsage();
}
// The following tests check support for >4GB cords in 64-bit binaries, and
......
......@@ -19,7 +19,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/check.h"
#include "absl/strings/str_cat.h"
using absl::chars_format;
......@@ -56,14 +56,14 @@ void ExpectParsedFloat(std::string s, absl::chars_format format_flags,
begin_subrange = static_cast<int>(open_bracket_pos);
s.replace(open_bracket_pos, 1, "");
std::string::size_type close_bracket_pos = s.find(']');
ABSL_RAW_CHECK(close_bracket_pos != absl::string_view::npos,
"Test input contains [ without matching ]");
CHECK_NE(close_bracket_pos, absl::string_view::npos)
<< "Test input contains [ without matching ]";
end_subrange = static_cast<int>(close_bracket_pos);
s.replace(close_bracket_pos, 1, "");
}
const std::string::size_type expected_characters_matched = s.find('$');
ABSL_RAW_CHECK(expected_characters_matched != std::string::npos,
"Input string must contain $");
CHECK_NE(expected_characters_matched, std::string::npos)
<< "Input string must contain $";
s.replace(expected_characters_matched, 1, "");
ParsedFloat parsed =
......
......@@ -26,6 +26,7 @@
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/strings/internal/str_format/bind.h"
#include "absl/strings/match.h"
#include "absl/types/optional.h"
......@@ -264,7 +265,7 @@ MATCHER_P(MatchesPointerString, ptr, "") {
}
void* parsed = nullptr;
if (sscanf(arg.c_str(), "%p", &parsed) != 1) {
ABSL_RAW_LOG(FATAL, "Could not parse %s", arg.c_str());
LOG(FATAL) << "Could not parse " << arg;
}
return ptr == parsed;
}
......
......@@ -37,7 +37,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/random/distributions.h"
#include "absl/random/random.h"
#include "absl/strings/internal/numbers_test_common.h"
......@@ -1337,11 +1337,9 @@ TEST_F(SimpleDtoaTest, ExhaustiveDoubleToSixDigits) {
if (strcmp(sixdigitsbuf, snprintfbuf) != 0) {
mismatches.push_back(d);
if (mismatches.size() < 10) {
ABSL_RAW_LOG(ERROR, "%s",
absl::StrCat("Six-digit failure with double. ", "d=", d,
"=", d, " sixdigits=", sixdigitsbuf,
" printf(%g)=", snprintfbuf)
.c_str());
LOG(ERROR) << "Six-digit failure with double. d=" << d
<< " sixdigits=" << sixdigitsbuf
<< " printf(%g)=" << snprintfbuf;
}
}
};
......@@ -1389,12 +1387,10 @@ TEST_F(SimpleDtoaTest, ExhaustiveDoubleToSixDigits) {
if (kFloatNumCases >= 1e9) {
// The exhaustive test takes a very long time, so log progress.
char buf[kSixDigitsToBufferSize];
ABSL_RAW_LOG(
INFO, "%s",
absl::StrCat("Exp ", exponent, " powten=", powten, "(", powten,
") (",
std::string(buf, SixDigitsToBuffer(powten, buf)), ")")
.c_str());
LOG(INFO) << "Exp " << exponent << " powten=" << powten << "(" << powten
<< ") ("
<< absl::string_view(buf, SixDigitsToBuffer(powten, buf))
<< ")";
}
for (int digits : digit_testcases) {
if (exponent == 308 && digits >= 179769) break; // don't overflow!
......@@ -1419,20 +1415,17 @@ TEST_F(SimpleDtoaTest, ExhaustiveDoubleToSixDigits) {
double before = nextafter(d, 0.0);
double after = nextafter(d, 1.7976931348623157e308);
char b1[32], b2[kSixDigitsToBufferSize];
ABSL_RAW_LOG(
ERROR, "%s",
absl::StrCat(
"Mismatch #", i, " d=", d, " (", ToNineDigits(d), ")",
" sixdigits='", sixdigitsbuf, "'", " snprintf='", snprintfbuf,
"'", " Before.=", PerfectDtoa(before), " ",
(SixDigitsToBuffer(before, b2), b2),
" vs snprintf=", (snprintf(b1, sizeof(b1), "%g", before), b1),
" Perfect=", PerfectDtoa(d), " ", (SixDigitsToBuffer(d, b2), b2),
" vs snprintf=", (snprintf(b1, sizeof(b1), "%g", d), b1),
" After.=.", PerfectDtoa(after), " ",
(SixDigitsToBuffer(after, b2), b2),
" vs snprintf=", (snprintf(b1, sizeof(b1), "%g", after), b1))
.c_str());
LOG(ERROR) << "Mismatch #" << i << " d=" << d << " (" << ToNineDigits(d)
<< ") sixdigits='" << sixdigitsbuf << "' snprintf='"
<< snprintfbuf << "' Before.=" << PerfectDtoa(before) << " "
<< (SixDigitsToBuffer(before, b2), b2) << " vs snprintf="
<< (snprintf(b1, sizeof(b1), "%g", before), b1)
<< " Perfect=" << PerfectDtoa(d) << " "
<< (SixDigitsToBuffer(d, b2), b2)
<< " vs snprintf=" << (snprintf(b1, sizeof(b1), "%g", d), b1)
<< " After.=." << PerfectDtoa(after) << " "
<< (SixDigitsToBuffer(after, b2), b2) << " vs snprintf="
<< (snprintf(b1, sizeof(b1), "%g", after), b1);
}
}
}
......
......@@ -198,7 +198,8 @@ cc_test(
deps = [
":graphcycles_internal",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/log:check",
"@com_google_googletest//:gtest_main",
],
)
......@@ -247,7 +248,8 @@ cc_test(
"//absl/base",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/log:check",
"//absl/memory",
"//absl/time",
"@com_google_googletest//:gtest_main",
......@@ -376,6 +378,6 @@ cc_test(
deps = [
":synchronization",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
"//absl/log:check",
],
)
......@@ -151,9 +151,10 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
absl::graphcycles_internal
absl::check
absl::core_headers
absl::raw_logging_internal
absl::graphcycles_internal
absl::log
GTest::gmock_main
)
......@@ -183,10 +184,11 @@ absl_cc_test(
absl::synchronization
absl::thread_pool
absl::base
absl::check
absl::config
absl::core_headers
absl::log
absl::memory
absl::raw_logging_internal
absl::time
GTest::gmock_main
)
......@@ -278,5 +280,5 @@ absl_cc_test(
DEPS
absl::synchronization
absl::core_headers
absl::raw_logging_internal
absl::check
)
......@@ -21,8 +21,9 @@
#include <vector>
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
......@@ -65,51 +66,51 @@ static bool IsReachable(Edges *edges, int from, int to,
}
static void PrintEdges(Edges *edges) {
ABSL_RAW_LOG(INFO, "EDGES (%zu)", edges->size());
LOG(INFO) << "EDGES (" << edges->size() << ")";
for (const auto &edge : *edges) {
int a = edge.from;
int b = edge.to;
ABSL_RAW_LOG(INFO, "%d %d", a, b);
LOG(INFO) << a << " " << b;
}
ABSL_RAW_LOG(INFO, "---");
LOG(INFO) << "---";
}
static void PrintGCEdges(Nodes *nodes, const IdMap &id, GraphCycles *gc) {
ABSL_RAW_LOG(INFO, "GC EDGES");
LOG(INFO) << "GC EDGES";
for (int a : *nodes) {
for (int b : *nodes) {
if (gc->HasEdge(Get(id, a), Get(id, b))) {
ABSL_RAW_LOG(INFO, "%d %d", a, b);
LOG(INFO) << a << " " << b;
}
}
}
ABSL_RAW_LOG(INFO, "---");
LOG(INFO) << "---";
}
static void PrintTransitiveClosure(Nodes *nodes, Edges *edges) {
ABSL_RAW_LOG(INFO, "Transitive closure");
LOG(INFO) << "Transitive closure";
for (int a : *nodes) {
for (int b : *nodes) {
std::unordered_set<int> seen;
if (IsReachable(edges, a, b, &seen)) {
ABSL_RAW_LOG(INFO, "%d %d", a, b);
LOG(INFO) << a << " " << b;
}
}
}
ABSL_RAW_LOG(INFO, "---");
LOG(INFO) << "---";
}
static void PrintGCTransitiveClosure(Nodes *nodes, const IdMap &id,
GraphCycles *gc) {
ABSL_RAW_LOG(INFO, "GC Transitive closure");
LOG(INFO) << "GC Transitive closure";
for (int a : *nodes) {
for (int b : *nodes) {
if (gc->IsReachable(Get(id, a), Get(id, b))) {
ABSL_RAW_LOG(INFO, "%d %d", a, b);
LOG(INFO) << a << " " << b;
}
}
}
ABSL_RAW_LOG(INFO, "---");
LOG(INFO) << "---";
}
static void CheckTransitiveClosure(Nodes *nodes, Edges *edges, const IdMap &id,
......@@ -125,9 +126,8 @@ static void CheckTransitiveClosure(Nodes *nodes, Edges *edges, const IdMap &id,
PrintGCEdges(nodes, id, gc);
PrintTransitiveClosure(nodes, edges);
PrintGCTransitiveClosure(nodes, id, gc);
ABSL_RAW_LOG(FATAL, "gc_reachable %s reachable %s a %d b %d",
gc_reachable ? "true" : "false",
reachable ? "true" : "false", a, b);
LOG(FATAL) << "gc_reachable " << gc_reachable << " reachable "
<< reachable << " a " << a << " b " << b;
}
}
}
......@@ -142,7 +142,7 @@ static void CheckEdges(Nodes *nodes, Edges *edges, const IdMap &id,
if (!gc->HasEdge(Get(id, a), Get(id, b))) {
PrintEdges(edges);
PrintGCEdges(nodes, id, gc);
ABSL_RAW_LOG(FATAL, "!gc->HasEdge(%d, %d)", a, b);
LOG(FATAL) << "!gc->HasEdge(" << a << ", " << b << ")";
}
}
for (const auto &a : *nodes) {
......@@ -155,13 +155,12 @@ static void CheckEdges(Nodes *nodes, Edges *edges, const IdMap &id,
if (count != edges->size()) {
PrintEdges(edges);
PrintGCEdges(nodes, id, gc);
ABSL_RAW_LOG(FATAL, "edges->size() %zu count %d", edges->size(), count);
LOG(FATAL) << "edges->size() " << edges->size() << " count " << count;
}
}
static void CheckInvariants(const GraphCycles &gc) {
if (ABSL_PREDICT_FALSE(!gc.CheckInvariants()))
ABSL_RAW_LOG(FATAL, "CheckInvariants");
CHECK(gc.CheckInvariants()) << "CheckInvariants";
}
// Returns the index of a randomly chosen node in *nodes.
......@@ -309,7 +308,7 @@ TEST(GraphCycles, RandomizedTest) {
break;
default:
ABSL_RAW_LOG(FATAL, "op %d", op);
LOG(FATAL) << "op " << op;
}
// Very rarely, test graph expansion by adding then removing many nodes.
......
......@@ -18,8 +18,8 @@
#include "absl/base/attributes.h"
#include "absl/base/const_init.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/thread_annotations.h"
#include "absl/log/check.h"
#include "absl/synchronization/mutex.h"
#include "absl/synchronization/notification.h"
......@@ -35,20 +35,20 @@ namespace {
// Thread two waits on 'notification', then sets 'state' inside the 'mutex',
// signalling the change via 'condvar'.
//
// These tests use ABSL_RAW_CHECK to validate invariants, rather than EXPECT or
// ASSERT from gUnit, because we need to invoke them during global destructors,
// when gUnit teardown would have already begun.
// These tests use CHECK to validate invariants, rather than EXPECT or ASSERT
// from gUnit, because we need to invoke them during global destructors, when
// gUnit teardown would have already begun.
void ThreadOne(absl::Mutex* mutex, absl::CondVar* condvar,
absl::Notification* notification, bool* state) {
// Test that the notification is in a valid initial state.
ABSL_RAW_CHECK(!notification->HasBeenNotified(), "invalid Notification");
ABSL_RAW_CHECK(*state == false, "*state not initialized");
CHECK(!notification->HasBeenNotified()) << "invalid Notification";
CHECK(!*state) << "*state not initialized";
{
absl::MutexLock lock(mutex);
notification->Notify();
ABSL_RAW_CHECK(notification->HasBeenNotified(), "invalid Notification");
CHECK(notification->HasBeenNotified()) << "invalid Notification";
while (*state == false) {
condvar->Wait(mutex);
......@@ -58,11 +58,11 @@ void ThreadOne(absl::Mutex* mutex, absl::CondVar* condvar,
void ThreadTwo(absl::Mutex* mutex, absl::CondVar* condvar,
absl::Notification* notification, bool* state) {
ABSL_RAW_CHECK(*state == false, "*state not initialized");
CHECK(!*state) << "*state not initialized";
// Wake thread one
notification->WaitForNotification();
ABSL_RAW_CHECK(notification->HasBeenNotified(), "invalid Notification");
CHECK(notification->HasBeenNotified()) << "invalid Notification";
{
absl::MutexLock lock(mutex);
*state = true;
......
......@@ -77,8 +77,8 @@ cc_test(
":any",
"//absl/base:config",
"//absl/base:exception_testing",
"//absl/base:raw_logging_internal",
"//absl/container:test_instance_tracker",
"//absl/log",
"@com_google_googletest//:gtest_main",
],
)
......@@ -185,7 +185,7 @@ cc_test(
deps = [
":optional",
"//absl/base:config",
"//absl/base:raw_logging_internal",
"//absl/log",
"//absl/meta:type_traits",
"//absl/strings",
"@com_google_googletest//:gtest_main",
......
......@@ -68,7 +68,7 @@ absl_cc_test(
absl::any
absl::config
absl::exception_testing
absl::raw_logging_internal
absl::log
absl::test_instance_tracker
GTest::gmock_main
)
......@@ -220,7 +220,7 @@ absl_cc_test(
DEPS
absl::optional
absl::config
absl::raw_logging_internal
absl::log
absl::strings
absl::type_traits
GTest::gmock_main
......
......@@ -25,8 +25,8 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
#include "absl/base/internal/exception_testing.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/container/internal/test_instance_tracker.h"
#include "absl/log/log.h"
namespace {
using absl::test_internal::CopyableOnlyInstance;
......@@ -704,7 +704,7 @@ struct BadCopyable {
#ifdef ABSL_HAVE_EXCEPTIONS
throw BadCopy();
#else
ABSL_RAW_LOG(FATAL, "Bad copy");
LOG(FATAL) << "Bad copy";
#endif
}
};
......
......@@ -23,7 +23,7 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/log/log.h"
#include "absl/meta/type_traits.h"
#include "absl/strings/string_view.h"
......@@ -1542,8 +1542,7 @@ TEST(optionalTest, Hash) {
struct MoveMeNoThrow {
MoveMeNoThrow() : x(0) {}
[[noreturn]] MoveMeNoThrow(const MoveMeNoThrow& other) : x(other.x) {
ABSL_RAW_LOG(FATAL, "Should not be called.");
abort();
LOG(FATAL) << "Should not be called.";
}
MoveMeNoThrow(MoveMeNoThrow&& other) noexcept : x(other.x) {}
int x;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment