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

Diff of /code/trunk/RunTest

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

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

Legend:
Removed from v.73  
changed lines
  Added in v.93

  ViewVC Help
Powered by ViewVC 1.1.5