Merge branch 'micro' into maint
[platform/upstream/automake.git] / t / yacc-line.sh
old mode 100755 (executable)
new mode 100644 (file)
index ac6a0aa..b034af3
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 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
 # Check that automake yacc support ensures that yacc-generated C
 # files use correct "#line" directives.  Try also with the
 # 'subdir-object' option enabled.
-# See also sister test 'lex-line.test'.
+# See also sister test 'lex-line.sh'.
 
-required=yacc
-. ./defs || Exit 1
+required='cc yacc'
+. test-init.sh
 
 cat >> configure.ac << 'END'
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
-AM_PROG_CC_C_O
 AC_PROG_YACC
 AC_OUTPUT
 END
@@ -77,7 +76,9 @@ c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c'
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+# FIXME: stop disabling the warnings in the 'unsupported' category
+# FIXME: once the 'subdir-objects' option has been mandatory.
+$AUTOMAKE -a -Wno-unsupported
 
 for vpath in : false; do
 
@@ -94,18 +95,30 @@ for vpath in : false; do
 
   # For debugging,
   ls -l . sub sub/dir
-  $FGREP '.y' $c_outputs
+  $EGREP 'line|\.y' $c_outputs
 
   # Adjusted "#line" should not contain reference to the builddir.
-  $EGREP '#.*line.*(build|\.\.).*\.y' $c_outputs && Exit 1
+  grep '#.*line.*build.*\.y' $c_outputs && exit 1
+  # Adjusted "#line" should not contain reference to the absolute
+  # srcdir.
+  $EGREP '#.*line *"?/.*\.y' $c_outputs && exit 1
   # Adjusted "#line" should not contain reference to the default
   # output file names, e.g., 'y.tab.c' and 'y.tab.h'.
-  $EGREP '#.*line.*y\.tab\.' $c_outputs && Exit 1
-  # Don't be excessively strict in grepping, to avoid spurious failures.
-  grep '#.*line.*zardoz\.y' zardoz.c
-  grep '#.*line.*quux\.y' bar-quux.c
-  grep '#.*line.*zardoz\.y' sub/foo-zardoz.c
-  grep '#.*line.*quux\.y' sub/dir/quux.c
+  grep '#.*line.*y\.tab\.' $c_outputs && exit 1
+  # Look out for a silly regression.
+  grep "#.*\.y.*\.y" $c_outputs && exit 1
+  if $vpath; then
+    grep '#.*line.*"\.\./zardoz\.y"' zardoz.c
+    grep '#.*line.*"\.\./dir/quux\.y"' bar-quux.c
+    grep '#.*line.*"\.\./\.\./sub/zardoz\.y"' sub/foo-zardoz.c
+    grep '#.*line.*"\.\./\.\./sub/dir/quux\.y"' sub/dir/quux.c
+  else
+    grep '#.*line.*"zardoz\.y"' zardoz.c
+    grep '#.*line.*"dir/quux\.y"' bar-quux.c
+    grep '#.*line.*"zardoz\.y"' sub/foo-zardoz.c
+    grep '#.*line.*"dir/quux\.y"' sub/dir/quux.c
+  fi
+
   cd $srcdir
 
 done