summaryrefslogtreecommitdiffstats
path: root/tests/t0251-gpt-unicode.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:16:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:16:34 +0000
commita398d2c2b5fd6ab0545d8bb019f9a970b2309404 (patch)
tree272fc7ab226258d7ceddee12c8c682c8e711c2b0 /tests/t0251-gpt-unicode.sh
parentInitial commit. (diff)
downloadparted-upstream.tar.xz
parted-upstream.zip
Adding upstream version 3.6.upstream/3.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/t0251-gpt-unicode.sh')
-rwxr-xr-xtests/t0251-gpt-unicode.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh
new file mode 100755
index 0000000..a87cd36
--- /dev/null
+++ b/tests/t0251-gpt-unicode.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Test unicode partition names
+# Copyright (C) 2013-2014, 2019-2023 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+dev=loop-file
+
+# create zeroed device
+truncate -s 10m $dev || fail=1
+
+LC_ALL=$(locale -a | grep en_US.utf8)
+if [ -z "$LC_ALL" ]; then
+ LC_ALL=C.UTF-8
+fi
+export LC_ALL="$LC_ALL"
+# create gpt label with named partition
+part_name=$(printf 'foo\341\264\244')
+parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > empty 2>&1 || fail=1
+
+# ensure there was no output
+compare /dev/null empty || fail=1
+
+# check for expected output
+dd if=$dev bs=1 skip=$(($sector_size_+$sector_size_+56)) count=10 2>/dev/null | od -An -tx1 > out || fail=1
+echo ' 66 00 6f 00 6f 00 24 1d 00 00' >> exp
+compare exp out || fail=1
+
+Exit $fail