NEWS.stable: log cherry-pick [93b28fe]->[e7f1d9f] ioctl: Move autoconf macro to a...
[gnulib.git] / tests / test-update-copyright.sh
index 24574b2..2d1022a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Test suite for update-copyright.
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2009-2010 Free Software Foundation, Inc.
 # This file is part of the GNUlib Library.
 #
 # This program is free software: you can redistribute it and/or modify
@@ -32,7 +32,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 +47,10 @@ echo a > $TMP-in
     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.  ##
 ## ----------------------------- ##
@@ -82,6 +91,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Foundation, Inc.
 EOF
 
+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2009 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
@@ -124,6 +134,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Foundation, Inc.
 EOF
 
+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
@@ -162,6 +173,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
 EOF
 
+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
@@ -215,7 +227,7 @@ rm $TMP*
 ## -------------- ##
 
 TMP=$TMP_BASE-current-year
-YEAR=`/usr/bin/perl -e 'print [localtime]->[5] + 1900'`;
+YEAR=`date +%Y`
 cat > $TMP <<EOF
 '\" Copyright (C) 2006
 '\" Free Software Foundation,