2 # Convenience script to rename test cases in Automake.
4 # Copyright (C) 2013 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 fatal () { echo "$me: $*" >&2; exit 1; }
27 1) input=$(cat -- "$1");;
28 *) fatal "too many arguments";;
34 [[ -f bin/automake.in && -d lib/Automake ]] \
35 || fatal "can only be run from the top-level of the Automake source tree"
37 $SED --version 2>&1 | grep GNU >/dev/null 2>&1 \
38 || fatal "GNU sed is required by this script"
40 # Validate and cleanup input.
45 (NF != 2) { print me \": wrong number of fields at line \" NR;
47 { printf (\"t/%s t/%s\\n\", \$1, \$2); }
50 # Prepare git commit message.
52 echo "tests: more significant names for some tests" >&5
54 $AWK >&5 <<<"$input" \
55 '{ printf ("* %s: Rename...\n* %s: ... like this.\n", $1, $2) }'
59 eval "$($AWK '{ printf ("git mv %s %s\n", $1, $2) }' <<<"$input")"
61 # Adjust the list of tests (do this conditionally, since such a
62 # list is not required nor used in Automake-NG).
63 if test -f t/list-of-tests.mk; then
64 $SED -e "$($AWK '{ printf ("s|^%s |%s |\n", $1, $2) }' <<<"$input")" \
66 git add t/list-of-tests.mk
71 echo "NOTICE: pre-filled commit message is in file '$msg_file'"