annotate admin/mktests.sh @ 12686:7c1bc8d8c406 octave-forge

fix range check of k-index
author schloegl
date Sat, 12 Sep 2015 07:33:55 +0000
parents 185c49a73acc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
1 #! /bin/sh
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
2
2423
2c1169bbf968 packages, packages, packages
adb014
parents: 2247
diff changeset
3 # Root of the search
2c1169bbf968 packages, packages, packages
adb014
parents: 2247
diff changeset
4 root=`pwd`
2162
b57d57e1a4f8 patch to allow 2.9.x autoload functionality to replace symbolic links
adb014
parents: 1726
diff changeset
5
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
6 # Create a new fntests.m file
1713
74f60828e726 Print number of files with and without tests. Use looser output format
pkienzle
parents: 1710
diff changeset
7 echo "fid=fopen('fntests.log','wt');" > fntests.m
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
8 echo "if fid<0,error('could not open fntests.log for writing');end" >>fntests.m
1179
8c1278092724 Add explanation of test results to the log file.
pkienzle
parents: 1174
diff changeset
9 echo "test('','explain',fid);" >> fntests.m
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
10 echo "passes=0; tests=0;" >>fntests.m
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
11
3967
185c49a73acc More replaces of use of CVS with SVN
adb014
parents: 2460
diff changeset
12 # Find all toplevel non-svn directories
185c49a73acc More replaces of use of CVS with SVN
adb014
parents: 2460
diff changeset
13 DIRS="`find $* -type d ! -name .svn`"
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
14
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
15 # Find the tests in that directory
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
16 for dir in $DIRS; do
2247
64599a4ed03e Remove bashisms from mktest.sh and run_forge
adb014
parents: 2162
diff changeset
17 dir=`echo $dir | sed -e "s-^\./--" `
1171
2ca12631e149 Prettier output
pkienzle
parents: 1167
diff changeset
18
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
19 # skip the NOINSTALL directories
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
20 if test -f "$dir/NOINSTALL"; then continue; fi
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
21
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
22 # Build a list of possible test files
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
23 FILES=""
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
24
2423
2c1169bbf968 packages, packages, packages
adb014
parents: 2247
diff changeset
25 # Find all .cc files
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
26 cxx_files=`echo $dir/*.cc`
2423
2c1169bbf968 packages, packages, packages
adb014
parents: 2247
diff changeset
27 if test "$cxx_files" != "$dir/*.cc"; then FILES="$FILES $cxx_files"; fi
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
28
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
29 # Find all m-files
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
30 m_files=`echo $dir/*.m`
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
31 if test "$m_files" != "$dir/*.m"; then FILES="$FILES $m_files"; fi
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
32
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
33 # No C++ of m-files, so no testing
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
34 if test -z "$FILES" ; then continue; fi
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
35
1174
c000804b5358 hack around the fact that grep '\(A\|B\)' isn't universal.
pkienzle
parents: 1173
diff changeset
36 # Find all files with %!test or %!assert in them
c000804b5358 hack around the fact that grep '\(A\|B\)' isn't universal.
pkienzle
parents: 1173
diff changeset
37 # XXX FIXME XXX is there a system independent way of doing (test|assert)
c000804b5358 hack around the fact that grep '\(A\|B\)' isn't universal.
pkienzle
parents: 1173
diff changeset
38 TESTS=`grep -l -E '^%![ta][es]s' $FILES`
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
39
1713
74f60828e726 Print number of files with and without tests. Use looser output format
pkienzle
parents: 1710
diff changeset
40 NUMFILES=`echo $FILES | wc -w`
74f60828e726 Print number of files with and without tests. Use looser output format
pkienzle
parents: 1710
diff changeset
41 NUMTESTS=`echo $TESTS | wc -w`
74f60828e726 Print number of files with and without tests. Use looser output format
pkienzle
parents: 1710
diff changeset
42 prompt="$dir [tests $NUMTESTS of $NUMFILES files]"
74f60828e726 Print number of files with and without tests. Use looser output format
pkienzle
parents: 1710
diff changeset
43
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
44 # if no files have tests in them, skip
1726
86c33db6cc6d Don't use mindepth/maxdepth gnu extenstions to find.
pkienzle
parents: 1713
diff changeset
45 echo "printf('%s','$prompt'); disp('');" >>fntests.m
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
46 if test -z "$TESTS" ; then
1713
74f60828e726 Print number of files with and without tests. Use looser output format
pkienzle
parents: 1710
diff changeset
47 echo "printf('%-40s ---> success','');disp('');" >>fntests.m
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
48 else
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
49 echo "dp=dn=0;" >>fntests.m
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
50 for file in $TESTS ; do
2423
2c1169bbf968 packages, packages, packages
adb014
parents: 2247
diff changeset
51 echo "[p,n] = test('$root/$file','quiet',fid);" >>fntests.m
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
52 echo "dp += p; dn += n;" >>fntests.m
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
53 done
1713
74f60828e726 Print number of files with and without tests. Use looser output format
pkienzle
parents: 1710
diff changeset
54 echo "if dp==dn, printf('%-40s ---> success',''); else" >>fntests.m
74f60828e726 Print number of files with and without tests. Use looser output format
pkienzle
parents: 1710
diff changeset
55 echo "printf('%-40s ---> passes %d out of %d tests','',dp,dn); end" >>fntests.m
1173
9f25bbfb1008 Remove \n characters since they were confusing IRIX's sh command.
pkienzle
parents: 1171
diff changeset
56 echo "disp(''); passes += dp; tests += dn;" >>fntests.m
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
57 fi
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
58
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
59 done
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
60
1173
9f25bbfb1008 Remove \n characters since they were confusing IRIX's sh command.
pkienzle
parents: 1171
diff changeset
61 echo "printf('passes %d out of %d tests',passes,tests);disp('');" >> fntests.m
1167
2abbfb5b4281 Build a more sophisticated test script; clean up some of the tests.
pkienzle
parents:
diff changeset
62 echo "fclose(fid);" >> fntests.m