From 3bd3ecc577711d871a47b2e3e24bccb0ed102a36 Mon Sep 17 00:00:00 2001 From: "eli.bendersky" Date: Wed, 11 Jan 2012 15:56:41 +0200 Subject: [PATCH] Issue #2: made all examples run (and test/run_examples_test.py pass) on Windows. --- CHANGES | 4 +++- examples/dwarf_die_tree.py | 2 +- examples/dwarf_location_lists.py | 2 +- examples/dwarf_range_lists.py | 2 +- examples/elf_low_high_api.py | 2 +- examples/elf_relocations.py | 2 +- examples/elf_show_debug_sections.py | 2 +- examples/elfclass_address_size.py | 2 +- examples/examine_dwarf_info.py | 2 +- test/run_examples_test.py | 3 ++- 10 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index 5d88b08..29325f7 100644 --- a/CHANGES +++ b/CHANGES @@ -3,7 +3,9 @@ Changelog + Version 0.11 (??) - - Fixed some problems with running tests + - Fixed some problems with running tests + - Issue #2: made all examples run (and test/run_examples_test.py pass) + on Windows. + Version 0.10 - Initial public release (06.01.2012) diff --git a/examples/dwarf_die_tree.py b/examples/dwarf_die_tree.py index 769adcf..9650f30 100644 --- a/examples/dwarf_die_tree.py +++ b/examples/dwarf_die_tree.py @@ -22,7 +22,7 @@ from elftools.elf.elffile import ELFFile def process_file(filename): print('Processing file:', filename) - with open(filename) as f: + with open(filename, 'rb') as f: elffile = ELFFile(f) if not elffile.has_dwarf_info(): diff --git a/examples/dwarf_location_lists.py b/examples/dwarf_location_lists.py index a9f22bb..3ac989c 100644 --- a/examples/dwarf_location_lists.py +++ b/examples/dwarf_location_lists.py @@ -25,7 +25,7 @@ from elftools.dwarf.locationlists import LocationEntry def process_file(filename): print('Processing file:', filename) - with open(filename) as f: + with open(filename, 'rb') as f: elffile = ELFFile(f) if not elffile.has_dwarf_info(): diff --git a/examples/dwarf_range_lists.py b/examples/dwarf_range_lists.py index 397c162..48a0cbb 100644 --- a/examples/dwarf_range_lists.py +++ b/examples/dwarf_range_lists.py @@ -25,7 +25,7 @@ from elftools.dwarf.ranges import RangeEntry def process_file(filename): print('Processing file:', filename) - with open(filename) as f: + with open(filename, 'rb') as f: elffile = ELFFile(f) if not elffile.has_dwarf_info(): diff --git a/examples/elf_low_high_api.py b/examples/elf_low_high_api.py index 97e4dc4..a4fb2ca 100644 --- a/examples/elf_low_high_api.py +++ b/examples/elf_low_high_api.py @@ -23,7 +23,7 @@ from elftools.elf.sections import SymbolTableSection def process_file(filename): print('Processing file:', filename) - with open(filename) as f: + with open(filename, 'rb') as f: section_info_lowlevel(f) f.seek(0) section_info_highlevel(f) diff --git a/examples/elf_relocations.py b/examples/elf_relocations.py index 53bbac4..c8405ad 100644 --- a/examples/elf_relocations.py +++ b/examples/elf_relocations.py @@ -23,7 +23,7 @@ from elftools.elf.relocation import RelocationSection def process_file(filename): print('Processing file:', filename) - with open(filename) as f: + with open(filename, 'rb') as f: elffile = ELFFile(f) # Read the .rela.dyn section from the file, by explicitly asking diff --git a/examples/elf_show_debug_sections.py b/examples/elf_show_debug_sections.py index 3b2c806..a7e0d22 100644 --- a/examples/elf_show_debug_sections.py +++ b/examples/elf_show_debug_sections.py @@ -21,7 +21,7 @@ from elftools.elf.elffile import ELFFile def process_file(filename): print('In file:', filename) - with open(filename) as f: + with open(filename, 'rb') as f: elffile = ELFFile(f) for section in elffile.iter_sections(): diff --git a/examples/elfclass_address_size.py b/examples/elfclass_address_size.py index 39c1fbc..d6b19d3 100644 --- a/examples/elfclass_address_size.py +++ b/examples/elfclass_address_size.py @@ -21,7 +21,7 @@ from elftools.elf.elffile import ELFFile def process_file(filename): - with open(filename) as f: + with open(filename, 'rb') as f: elffile = ELFFile(f) # elfclass is a public attribute of ELFFile, read from its header print('%s: elfclass is %s' % (filename, elffile.elfclass)) diff --git a/examples/examine_dwarf_info.py b/examples/examine_dwarf_info.py index 6064412..6be47b9 100644 --- a/examples/examine_dwarf_info.py +++ b/examples/examine_dwarf_info.py @@ -21,7 +21,7 @@ from elftools.elf.elffile import ELFFile def process_file(filename): print('Processing file:', filename) - with open(filename) as f: + with open(filename, 'rb') as f: elffile = ELFFile(f) if not elffile.has_dwarf_info(): diff --git a/test/run_examples_test.py b/test/run_examples_test.py index 4a73b99..06e8585 100755 --- a/test/run_examples_test.py +++ b/test/run_examples_test.py @@ -55,7 +55,8 @@ def run_example_and_compare(example_path): testlog.info('.......ERROR - example returned error code %s' % rc) return False - if example_out == ref_str: + # Comparison is done as lists of lines, to avoid EOL problems + if example_out.split() == ref_str.split(): return True else: testlog.info('.......FAIL comparison') -- 2.30.2