|
|
0cb0b9 |
From e73c27f435017e22a68383255f15ebaa562dd414 Mon Sep 17 00:00:00 2001
|
|
|
0cb0b9 |
From: "Brian C. Lane" <bcl@redhat.com>
|
|
|
0cb0b9 |
Date: Wed, 13 Aug 2014 13:40:28 -0700
|
|
|
0cb0b9 |
Subject: [PATCH] tests: Try several UTF8 locales
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
Not all distributions (Fedora) have C.UTF-8 so try several (en_US, de_DE,
|
|
|
0cb0b9 |
fr_FR, es_ES). This may still fail if none exist.
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
* tests/t0251-gpt-unicode.sh: Test for en_US de_DE fr_FR es_ES
|
|
|
0cb0b9 |
---
|
|
|
0cb0b9 |
tests/t0251-gpt-unicode.sh | 18 +++++++++++++++++-
|
|
|
0cb0b9 |
1 file changed, 17 insertions(+), 1 deletion(-)
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh
|
|
|
0cb0b9 |
index c845950..537aaa1 100755
|
|
|
0cb0b9 |
--- a/tests/t0251-gpt-unicode.sh
|
|
|
0cb0b9 |
+++ b/tests/t0251-gpt-unicode.sh
|
|
|
0cb0b9 |
@@ -22,7 +22,23 @@ dev=loop-file
|
|
|
0cb0b9 |
# create zeroed device
|
|
|
0cb0b9 |
truncate -s 10m $dev || fail=1
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
-export LC_ALL=C.UTF-8
|
|
|
0cb0b9 |
+found_locale=no
|
|
|
0cb0b9 |
+for locale in en_US de_DE fr_FR es_ES
|
|
|
0cb0b9 |
+do
|
|
|
0cb0b9 |
+ LC_ALL="$locale.utf8"
|
|
|
0cb0b9 |
+
|
|
|
0cb0b9 |
+ # In a UTF-8 locale, the string below prints as 4 characters.
|
|
|
0cb0b9 |
+ if [ `printf 'foo\341\264\244' | wc -m` -eq 4 ]; then
|
|
|
0cb0b9 |
+ found_locale=yes
|
|
|
0cb0b9 |
+ break
|
|
|
0cb0b9 |
+ fi
|
|
|
0cb0b9 |
+done
|
|
|
0cb0b9 |
+
|
|
|
0cb0b9 |
+if [ "$found_locale" != "yes" ]; then
|
|
|
0cb0b9 |
+ echo "no valid UTF-8 locale found; skipping" >&2
|
|
|
0cb0b9 |
+ exit 77
|
|
|
0cb0b9 |
+fi
|
|
|
0cb0b9 |
+
|
|
|
0cb0b9 |
# create gpt label with named partition
|
|
|
0cb0b9 |
part_name=$(printf 'foo\341\264\244')
|
|
|
0cb0b9 |
parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > empty 2>&1 || fail=1
|
|
|
0cb0b9 |
--
|
|
|
0cb0b9 |
1.9.3
|
|
|
0cb0b9 |
|