OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 ############################################################################### |
| 4 # |
| 5 # Script to check output of some translated messages |
| 6 # |
| 7 # This should be useful for translators to check that the translated strings |
| 8 # look good. This doesn't make xz print all possible strings, but it should |
| 9 # cover most of the cases where mistakes can easily happen. |
| 10 # |
| 11 # Give the path and filename of the xz executable as an argument. If no |
| 12 # arguments are given, this script uses ../src/xz/xz (relative to the |
| 13 # location of this script). |
| 14 # |
| 15 # You may want to pipe the output of this script to less -S to view the |
| 16 # tables printed by xz --list on a 80-column terminal. On the other hand, |
| 17 # viewing the other messages may be better without -S. |
| 18 # |
| 19 ############################################################################### |
| 20 # |
| 21 # Author: Lasse Collin |
| 22 # |
| 23 # This file has been put into the public domain. |
| 24 # You can do whatever you want with this file. |
| 25 # |
| 26 ############################################################################### |
| 27 |
| 28 set -e |
| 29 |
| 30 # If an argument was given, use it to set the location of the xz executable. |
| 31 unset XZ |
| 32 if [ -n "$1" ]; then |
| 33 XZ=$1 |
| 34 [ "x${XZ:0:1}" != "x/" ] && XZ="$PWD/$XZ" |
| 35 fi |
| 36 |
| 37 # Locate top_srcdir and go there. |
| 38 top_srcdir="$(cd -- "$(dirname -- "$0")" && cd .. && pwd)" |
| 39 cd -- "$top_srcdir" |
| 40 |
| 41 # If XZ wasn't already set, use the default location. |
| 42 XZ=${XZ-"$PWD/src/xz/xz"} |
| 43 if [ "$(type -t "$XZ" || true)" != "file" ]; then |
| 44 echo "Give the location of the xz executable as an argument" \ |
| 45 "to this script." |
| 46 exit 1 |
| 47 fi |
| 48 XZ=$(type -p -- "$XZ") |
| 49 |
| 50 # Print the xz version and locale information. |
| 51 echo "$XZ --version" |
| 52 "$XZ" --version |
| 53 echo |
| 54 if [ -d .git ] && type git > /dev/null 2>&1; then |
| 55 echo "Source code version in $PWD:" |
| 56 git describe --abbrev=4 |
| 57 fi |
| 58 echo |
| 59 locale |
| 60 echo |
| 61 |
| 62 # Make the test files directory the current directory. |
| 63 cd tests/files |
| 64 |
| 65 # Put xz in PATH so that argv[0] stays short. |
| 66 PATH=${XZ%/*}:$PATH |
| 67 |
| 68 # Some of the test commands are error messages and thus don't |
| 69 # return successfully. |
| 70 set +e |
| 71 |
| 72 for CMD in \ |
| 73 "xz --foobarbaz" \ |
| 74 "xz --memlimit=123abcd" \ |
| 75 "xz --memlimit=40MiB -6 /dev/null" \ |
| 76 "xz --memlimit=0 --info-memory" \ |
| 77 "xz --memlimit-compress=1234MiB --memlimit-decompress=50MiB --info-memor
y" \ |
| 78 "xz --verbose --verbose /dev/null | cat" \ |
| 79 "xz --lzma2=foobarbaz" \ |
| 80 "xz --lzma2=foobarbaz=abcd" \ |
| 81 "xz --lzma2=mf=abcd" \ |
| 82 "xz --lzma2=preset=foobarbaz" \ |
| 83 "xz --lzma2=mf=bt4,nice=2" \ |
| 84 "xz --lzma2=nice=50000" \ |
| 85 "xz --help" \ |
| 86 "xz --long-help" \ |
| 87 "xz --list good-*lzma2*" \ |
| 88 "xz --list good-1-check*" \ |
| 89 "xz --list --verbose good-*lzma2*" \ |
| 90 "xz --list --verbose good-1-check*" \ |
| 91 "xz --list --verbose --verbose good-*lzma2*" \ |
| 92 "xz --list --verbose --verbose good-1-check*" \ |
| 93 "xz --list --verbose --verbose unsupported-check.xz" |
| 94 do |
| 95 echo "-----------------------------------------------------------" |
| 96 echo |
| 97 echo "\$ $CMD" |
| 98 eval "$CMD" |
| 99 echo |
| 100 done 2>&1 |
OLD | NEW |