From 7f941f990aa436c7d736f19a2f5579cd85933ec6 Mon Sep 17 00:00:00 2001 From: "jimblandy@gmail.com" Date: Tue, 15 Dec 2009 16:54:44 +0000 Subject: Linux dumper: Add unit tests for google_breakpad::StabsReader. The test system is based on Google C++ Testing Framework and the Google C++ Mocking Framework. This includes a parser that turns human-readable input files ("mock stabs") into .stab and .stabstr section contents, which we can then pass to a StabsReader instance, using a handler object written with GoogleMock. The 'make check' target in src/tools/linux/dump_syms runs this. The supplied input file is pretty small, but I've done coverage testing, and it does cover the parser. I thought the mock stabs parser would be less elaborate than it turned out to be. Lesson learned. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@444 4c0a9323-5329-0410-9bdc-e9ce6186880e --- .../linux/testdata/stabs_reader_unittest.input1 | 19 +++++++++++++++++++ .../linux/testdata/stabs_reader_unittest.input2 | 1 + .../linux/testdata/stabs_reader_unittest.input3 | 2 ++ .../linux/testdata/stabs_reader_unittest.input4 | 1 + .../linux/testdata/stabs_reader_unittest.input5 | 2 ++ 5 files changed, 25 insertions(+) create mode 100644 src/common/linux/testdata/stabs_reader_unittest.input1 create mode 100644 src/common/linux/testdata/stabs_reader_unittest.input2 create mode 100644 src/common/linux/testdata/stabs_reader_unittest.input3 create mode 100644 src/common/linux/testdata/stabs_reader_unittest.input4 create mode 100644 src/common/linux/testdata/stabs_reader_unittest.input5 (limited to 'src/common/linux/testdata') diff --git a/src/common/linux/testdata/stabs_reader_unittest.input1 b/src/common/linux/testdata/stabs_reader_unittest.input1 new file mode 100644 index 00000000..44b3d0a3 --- /dev/null +++ b/src/common/linux/testdata/stabs_reader_unittest.input1 @@ -0,0 +1,19 @@ +SO 10 11 0x02 builddir/ +FUN 20 21 0x12 not the SO with source file name we expected +SO 30 31 0x22 +SO 40 41 0x32 builddir1/ +SO 50 51 0x42 file1.c +LSYM 60 61 0x52 not the FUN we're looking for +FUN 70 71 0x62 fun1 +BINCL 80 81 0x72 something to ignore in a FUN body +SLINE 90 91 0x82 +SOL 100 101 0x92 header.h +SLINE 110 111 0x102 +FUN 120 121 0x112 fun2:some stabs type info here, to trim from the name +SLINE 130 131 0x122 +SOL 140 141 0x132 file1.c +SLINE 150 151 0x142 +SO 160 161 0x152 +LSYM 170 171 0x162 +SO 180 181 0x182 file3.c +SO 190 191 0x192 diff --git a/src/common/linux/testdata/stabs_reader_unittest.input2 b/src/common/linux/testdata/stabs_reader_unittest.input2 new file mode 100644 index 00000000..82efeb92 --- /dev/null +++ b/src/common/linux/testdata/stabs_reader_unittest.input2 @@ -0,0 +1 @@ +SO 10 11 0x12 file2-1.c diff --git a/src/common/linux/testdata/stabs_reader_unittest.input3 b/src/common/linux/testdata/stabs_reader_unittest.input3 new file mode 100644 index 00000000..73e6a302 --- /dev/null +++ b/src/common/linux/testdata/stabs_reader_unittest.input3 @@ -0,0 +1,2 @@ +SO 10 11 0x12 file3-1.c +FUN 20 21 0x22 fun3_1 diff --git a/src/common/linux/testdata/stabs_reader_unittest.input4 b/src/common/linux/testdata/stabs_reader_unittest.input4 new file mode 100644 index 00000000..dfdbf677 --- /dev/null +++ b/src/common/linux/testdata/stabs_reader_unittest.input4 @@ -0,0 +1 @@ +SO 10 11 0x12 build-directory/ diff --git a/src/common/linux/testdata/stabs_reader_unittest.input5 b/src/common/linux/testdata/stabs_reader_unittest.input5 new file mode 100644 index 00000000..7a447c88 --- /dev/null +++ b/src/common/linux/testdata/stabs_reader_unittest.input5 @@ -0,0 +1,2 @@ +SO 10 11 0x12 file5-1.c +SO 20 21 0x22 file5-2.c -- cgit v1.2.1