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

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12