diff options
author | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-07 23:26:37 +0000 |
---|---|---|
committer | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-07 23:26:37 +0000 |
commit | f9e11f6d768d37ca829c2b84f34886ca21109990 (patch) | |
tree | 8a155f171684ea973343b77fa990e6cce40cc648 /courgette/encode_decode_unittest.cc | |
parent | 31cee2c4aa51b30ed1cf9f970bc2caa6b86575c6 (diff) | |
download | chromium_src-f9e11f6d768d37ca829c2b84f34886ca21109990.zip chromium_src-f9e11f6d768d37ca829c2b84f34886ca21109990.tar.gz chromium_src-f9e11f6d768d37ca829c2b84f34886ca21109990.tar.bz2 |
Revert 108929 - Add Elf 32 Support to Courgette.
This change takes advantage of recent refactoring and adds support for
Elf X86 32 executables to courgette. It should have no effect on handling
of Windows PE executables.
We have planned ahead to be able to restrict the code size of the courgette
library in different cases to reduce patcher sizes, but this change does
not yet take advantage of that (all platforms are supported everywhere).
Also, the patcher class currently contains a very small amount of Elf/PE
specific code for recreating relocation tables that cannot (currently) be
compiled out.
BUG=chromium-os:22149
TEST=Please verify that Chrome/Chromium patches can still be generated and
work.
Also, please see how much the updater executable which is downloaded to
users has changed in size since R16.
Review URL: http://codereview.chromium.org/8428009
TBR=dgarrett@chromium.org
Review URL: http://codereview.chromium.org/8490023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/encode_decode_unittest.cc')
-rw-r--r-- | courgette/encode_decode_unittest.cc | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/courgette/encode_decode_unittest.cc b/courgette/encode_decode_unittest.cc index 20f0e16..90f5cd6 100644 --- a/courgette/encode_decode_unittest.cc +++ b/courgette/encode_decode_unittest.cc @@ -8,20 +8,20 @@ class EncodeDecodeTest : public BaseTest { public: - void TestAssembleToStreamDisassemble(std::string file, - size_t expected_encoded_lenth) const; + void TestExe(const char *) const; }; -void EncodeDecodeTest::TestAssembleToStreamDisassemble( - std::string file, - size_t expected_encoded_lenth) const { - const void* original_buffer = file.c_str(); - size_t original_length = file.length(); +void EncodeDecodeTest::TestExe(const char* file_name) const { + // Test top-level Courgette API for converting an a file to a binary + // assembly representation and back. + std::string file1 = FileContents(file_name); + + const void* original_buffer = file1.c_str(); + size_t original_length = file1.size(); courgette::AssemblyProgram* program = NULL; const courgette::Status parse_status = - courgette::ParseDetectedExecutable(original_buffer, - original_length, + courgette::ParseDetectedExecutable(original_buffer, original_length, &program); EXPECT_EQ(courgette::C_OK, parse_status); @@ -45,7 +45,7 @@ void EncodeDecodeTest::TestAssembleToStreamDisassemble( const void* buffer = sink.Buffer(); size_t length = sink.Length(); - EXPECT_EQ(expected_encoded_lenth, length); + EXPECT_EQ(971850U, length); courgette::SourceStreamSet sources; bool can_get_source_streams = sources.Init(buffer, length); @@ -68,12 +68,7 @@ void EncodeDecodeTest::TestAssembleToStreamDisassemble( DeleteEncodedProgram(encoded2); } -TEST_F(EncodeDecodeTest, PE) { - std::string file = FileContents("setup1.exe"); - TestAssembleToStreamDisassemble(file, 971850); -} -TEST_F(EncodeDecodeTest, Elf_Small) { - std::string file = FileContents("elf-32-1"); - TestAssembleToStreamDisassemble(file, 135988); +TEST_F(EncodeDecodeTest, All) { + TestExe("setup1.exe"); } |