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

Diff of /code/trunk/RunTest

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

revision 49 by nigel, Sat Feb 24 21:39:33 2007 UTC revision 116 by ph10, Fri Mar 9 15:23:02 2007 UTC
# Line 6  Line 6 
6  # Run PCRE tests  # Run PCRE tests
7    
8  cf=diff  cf=diff
9    valgrind=
10    if [ ! -d testdata ] ; then
11      ln -s @top_srcdir@/testdata testdata
12    fi
13    testdata=./testdata
14    
15    # Find which optional facilities are available
16    
17    case `./pcretest -C | ./pcregrep 'Internal link size'` in
18      *2) link_size=2;;
19      *3) link_size=3;;
20      *4) link_size=4;;
21       *) echo "Failed to find internal link size"; exit 1;;
22    esac
23    
24  # Select which tests to run; if no selection, run all  ./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null
25    utf8=$?
26    
27    ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null
28    ucp=$?
29    
30    # Select which tests to run; for those that are explicitly requested, check
31    # that the necessary optional facilities are available.
32    
33  do1=no  do1=no
34  do2=no  do2=no
# Line 15  do3=no Line 36  do3=no
36  do4=no  do4=no
37  do5=no  do5=no
38  do6=no  do6=no
39    do7=no
40    do8=no
41    do9=no
42    
43  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
44    case $1 in    case $1 in
# Line 22  while [ $# -gt 0 ] ; do Line 46  while [ $# -gt 0 ] ; do
46      2) do2=yes;;      2) do2=yes;;
47      3) do3=yes;;      3) do3=yes;;
48      4) do4=yes;;      4) do4=yes;;
49      5) do5=yes;;      5) do5=yes;;
50      6) do6=yes;;      6) do6=yes;;
51        7) do7=yes;;
52        8) do8=yes;;
53        9) do9=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 [ "@UTF8@" = "" ] ; then  if [ "$link_size" != "2" ] ; then
61      if [ $do2 = yes ] ; then
62        echo "Can't run test 2 with an internal link size other than 2"
63        exit 1
64      fi
65    if [ $do5 = yes ] ; then    if [ $do5 = yes ] ; then
66      echo "Can't run test 5 because UFT8 support is not configured"      echo "Can't run test 5 with an internal link size other than 2"
67        exit 1
68      fi
69      if [ $do6 = yes ] ; then
70        echo "Can't run test 6 with an internal link size other than 2"
71        exit 1
72      fi
73    fi
74    
75    if [ $utf8 -eq 0 ] ; then
76      if [ $do4 = yes ] ; then
77        echo "Can't run test 4 because UTF-8 support is not configured"
78        exit 1
79      fi
80      if [ $do5 = yes ] ; then
81        echo "Can't run test 5 because UTF-8 support is not configured"
82        exit 1
83      fi
84      if [ $do6 = yes ] ; then
85        echo "Can't run test 6 because UTF-8 support is not configured"
86        exit 1
87      fi
88      if [ $do8 = yes ] ; then
89        echo "Can't run test 8 because UTF-8 support is not configured"
90        exit 1
91      fi
92      if [ $do9 = yes ] ; then
93        echo "Can't run test 9 because UTF-8 support is not configured"
94      exit 1      exit 1
95    fi    fi
96    fi
97    
98    if [ $ucp -eq 0 ] ; then
99    if [ $do6 = yes ] ; then    if [ $do6 = yes ] ; then
100      echo "Can't run test 6 because UFT8 support is not configured"      echo "Can't run test 6 because Unicode property support is not configured"
101      exit 1      exit 1
102    fi    fi
103  fi    if [ $do9 = yes ] ; then
104        echo "Can't run test 9 because Unicode property support is not configured"
105        exit 1
106      fi
107    fi
108    
109    # If no specific tests were requested, select all that are relevant.
110    
111  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 \
112       $do5 = no -a $do6 = no ] ; then       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
113         $do9 = no ] ; then
114    do1=yes    do1=yes
115    do2=yes    do2=yes
116    do3=yes    do3=yes
117    do4=yes    if [ $utf8 -ne 0 ] ; then do4=yes; fi
118    if [ "@UTF8@" != "" ] ; then do5=yes; fi    if [ $utf8 -ne 0 ] ; then do5=yes; fi
119    if [ "@UTF8@" != "" ] ; then do6=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
120      do7=yes
121      if [ $utf8 -ne 0 ] ; then do8=yes; fi
122      if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
123  fi  fi
124    
125    # Show which release
126    
127    ./pcretest /dev/null
128    
129  # Primary test, Perl-compatible  # Primary test, Perl-compatible
130    
131  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
132    echo "Testing main functionality (Perl compatible)"    echo "Test 1: main functionality (Perl compatible)"
133    ./pcretest testdata/testinput1 testtry    $valgrind ./pcretest -q $testdata/testinput1 testtry
134    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
135      $cf testtry testdata/testoutput1      $cf testtry $testdata/testoutput1
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"
140      echo " "
141  fi  fi
142    
143  # PCRE tests that are not Perl-compatible - API & error tests, mostly  # PCRE tests that are not Perl-compatible - API & error tests, mostly
144    
145  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
146    echo "Testing API and error handling (not Perl compatible)"    if [ "$link_size" = "2" ] ; then
147    ./pcretest -i testdata/testinput2 testtry      echo "Test 2: API and error handling (not Perl compatible)"
148    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $testdata/testinput2 testtry
149      $cf testtry testdata/testoutput2      if [ $? = 0 ] ; then
150      if [ $? != 0 ] ; then exit 1; fi        $cf testtry $testdata/testoutput2
151    else exit 1        if [ $? != 0 ] ; then exit 1; fi
152        else exit 1
153        fi
154        echo "OK"
155        echo " "
156      else
157        echo Test 2 skipped for link size other than 2 \($link_size\)
158        echo " "
159    fi    fi
160  fi  fi
161    
162  # Additional Perl-compatible tests for Perl 5.005's new features  # Locale-specific tests, provided the "fr_FR" locale is available
163    
164  if [ $do3 = yes ] ; then  if [ $do3 = yes ] ; then
165    echo "Testing Perl 5.005 features (Perl 5.005 compatible)"    locale -a | grep '^fr_FR$' >/dev/null
   ./pcretest testdata/testinput3 testtry  
   if [ $? = 0 ] ; then  
     $cf testtry testdata/testoutput3  
     if [ $? != 0 ] ; then exit 1; fi  
   else exit 1  
   fi  
 fi  
   
 if [ $do1 = yes -a $do2 = yes -a $do3 = yes ] ; then  
   echo " "  
   echo "The three main tests all ran OK"  
   echo " "  
 fi  
   
 # Locale-specific tests, provided the "fr" locale is available  
   
 if [ $do4 = yes ] ; then  
   locale -a | grep '^fr$' >/dev/null  
166    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
167      echo "Testing locale-specific features (using 'fr' locale)"      echo "Test 3: locale-specific features (using 'fr_FR' locale)"
168      ./pcretest testdata/testinput4 testtry      $valgrind ./pcretest -q $testdata/testinput3 testtry
169      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
170        $cf testtry testdata/testoutput4        $cf testtry $testdata/testoutput3
171        if [ $? != 0 ] ; then        if [ $? != 0 ] ; then
172          echo " "          echo " "
173          echo "Locale test did not run entirely successfully."          echo "Locale test did not run entirely successfully."
174          echo "This usually means that there is a problem with the locale"          echo "This usually means that there is a problem with the locale"
175          echo "settings rather than a bug in PCRE."          echo "settings rather than a bug in PCRE."
176        else        else
177        echo "Locale test ran OK"        echo "OK"
178        fi        fi
179        echo " "        echo " "
180      else exit 1      else exit 1
181      fi      fi
182    else    else
183      echo "Cannot test locale-specific features - 'fr' locale not found,"      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"
184      echo "or the \"locale\" command is not available to check for it."      echo "or the \"locale\" command is not available to check for it."
185      echo " "      echo " "
186    fi    fi
187  fi  fi
188    
189  # Additional tests for UTF8 support  # Additional tests for UTF8 support
190    
191  if [ $do5 = yes ] ; then  if [ $do4 = yes ] ; then
192    echo "Testing experimental, incomplete UTF8 support (Perl compatible)"    echo "Test 4: UTF-8 support (Perl compatible)"
193    ./pcretest testdata/testinput5 testtry    $valgrind ./pcretest -q $testdata/testinput4 testtry
194    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
195      $cf testtry testdata/testoutput5      $cf testtry $testdata/testoutput4
196      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
197    else exit 1    else exit 1
198    fi    fi
199    echo "UTF8 test ran OK"    echo "OK"
200    echo " "    echo " "
201  fi  fi
202    
203    if [ $do5 = yes ] ; then
204      if [ "$link_size" = "2" ] ; then
205        echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
206        $valgrind ./pcretest -q $testdata/testinput5 testtry
207        if [ $? = 0 ] ; then
208          $cf testtry $testdata/testoutput5
209          if [ $? != 0 ] ; then exit 1; fi
210        else exit 1
211        fi
212        echo "OK"
213        echo " "
214      else
215        echo Test 5 skipped for link size other than 2 \($link_size\)
216        echo " "
217      fi
218    fi
219    
220  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
221    echo "Testing API and internals for UTF8 support (not Perl compatible)"    if [ "$link_size" = "2" ] ; then
222    ./pcretest testdata/testinput6 testtry      echo "Test 6: Unicode property support"
223        $valgrind ./pcretest -q $testdata/testinput6 testtry
224        if [ $? = 0 ] ; then
225          $cf testtry $testdata/testoutput6
226          if [ $? != 0 ] ; then exit 1; fi
227        else exit 1
228        fi
229        echo "OK"
230        echo " "
231      else
232        echo Test 6 skipped for link size other than 2 \($link_size\)
233        echo " "
234      fi
235    fi
236    
237    # Tests for DFA matching support
238    
239    if [ $do7 = yes ] ; then
240      echo "Test 7: DFA matching"
241      $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
242      if [ $? = 0 ] ; then
243        $cf testtry $testdata/testoutput7
244        if [ $? != 0 ] ; then exit 1; fi
245      else exit 1
246      fi
247      echo "OK"
248      echo " "
249    fi
250    
251    if [ $do8 = yes ] ; then
252      echo "Test 8: DFA matching with UTF-8"
253      $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry
254      if [ $? = 0 ] ; then
255        $cf testtry $testdata/testoutput8
256        if [ $? != 0 ] ; then exit 1; fi
257      else exit 1
258      fi
259      echo "OK"
260      echo " "
261    fi
262    
263    if [ $do9 = yes ] ; then
264      echo "Test 9: DFA matching with Unicode properties"
265      $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry
266    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
267      $cf testtry testdata/testoutput6      $cf testtry $testdata/testoutput9
268      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
269    else exit 1    else exit 1
270    fi    fi
271    echo "UTF8 internals test ran OK"    echo "OK"
272    echo " "    echo " "
273  fi  fi
274    

Legend:
Removed from v.49  
changed lines
  Added in v.116

  ViewVC Help
Powered by ViewVC 1.1.5