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

Diff of /code/trunk/RunTest.in

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

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

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12