Add test coverage for deleted header files.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 9 Jan 2011 11:06:24 +0000 (12:06 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 9 Jan 2011 13:50:09 +0000 (14:50 +0100)
* tests/depcomp6.test, tests/depcomp7.test: Update tests to
also check for the deleted header bug.  If no dependency
tracking mechanism could be found, SKIP rather than exit
successfully.  Use GNU style spacing and ANSI C prototypes.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
tests/depcomp6.test
tests/depcomp7.test

index eab80e1..0e2c990 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-01-09  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Add test coverage for deleted header files.
+       * tests/depcomp6.test, tests/depcomp7.test: Update tests to
+       also check for the deleted header bug.  If no dependency
+       tracking mechanism could be found, SKIP rather than exit
+       successfully.  Use GNU style spacing and ANSI C prototypes.
+
        Fix typos in Rule.pm comments.
        * lib/Automake/Rule.pm: Fix typos in comments.
 
index 7fc651f..ea15e20 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2010, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ cat >foo.c <<'END'
 #include "foo.h"
 #include "sub2/baz.h"
 #include <stdlib.h>
-int main() { printf("foo"); return bar() + baz(); }
+int main (void) { printf ("foo"); return bar () + baz (); }
 END
 
 cat >foo.h <<'END'
@@ -57,28 +57,28 @@ END
 
 cat >sub/bar.c <<'END'
 #include "sub/bar.h"
-int bar() { return 0; }
+int bar (void) { return 0; }
 END
 
 touch sub2/sub3/ba3.h
 
 cat >sub/bar.h <<'END'
 #include <stdio.h>
-extern int bar();
+extern int bar (void);
 END
 
 cat >sub2/baz.c <<'END'
 #include "baz.h"
-int baz() { return 0; }
+int baz (void) { return 0; }
 END
 
 cat >sub2/baz.h <<'END'
-extern int baz();
+extern int baz (void);
 END
 
 cat >sub2/sub3/ba3.c <<'END'
 #include "ba3.h"
-int ba3() { return 0; }
+int ba3 (void) { return 0; }
 END
 
 $ACLOCAL
@@ -88,17 +88,24 @@ $AUTOMAKE -a
 ./configure --enable-dependency-tracking
 $MAKE
 
-# check that dependency tracking works
-if grep 'depmode=none' Makefile; then :
-else
-  cd sub2
-  $sleep
-  echo 'choke me' > sub3/ba3.h
-  # Do not use `$MAKE && Exit 1' here, since even relatively-recent
-  # versions of the BSD shell wrongly exit when the `errexit' shell
-  # flag is active if a command within "&&" fails inside a compound
-  # statement.
-  if $MAKE; then Exit 1; else :; fi
+# Check that dependency tracking works.
+if grep 'depmode=none' Makefile; then
+  Exit 77
 fi
 
+cd sub2
+$sleep
+echo 'choke me' > sub3/ba3.h
+# Do not use `$MAKE && Exit 1' here, since even relatively-recent
+# versions of the BSD shell wrongly exit when the `errexit' shell
+# flag is active if a command within "&&" fails inside a compound
+# statement.
+if $MAKE; then Exit 1; else :; fi
+
+# Ensure the deleted header bug is fixed.
+rm -f sub3/ba3.h
+sed 1d sub3/ba3.c >sub3/ba3.t
+mv -f sub3/ba3.t sub3/ba3.c
+$MAKE
+
 :
index 695041a..47f09fc 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007, 2010, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ cat >foo.c <<'END'
 #include "foo.h"
 #include "sub2/baz.h"
 #include <stdlib.h>
-int main() { printf("foo"); return bar() + baz(); }
+int main (void) { printf ("foo"); return bar () + baz (); }
 END
 
 cat >foo.h <<'END'
@@ -58,28 +58,28 @@ END
 
 cat >sub/bar.c <<'END'
 #include "sub/bar.h"
-int bar() { return 0; }
+int bar (void) { return 0; }
 END
 
 echo 'extern int x;' > sub2/sub3/ba3.h
 
 cat >sub/bar.h <<'END'
 #include <stdio.h>
-extern int bar();
+extern int bar (void);
 END
 
 cat >sub2/baz.c <<'END'
 #include "baz.h"
-int baz() { return 0; }
+int baz (void) { return 0; }
 END
 
 cat >sub2/baz.h <<'END'
-extern int baz();
+extern int baz (void);
 END
 
-cat >sub2/sub3/ba3.c <<'END'
+cat >sub2/sub3/ba3.in <<'END'
 #include "ba3.h"
-int ba3() { return 0; }
+int ba3 (void) { return 0; }
 END
 
 libtoolize
@@ -87,13 +87,18 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
+st=0
 for staticshared in --disable-shared "" --disable-static; do
 
+  cp sub2/sub3/ba3.in sub2/sub3/ba3.c
   ./configure --enable-dependency-tracking $staticshared
   $MAKE
 
-  # check that dependency tracking works
-  if grep 'depmode=none' Makefile; then :
+  # If we cannot enable dependency tracking, perform only the most basic
+  # checks, and don't consider this test to be PASSed but SKIPped, because
+  # the main purpose of this test is exposing the depmode features.
+  if grep 'depmode=none' Makefile; then
+    st=77
   else
     cd sub2
     $sleep
@@ -103,6 +108,11 @@ for staticshared in --disable-shared "" --disable-static; do
     # flag is active if a command within "&&" fails inside a compound
     # statement.
     if $MAKE; then Exit 1; else :; fi
+
+    # Ensure the deleted header bug is fixed.
+    rm -f sub3/ba3.h
+    sed 1d sub3/ba3.in >sub3/ba3.c
+    $MAKE
     cd ..
   fi
 
@@ -114,4 +124,4 @@ for staticshared in --disable-shared "" --disable-static; do
 
 done
 
-:
+Exit $st