changeset 20340:4f911b4e012b

allow bc-overload tests to be written to an arbitrary directory * build-bc-overload-tests.sh: Fix file name in comments to match file name. Accept second argument to specify directory in which to write output files. * test/Makefile.am (bc-overload-tests.stamp): Adapt rule.
author John W. Eaton <jwe@octave.org>
date Thu, 02 Jul 2015 18:07:24 -0400
parents dadfb0be8a42
children 47d704435aa4
files test/Makefile.am test/build-bc-overload-tests.sh
diffstat 2 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/test/Makefile.am	Thu Jul 02 18:00:39 2015 -0400
+++ b/test/Makefile.am	Thu Jul 02 18:07:24 2015 -0400
@@ -91,7 +91,8 @@
   $(shell $(srcdir)/build-bc-overload-tests.sh --list-files)
 
 bc-overload-tests.stamp: build-bc-overload-tests.sh bc-overloads-expected
-	$(srcdir)/build-bc-overload-tests.sh $(srcdir)/bc-overloads-expected
+	$(AM_V_GEN)rm -f $@ && \
+	$(srcdir)/build-bc-overload-tests.sh $(top_builddir)/test $(srcdir)/bc-overloads-expected && \
 	touch $@
 
 BUILT_SOURCES = bc-overload-tests.stamp
--- a/test/build-bc-overload-tests.sh	Thu Jul 02 18:00:39 2015 -0400
+++ b/test/build-bc-overload-tests.sh	Thu Jul 02 18:07:24 2015 -0400
@@ -57,28 +57,32 @@
       exit
     ;;
     *)
-      expected_results_file="$1"
+      echo "usage: build-bc-overload-tests.sh option" 1>&2
+      exit 1
     ;;
   esac
+elif [ $# -eq 2 ]; then
+    output_dir="$1"
+    expected_results_file="$2"
 else
-  echo "usage: build_bc_overload_tests.sh expected-results-file" 1>&2
+  echo "usage: build-bc-overload-tests.sh expected-results-file" 1>&2
   exit 1
 fi
 
 for class in $CLASSES; do
-  DIR="@$class"
+  DIR="$output_dir/@$class"
   test -d $DIR || mkdir $DIR || { echo "error: could not create $DIR"; exit; }
   cat > $DIR/tbcover.m << EOF
 % !!! DO NOT EDIT !!!
-% generated automatically by build_bc_overload_tests.sh
+% generated automatically by build-bc-overload-tests.sh
 function s = tbcover (x, y)
   s = '$class';
 EOF
 done
 
-cat > tbcover.m << EOF
+cat > $output_dir/tbcover.m << EOF
 % !!! DO NOT EDIT !!!
-% generated automatically by build_bc_overload_tests.sh
+% generated automatically by build-bc-overload-tests.sh
 function s = tbcover (x, y)
   s = 'none';
 EOF
@@ -87,10 +91,10 @@
   exit
 fi
 
-cat > bc-overloads.tst << EOF
+cat > $output_dir/bc-overloads.tst << EOF
 ## !!! DO NOT EDIT !!!
 ## THIS IS AN AUTOMATICALLY GENERATED FILE
-## modify build_bc_overload_tests.sh to generate the tests you need.
+## modify build-bc-overload-tests.sh to generate the tests you need.
 
 %!shared ex
 %! ex.double = 1;
@@ -113,7 +117,7 @@
 
 cat $expected_results_file | \
 while read cl1 cl2 clr ; do
-  cat >> bc-overloads.tst << EOF
+  cat >> $output_dir/bc-overloads.tst << EOF
 %% Name call
 %!assert (tbcover (ex.$cl1, ex.$cl2), "$clr")
 %% Handle call
@@ -122,7 +126,7 @@
 EOF
 done
 
-cat >> bc-overloads.tst << EOF
+cat >> $output_dir/bc-overloads.tst << EOF
 %%test handles through cellfun
 %!test
 %! f = fieldnames (ex);