/[pcre]/code/tags/pcre-8.11/RunTest
ViewVC logotype

Diff of /code/tags/pcre-8.11/RunTest

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

code/trunk/RunTest.in revision 63 by nigel, Sat Feb 24 21:40:03 2007 UTC code/trunk/RunTest revision 138 by ph10, Thu Mar 29 15:20:15 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  testdata=@top_srcdir@/testdata  valgrind=
7    testdata=testdata
8    
9    if [ -n "$srcdir" -a -d "$srcdir" ] ; then
10      testdata="$srcdir/testdata"
11    fi
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  # Select which tests to run; if no selection, run all  ./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    # 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
33  do3=no  do3=no
34  do4=no  do4=no
35  do5=no  do5=no
36    do6=no
37    do7=no
38    do8=no
39    do9=no
40    
41  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
42    case $1 in    case $1 in
# Line 22  while [ $# -gt 0 ] ; do Line 44  while [ $# -gt 0 ] ; do
44      2) do2=yes;;      2) do2=yes;;
45      3) do3=yes;;      3) do3=yes;;
46      4) do4=yes;;      4) do4=yes;;
47      5) do5=yes;;      5) do5=yes;;
48        6) do6=yes;;
49        7) do7=yes;;
50        8) do8=yes;;
51        9) do9=yes;;
52        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 [ "@UTF8@" = "" ] ; then  if [ "$link_size" != "2" ] ; then
59      if [ $do2 = yes ] ; then
60        echo "Can't run test 2 with an internal link size other than 2"
61        exit 1
62      fi
63      if [ $do5 = yes ] ; then
64        echo "Can't run test 5 with an internal link size other than 2"
65        exit 1
66      fi
67      if [ $do6 = yes ] ; then
68        echo "Can't run test 6 with an internal link size other than 2"
69        exit 1
70      fi
71    fi
72    
73    if [ $utf8 -eq 0 ] ; then
74    if [ $do4 = yes ] ; then    if [ $do4 = yes ] ; then
75      echo "Can't run test 4 because UFT8 support is not configured"      echo "Can't run test 4 because UTF-8 support is not configured"
76      exit 1      exit 1
77    fi    fi
78    if [ $do5 = yes ] ; then    if [ $do5 = yes ] ; then
79      echo "Can't run test 5 because UFT8 support is not configured"      echo "Can't run test 5 because UTF-8 support is not configured"
80      exit 1      exit 1
81    fi    fi
82  fi    if [ $do6 = yes ] ; then
83        echo "Can't run test 6 because UTF-8 support is not configured"
84        exit 1
85      fi
86      if [ $do8 = yes ] ; then
87        echo "Can't run test 8 because UTF-8 support is not configured"
88        exit 1
89      fi
90      if [ $do9 = yes ] ; then
91        echo "Can't run test 9 because UTF-8 support is not configured"
92        exit 1
93      fi
94    fi
95    
96  if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a\  if [ $ucp -eq 0 ] ; then
97       $do5 = no ] ; then    if [ $do6 = yes ] ; then
98        echo "Can't run test 6 because Unicode property support is not configured"
99        exit 1
100      fi
101      if [ $do9 = yes ] ; then
102        echo "Can't run test 9 because Unicode property support is not configured"
103        exit 1
104      fi
105    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 \
110         $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
111         $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 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
118      do7=yes
119      if [ $utf8 -ne 0 ] ; then do8=yes; fi
120      if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
121  fi  fi
122    
123    # Show which release
124    
125    echo ""
126    echo PCRE C library tests
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
     echo " "  
137    else exit 1    else exit 1
138    fi    fi
139      echo "OK"
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    echo "Testing API and error handling (not Perl compatible)"    if [ "$link_size" = "2" ] ; then
146    ./pcretest -i $testdata/testinput2 testtry      echo "Test 2: API and error handling (not Perl compatible)"
147    if [ $? = 0 ] ; then      $valgrind ./pcretest -q $testdata/testinput2 testtry
148      $cf testtry $testdata/testoutput2      if [ $? = 0 ] ; then
149      if [ $? != 0 ] ; then exit 1; fi        $cf testtry $testdata/testoutput2
150    else exit 1        if [ $? != 0 ] ; then exit 1; fi
151        else exit 1
152        fi
153        echo "OK"
154      else
155        echo Test 2 skipped for link size other than 2 \($link_size\)
156        echo " "
157    fi    fi
158  fi  fi
159    
160  if [ $do1 = yes -a $do2 = yes ] ; then  # Locale-specific tests, provided the "fr_FR" locale is available
   echo " "  
   echo "The two main tests ran OK"  
   echo " "  
 fi  
   
 # Locale-specific tests, provided the "fr" locale is available  
161    
162  if [ $do3 = yes ] ; then  if [ $do3 = yes ] ; then
163    locale -a | grep '^fr$' >/dev/null    locale -a | grep '^fr_FR$' >/dev/null
164    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
165      echo "Testing locale-specific features (using 'fr' locale)"      echo "Test 3: locale-specific features (using 'fr_FR' locale)"
166      ./pcretest $testdata/testinput3 testtry      $valgrind ./pcretest -q $testdata/testinput3 testtry
167      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
168        $cf testtry $testdata/testoutput3        $cf testtry $testdata/testoutput3
169        if [ $? != 0 ] ; then        if [ $? != 0 ] ; then
170          echo " "          echo " "
171          echo "Locale test did not run entirely successfully."          echo "Locale test did not run entirely successfully."
172          echo "This usually means that there is a problem with the locale"          echo "This usually means that there is a problem with the locale"
173          echo "settings rather than a bug in PCRE."          echo "settings rather than a bug in PCRE."
174        else        else
175        echo "Locale test ran OK"        echo "OK"
176        fi        fi
       echo " "  
177      else exit 1      else exit 1
178      fi      fi
179    else    else
180      echo "Cannot test locale-specific features - 'fr' locale not found,"      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"
181      echo "or the \"locale\" command is not available to check for it."      echo "or the \"locale\" command is not available to check for it."
182      echo " "      echo " "
183    fi    fi
184  fi  fi
185    
186  # Additional tests for UTF8 support  # Additional tests for UTF8 support
187    
188  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
189    echo "Testing UTF-8 support (Perl compatible)"    echo "Test 4: UTF-8 support (Perl compatible)"
190    ./pcretest $testdata/testinput4 testtry    $valgrind ./pcretest -q $testdata/testinput4 testtry
191    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
192      $cf testtry $testdata/testoutput4      $cf testtry $testdata/testoutput4
193      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
194    else exit 1    else exit 1
195    fi    fi
196    echo "UTF8 test ran OK"    echo "OK"
   echo " "  
197  fi  fi
198    
199  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
200    echo "Testing API and internals for UTF-8 support (not Perl compatible)"    if [ "$link_size" = "2" ] ; then
201    ./pcretest $testdata/testinput5 testtry      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
202        $valgrind ./pcretest -q $testdata/testinput5 testtry
203        if [ $? = 0 ] ; then
204          $cf testtry $testdata/testoutput5
205          if [ $? != 0 ] ; then exit 1; fi
206        else exit 1
207        fi
208        echo "OK"
209      else
210        echo Test 5 skipped for link size other than 2 \($link_size\)
211        echo " "
212      fi
213    fi
214    
215    if [ $do6 = yes ] ; then
216      if [ "$link_size" = "2" ] ; then
217        echo "Test 6: Unicode property support"
218        $valgrind ./pcretest -q $testdata/testinput6 testtry
219        if [ $? = 0 ] ; then
220          $cf testtry $testdata/testoutput6
221          if [ $? != 0 ] ; then exit 1; fi
222        else exit 1
223        fi
224        echo "OK"
225      else
226        echo Test 6 skipped for link size other than 2 \($link_size\)
227        echo " "
228      fi
229    fi
230    
231    # Tests for DFA matching support
232    
233    if [ $do7 = yes ] ; then
234      echo "Test 7: DFA matching"
235      $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
236      if [ $? = 0 ] ; then
237        $cf testtry $testdata/testoutput7
238        if [ $? != 0 ] ; then exit 1; fi
239      else exit 1
240      fi
241      echo "OK"
242    fi
243    
244    if [ $do8 = yes ] ; then
245      echo "Test 8: DFA matching with UTF-8"
246      $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry
247      if [ $? = 0 ] ; then
248        $cf testtry $testdata/testoutput8
249        if [ $? != 0 ] ; then exit 1; fi
250      else exit 1
251      fi
252      echo "OK"
253    fi
254    
255    if [ $do9 = yes ] ; then
256      echo "Test 9: DFA matching with Unicode properties"
257      $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry
258    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
259      $cf testtry $testdata/testoutput5      $cf testtry $testdata/testoutput9
260      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
261    else exit 1    else exit 1
262    fi    fi
263    echo "UTF8 internals test ran OK"    echo "OK"
   echo " "  
264  fi  fi
265    
266  # End  # End

Legend:
Removed from v.63  
changed lines
  Added in v.138

  ViewVC Help
Powered by ViewVC 1.1.5