Blame localedata/sort-test.sh

Packit 6c4009
#!/bin/sh
Packit 6c4009
# Test collation using xfrm-test.
Packit 6c4009
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
Packit 6c4009
# This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
# The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
# modify it under the terms of the GNU Lesser General Public
Packit 6c4009
# License as published by the Free Software Foundation; either
Packit 6c4009
# version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
# The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
# Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
# You should have received a copy of the GNU Lesser General Public
Packit 6c4009
# License along with the GNU C Library; if not, see
Packit 6c4009
# <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
set -e
Packit 6c4009
Packit 6c4009
common_objpfx=$1; shift
Packit 6c4009
test_program_prefix_before_env=$1; shift
Packit 6c4009
run_program_env=$1; shift
Packit 6c4009
test_program_prefix_after_env=$1; shift
Packit 6c4009
lang=$*
Packit 6c4009
Packit 6c4009
id=${PPID:-100}
Packit 6c4009
here=`pwd`
Packit 6c4009
Packit 6c4009
# Run collation tests.
Packit 6c4009
status=0
Packit 6c4009
for l in $lang; do
Packit 6c4009
  here=0
Packit 6c4009
  # Locale name matches test filename (without in).
Packit 6c4009
  cns=$l
Packit 6c4009
  ${test_program_prefix_before_env} \
Packit 6c4009
   ${run_program_env} \
Packit 6c4009
   LC_ALL=$l ${test_program_prefix_after_env} \
Packit 6c4009
   ${common_objpfx}localedata/collate-test $id < $cns.in \
Packit 6c4009
   > ${common_objpfx}localedata/$cns.out || here=1
Packit 6c4009
  cmp -s $cns.in ${common_objpfx}localedata/$cns.out || here=1
Packit 6c4009
  if test $here -eq 0; then
Packit 6c4009
    echo "$l collate-test OK"
Packit 6c4009
  else
Packit 6c4009
    echo "$l collate-test FAIL"
Packit 6c4009
    diff -u $cns.in ${common_objpfx}localedata/$cns.out | sed 's/^/  /'
Packit 6c4009
    status=1
Packit 6c4009
  fi
Packit 6c4009
Packit 6c4009
  ${test_program_prefix_before_env} \
Packit 6c4009
   ${run_program_env} \
Packit 6c4009
   LC_ALL=$l ${test_program_prefix_after_env} \
Packit 6c4009
   ${common_objpfx}localedata/xfrm-test $id < $cns.in \
Packit 6c4009
   > ${common_objpfx}localedata/$cns.xout || here=1
Packit 6c4009
  cmp -s $cns.in ${common_objpfx}localedata/$cns.xout || here=1
Packit 6c4009
  ${test_program_prefix_before_env} \
Packit 6c4009
   ${run_program_env} \
Packit 6c4009
   LC_ALL=$l ${test_program_prefix_after_env} \
Packit 6c4009
   ${common_objpfx}localedata/xfrm-test $id -nocache < $cns.in \
Packit 6c4009
   > ${common_objpfx}localedata/$cns.nocache.xout || here=1
Packit 6c4009
  cmp -s $cns.in ${common_objpfx}localedata/$cns.nocache.xout || here=1
Packit 6c4009
  if test $here -eq 0; then
Packit 6c4009
    echo "$l xfrm-test OK"
Packit 6c4009
  else
Packit 6c4009
    echo "$l xfrm-test FAIL"
Packit 6c4009
    diff -u $cns.in ${common_objpfx}localedata/$cns.xout | sed 's/^/  /'
Packit 6c4009
    diff -u $cns.in ${common_objpfx}localedata/$cns.nocache.xout | sed 's/^/  /'
Packit 6c4009
    status=1
Packit 6c4009
  fi
Packit 6c4009
done
Packit 6c4009
Packit 6c4009
exit $status
Packit 6c4009
# Local Variables:
Packit 6c4009
#  mode:shell-script
Packit 6c4009
# End: