fix sort-mb-tests.sh test (B.Voelker)

This commit is contained in:
Ondrej Oprala 2013-02-18 16:59:45 +01:00
parent 970e32111e
commit 1812652505
2 changed files with 44 additions and 59 deletions

View File

@ -4119,68 +4119,50 @@ diff -urNp coreutils-8.21-orig/tests/misc/mb2.X coreutils-8.21/tests/misc/mb2.X
+Banana530
diff -urNp coreutils-8.21-orig/tests/misc/sort-mb-tests.sh coreutils-8.21/tests/misc/sort-mb-tests.sh
--- coreutils-8.21-orig/tests/misc/sort-mb-tests.sh 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-8.21/tests/misc/sort-mb-tests.sh 2013-02-15 14:25:08.020467562 +0100
@@ -0,0 +1,63 @@
+#! /bin/sh
+++ coreutils-8.21/tests/misc/sort-mb-tests.sh 2013-02-18 17:44:03.852275681 +0100
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Verify sort's multi-byte support.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+
+expensive_
+
+case $# in
+ 0) xx='../src/sort';;
+ *) xx="$1";;
+esac
+test "$VERBOSE" && echo=echo || echo=:
+$echo testing program: $xx
+errors=0
+test "$srcdir" || srcdir=.
+test "$VERBOSE" && $xx --version 2> /dev/null
+print_ver_ sort
+
+export LC_ALL=en_US.UTF-8
+locale -k LC_CTYPE 2>&1 | grep -q charmap.*UTF-8 || exit 77
+errors=0
+locale -k LC_CTYPE | grep -q "charmap.*UTF-8" \
+ || skip_ "No UTF-8 locale available"
+
+$xx -t -k2 -n misc/mb1.I > misc/mb1.O
+code=$?
+if test $code != 0; then
+ $echo "Test mb1 failed: $xx return code $code differs from expected value 0"
+ errors=`expr $errors + 1`
+else
+ cmp misc/mb1.O $srcdir/misc/mb1.X > /dev/null 2>&1
+ case $? in
+ 0) if test "$VERBOSE"; then $echo "passed mb1"; fi;;
+ 1) $echo "Test mb1 failed: files misc/mb1.O and $srcdir/misc/mb1.X differ" 1>&2
+ (diff -c misc/mb1.O $srcdir/misc/mb1.X) 2> /dev/null
+ errors=`expr $errors + 1`;;
+ 2) $echo "Test mb1 may have failed." 1>&2
+ $echo The command "cmp misc/mb1.O $srcdir/misc/mb1.X" failed. 1>&2
+ errors=`expr $errors + 1`;;
+ esac
+fi
+
+$xx -t -k4 -n misc/mb2.I > misc/mb2.O
+code=$?
+if test $code != 0; then
+ $echo "Test mb2 failed: $xx return code $code differs from expected value 0" 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp misc/mb2.O $srcdir/misc/mb2.X > /dev/null 2>&1
+ case $? in
+ 0) if test "$VERBOSE"; then $echo "passed mb2"; fi;;
+ 1) $echo "Test mb2 failed: files misc/mb2.O and $srcdir/misc/mb2.X differ" 1>&2
+ (diff -c misc/mb2.O $srcdir/misc/mb2.X) 2> /dev/null
+ errors=`expr $errors + 1`;;
+ 2) $echo "Test mb2 may have failed." 1>&2
+ $echo The command "cmp misc/mb2.O $srcdir/misc/mb2.X" failed. 1>&2
+ errors=`expr $errors + 1`;;
+ esac
+fi
+cat <<EOF > exp
+Banana5
+Apple10
+Citrus20
+Cherry30
+EOF
+
+if test $errors = 0; then
+ $echo Passed all 113 tests. 1>&2
+else
+ $echo Failed $errors tests. 1>&2
+fi
+test $errors = 0 || errors=1
+exit $errors
+cat <<EOF | sort -t -k2 -n > out || fail=1
+Apple10
+Banana5
+Citrus20
+Cherry30
+EOF
+
+compare exp out || { fail=1; cat out; }
+
+
+cat <<EOF > exp
+Citrus205
+Cherry3010
+Apple1020
+Banana530
+EOF
+
+cat <<EOF | sort -t -k4 -n > out || fail=1
+Apple1020
+Banana530
+Citrus205
+Cherry3010
+EOF
+
+compare exp out || { fail=1; cat out; }
+
+Exit $fail

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.21
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -376,6 +376,9 @@ fi
%{_sbindir}/chroot
%changelog
* Mon Feb 18 2013 Ondrej Oprala <ooprala@redhat.com> 8.21-4
- fix sort-mb-tests.sh test (B.Voelker)
* Mon Feb 18 2013 Mark Wielaard <mjw@redhat.com> 8.21-3
- fix coreutils-i18n.patch to terminate mbdelim string (#911929)