changeset 10096:ffc5426c85a4

build_bc_overload_tests.sh: accept expected results file as argument
author John W. Eaton <jwe@octave.org>
date Wed, 13 Jan 2010 13:42:57 -0500
parents eb8ac0eed9f1
children 462fa695a565
files test/ChangeLog test/Makefile.am test/build_bc_overload_tests.sh
diffstat 3 files changed, 46 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/test/ChangeLog	Wed Jan 13 18:19:37 2010 +0100
+++ b/test/ChangeLog	Wed Jan 13 13:42:57 2010 -0500
@@ -1,3 +1,8 @@
+2010-01-13  John W. Eaton  <jwe@octave.org>
+
+	* Makefile.am (test_bc_overloads.m): Accept expected results
+	file as argument.  Style fixes.
+
 2010-01-13  Jaroslav Hajek  <highegg@gmail.com>
 
 	* build_bc_overload_tests.sh: New shell script.
--- a/test/Makefile.am	Wed Jan 13 18:19:37 2010 +0100
+++ b/test/Makefile.am	Wed Jan 13 13:42:57 2010 -0500
@@ -69,7 +69,7 @@
 	$(srcdir)/build_sparse_tests.sh
 
 test_bc_overloads.m: build_bc_overload_tests.sh bc_overloads_expected
-	$(srcdir)/build_bc_overload_tests.sh
+	$(srcdir)/build_bc_overload_tests.sh $(srcdir)/bc_overloads_expected
 
 EXTRA_DIST = \
   ChangeLog \
--- a/test/build_bc_overload_tests.sh	Wed Jan 13 18:19:37 2010 +0100
+++ b/test/build_bc_overload_tests.sh	Wed Jan 13 13:42:57 2010 -0500
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
 
 # Copyright (C) 2010 VZLU Prague
 #
@@ -18,30 +18,52 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-CLASSES="double single char logical int8 int16 int32 int64 \
-uint8 uint16 uint32 uint64 struct cell function_handle"
+CLASSES="
+  double
+  single
+  char
+  logical
+  int8
+  int16
+  int32
+  int64
+  uint8
+  uint16
+  uint32
+  uint64
+  struct
+  cell
+  function_handle
+"
 
-for class in $CLASSES ; do
-	DIR=\@$class
-	test -d $DIR || mkdir $DIR || { echo "error: could not create $DIR" ; exit ; }
-	cat > $DIR/tbcover.m <<end
+if [ $# -eq 1 ]; then
+  expected_results_file="$1"
+else
+  echo "usage: build_bc_overload_tests.sh expected-results-file" 1>&2
+  exit 1
+fi
+
+for class in $CLASSES; do
+  DIR="@$class"
+  test -d $DIR || mkdir $DIR || { echo "error: could not create $DIR"; exit; }
+  cat > $DIR/tbcover.m << EOF
 % DO NOT EDIT - generated automatically
 function s = tbcover (x, y)
   s = '$class';
-end
+EOF
 done
 
-cat > tbcover.m <<end
+cat > tbcover.m << EOF
 % DO NOT EDIT - generated automatically
 function s = tbcover (x, y)
   s = 'none';
-end
+EOF
 
 if test "$1" == "overloads_only" ; then
-	exit
+  exit
 fi
 
-cat > test_bc_overloads.m <<end
+cat > test_bc_overloads.m << EOF
 ## THIS IS AN AUTOMATICALLY GENERATED FILE --- DO NOT EDIT ---
 ## instead modify build_bc_overload_tests.sh to generate the tests that you want.
 
@@ -62,20 +84,20 @@
 %! ex.struct = struct ();
 %! ex.function_handle = @numel;
 
-end
+EOF
 
-cat bc_overloads_expected |\
+cat $expected_results_file | \
 while read cl1 cl2 clr ; do
-	cat >> test_bc_overloads.m <<end
+  cat >> test_bc_overloads.m << EOF
 %% Name call
 %!assert (tbcover (ex.$cl1, ex.$cl2), "$clr")
 %% Handle call
 %!assert ((@tbcover) (ex.$cl1, ex.$cl2), "$clr")
 
-end
+EOF
 done
 
-cat >> test_bc_overloads.m <<end
+cat >> test_bc_overloads.m << EOF
 %%test handles through cellfun
 %!test
 %! f = fieldnames (ex);
@@ -89,4 +111,4 @@
 %!   endfor
 %! endfor
 %! assert (cellfun (@tbcover, c1, c2, "uniformoutput", false), s);
-end
+EOF