summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-rc/codepage.test
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2018-05-02 19:43:44 +0000
committerMartin Storsjo <martin@martin.st>2018-05-02 19:43:44 +0000
commitd1d046aa32395d8e9c459e877a03e716d47aca2c (patch)
treec2e7f98b2c476189bb52c52992ac4475a908c52d /llvm/test/tools/llvm-rc/codepage.test
parent4d64306a92a93a8e4f20c0c83e164c223b26b848 (diff)
downloadbcm5719-llvm-d1d046aa32395d8e9c459e877a03e716d47aca2c.tar.gz
bcm5719-llvm-d1d046aa32395d8e9c459e877a03e716d47aca2c.zip
[llvm-rc] Add rudimentary support for codepages
Only support UTF-8 (since LLVM contains UTF-8 parsing support already, and the code even does that already) and Windows-1252 (where most code points has the same value in unicode). Keep the existing default as only allowing ASCII input. Using the option type JoinedOrSeparate, since the real rc.exe handles options in this form, even if llvm-rc uses Separate for other similar existing options. Rename the struct SearchParams to WriterParams since it's now used for more than just include paths. Add a missing getResourceTypeName method to the BundleResource class, to fix error printing from within STRINGTABLE resources (used in tests). Differential Revision: https://reviews.llvm.org/D46238 llvm-svn: 331391
Diffstat (limited to 'llvm/test/tools/llvm-rc/codepage.test')
-rw-r--r--llvm/test/tools/llvm-rc/codepage.test44
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-rc/codepage.test b/llvm/test/tools/llvm-rc/codepage.test
new file mode 100644
index 00000000000..ce17e0a6b2b
--- /dev/null
+++ b/llvm/test/tools/llvm-rc/codepage.test
@@ -0,0 +1,44 @@
+; RUN: llvm-rc /C 65001 /FO %t.utf8.res %p/Inputs/utf8.rc
+; RUN: llvm-readobj %t.utf8.res | FileCheck %s --check-prefix=UTF8
+
+; UTF8: Resource type (int): 6
+; UTF8-NEXT: Resource name (int): 1
+; UTF8-NEXT: Data version: 0
+; UTF8-NEXT: Memory flags: 0x1030
+; UTF8-NEXT: Language ID: 1033
+; UTF8-NEXT: Version (major): 0
+; UTF8-NEXT: Version (minor): 0
+; UTF8-NEXT: Characteristics: 0
+; UTF8-NEXT: Data size: 68
+; UTF8-NEXT: Data: (
+; UTF8-NEXT: 0000: 00000700 E500E400 F6002000 A9002000 |.......... ... .|
+; UTF8-NEXT: 0010: 61000B00 E500E400 F6002000 A9002000 |a......... ... .|
+; UTF8-NEXT: 0020: E500E400 F6002000 A9000000 00000000 |...... .........|
+; UTF8-NEXT: 0030: 00000000 00000000 00000000 00000000 |................|
+; UTF8-NEXT: 0040: 00000000 |....|
+; UTF8-NEXT: )
+
+; RUN: not llvm-rc /C 65001 /FO %t.utf8-escape-narrow.res %p/Inputs/utf8-escape-narrow.rc 2>&1 | FileCheck %s --check-prefix UTF8_ESCAPE
+; UTF8_ESCAPE: llvm-rc: Error in STRINGTABLE statement (ID 1):
+; UTF8_ESCAPE-NEXT: Unable to interpret single byte (195) as UTF-8
+
+; RUN: llvm-rc /C 1252 /FO %t.cp1252.res %p/Inputs/cp1252.rc
+; RUN: llvm-readobj %t.cp1252.res | FileCheck %s --check-prefix=CP1252
+
+; CP1252: Resource type (int): 6
+; CP1252-NEXT: Resource name (int): 1
+; CP1252-NEXT: Data version: 0
+; CP1252-NEXT: Memory flags: 0x1030
+; CP1252-NEXT: Language ID: 1033
+; CP1252-NEXT: Version (major): 0
+; CP1252-NEXT: Version (minor): 0
+; CP1252-NEXT: Characteristics: 0
+; CP1252-NEXT: Data size: 92
+; CP1252-NEXT: Data: (
+; CP1252-NEXT: 0000: 00000F00 E500E400 F6002000 A9002000 |.......... ... .|
+; CP1252-NEXT: 0010: 92012000 E500E400 F6002000 A9002000 |.. ....... ... .|
+; CP1252-NEXT: 0020: 92010F00 E500E400 F6002000 A9002000 |.......... ... .|
+; CP1252-NEXT: 0030: 92012000 E500E400 F6002000 A9002000 |.. ....... ... .|
+; CP1252-NEXT: 0040: 92010000 00000000 00000000 00000000 |................|
+; CP1252-NEXT: 0050: 00000000 00000000 00000000 |............|
+; CP1252-NEXT: )
OpenPOWER on IntegriCloud