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