Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1253)

Unified Diff: src/tools/windows/dump_syms/dump_syms_unittest.cc

Issue 1782453003: Windows dump_syms: Add unittest for a PDB containing PDATA/XDATA Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@pdb-pdata
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/tools/windows/dump_syms/dump_syms_unittest.cc
diff --git a/src/tools/windows/dump_syms/dump_syms_unittest.cc b/src/tools/windows/dump_syms/dump_syms_unittest.cc
index 61f84431ede46c84f3c8525c7dd57ac8e6806ddb..80205dcfec5c5bed7998bff9d48ab80381ff46b4 100644
--- a/src/tools/windows/dump_syms/dump_syms_unittest.cc
+++ b/src/tools/windows/dump_syms/dump_syms_unittest.cc
@@ -56,12 +56,16 @@ const wchar_t* kRootNames[] = {
// without source data.
L"omap_stretched",
// A PDB file with OMAP data for an image that has been basic block reordered.
- L"omap_reorder_bbs",
- // A 64bit PDB file with no OMAP data.
- L"dump_syms_regtest64",
-};
-
-void TrimLastComponent(const std::wstring& path,
+ L"omap_reorder_bbs",
+ // A 64bit PDB file with no OMAP data.
+ L"dump_syms_regtest64",
+ // A 64bit PDB file with PDATA
+ L"pdb_pdata_in_pdb",
+ // A 64bit PDB file with an exe to provide PDATA
+ L"pdb_pdata_in_exe",
+};
+
+void TrimLastComponent(const std::wstring& path,
std::wstring* trimmed,
std::wstring* component) {
size_t len = path.size();
@@ -160,13 +164,13 @@ void GetFileContents(const std::wstring& path, std::string* content) {
if (bytes_read == 0)
break;
content->append(buffer, bytes_read);
- }
-}
-
-class DumpSymsRegressionTest : public testing::Test {
- public:
- virtual void SetUp() {
- std::wstring self_dir;
+ }
+}
+
+class DumpSymsRegressionTest : public testing::TestWithParam<const wchar_t *> {
+ public:
+ virtual void SetUp() {
+ std::wstring self_dir;
ASSERT_TRUE(GetSelfDirectory(&self_dir));
dump_syms_exe = self_dir + L"\\dump_syms.exe";
@@ -177,15 +181,14 @@ class DumpSymsRegressionTest : public testing::Test {
std::wstring dump_syms_exe;
std::wstring testdata_dir;
};
-
-} //namespace
-
-TEST_F(DumpSymsRegressionTest, EnsureDumpedSymbolsMatch) {
- for (size_t i = 0; i < sizeof(kRootNames) / sizeof(kRootNames[0]); ++i) {
- const wchar_t* root_name = kRootNames[i];
- std::wstring root_path = testdata_dir + L"\\" + root_name;
-
- std::wstring sym_path = root_path + L".sym";
+
+} //namespace
+
+TEST_P(DumpSymsRegressionTest, EnsureDumpedSymbolsMatch) {
+ const wchar_t* root_name = GetParam();
+ std::wstring root_path = testdata_dir + L"\\" + root_name;
+
+ std::wstring sym_path = root_path + L".sym";
std::string expected_symbols;
ASSERT_NO_FATAL_FAILURE(GetFileContents(sym_path, &expected_symbols));
@@ -193,12 +196,14 @@ TEST_F(DumpSymsRegressionTest, EnsureDumpedSymbolsMatch) {
std::wstring command_line = L"\"" + dump_syms_exe + L"\" \"" +
pdb_path + L"\"";
std::string symbols;
- ASSERT_NO_FATAL_FAILURE(RunCommand(command_line, &symbols));
-
- EXPECT_EQ(expected_symbols, symbols);
- }
-}
-
-} // namespace dump_syms
-} // namespace windows
-} // namespace tools
+ ASSERT_NO_FATAL_FAILURE(RunCommand(command_line, &symbols));
+
+ EXPECT_EQ(expected_symbols, symbols);
+}
+
+INSTANTIATE_TEST_CASE_P(DumpSyms, DumpSymsRegressionTest,
+ testing::ValuesIn(kRootNames));
+
+} // namespace dump_syms
+} // namespace windows
+} // namespace tools
« no previous file with comments | « src/common/windows/pdb_source_line_writer.cc ('k') | src/tools/windows/dump_syms/testdata/dump_syms_regtest.sym » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698