/[pcre]/code/trunk/RunTest
ViewVC logotype

Diff of /code/trunk/RunTest

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

code/trunk/RunTest.in revision 96 by nigel, Fri Mar 2 13:10:43 2007 UTC code/trunk/RunTest revision 165 by ph10, Wed May 9 10:50:57 2007 UTC
# Line 1  Line 1 
1  #! /bin/sh  #! /bin/sh
2    
 # This file is generated by configure from RunTest.in. Make any changes  
 # to that file.  
   
3  # Run PCRE tests  # Run PCRE tests
4    
5  cf=diff  cf="diff -u"
6  valgrind=  valgrind=
7  if [ ! -d testdata ] ; then  testdata=testdata
8    ln -s @top_srcdir@/testdata testdata  
9    if [ -n "$srcdir" -a -d "$srcdir" ] ; then
10      testdata="$srcdir/testdata"
11  fi  fi
 testdata=./testdata  
12    
13    # Find which optional facilities are available
14    
15    case `./pcretest -C | ./pcregrep 'Internal link size'` in
16      *2) link_size=2;;
17      *3) link_size=3;;
18      *4) link_size=4;;
19       *) echo "Failed to find internal link size"; exit 1;;
20    esac
21    
22    ./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null
23    utf8=$?
24    
25  # Select which tests to run; if no selection, run all  ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
26    ucp=$?
27    
28    # Select which tests to run; for those that are explicitly requested, check
29    # that the necessary optional facilities are available.
30    
31  do1=no  do1=no
32  do2=no  do2=no
# Line 24  do6=no Line 37  do6=no
37  do7=no  do7=no
38  do8=no  do8=no
39  do9=no  do9=no
40    do10=no
41    
42  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
43    case $1 in    case $1 in
# Line 36  while [ $# -gt 0 ] ; do Line 50  while [ $# -gt 0 ] ; do
50      7) do7=yes;;      7) do7=yes;;
51      8) do8=yes;;      8) do8=yes;;
52      9) do9=yes;;      9) do9=yes;;
53      valgrind) valgrind="valgrind -q";;     10) do10=yes;;
54       valgrind) valgrind="valgrind -q";;
55      *) echo "Unknown test number $1"; exit 1;;      *) echo "Unknown test number $1"; exit 1;;
56    esac    esac
57    shift    shift
58  done  done
59    
60  if [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then  if [ $utf8 -eq 0 ] ; then
   if [ $do2 = yes ] ; then  
     echo "Can't run test 2 with an internal link size other than 2"  
     exit 1  
   fi  
   if [ $do5 = yes ] ; then  
     echo "Can't run test 5 with an internal link size other than 2"  
     exit 1  
   fi  
   if [ $do6 = yes ] ; then  
     echo "Can't run test 6 with an internal link size other than 2"  
     exit 1  
   fi  
 fi  
   
 if [ "@UTF8@" = "" ] ; then  
61    if [ $do4 = yes ] ; then    if [ $do4 = yes ] ; then
62      echo "Can't run test 4 because UTF-8 support is not configured"      echo "Can't run test 4 because UTF-8 support is not configured"
63      exit 1      exit 1
# Line 80  if [ "@UTF8@" = "" ] ; then Line 80  if [ "@UTF8@" = "" ] ; then
80    fi    fi
81  fi  fi
82    
83  if [ "@UCP@" = "" ] ; then  if [ $ucp -eq 0 ] ; then
84    if [ $do6 = yes ] ; then    if [ $do6 = yes ] ; then
85      echo "Can't run test 6 because Unicode property support is not configured"      echo "Can't run test 6 because Unicode property support is not configured"
86      exit 1      exit 1
# Line 89  if [ "@UCP@" = "" ] ; then Line 89  if [ "@UCP@" = "" ] ; then
89      echo "Can't run test 9 because Unicode property support is not configured"      echo "Can't run test 9 because Unicode property support is not configured"
90      exit 1      exit 1
91    fi    fi
92      if [ $do10 = yes ] ; then
93        echo "Can't run test 10 because Unicode property support is not configured"
94        exit 1
95      fi
96    fi
97    
98    if [ $link_size -ne 2 ] ; then
99      if [ $do10 = yes ] ; then
100        echo "Can't run test 10 because the link size ($link_size) is not 2"
101        exit 1
102      fi
103  fi  fi
104    
105    # If no specific tests were requested, select all that are relevant.
106    
107  if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \  if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
108       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
109       $do9 = no ] ; then       $do9 = no -a $do10 = no ] ; then
110    do1=yes    do1=yes
111    do2=yes    do2=yes
112    do3=yes    do3=yes
113    if [ "@UTF8@" != "" ] ; then do4=yes; fi    if [ $utf8 -ne 0 ] ; then do4=yes; fi
114    if [ "@UTF8@" != "" ] ; then do5=yes; fi    if [ $utf8 -ne 0 ] ; then do5=yes; fi
115    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
116    do7=yes    do7=yes
117    if [ "@UTF8@" != "" ] ; then do8=yes; fi    if [ $utf8 -ne 0 ] ; then do8=yes; fi
118    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do9=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
119      if [ $link_size -eq 2 ] ; then do10=yes; fi
120  fi  fi
121    
122  # Show which release  # Show which release
123    
124    echo ""
125    echo PCRE C library tests
126  ./pcretest /dev/null  ./pcretest /dev/null
127    
128  # Primary test, Perl-compatible  # Primary test, Perl-compatible
# Line 115  if [ $do1 = yes ] ; then Line 131  if [ $do1 = yes ] ; then
131    echo "Test 1: main functionality (Perl compatible)"    echo "Test 1: main functionality (Perl compatible)"
132    $valgrind ./pcretest -q $testdata/testinput1 testtry    $valgrind ./pcretest -q $testdata/testinput1 testtry
133    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
134      $cf testtry $testdata/testoutput1      $cf $testdata/testoutput1 testtry
135      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
136    else exit 1    else exit 1
137    fi    fi
138    echo "OK"    echo "OK"
   echo " "  
139  fi  fi
140    
141  # PCRE tests that are not Perl-compatible - API & error tests, mostly  # PCRE tests that are not Perl-compatible - API & error tests, mostly
142    
143  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
144    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo "Test 2: API and error handling (not Perl compatible)"
145      echo "Test 2: API and error handling (not Perl compatible)"    $valgrind ./pcretest -q $testdata/testinput2 testtry
146      $valgrind ./pcretest -q $testdata/testinput2 testtry    if [ $? = 0 ] ; then
147      if [ $? = 0 ] ; then      $cf $testdata/testoutput2 testtry
148        $cf testtry $testdata/testoutput2      if [ $? != 0 ] ; then exit 1; fi
149        if [ $? != 0 ] ; then exit 1; fi    else exit 1
     else exit 1  
     fi  
     echo "OK"  
     echo " "  
   else  
     echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\)  
     echo " "  
150    fi    fi
151      echo "OK"
152  fi  fi
153    
154  # Locale-specific tests, provided the "fr_FR" locale is available  # Locale-specific tests, provided that either the "fr_FR" or the "french"
155    # locale is available. The former is the Unix-like standard; the latter is
156    # for Windows.
157    
158  if [ $do3 = yes ] ; then  if [ $do3 = yes ] ; then
159    locale -a | grep '^fr_FR$' >/dev/null    locale -a | grep '^fr_FR$' >/dev/null
160    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
161      echo "Test 3: locale-specific features (using 'fr_FR' locale)"      locale=fr_FR
162      $valgrind ./pcretest -q $testdata/testinput3 testtry      infile=$testdata/testinput3
163        outfile=$testdata/testoutput3
164      else
165        locale -a | grep '^french$' >/dev/null
166        if [ $? -eq 0 ] ; then
167          locale=french
168          sed 's/fr_FR/french/' $testdata/testinput3 >test3input
169          sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
170          infile=test3input
171          outfile=test3output
172        else
173          locale=
174        fi
175      fi
176    
177      if [ "$locale" != "" ] ; then
178        echo "Test 3: locale-specific features (using '$locale' locale)"
179        $valgrind ./pcretest -q $infile testtry
180      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
181        $cf testtry $testdata/testoutput3        $cf $outfile testtry
182        if [ $? != 0 ] ; then        if [ $? != 0 ] ; then
183          echo " "          echo " "
184          echo "Locale test did not run entirely successfully."          echo "Locale test did not run entirely successfully."
# Line 159  if [ $do3 = yes ] ; then Line 187  if [ $do3 = yes ] ; then
187        else        else
188        echo "OK"        echo "OK"
189        fi        fi
       echo " "  
190      else exit 1      else exit 1
191      fi      fi
192    else    else
193      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
194      echo "or the \"locale\" command is not available to check for it."      echo "'french' locale exists, or the \"locale\" command is not available"
195        echo "to check for them."
196      echo " "      echo " "
197    fi    fi
198  fi  fi
# Line 175  if [ $do4 = yes ] ; then Line 203  if [ $do4 = yes ] ; then
203    echo "Test 4: UTF-8 support (Perl compatible)"    echo "Test 4: UTF-8 support (Perl compatible)"
204    $valgrind ./pcretest -q $testdata/testinput4 testtry    $valgrind ./pcretest -q $testdata/testinput4 testtry
205    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
206      $cf testtry $testdata/testoutput4      $cf $testdata/testoutput4 testtry
207      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
208    else exit 1    else exit 1
209    fi    fi
210    echo "OK"    echo "OK"
   echo " "  
211  fi  fi
212    
213  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
214    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
215      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"    $valgrind ./pcretest -q $testdata/testinput5 testtry
216      $valgrind ./pcretest -q $testdata/testinput5 testtry    if [ $? = 0 ] ; then
217      if [ $? = 0 ] ; then      $cf $testdata/testoutput5 testtry
218        $cf testtry $testdata/testoutput5      if [ $? != 0 ] ; then exit 1; fi
219        if [ $? != 0 ] ; then exit 1; fi    else exit 1
     else exit 1  
     fi  
     echo "OK"  
     echo " "  
   else  
     echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\)  
     echo " "  
220    fi    fi
221      echo "OK"
222  fi  fi
223    
224  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
225    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo "Test 6: Unicode property support"
226      echo "Test 6: Unicode property support"    $valgrind ./pcretest -q $testdata/testinput6 testtry
227      $valgrind ./pcretest -q $testdata/testinput6 testtry    if [ $? = 0 ] ; then
228      if [ $? = 0 ] ; then      $cf $testdata/testoutput6 testtry
229        $cf testtry $testdata/testoutput6      if [ $? != 0 ] ; then exit 1; fi
230        if [ $? != 0 ] ; then exit 1; fi    else exit 1
     else exit 1  
     fi  
     echo "OK"  
     echo " "  
   else  
     echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)  
     echo " "  
231    fi    fi
232      echo "OK"
233  fi  fi
234    
235  # Tests for DFA matching support  # Tests for DFA matching support
# Line 223  if [ $do7 = yes ] ; then Line 238  if [ $do7 = yes ] ; then
238    echo "Test 7: DFA matching"    echo "Test 7: DFA matching"
239    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
240    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
241      $cf testtry $testdata/testoutput7      $cf $testdata/testoutput7 testtry
242      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
243    else exit 1    else exit 1
244    fi    fi
245    echo "OK"    echo "OK"
   echo " "  
246  fi  fi
247    
248  if [ $do8 = yes ] ; then  if [ $do8 = yes ] ; then
249    echo "Test 8: DFA matching with UTF-8"    echo "Test 8: DFA matching with UTF-8"
250    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry
251    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
252      $cf testtry $testdata/testoutput8      $cf $testdata/testoutput8 testtry
253      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
254    else exit 1    else exit 1
255    fi    fi
256    echo "OK"    echo "OK"
   echo " "  
257  fi  fi
258    
259  if [ $do9 = yes ] ; then  if [ $do9 = yes ] ; then
260    echo "Test 9: DFA matching with Unicode properties"    echo "Test 9: DFA matching with Unicode properties"
261    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry
262    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
263      $cf testtry $testdata/testoutput9      $cf $testdata/testoutput9 testtry
264        if [ $? != 0 ] ; then exit 1; fi
265      else exit 1
266      fi
267      echo "OK"
268    fi
269    
270    # Test of internal offsets and code sizes. This test is run only when there
271    # is Unicode property support and the link size is 2. The actual tests are
272    # mostly the same as in some of the above, but in this test we inspect some
273    # offsets and sizes that require a known link size. This is a doublecheck for
274    # the maintainer, just in case something changes unexpectely.
275    
276    if [ $do10 = yes ] ; then
277      echo "Test 10: Internal offsets and code size tests"
278      $valgrind ./pcretest -q $testdata/testinput10 testtry
279      if [ $? = 0 ] ; then
280        $cf $testdata/testoutput10 testtry
281      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
282    else exit 1    else exit 1
283    fi    fi
284    echo "OK"    echo "OK"
   echo " "  
285  fi  fi
286    
287  # End  # End

Legend:
Removed from v.96  
changed lines
  Added in v.165

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12