tests: expose automake bug#14560
[platform/upstream/automake.git] / t / subobj-clean-pr10697.sh
old mode 100755 (executable)
new mode 100644 (file)
index 69abc10..df97f07
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998-2012 Free Software Foundation, Inc.
+# Copyright (C) 1998-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
@@ -22,7 +22,7 @@
 # 'subobj-clean-lt-pr10697.sh', which deals with the libtool case.
 
 required=cc
-. ./defs || Exit 1
+. test-init.sh
 
 cat >> configure.ac << 'END'
 AC_PROG_CC
@@ -34,21 +34,19 @@ END
 echo "OBJEXT='@OBJEXT@'" > get-objext.in
 
 oPATH=$PATH
-ocwd=`pwd` || fatal_ "getting current working directory"
+ocwd=$(pwd) || fatal_ "getting current working directory"
 
 # An rm(1) wrapper that fails when invoked too many times.
 mkdir rm-wrap
 max_rm_invocations=3
 count_file=$ocwd/rm-wrap/count
 cat > rm-wrap/rm <<END
-#!/bin/sh
-set -e
-count=\`cat '$count_file'\`
-count=\`expr \$count + 1\`
-if test \$count -le $max_rm_invocations; then :; else
+#!$AM_TEST_RUNNER_SHELL -e
+count=\$((\$(cat '$count_file') + 1))
+test \$count -le $max_rm_invocations || {
   echo "rm invoked more than $max_rm_invocations times" >&2
   exit 1
-fi
+}
 echo "\$count" > '$count_file'
 PATH='$oPATH'; export PATH
 exec rm "\$@"
@@ -115,9 +113,9 @@ $MAKE mostlyclean
 ls -l . sub1 sub2
 for i in 1 2; do
   for j in a b c d e f; do
-    test ! -f sub$i/$j.o
-    test ! -f sub$i/$j.obj
-    test -f sub$i/$j.c || Exit 99 # Sanity check
+    test ! -e sub$i/$j.o
+    test ! -e sub$i/$j.obj
+    test -f sub$i/$j.c || exit 99 # Sanity check
   done
 done
 
@@ -150,14 +148,14 @@ test -f sub2/a.$OBJEXT
 
 # ... but they get removed by "make mostlyclean" ...
 $MAKE mostlyclean
-test ! -f sub1/a.$OBJEXT
-test ! -f sub2/d.$OBJEXT
+test ! -e sub1/a.$OBJEXT
+test ! -e sub2/d.$OBJEXT
 
 # ... and do not get rebuilt ...
 $MAKE clean
 $MAKE all
-test ! -f sub1/a.$OBJEXT
-test ! -f sub2/d.$OBJEXT
+test ! -e sub1/a.$OBJEXT
+test ! -e sub2/d.$OBJEXT
 
 # ... while the non-stale files do.
 test -f sub1/b.$OBJEXT