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 +Banana530
diff -urNp coreutils-8.21-orig/tests/misc/sort-mb-tests.sh coreutils-8.21/tests/misc/sort-mb-tests.sh 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-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 +++ coreutils-8.21/tests/misc/sort-mb-tests.sh 2013-02-18 17:44:03.852275681 +0100
@@ -0,0 +1,63 @@ @@ -0,0 +1,45 @@
+#!/bin/sh +#!/bin/sh
+# Verify sort's multi-byte support.
+ +
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+ +print_ver_ sort
+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
+ +
+export LC_ALL=en_US.UTF-8 +export LC_ALL=en_US.UTF-8
+locale -k LC_CTYPE 2>&1 | grep -q charmap.*UTF-8 || exit 77 +locale -k LC_CTYPE | grep -q "charmap.*UTF-8" \
+errors=0 + || 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 +cat <<EOF > exp
+code=$? +Banana5
+if test $code != 0; then +Apple10
+ $echo "Test mb2 failed: $xx return code $code differs from expected value 0" 1>&2 +Citrus20
+ errors=`expr $errors + 1` +Cherry30
+else +EOF
+ 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
+ +
+if test $errors = 0; then +cat <<EOF | sort -t -k2 -n > out || fail=1
+ $echo Passed all 113 tests. 1>&2 +Apple10
+else +Banana5
+ $echo Failed $errors tests. 1>&2 +Citrus20
+fi +Cherry30
+test $errors = 0 || errors=1 +EOF
+exit $errors +
+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 Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils Name: coreutils
Version: 8.21 Version: 8.21
Release: 3%{?dist} Release: 4%{?dist}
License: GPLv3+ License: GPLv3+
Group: System Environment/Base Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/ Url: http://www.gnu.org/software/coreutils/
@ -376,6 +376,9 @@ fi
%{_sbindir}/chroot %{_sbindir}/chroot
%changelog %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 * Mon Feb 18 2013 Mark Wielaard <mjw@redhat.com> 8.21-3
- fix coreutils-i18n.patch to terminate mbdelim string (#911929) - fix coreutils-i18n.patch to terminate mbdelim string (#911929)