From ee173fbe36bcd175d185ad89e553c4abbf7be93e Mon Sep 17 00:00:00 2001 From: Sergiu Iordache Date: Fri, 5 Aug 2011 15:32:15 -0700 Subject: [PATCH] crash-reporter: Re-enable CollectBadDirectory unittest The KernelCollectorTest.CollectBadDirectory unittest was first re-enabled by sergiu@ in https://gerrit.chromium.org/gerrit/5433, but it broke the buildbots and had to be re-disabled. So I'm trying again, but this time I have the power of trybots! I also added code to output the log if it fails again. BUG=chromium-os:18622 TEST=Ran unittests. Ran trybots on: alex-paladin, amd64-generic-paladin, arm-tegra2-paladin, lumpy-paladin, stumpy-paladin. Change-Id: Ib7fa1c1a32e9c198db9bdae8f933c9dd9fc3381a Reviewed-on: https://gerrit.chromium.org/gerrit/20667 Tested-by: Michael Krebs Reviewed-by: Ben Chan Commit-Ready: Michael Krebs --- crash_reporter/kernel_collector_test.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/crash_reporter/kernel_collector_test.cc b/crash_reporter/kernel_collector_test.cc index ea18c6270..ee96f058e 100644 --- a/crash_reporter/kernel_collector_test.cc +++ b/crash_reporter/kernel_collector_test.cc @@ -20,6 +20,7 @@ static const char kTestKCrash[] = "test/kcrash"; static const char kTestCrashDirectory[] = "test/crash_directory"; using chromeos::FindLog; +using chromeos::GetLog; void CountCrash() { ++s_crashes; @@ -230,14 +231,14 @@ TEST_F(KernelCollectorTest, CollectNoCrash) { ASSERT_EQ(0, s_crashes); } -// Disabled for crosbug.com/18622 -//TEST_F(KernelCollectorTest, CollectBadDirectory) { -// WriteStringToFile(test_kcrash_, "====1.1\nsomething"); -// ASSERT_TRUE(collector_.Collect()); -// ASSERT_TRUE(FindLog( -// "Unable to create appropriate crash directory")); -// ASSERT_EQ(1, s_crashes); -//} +TEST_F(KernelCollectorTest, CollectBadDirectory) { + WriteStringToFile(test_kcrash_, "====1.1\nsomething"); + ASSERT_TRUE(collector_.Collect()); + ASSERT_TRUE(FindLog("Unable to create appropriate crash directory")) + << "Did not find expected error string in log: {\n" + << GetLog() << "}"; + ASSERT_EQ(1, s_crashes); +} void KernelCollectorTest::SetUpSuccessfulCollect() { collector_.ForceCrashDirectory(kTestCrashDirectory);