Fix issues with Windows dump_syms_unittest

* Turn DumpSymsRegressionTest into a parameterized test so it's easier to
see which test file is failing

* Convert dump_syms_regtest.sym to DOS line endings, being careful to
preserve the required spaces at the end of 'STACK WIN' lines

* In test #4 (omap_reorder_bbs), since the .exe corresponding to the .pdb is
not present, no INFO line is generated in the .sym file.  Update .sym file.

* Stop collecting stderr from dump_syms.  Future work: perhaps it's worth
collecting stderr to compare with a different file to verify that "Couldn't
locate EXE or DLL file" is output when expected?

* Regenerate testdata for test #5 (dump_syms_regtest64), which currently
does not pass, seemingly due a mis-match in the PDB age between the .pdb
file and the .sym file.  Also add the .exe corresponding to the .pdb
present, to provide CFI

BUG=

Change-Id: I54fab866437c9e1bad3a5534cef4fe4b6ae47cd2
Reviewed-on: https://chromium-review.googlesource.com/453178
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Jon Turney 2017-03-10 23:09:14 +00:00 committed by Mike Frysinger
parent 796a6c9baf
commit 4bb0cd4743
7 changed files with 2961 additions and 2954 deletions

View File

@ -121,7 +121,7 @@ void RunCommand(const std::wstring& command_line,
STARTUPINFO startup_info = {};
PROCESS_INFORMATION process_info = {};
startup_info.cb = sizeof(STARTUPINFO);
startup_info.hStdError = child_stdout_write;
startup_info.hStdError = NULL;
startup_info.hStdInput = child_stdin_read;
startup_info.hStdOutput = child_stdout_write;
startup_info.dwFlags = STARTF_USESTDHANDLES;
@ -162,7 +162,7 @@ void GetFileContents(const std::wstring& path, std::string* content) {
}
}
class DumpSymsRegressionTest : public testing::Test {
class DumpSymsRegressionTest : public testing::TestWithParam<const wchar_t *> {
public:
virtual void SetUp() {
std::wstring self_dir;
@ -179,9 +179,8 @@ class DumpSymsRegressionTest : public testing::Test {
} //namespace
TEST_F(DumpSymsRegressionTest, EnsureDumpedSymbolsMatch) {
for (size_t i = 0; i < sizeof(kRootNames) / sizeof(kRootNames[0]); ++i) {
const wchar_t* root_name = kRootNames[i];
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";
@ -195,9 +194,12 @@ TEST_F(DumpSymsRegressionTest, EnsureDumpedSymbolsMatch) {
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

View File

@ -27,9 +27,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// with 32-bit cl
// cl /Zi dump_syms_regtest.cc /link /PROFILE
// dump_syms dump_syms_regtest.pdb > dump_syms_regtest.sym
// with 64-bit cl
// cp dump_syms_regtest.cc dump_syms_regtest64.cc
// cl /Zi dump_syms_regtest64.cc /link /PROFILE
// dump_syms dump_syms_regtest64.pdb > dump_syms_regtest64.sym
namespace google_breakpad {
class C {

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,6 +1,6 @@
MODULE windows x86_64 72E103A85CB249078B76B2E7C06257B13 dump_syms_regtest64.pdb
INFO CODE_ID 5357F5C01A000 dump_syms_regtest64.exe
FILE 1 d:\src\breakpad\src\tools\windows\dump_syms\testdata\dump_syms_regtest64.cc
INFO CODE_ID 589DFD111A000 dump_syms_regtest64.exe
FILE 1 c:\cygwin64\wip\breakpad-depot\src\src\tools\windows\dump_syms\testdata\dump_syms_regtest.cc
FILE 2 f:\dd\vctools\crt\crtw32\misc\amd64\amdsecgs.asm
FILE 3 f:\dd\ExternalAPIs\Windows\WinBlue\sdk\inc\ksamd64.inc
FILE 4 f:\dd\ExternalAPIs\Windows\WinBlue\sdk\inc\kxamd64.inc

View File

@ -1,5 +1,4 @@
MODULE windows x86 99302CF6F3C244F2B8E048BA0268A12F1 omap_reorder_bbs.pdb
INFO CODE_ID 517C17D711000 omap_reorder_bbs.exe
FILE 1 c:\src\breakpad\src\src\tools\windows\dump_syms\testdata\dump_syms_regtest.cc
FILE 2 f:\dd\public\sdk\inc\internal\pebteb.h
FILE 3 f:\dd\public\sdk\inc\internal\ntldr.h