X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-update-copyright.sh;h=a1fce0b57ba851f6a20ca13ce9c38241d47dd122;hb=d6e564567eb4ab3033d8e08c8467e3d1a3f51c0d;hp=24574b29f9685f1da96cb2fc0befe2f65fb1ef29;hpb=66a0ae8baa37cf767dc21fbc429c0570d5d8d951;p=gnulib.git diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh index 24574b29f..a1fce0b57 100755 --- a/tests/test-update-copyright.sh +++ b/tests/test-update-copyright.sh @@ -1,6 +1,6 @@ #!/bin/sh # Test suite for update-copyright. -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009-2011 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # This program is free software: you can redistribute it and/or modify @@ -23,6 +23,10 @@ else compare() { cmp "$@"; } fi +# Ensure the update-copyright program gets found. +PATH=$abs_aux_dir:$PATH +export PATH + TMP_BASE=update-copyright.test trap 'rm -f $TMP_BASE*' 0 1 2 3 15 @@ -32,7 +36,12 @@ trap 'rm -f $TMP_BASE*' 0 1 2 3 15 TMP=$TMP_BASE s=$TMP-script -printf '#!/usr/bin/perl -pi\ns/a/b/\n' > $s +cat <<\EOF > $s +eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}' + & eval 'exec perl -wS -0777 -pi "$0" $argv:q' + if 0; +s/a/b/ +EOF chmod a+x $s echo a > $TMP-in ./$s $TMP-in 2>/dev/null && test b = "`cat $TMP-in 2>/dev/null`" || @@ -42,6 +51,17 @@ echo a > $TMP-in exit 77 } +# Skip this test if Perl is too old. FIXME: 5.8.0 is just a guess. +# We have a report that 5.6.1 is inadequate and that 5.8.0 works. +perl -e 'require 5.8.0' || { + echo '$0: skipping this test; Perl version is too old' 1>&2 + exit 77 +} + +# Do not let a different envvar setting perturb results. +UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72 +export UPDATE_COPYRIGHT_MAX_LINE_LENGTH + ## ----------------------------- ## ## Examples from documentation. ## ## ----------------------------- ## @@ -86,8 +106,8 @@ UPDATE_COPYRIGHT_YEAR=2009 \ update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare - $TMP-stderr < $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare - $TMP-stderr < $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare - $TMP-stderr <[5] + 1900'`; +YEAR=`date +%Y` cat > $TMP < $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare - $TMP-stderr < $TMP-stdout 2> $TMP-stderr compare /dev/null $TMP-stdout || exit 1 compare - $TMP-stderr <