/[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 128 by ph10, Tue Mar 20 11:46:50 2007 UTC code/trunk/RunTest revision 247 by ph10, Mon Sep 17 09:38:32 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  # Find which optional facilities are available
14    
# Line 39  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 51  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    
 if [ "$link_size" != "2" ] ; 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  
   
60  if [ $utf8 -eq 0 ] ; then  if [ $utf8 -eq 0 ] ; 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"
# Line 81  if [ $utf8 -eq 0 ] ; then Line 66  if [ $utf8 -eq 0 ] ; then
66      echo "Can't run test 5 because UTF-8 support is not configured"      echo "Can't run test 5 because UTF-8 support is not configured"
67      exit 1      exit 1
68    fi    fi
   if [ $do6 = yes ] ; then  
     echo "Can't run test 6 because UTF-8 support is not configured"  
     exit 1  
   fi  
69    if [ $do8 = yes ] ; then    if [ $do8 = yes ] ; then
70      echo "Can't run test 8 because UTF-8 support is not configured"      echo "Can't run test 8 because UTF-8 support is not configured"
71      exit 1      exit 1
72    fi    fi
   if [ $do9 = yes ] ; then  
     echo "Can't run test 9 because UTF-8 support is not configured"  
     exit 1  
   fi  
73  fi  fi
74    
75  if [ $ucp -eq 0 ] ; then  if [ $ucp -eq 0 ] ; then
# Line 104  if [ $ucp -eq 0 ] ; then Line 81  if [ $ucp -eq 0 ] ; then
81      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"
82      exit 1      exit 1
83    fi    fi
84      if [ $do10 = yes ] ; then
85        echo "Can't run test 10 because Unicode property support is not configured"
86        exit 1
87      fi
88    fi
89    
90    if [ $link_size -ne 2 ] ; then
91      if [ $do10 = yes ] ; then
92        echo "Can't run test 10 because the link size ($link_size) is not 2"
93        exit 1
94      fi
95  fi  fi
96    
97  # If no specific tests were requested, select all that are relevant.  # If no specific tests were requested, select all that are relevant.
98    
99  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 \
100       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
101       $do9 = no ] ; then       $do9 = no -a $do10 = no ] ; then
102    do1=yes    do1=yes
103    do2=yes    do2=yes
104    do3=yes    do3=yes
# Line 120  if [ $do1 = no -a $do2 = no -a $do3 = no Line 108  if [ $do1 = no -a $do2 = no -a $do3 = no
108    do7=yes    do7=yes
109    if [ $utf8 -ne 0 ] ; then do8=yes; fi    if [ $utf8 -ne 0 ] ; then do8=yes; fi
110    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
111      if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi
112  fi  fi
113    
114  # Show which release  # Show which release
# Line 134  if [ $do1 = yes ] ; then Line 123  if [ $do1 = yes ] ; then
123    echo "Test 1: main functionality (Perl compatible)"    echo "Test 1: main functionality (Perl compatible)"
124    $valgrind ./pcretest -q $testdata/testinput1 testtry    $valgrind ./pcretest -q $testdata/testinput1 testtry
125    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
126      $cf testtry $testdata/testoutput1      $cf $testdata/testoutput1 testtry
127      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
128    else exit 1    else exit 1
129    fi    fi
# Line 144  fi Line 133  fi
133  # PCRE tests that are not Perl-compatible - API & error tests, mostly  # PCRE tests that are not Perl-compatible - API & error tests, mostly
134    
135  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
136    if [ "$link_size" = "2" ] ; then    echo "Test 2: API and error handling (not Perl compatible)"
137      echo "Test 2: API and error handling (not Perl compatible)"    $valgrind ./pcretest -q $testdata/testinput2 testtry
138      $valgrind ./pcretest -q $testdata/testinput2 testtry    if [ $? = 0 ] ; then
139      if [ $? = 0 ] ; then      $cf $testdata/testoutput2 testtry
140        $cf testtry $testdata/testoutput2      if [ $? != 0 ] ; then exit 1; fi
141        if [ $? != 0 ] ; then exit 1; fi    else exit 1
     else exit 1  
     fi  
     echo "OK"  
   else  
     echo Test 2 skipped for link size other than 2 \($link_size\)  
     echo " "  
142    fi    fi
143      echo "OK"
144  fi  fi
145    
146  # Locale-specific tests, provided the "fr_FR" locale is available  # Locale-specific tests, provided that either the "fr_FR" or the "french"
147    # locale is available. The former is the Unix-like standard; the latter is
148    # for Windows.
149    
150  if [ $do3 = yes ] ; then  if [ $do3 = yes ] ; then
151    locale -a | grep '^fr_FR$' >/dev/null    locale -a | grep '^fr_FR$' >/dev/null
152    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
153      echo "Test 3: locale-specific features (using 'fr_FR' locale)"      locale=fr_FR
154      $valgrind ./pcretest -q $testdata/testinput3 testtry      infile=$testdata/testinput3
155        outfile=$testdata/testoutput3
156      else
157        locale -a | grep '^french$' >/dev/null
158        if [ $? -eq 0 ] ; then
159          locale=french
160          sed 's/fr_FR/french/' $testdata/testinput3 >test3input
161          sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
162          infile=test3input
163          outfile=test3output
164        else
165          locale=
166        fi
167      fi
168    
169      if [ "$locale" != "" ] ; then
170        echo "Test 3: locale-specific features (using '$locale' locale)"
171        $valgrind ./pcretest -q $infile testtry
172      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
173        $cf testtry $testdata/testoutput3        $cf $outfile testtry
174        if [ $? != 0 ] ; then        if [ $? != 0 ] ; then
175          echo " "          echo " "
176          echo "Locale test did not run entirely successfully."          echo "Locale test did not run entirely successfully."
# Line 179  if [ $do3 = yes ] ; then Line 182  if [ $do3 = yes ] ; then
182      else exit 1      else exit 1
183      fi      fi
184    else    else
185      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
186      echo "or the \"locale\" command is not available to check for it."      echo "'french' locale exists, or the \"locale\" command is not available"
187        echo "to check for them."
188      echo " "      echo " "
189    fi    fi
190  fi  fi
# Line 191  if [ $do4 = yes ] ; then Line 195  if [ $do4 = yes ] ; then
195    echo "Test 4: UTF-8 support (Perl compatible)"    echo "Test 4: UTF-8 support (Perl compatible)"
196    $valgrind ./pcretest -q $testdata/testinput4 testtry    $valgrind ./pcretest -q $testdata/testinput4 testtry
197    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
198      $cf testtry $testdata/testoutput4      $cf $testdata/testoutput4 testtry
199      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
200    else exit 1    else exit 1
201    fi    fi
# Line 199  if [ $do4 = yes ] ; then Line 203  if [ $do4 = yes ] ; then
203  fi  fi
204    
205  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
206    if [ "$link_size" = "2" ] ; then    echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
207      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"    $valgrind ./pcretest -q $testdata/testinput5 testtry
208      $valgrind ./pcretest -q $testdata/testinput5 testtry    if [ $? = 0 ] ; then
209      if [ $? = 0 ] ; then      $cf $testdata/testoutput5 testtry
210        $cf testtry $testdata/testoutput5      if [ $? != 0 ] ; then exit 1; fi
211        if [ $? != 0 ] ; then exit 1; fi    else exit 1
     else exit 1  
     fi  
     echo "OK"  
   else  
     echo Test 5 skipped for link size other than 2 \($link_size\)  
     echo " "  
212    fi    fi
213      echo "OK"
214  fi  fi
215    
216  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
217    if [ "$link_size" = "2" ] ; then    echo "Test 6: Unicode property support"
218      echo "Test 6: Unicode property support"    $valgrind ./pcretest -q $testdata/testinput6 testtry
219      $valgrind ./pcretest -q $testdata/testinput6 testtry    if [ $? = 0 ] ; then
220      if [ $? = 0 ] ; then      $cf $testdata/testoutput6 testtry
221        $cf testtry $testdata/testoutput6      if [ $? != 0 ] ; then exit 1; fi
222        if [ $? != 0 ] ; then exit 1; fi    else exit 1
     else exit 1  
     fi  
     echo "OK"  
   else  
     echo Test 6 skipped for link size other than 2 \($link_size\)  
     echo " "  
223    fi    fi
224      echo "OK"
225  fi  fi
226    
227  # Tests for DFA matching support  # Tests for DFA matching support
# Line 236  if [ $do7 = yes ] ; then Line 230  if [ $do7 = yes ] ; then
230    echo "Test 7: DFA matching"    echo "Test 7: DFA matching"
231    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
232    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
233      $cf testtry $testdata/testoutput7      $cf $testdata/testoutput7 testtry
234      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
235    else exit 1    else exit 1
236    fi    fi
# Line 247  if [ $do8 = yes ] ; then Line 241  if [ $do8 = yes ] ; then
241    echo "Test 8: DFA matching with UTF-8"    echo "Test 8: DFA matching with UTF-8"
242    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry
243    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
244      $cf testtry $testdata/testoutput8      $cf $testdata/testoutput8 testtry
245      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
246    else exit 1    else exit 1
247    fi    fi
# Line 258  if [ $do9 = yes ] ; then Line 252  if [ $do9 = yes ] ; then
252    echo "Test 9: DFA matching with Unicode properties"    echo "Test 9: DFA matching with Unicode properties"
253    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry
254    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
255      $cf testtry $testdata/testoutput9      $cf $testdata/testoutput9 testtry
256        if [ $? != 0 ] ; then exit 1; fi
257      else exit 1
258      fi
259      echo "OK"
260    fi
261    
262    # Test of internal offsets and code sizes. This test is run only when there
263    # is Unicode property support and the link size is 2. The actual tests are
264    # mostly the same as in some of the above, but in this test we inspect some
265    # offsets and sizes that require a known link size. This is a doublecheck for
266    # the maintainer, just in case something changes unexpectely.
267    
268    if [ $do10 = yes ] ; then
269      echo "Test 10: Internal offsets and code size tests"
270      $valgrind ./pcretest -q $testdata/testinput10 testtry
271      if [ $? = 0 ] ; then
272        $cf $testdata/testoutput10 testtry
273      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
274    else exit 1    else exit 1
275    fi    fi

Legend:
Removed from v.128  
changed lines
  Added in v.247

  ViewVC Help
Powered by ViewVC 1.1.5