test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / cxx-demo.sh
old mode 100755 (executable)
new mode 100644 (file)
index 77f7c83..97a46ce
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2012 Free Software Foundation, Inc.
+# Copyright (C) 2012-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
@@ -18,7 +18,7 @@
 
 required=c++
 am_create_testdir=empty
-. ./defs || exit 1
+. test-init.sh
 
 cat > configure.ac << 'END'
 AC_INIT([GNU C++ Demo], [1.3], [bug-automake@gnu.org])
@@ -165,7 +165,12 @@ END
     Good morning, work.
 END
   for p in play work; do
-    ./$p > got.$p || { cat got.$p; exit 1; }
+    # The program must run correctly (exit status = 0).
+    ./$p
+    # And it must have the expected output.  Note that we strip extra
+    # CR characters (if any), to cater to MinGW programs on MSYS.
+    # See automake bug#14493.
+    ./$p | tr -d '\015' > got.$p || { cat got.$p; exit 1; }
     cat exp.$p
     cat got.$p
     diff exp.$p got.$p