Issue #2: made all examples run (and test/run_examples_test.py pass) on Windows.
authoreli.bendersky <devnull@localhost>
Wed, 11 Jan 2012 13:56:41 +0000 (15:56 +0200)
committereli.bendersky <devnull@localhost>
Wed, 11 Jan 2012 13:56:41 +0000 (15:56 +0200)
CHANGES
examples/dwarf_die_tree.py
examples/dwarf_location_lists.py
examples/dwarf_range_lists.py
examples/elf_low_high_api.py
examples/elf_relocations.py
examples/elf_show_debug_sections.py
examples/elfclass_address_size.py
examples/examine_dwarf_info.py
test/run_examples_test.py

diff --git a/CHANGES b/CHANGES
index 5d88b0818582453ce4c1864c918097f1aacfc163..29325f722eecbe884cbf94e9f1d16fb1ddf5ea47 100644 (file)
--- 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)
 
index 769adcf8e715a975b387057efbf004569dfeb9c6..9650f309d68e5fccc77e0b05d003851ab97e17d2 100644 (file)
@@ -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():
index a9f22bbd517cbe3ac723af20355fb2f84e7df07a..3ac989c2743fa2576f508ededa0a5308eb0cfa11 100644 (file)
@@ -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():
index 397c16242c4b3336ca242659cfe6d397e559e9ed..48a0cbbaa2111280d2563a10b620dea157f3ef47 100644 (file)
@@ -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():
index 97e4dc40a4fc473100076bbec5bf1b939da3b406..a4fb2cae9f823a63288ec230022037a1c0f50c14 100644 (file)
@@ -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)
index 53bbac49d39f084c2c58073a21e7e1335ec7e865..c8405adeffb0697b0d04fbe4e0a4116e27b4e883 100644 (file)
@@ -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
index 3b2c80637803eb78ec48c5214868929d8a12ba0d..a7e0d227d55de72f6a9230c988c7611a5edfb0de 100644 (file)
@@ -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():
index 39c1fbcf6ef0eeeeeb161821b673f8a1f4874021..d6b19d3d40e706a4417396c716eaf22f64aa879a 100644 (file)
@@ -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))
index 606441233f368837c97fd43ac375a0131bd37191..6be47b91c7cfd6f23ecc24746ce4073ce4a21f24 100644 (file)
@@ -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():
index 4a73b991f61457ff0ec6f626abd5eaa1280bc491..06e8585a9849c96674a86ed064b8de637d5967e4 100755 (executable)
@@ -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')