/[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 158 by ph10, Tue May 1 10:30:14 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 36  while [ $# -gt 0 ] ; do Line 49  while [ $# -gt 0 ] ; do
49      7) do7=yes;;      7) do7=yes;;
50      8) do8=yes;;      8) do8=yes;;
51      9) do9=yes;;      9) do9=yes;;
52      valgrind) valgrind="valgrind -q";;      valgrind) valgrind="valgrind -q";;
53      *) echo "Unknown test number $1"; exit 1;;      *) echo "Unknown test number $1"; exit 1;;
54    esac    esac
55    shift    shift
56  done  done
57    
58  if [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then  if [ "$link_size" != "2" ] ; then
59    if [ $do2 = yes ] ; then    if [ $do2 = yes ] ; then
60      echo "Can't run test 2 with an internal link size other than 2"      echo "Can't run test 2 with an internal link size other than 2"
61      exit 1      exit 1
# Line 57  if [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@ Line 70  if [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@
70    fi    fi
71  fi  fi
72    
73  if [ "@UTF8@" = "" ] ; then  if [ $utf8 -eq 0 ] ; then
74    if [ $do4 = yes ] ; then    if [ $do4 = yes ] ; then
75      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"
76      exit 1      exit 1
# Line 80  if [ "@UTF8@" = "" ] ; then Line 93  if [ "@UTF8@" = "" ] ; then
93    fi    fi
94  fi  fi
95    
96  if [ "@UCP@" = "" ] ; then  if [ $ucp -eq 0 ] ; then
97    if [ $do6 = yes ] ; then    if [ $do6 = yes ] ; then
98      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"
99      exit 1      exit 1
# Line 91  if [ "@UCP@" = "" ] ; then Line 104  if [ "@UCP@" = "" ] ; then
104    fi    fi
105  fi  fi
106    
107    # If no specific tests were requested, select all that are relevant.
108    
109  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 \
110       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
111       $do9 = no ] ; then       $do9 = no ] ; then
112    do1=yes    do1=yes
113    do2=yes    do2=yes
114    do3=yes    do3=yes
115    if [ "@UTF8@" != "" ] ; then do4=yes; fi    if [ $utf8 -ne 0 ] ; then do4=yes; fi
116    if [ "@UTF8@" != "" ] ; then do5=yes; fi    if [ $utf8 -ne 0 ] ; then do5=yes; fi
117    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
118    do7=yes    do7=yes
119    if [ "@UTF8@" != "" ] ; then do8=yes; fi    if [ $utf8 -ne 0 ] ; then do8=yes; fi
120    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do9=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
121  fi  fi
122    
123  # Show which release  # Show which release
124    
125    echo ""
126    echo PCRE C library tests
127  ./pcretest /dev/null  ./pcretest /dev/null
128    
129  # Primary test, Perl-compatible  # Primary test, Perl-compatible
# Line 115  if [ $do1 = yes ] ; then Line 132  if [ $do1 = yes ] ; then
132    echo "Test 1: main functionality (Perl compatible)"    echo "Test 1: main functionality (Perl compatible)"
133    $valgrind ./pcretest -q $testdata/testinput1 testtry    $valgrind ./pcretest -q $testdata/testinput1 testtry
134    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
135      $cf testtry $testdata/testoutput1      $cf $testdata/testoutput1 testtry
136      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
137    else exit 1    else exit 1
138    fi    fi
139    echo "OK"    echo "OK"
   echo " "  
140  fi  fi
141    
142  # PCRE tests that are not Perl-compatible - API & error tests, mostly  # PCRE tests that are not Perl-compatible - API & error tests, mostly
143    
144  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
145    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    if [ "$link_size" = "2" ] ; then
146      echo "Test 2: API and error handling (not Perl compatible)"      echo "Test 2: API and error handling (not Perl compatible)"
147      $valgrind ./pcretest -q $testdata/testinput2 testtry      $valgrind ./pcretest -q $testdata/testinput2 testtry
148      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
149        $cf testtry $testdata/testoutput2        $cf $testdata/testoutput2 testtry
150        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
151      else exit 1      else exit 1
152      fi      fi
153      echo "OK"      echo "OK"
     echo " "  
154    else    else
155      echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\)      echo Test 2 skipped for link size other than 2 \($link_size\)
156      echo " "      echo " "
157    fi    fi
158  fi  fi
159    
160  # Locale-specific tests, provided the "fr_FR" locale is available  # Locale-specific tests, provided that either the "fr_FR" or the "french"
161    # locale is available. The former is the Unix-like standard; the latter is
162    # for Windows.
163    
164  if [ $do3 = yes ] ; then  if [ $do3 = yes ] ; then
165    locale -a | grep '^fr_FR$' >/dev/null    locale -a | grep '^fr_FR$' >/dev/null
166    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
167      echo "Test 3: locale-specific features (using 'fr_FR' locale)"      locale=fr_FR
168      $valgrind ./pcretest -q $testdata/testinput3 testtry      infile=$testdata/testinput3
169        outfile=$testdata/testoutput3
170      else
171        locale -a | grep '^french$' >/dev/null
172        if [ $? -eq 0 ] ; then
173          locale=french
174          sed 's/fr_FR/french/' $testdata/testinput3 >test3input
175          sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
176          infile=test3input
177          outfile=test3output
178        else
179          locale=
180        fi
181      fi
182    
183      if [ "$locale" != "" ] ; then
184        echo "Test 3: locale-specific features (using '$locale' locale)"
185        $valgrind ./pcretest -q $infile testtry
186      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
187        $cf testtry $testdata/testoutput3        $cf $outfile testtry
188        if [ $? != 0 ] ; then        if [ $? != 0 ] ; then
189          echo " "          echo " "
190          echo "Locale test did not run entirely successfully."          echo "Locale test did not run entirely successfully."
# Line 159  if [ $do3 = yes ] ; then Line 193  if [ $do3 = yes ] ; then
193        else        else
194        echo "OK"        echo "OK"
195        fi        fi
       echo " "  
196      else exit 1      else exit 1
197      fi      fi
198    else    else
199      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
200      echo "or the \"locale\" command is not available to check for it."      echo "'french' locale exists, or the \"locale\" command is not available"
201        echo "to check for them."
202      echo " "      echo " "
203    fi    fi
204  fi  fi
# Line 175  if [ $do4 = yes ] ; then Line 209  if [ $do4 = yes ] ; then
209    echo "Test 4: UTF-8 support (Perl compatible)"    echo "Test 4: UTF-8 support (Perl compatible)"
210    $valgrind ./pcretest -q $testdata/testinput4 testtry    $valgrind ./pcretest -q $testdata/testinput4 testtry
211    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
212      $cf testtry $testdata/testoutput4      $cf $testdata/testoutput4 testtry
213      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
214    else exit 1    else exit 1
215    fi    fi
216    echo "OK"    echo "OK"
   echo " "  
217  fi  fi
218    
219  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
220    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    if [ "$link_size" = "2" ] ; then
221      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
222      $valgrind ./pcretest -q $testdata/testinput5 testtry      $valgrind ./pcretest -q $testdata/testinput5 testtry
223      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
224        $cf testtry $testdata/testoutput5        $cf $testdata/testoutput5 testtry
225        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
226      else exit 1      else exit 1
227      fi      fi
228      echo "OK"      echo "OK"
     echo " "  
229    else    else
230      echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\)      echo Test 5 skipped for link size other than 2 \($link_size\)
231      echo " "      echo " "
232    fi    fi
233  fi  fi
234    
235  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
236    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    if [ "$link_size" = "2" ] ; then
237      echo "Test 6: Unicode property support"      echo "Test 6: Unicode property support"
238      $valgrind ./pcretest -q $testdata/testinput6 testtry      $valgrind ./pcretest -q $testdata/testinput6 testtry
239      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
240        $cf testtry $testdata/testoutput6        $cf $testdata/testoutput6 testtry
241        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
242      else exit 1      else exit 1
243      fi      fi
244      echo "OK"      echo "OK"
     echo " "  
245    else    else
246      echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)      echo Test 6 skipped for link size other than 2 \($link_size\)
247      echo " "      echo " "
248    fi    fi
249  fi  fi
250    
# Line 223  if [ $do7 = yes ] ; then Line 254  if [ $do7 = yes ] ; then
254    echo "Test 7: DFA matching"    echo "Test 7: DFA matching"
255    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
256    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
257      $cf testtry $testdata/testoutput7      $cf $testdata/testoutput7 testtry
258      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
259    else exit 1    else exit 1
260    fi    fi
261    echo "OK"    echo "OK"
   echo " "  
262  fi  fi
263    
264  if [ $do8 = yes ] ; then  if [ $do8 = yes ] ; then
265    echo "Test 8: DFA matching with UTF-8"    echo "Test 8: DFA matching with UTF-8"
266    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry
267    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
268      $cf testtry $testdata/testoutput8      $cf $testdata/testoutput8 testtry
269      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
270    else exit 1    else exit 1
271    fi    fi
272    echo "OK"    echo "OK"
   echo " "  
273  fi  fi
274    
275  if [ $do9 = yes ] ; then  if [ $do9 = yes ] ; then
276    echo "Test 9: DFA matching with Unicode properties"    echo "Test 9: DFA matching with Unicode properties"
277    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry
278    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
279      $cf testtry $testdata/testoutput9      $cf $testdata/testoutput9 testtry
280      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
281    else exit 1    else exit 1
282    fi    fi
283    echo "OK"    echo "OK"
   echo " "  
284  fi  fi
285    
286  # End  # End

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

  ViewVC Help
Powered by ViewVC 1.1.5