ios: Fix typo in checking thread_times values.

Change-Id: I4199b5b149d7792dcfb8a3b8de571026b1e98521
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3264806
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
This commit is contained in:
Justin Cohen 2021-11-05 15:23:47 -04:00 committed by Crashpad LUCI CQ
parent 5225da1232
commit 4bf79bc2bf
4 changed files with 24 additions and 3 deletions

View File

@ -444,7 +444,10 @@ source_set("snapshot_test") {
} }
if (crashpad_is_ios) { if (crashpad_is_ios) {
deps += [ "../minidump" ] deps += [
":snapshot_test_ios_data",
"../minidump",
]
} }
data_deps = [ data_deps = [
@ -485,6 +488,14 @@ source_set("snapshot_test") {
} }
} }
bundle_data("snapshot_test_ios_data") {
testonly = true
sources = [ "ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa" ]
outputs = [ "{{bundle_resources_dir}}/crashpad_test_data/" +
"{{source_root_relative_dir}}/{{source_file_part}}" ]
}
crashpad_loadable_module("crashpad_snapshot_test_module") { crashpad_loadable_module("crashpad_snapshot_test_module") {
testonly = true testonly = true
sources = [ "crashpad_info_client_options_test_module.cc" ] sources = [ "crashpad_info_client_options_test_module.cc" ]

View File

@ -77,9 +77,9 @@ bool ProcessSnapshotIOSIntermediateDump::Initialize(
const IOSIntermediateDumpMap* thread_times = const IOSIntermediateDumpMap* thread_times =
process_info->GetAsMap(Key::kTaskThreadTimes); process_info->GetAsMap(Key::kTaskThreadTimes);
if (thread_times) { if (thread_times) {
GetDataValueFromMap(basic_info, Key::kUserTime, &thread_times_user_time_); GetDataValueFromMap(thread_times, Key::kUserTime, &thread_times_user_time_);
GetDataValueFromMap( GetDataValueFromMap(
basic_info, Key::kSystemTime, &thread_times_system_time_); thread_times, Key::kSystemTime, &thread_times_system_time_);
} }
GetDataValueFromMap(process_info, Key::kSnapshotTime, &snapshot_time_); GetDataValueFromMap(process_info, Key::kSnapshotTime, &snapshot_time_);

View File

@ -25,6 +25,7 @@
#include "minidump/minidump_file_writer.h" #include "minidump/minidump_file_writer.h"
#include "test/errors.h" #include "test/errors.h"
#include "test/scoped_temp_dir.h" #include "test/scoped_temp_dir.h"
#include "test/test_paths.h"
#include "util/file/file_io.h" #include "util/file/file_io.h"
#include "util/file/filesystem.h" #include "util/file/filesystem.h"
#include "util/file/string_file.h" #include "util/file/string_file.h"
@ -630,6 +631,15 @@ TEST_F(ProcessSnapshotIOSIntermediateDumpTest, FullReport) {
ExpectSnapshot(process_snapshot); ExpectSnapshot(process_snapshot);
} }
TEST_F(ProcessSnapshotIOSIntermediateDumpTest, FuzzTestCases) {
base::FilePath fuzz_path = TestPaths::TestDataRoot().Append(FILE_PATH_LITERAL(
"snapshot/ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa"));
crashpad::internal::ProcessSnapshotIOSIntermediateDump process_snapshot;
EXPECT_TRUE(process_snapshot.Initialize(fuzz_path, {}));
EXPECT_TRUE(LoggingRemoveFile(path()));
}
} // namespace } // namespace
} // namespace test } // namespace test
} // namespace crashpad } // namespace crashpad