[PATCH] D61137: Fix llvm-objcopy/ELF/preserve-segment-contents test under Python 3.6
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 09:13:52 PDT 2019
aganea created this revision.
aganea added a reviewer: jhenderson.
Herald added subscribers: mstorsjo, MaskRay, jakehehrlich, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added a project: LLVM.
Previously, I had the following error under WSL/Ubuntu 18.04 with Python 3.6:
+ /usr/bin/python3.6 /mnt/f/svn/buildWSL/test/tools/llvm-objcopy/ELF/Output/preserve-segment-contents.test.tmp.py
Traceback (most recent call last):
File "/mnt/f/svn/buildWSL/test/tools/llvm-objcopy/ELF/Output/preserve-segment-contents.test.tmp.py", line 8, in <module>
input.write('\xDE\xAD\xBE\xEF')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
Strangely, Python 3.7 on Windows under MINGW32 was fine.
Tested on Python 2.7.16 and 3.7 on Windows. Tested on Python 3.6 on WSL.
Repository:
rL LLVM
https://reviews.llvm.org/D61137
Files:
llvm/trunk/test/tools/llvm-objcopy/ELF/preserve-segment-contents.test
Index: llvm/trunk/test/tools/llvm-objcopy/ELF/preserve-segment-contents.test
===================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/preserve-segment-contents.test
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/preserve-segment-contents.test
@@ -22,14 +22,14 @@
# RUN: od -t x1 -j 0x5000 -N 60 %t.stripped | FileCheck %s --check-prefix=CHECK7 -DPATTERN="00 00 00 00"
# RUN: cp %t.stripped %t.in
-# RUN: echo "with open('%/t.in', 'r+') as input:" > %t.py
+# RUN: echo "with open('%/t.in', 'rb+') as input:" > %t.py
# RUN: echo " for offset in [" >> %t.py
# RUN: echo " 0x2000, 0x2008, 0x200C, 0x2014, 0x2104, 0x2300," >> %t.py
# RUN: echo " 0x3008, 0x3010, 0x3018, 0x3020, 0x3028, 0x302C, 0x3034, 0x303C," >> %t.py
# RUN: echo " 0x4000, 0x4008, 0x4010, 0x4014, 0x401C, 0x4024, 0x4034," >> %t.py
# RUN: echo " 0x5000, 0x5008, 0x5010, 0x501C, 0x5024, 0x502C, 0x5030, 0x5038]:" >> %t.py
# RUN: echo " input.seek(offset)" >> %t.py
-# RUN: echo " input.write('\xDE\xAD\xBE\xEF')" >> %t.py
+# RUN: echo " input.write(bytearray.fromhex('DEADBEEF'))" >> %t.py
# RUN: %python %t.py
# RUN: llvm-objcopy %t.in %t.out
# RUN: od -t x1 -j 0x2000 -N 24 %t.out | FileCheck %s --check-prefix=CHECK1 -DPATTERN="de ad be ef"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61137.196650.patch
Type: text/x-patch
Size: 1543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190425/ce4692b4/attachment.bin>
More information about the llvm-commits
mailing list