summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-01-02 21:08:27 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-01-02 21:59:33 +0100
commitc31863138afeab687ac719c363274fa7095a9b5e (patch)
treeb5e3bffbedd85ed328b5ece2b739211ff6a04d0b
parentfe05207b40350b189727351c22871ae5075b186f (diff)
downloadautomake-c31863138afeab687ac719c363274fa7095a9b5e.tar.gz
maint: add some of my maintainer-specific scripts
They are likely not general enough for widespread use, but they are useful nonetheless. In the best-case scenario, they will start to be used by other people, and thus accordingly improved and made more general and flexible. In the worst case scenario, well, I still get to keep them in a centralized, blessed place, simplifying the deployment and use of them; so still a win for me :-) * maint/am-ft: New script. * maint/am-xft: Likewise. * maint/rename-tests: Likewise. * Makefile.am (EXTRA_DIST): Add them. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
-rw-r--r--Makefile.am9
-rwxr-xr-xmaint/am-ft109
-rwxr-xr-xmaint/am-xft3
-rwxr-xr-xmaint/rename-tests52
4 files changed, 173 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 030c2eb6a..f6db092f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -679,3 +679,12 @@ EXTRA_DIST += \
old/ChangeLog.09 \
old/ChangeLog.11 \
old/TODO
+
+## ---------------------------------------- ##
+## Maintainer-specific files and scripts. ##
+## ---------------------------------------- ##
+
+EXTRA_DIST += \
+ maint/am-ft \
+ maint/am-xft \
+ maint/rename-tests
diff --git a/maint/am-ft b/maint/am-ft
new file mode 100755
index 000000000..d8a2722be
--- /dev/null
+++ b/maint/am-ft
@@ -0,0 +1,109 @@
+#!/usr/bin/env bash
+# Remote testing of Automake tarballs made easy.
+# This script requires Bash 4.x or later.
+# TODO: some documentation would be nice ...
+
+set -u
+me=${0##*/}
+
+fatal () { echo "$me: $*" >&2; exit 1; }
+
+cmd='
+ test_script=$HOME/.am-test/run
+ if test -f "$test_script" && test -x "$test_script"; then
+ "$test_script" "$@"
+ else
+ nice -n19 ./configure && nice -n19 make -j10 check
+ fi
+'
+
+remote=
+interactive=1
+while test $# -gt 0; do
+ case $1 in
+ -b|--batch) interactive=0;;
+ -c|--command) cmd=${2-}; shift;;
+ -*) fatal "'$1': invalid option";;
+ *) remote=$1; shift; break;;
+ esac
+ shift
+done
+[[ -n $remote ]] || fatal "no remote given"
+
+if ((interactive)); then
+ do_on_error='{
+ AM_TESTSUITE_FAILED=yes
+ export AM_TESTSUITE_FAILED
+ # We should not modify the environment with which the failed
+ # tests have run, hence do not read ".profile", ".bashrc", and
+ # company.
+ exec bash --noprofile --norc -i
+ }'
+else
+ do_on_error='exit $?'
+fi
+
+tarball=$(echo automake*.tar.xz)
+
+case $tarball in
+ *' '*) fatal "too many automake tarballs: $tarball";;
+esac
+
+test -f $tarball || fatal "no automake tarball found"
+
+distdir=${tarball%%.tar.xz}
+
+env='PATH=$HOME/bin:$PATH'
+if test -t 1; then
+ env+=" TERM='$TERM' AM_COLOR_TESTS=always"
+fi
+
+# This is tempting:
+# $ ssh "command" arg-1 ... arg-2
+# but doesn't work as expected. So we need the following hack
+# to propagate the command line arguments to the remote shell.
+quoted_args=--
+while (($# > 0)); do
+ case $1 in
+ *\'*) quoted_args+=" "$(printf '%s\n' "$1" | sed "s/'/'\\''/g");;
+ *) quoted_args+=" '$1'";;
+ esac
+ shift
+done
+
+set -e
+set -x
+
+scp $tarball $remote:tmp/
+
+# Multiple '-t' to force tty allocation.
+ssh -t -t $remote "
+ set -x; set -e; set -u;
+ set $quoted_args
+ cd tmp
+ if test -e $distdir; then
+ # Use 'perl', not only 'rm -rf', to correctly handle read-only
+ # files or directory. Fall back to 'rm' if something goes awry.
+ perl -e 'use File::Path qw/rmtree/; rmtree(\"$distdir\")' \
+ || rm -rf $distdir || exit 1
+ test ! -e $distdir
+ fi
+ xz -dc $tarball | tar xf -
+ cd $distdir
+ "'
+ am_extra_acdir=$HOME/.am-test/extra-aclocal
+ am_extra_bindir=$HOME/.am-test/extra-bin
+ am_extra_setup=$HOME/.am-test/extra-setup.sh
+ if test -d "$am_extra_acdir"; then
+ export ACLOCAL_PATH=$am_extra_acdir${ACLOCAL_PATH+":$ACLOCAL_PATH"}
+ fi
+ if test -d "$am_extra_bindir"; then
+ export PATH=$am_extra_bindir:$PATH
+ fi
+ '"
+ export $env
+ if test -f \"\$am_extra_setup\"; then
+ . \"\$am_extra_setup\"
+ fi
+ ($cmd) || $do_on_error
+"
diff --git a/maint/am-xft b/maint/am-xft
new file mode 100755
index 000000000..564aa3b02
--- /dev/null
+++ b/maint/am-xft
@@ -0,0 +1,3 @@
+#!/bin/sh
+MAKE=${MAKE-make} GIT=${GIT-git}
+$GIT clean -fdx && $MAKE bootstrap && $MAKE dist && exec am-ft "$@"
diff --git a/maint/rename-tests b/maint/rename-tests
new file mode 100755
index 000000000..6fce9fe84
--- /dev/null
+++ b/maint/rename-tests
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# Convenience script to rename test cases in Automake.
+
+set -e -u
+
+me=${0##*/}
+fatal () { echo "$me: $*" >&2; exit 1; }
+
+case $# in
+ 0) input=$(cat);;
+ 1) input=$(cat -- "$1");;
+ *) fatal "too many arguments";;
+esac
+
+AWK=${AWK-awk}
+SED=${SED-sed}
+
+[[ -f automake.in && -d lib/Automake ]] \
+ || fatal "can only be run from the top-level of the Automake source tree"
+
+$SED --version 2>&1 | grep GNU >/dev/null 2>&1 \
+ || fatal "GNU sed is required by this script"
+
+# Validate and cleanup input.
+input=$(
+ $AWK -v me="$me" "
+ /^#/ { next; }
+ (NF == 0) { next; }
+ (NF != 2) { print me \": wrong number of fields at line \" NR;
+ exit(1); }
+ { printf (\"t/%s t/%s\\n\", \$1, \$2); }
+ " <<<"$input")
+
+# Prepare git commit message.
+exec 5>$me.git-msg
+echo "tests: more significant names for some tests" >&5
+echo >&5
+$AWK >&5 <<<"$input" \
+ '{ printf ("* %s: Rename...\n* %s: ... like this.\n", $1, $2) }'
+exec 5>&-
+
+# Rename tests.
+eval "$($AWK '{ printf ("git mv %s %s\n", $1, $2) }' <<<"$input")"
+
+# Adjust the list of tests (do this conditionally, since such a
+# list is not required nor used in Automake-NG.
+if test -f t/list-of-tests.mk; then
+ $SED -e "$($AWK '{ printf ("s|^%s |%s |\n", $1, $2) }' <<<"$input")" \
+ -i t/list-of-tests.mk
+fi
+
+git status