Left: | ||
Right: |
OLD | NEW |
---|---|
1 // Copyright (c) 2014, Google Inc. | 1 // Copyright (c) 2014, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 } | 97 } |
98 | 98 |
99 TEST_F(MicrodumpProcessorTest, TestProcess_Invalid) { | 99 TEST_F(MicrodumpProcessorTest, TestProcess_Invalid) { |
100 ProcessState state; | 100 ProcessState state; |
101 google_breakpad::ProcessResult result = | 101 google_breakpad::ProcessResult result = |
102 ProcessMicrodump("", "This is not a valid microdump", &state); | 102 ProcessMicrodump("", "This is not a valid microdump", &state); |
103 ASSERT_EQ(google_breakpad::PROCESS_ERROR_NO_THREAD_LIST, result); | 103 ASSERT_EQ(google_breakpad::PROCESS_ERROR_NO_THREAD_LIST, result); |
104 } | 104 } |
105 | 105 |
106 TEST_F(MicrodumpProcessorTest, TestProcess_MissingSymbols) { | 106 TEST_F(MicrodumpProcessorTest, TestProcess_MissingSymbols) { |
107 string microdump_file = files_path_ + "microdump.dmp"; | 107 string microdump_file = files_path_ + "microdump-arm64.dmp"; |
108 string microdump_contents; | 108 string microdump_contents; |
109 ReadFile(microdump_file, µdump_contents); | 109 ReadFile(microdump_file, µdump_contents); |
110 | 110 |
111 ProcessState state; | 111 ProcessState state; |
112 | 112 |
113 google_breakpad::ProcessResult result = | 113 google_breakpad::ProcessResult result = |
114 ProcessMicrodump("", microdump_contents, &state); | 114 ProcessMicrodump("", microdump_contents, &state); |
115 | 115 |
116 ASSERT_EQ(google_breakpad::PROCESS_OK, result); | 116 ASSERT_EQ(google_breakpad::PROCESS_OK, result); |
117 | 117 |
118 ASSERT_TRUE(state.crashed()); | 118 ASSERT_TRUE(state.crashed()); |
119 ASSERT_EQ(0, state.requesting_thread()); | 119 ASSERT_EQ(0, state.requesting_thread()); |
120 | 120 |
121 ASSERT_EQ(104U, state.modules()->module_count()); | 121 ASSERT_EQ(8U, state.modules()->module_count()); |
122 ASSERT_EQ(1U, state.threads()->size()); | 122 ASSERT_EQ(1U, state.threads()->size()); |
123 ASSERT_EQ(4U, state.threads()->at(0)->frames()->size()); | 123 ASSERT_EQ(12U, state.threads()->at(0)->frames()->size()); |
124 | 124 |
125 ASSERT_EQ("", | 125 ASSERT_EQ("", |
126 state.threads()->at(0)->frames()->at(0)->function_name); | 126 state.threads()->at(0)->frames()->at(0)->function_name); |
127 ASSERT_EQ("", | 127 ASSERT_EQ("", |
128 state.threads()->at(0)->frames()->at(3)->function_name); | 128 state.threads()->at(0)->frames()->at(3)->function_name); |
129 } | 129 } |
130 | 130 |
131 TEST_F(MicrodumpProcessorTest, TestProcess_UnsupportedArch) { | 131 TEST_F(MicrodumpProcessorTest, TestProcess_UnsupportedArch) { |
132 string microdump_contents = | 132 string microdump_contents = |
133 "W/google-breakpad(26491): -----BEGIN BREAKPAD MICRODUMP-----\n" | 133 "W/google-breakpad(26491): -----BEGIN BREAKPAD MICRODUMP-----\n" |
134 "W/google-breakpad(26491): O A \"unsupported-arch\"\n" | 134 "W/google-breakpad(26491): O A \"unsupported-arch\"\n" |
135 "W/google-breakpad(26491): S 0 A48BD840 A48BD000 00002000\n"; | 135 "W/google-breakpad(26491): S 0 A48BD840 A48BD000 00002000\n"; |
136 | 136 |
137 ProcessState state; | 137 ProcessState state; |
138 | 138 |
139 google_breakpad::ProcessResult result = | 139 google_breakpad::ProcessResult result = |
140 ProcessMicrodump("", microdump_contents, &state); | 140 ProcessMicrodump("", microdump_contents, &state); |
141 | 141 |
142 ASSERT_EQ(google_breakpad::PROCESS_ERROR_NO_THREAD_LIST, result); | 142 ASSERT_EQ(google_breakpad::PROCESS_ERROR_NO_THREAD_LIST, result); |
143 } | 143 } |
144 | 144 |
145 TEST_F(MicrodumpProcessorTest, TestProcess) { | 145 TEST_F(MicrodumpProcessorTest, TestProcessArm) { |
146 string symbols_file = files_path_ + "symbols/microdump"; | 146 string symbols_file = files_path_ + "symbols/microdump"; |
147 | 147 |
148 string microdump_file = files_path_ + "microdump.dmp"; | 148 string microdump_file = files_path_ + "microdump-arm.dmp"; |
149 string microdump_contents; | 149 string microdump_contents; |
150 ReadFile(microdump_file, µdump_contents); | 150 ReadFile(microdump_file, µdump_contents); |
151 | 151 |
152 ProcessState state; | 152 ProcessState state; |
153 | 153 |
154 google_breakpad::ProcessResult result = | 154 google_breakpad::ProcessResult result = |
155 ProcessMicrodump(symbols_file, microdump_contents, &state); | 155 ProcessMicrodump(symbols_file, microdump_contents, &state); |
156 | 156 |
157 ASSERT_EQ(google_breakpad::PROCESS_OK, result); | 157 ASSERT_EQ(google_breakpad::PROCESS_OK, result); |
158 ASSERT_TRUE(state.crashed()); | 158 ASSERT_TRUE(state.crashed()); |
159 ASSERT_EQ(0, state.requesting_thread()); | 159 ASSERT_EQ(0, state.requesting_thread()); |
160 ASSERT_EQ(104U, state.modules()->module_count()); | 160 ASSERT_EQ(6U, state.modules()->module_count()); |
161 ASSERT_EQ(1U, state.threads()->size()); | 161 ASSERT_EQ(1U, state.threads()->size()); |
162 | 162 |
163 ASSERT_EQ(21U, state.threads()->at(0)->frames()->size()); | 163 ASSERT_EQ("armv7l", state.system_info()->cpu); |
164 ASSERT_EQ(2, state.system_info()->cpu_count); | |
165 ASSERT_EQ("android", state.system_info()->os_short); | |
166 ASSERT_EQ("Android", state.system_info()->os); | |
167 ASSERT_EQ("OS VERSION INFO", state.system_info()->os_version); | |
164 | 168 |
165 ASSERT_EQ("content::::CrashIntentionally", | 169 ASSERT_EQ(8U, state.threads()->at(0)->frames()->size()); |
170 | |
171 ASSERT_EQ("MicrodumpWriterTest_Setup_Test::TestBody", | |
166 state.threads()->at(0)->frames()->at(0)->function_name); | 172 state.threads()->at(0)->frames()->at(0)->function_name); |
167 ASSERT_EQ("content::::MaybeHandleDebugURL", | 173 ASSERT_EQ("testing::Test::Run", |
168 state.threads()->at(0)->frames()->at(1)->function_name); | 174 state.threads()->at(0)->frames()->at(1)->function_name); |
169 ASSERT_EQ("content::Start", | 175 ASSERT_EQ("main", |
170 state.threads()->at(0)->frames()->at(19)->function_name); | 176 state.threads()->at(0)->frames()->at(6)->function_name); |
171 ASSERT_EQ("libchromeshell.so", | 177 ASSERT_EQ("breakpad_unittests", |
172 state.threads()->at(0)->frames()->at(19)->module->code_file()); | 178 state.threads()->at(0)->frames()->at(6)->module->code_file()); |
179 } | |
180 | |
181 TEST_F(MicrodumpProcessorTest, TestProcessArm64) { | |
mmandlis
2014/11/28 17:32:13
could you, please, create a helper function here f
primiano
2014/11/28 18:32:38
Done.
mmandlis
2014/11/28 19:17:45
Awesome. I think you can also use the AnalyzeDump
| |
182 string symbols_file = files_path_ + "symbols/microdump"; | |
183 | |
184 string microdump_file = files_path_ + "microdump-arm64.dmp"; | |
185 string microdump_contents; | |
186 ReadFile(microdump_file, µdump_contents); | |
187 | |
188 ProcessState state; | |
189 | |
190 google_breakpad::ProcessResult result = | |
191 ProcessMicrodump(symbols_file, microdump_contents, &state); | |
192 | |
193 ASSERT_EQ(google_breakpad::PROCESS_OK, result); | |
194 ASSERT_TRUE(state.crashed()); | |
195 ASSERT_EQ(0, state.requesting_thread()); | |
196 ASSERT_EQ(8U, state.modules()->module_count()); | |
197 ASSERT_EQ(1U, state.threads()->size()); | |
198 | |
199 ASSERT_EQ("aarch64", state.system_info()->cpu); | |
200 ASSERT_EQ(2, state.system_info()->cpu_count); | |
201 ASSERT_EQ("android", state.system_info()->os_short); | |
202 ASSERT_EQ("Android", state.system_info()->os); | |
203 ASSERT_EQ("OS 64 VERSION INFO", state.system_info()->os_version); | |
204 | |
205 ASSERT_EQ(9U, state.threads()->at(0)->frames()->size()); | |
206 | |
207 ASSERT_EQ("MicrodumpWriterTest_Setup_Test::TestBody", | |
208 state.threads()->at(0)->frames()->at(0)->function_name); | |
209 ASSERT_EQ("testing::Test::Run", | |
210 state.threads()->at(0)->frames()->at(2)->function_name); | |
211 ASSERT_EQ("main", | |
212 state.threads()->at(0)->frames()->at(7)->function_name); | |
213 ASSERT_EQ("breakpad_unittests", | |
214 state.threads()->at(0)->frames()->at(7)->module->code_file()); | |
173 } | 215 } |
174 | 216 |
175 } // namespace | 217 } // namespace |
176 | 218 |
177 int main(int argc, char* argv[]) { | 219 int main(int argc, char* argv[]) { |
178 ::testing::InitGoogleTest(&argc, argv); | 220 ::testing::InitGoogleTest(&argc, argv); |
179 return RUN_ALL_TESTS(); | 221 return RUN_ALL_TESTS(); |
180 } | 222 } |
OLD | NEW |