Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 434ca7a

Browse files
author
Thomas Preud'homme
committed
[test] Use system locale for mri-utf8.test
Summary: llvm-ar's mri-utf8.test test relies on the en_US.UTF-8 locale to be installed for its last RUN line to work. If not installed, the unicode string gets encoded (interpreted) as ascii which fails since the most significant byte is non zero. This commit changes the test to only rely on the system being able to encode the pound sign in its default encoding (e.g. UTF-16 for Microsoft Windows) by always opening the file via input/output redirection. This avoids forcing a given locale to be present and supported. A Byte Order Mark is also added to help recognizing the encoding of the file and its endianness. Reviewers: gbreynoo, MaskRay, rupprecht, JamesNagurne, jfb Subscribers: dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68472 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374318 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 65b47b2 commit 434ca7a

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

test/tools/llvm-ar/mri-nonascii.test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Test non-ascii archive members
2+
# XFAIL: system-darwin
3+
4+
RUN: rm -rf %t && mkdir -p %t/extracted
5+
6+
# Note: lit's Python will read this UTF-8 encoded mri-nonascii.txt file,
7+
# decode it to unicode. The filename in the redirection below will then
8+
# be encoded in the system's filename encoding (e.g. UTF-16 for
9+
# Microsoft Windows).
10+
RUN: echo "contents" > %t/£.txt
11+
12+
RUN: echo "CREATE %t/mri.ar" > %t/script.mri
13+
RUN: echo "ADDMOD %t/£.txt" >> %t/script.mri
14+
RUN: echo "SAVE" >> %t/script.mri
15+
16+
RUN: llvm-ar -M < %t/script.mri
17+
RUN: cd %t/extracted && llvm-ar x %t/mri.ar
18+
19+
# Same as above.
20+
RUN: FileCheck --strict-whitespace %s <£.txt
21+
CHECK:{{^}}
22+
CHECK-SAME:{{^}}contents{{$}}

test/tools/llvm-ar/mri-utf8.test

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)