test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / lex-depend.sh
old mode 100755 (executable)
new mode 100644 (file)
index 9487f4a..15867d4
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011-2012 Free Software Foundation, Inc.
+# Copyright (C) 2011-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
@@ -17,8 +17,8 @@
 # Test to make sure automatic dependency tracking work with Lex/C.
 # Test suggested by PR automake/6.
 
-required=lex
-. ./defs || Exit 1
+required='cc lex'
+. test-init.sh
 
 cat >> configure.ac << 'END'
 AC_PROG_CC
@@ -38,8 +38,7 @@ test-deps-exist:
 
 .PHONY: test-obj-updated
 test-obj-updated: joe.$(OBJEXT)
-       stat older my-hdr.h joe.$(OBJEXT) || : For debugging.
-       test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT)
+       is_newest joe.$(OBJEXT) my-hdr.h
 END
 
 cat > joe.l << 'END'
@@ -80,10 +79,15 @@ $AUTOCONF
 
 $MAKE test-deps-exist
 $MAKE
+cross_compiling || test "$(./zoo)" = 'Hello, World!' || exit 1
 
-: > older
 $sleep
-touch my-hdr.h
+cat >> my-hdr.h << 'END'
+#undef MESSAGE
+#define MESSAGE "Howdy, Earth!"
+END
 $MAKE test-obj-updated
+$MAKE
+cross_compiling || test "$(./zoo)" = 'Howdy, Earth!' || exit 1
 
 :