| commit | 585ba07db02da99787ec764809aa180a624e7a1a | [log] [tgz] |
|---|---|---|
| author | Mike Frysinger <vapier@chromium.org> | Thu Jan 21 05:50:28 2016 |
| committer | Mike Frysinger <vapier@chromium.org> | Thu Jan 21 05:50:28 2016 |
| tree | 055a292403ea90d6ab71aca3f80ec9977968998a | |
| parent | d5d13e605e161b8374d07ed61b17d75fe6d46381 [diff] |
exploitability_unittest: fix warnings
The std::getline function always returns its first arg (which is an
iostream object) and cannot return anything else. Thus, testing its
value is pointless, and even leads to build errors w/at least gcc-5
due to gtest ASSERT_TRUE funcs only taking bool types:
.../exploitability_unittest.cc: In member function 'virtual void {anonymous}::ExploitabilityLinuxUtilsTest_DisassembleBytesTest_Test::TestBody()':
.../exploitability_unittest.cc:200:136: error: no matching function for call to 'testing::AssertionResult::AssertionResult(std::basic_istream<char>&)'
In file included from .../breakpad_googletest_includes.h:33:0,
from .../exploitability_unittest.cc:35:
.../gtest.h:262:12: note: candidate: testing::AssertionResult::AssertionResult(bool)
Since we know this never fails, simply drop the ASSERT_TRUE usage.
The next line already checks the content of the buffer we read.
Further on in the file, we hit some signed warnings:
In file included from .../breakpad_googletest_includes.h:33:0,
from .../exploitability_unittest.cc:35:
.../gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]':
.../gtest.h:1484:23: required from 'static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int; bool lhs_is_null_literal = false]'
.../exploitability_unittest.cc:241:289: required from here
.../gtest.h:1448:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if (expected == actual) {
This is because we compare the register value (a uint64_t) directly to
an integer constant, and those are signed by default. Stick a U suffix
on them to fix things up.
BUG=chromium:579384
TEST=`make check` passes
R=ivanpe@chromium.org
Review URL: https://codereview.chromium.org/1611763002 .
Breakpad is a set of client and server components which implement a crash-reporting system.
# Configure CXXFLAGS=-m32 CFLAGS=-m32 CPPFLAGS=-m32 ./configure # Build make # Test make check # Install make install
If you need to reconfigure your build be sure to run make distclean first.
Get a copy of depot_tools repo. http://dev.chromium.org/developers/how-tos/install-depot-tools
Create a new directory for checking out the source code. mkdir breakpad && cd breakpad
Run the fetch tool from depot_tools to download all the source repos. fetch breakpad
Make changes. Build and test your changes. For core code like processor use methods above. For linux/mac/windows, there are test targets in each project file.
Commit your changes to your local repo and upload them to the server. http://dev.chromium.org/developers/contributing-code e.g. git commit ... && git cl upload ... You will be prompted for credential and a description.
At https://codereview.chromium.org/ you'll find your issue listed; click on it, and select Publish+Mail, and enter in the code reviewer and CC google-breakpad-dev@googlegroups.com