]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: fix spurious failure of 'get-sysconf.test'
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 1 Jan 2012 18:06:00 +0000 (19:06 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 12 Jan 2012 17:18:39 +0000 (18:18 +0100)
* tests/get-sysconf.test: Do not assume that a ChangeLog file exists
in $(srcdir): now that the ChangeLog is autogenerated and not under
version control anymore, this is not necessary true.  Instead, if we
are running from a git checkout, use "git log" to get information on
the version of the automake snapshot being tested (and fall back on
extracting the first ChangeLog entry otherwise).

Reported by Jim Meyering in automake bug#10418.

Cherry picked from commit v1.11-1675-g104f302.

tests/get-sysconf.test

index 1a549a3f791a38be8646ce30825eefe37e525e0f..bad4735d980a3d5669e807b56b79410de08cb12e 100755 (executable)
@@ -30,7 +30,19 @@ testbuilddir=`(cd .. && pwd)`
 top_testbuilddir=`(cd $testbuilddir/.. && pwd)`
 
 st=0
-sed 20q "$top_testsrcdir/ChangeLog" || st=1
+if test -d "$top_testsrcdir"/.git; then
+  # We are running from a git checkout.
+  git log -1 || st=1
+else
+  # We are probably running from a distribution tarball, so
+  # the ChangeLog file must be present.
+  awk '
+    BEGIN { first = 1 }
+    (first == 1) { print; first = 0; next; }
+    /^[^\t]/ { exit(0); }
+    { print }
+  ' "$top_testsrcdir"/ChangeLog || st=1
+fi
 $PERL -V || st=1
 cat "$top_testbuilddir/config.log" || st=1
 cat "$testbuilddir/aclocal-$APIVERSION" || st=1