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

Legend:
Removed from v.81  
changed lines
  Added in v.245

  ViewVC Help
Powered by ViewVC 1.1.5