/[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 81 by nigel, Sat Feb 24 21:40:59 2007 UTC code/trunk/RunTest revision 162 by ph10, Thu May 3 10:47:48 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  if [ ! -d testdata ] ; then  valgrind=
7    ln -s @top_srcdir@/testdata testdata  testdata=testdata
8    
9    if [ -n "$srcdir" -a -d "$srcdir" ] ; then
10      testdata="$srcdir/testdata"
11  fi  fi
 testdata=./testdata  
12    
13  # Select which tests to run; if no selection, run all  # 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    ./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
# Line 34  while [ $# -gt 0 ] ; do Line 49  while [ $# -gt 0 ] ; do
49      7) do7=yes;;      7) do7=yes;;
50      8) do8=yes;;      8) do8=yes;;
51      9) do9=yes;;      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 [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then  if [ $utf8 -eq 0 ] ; then
   if [ $do2 = yes ] ; then  
     echo "Can't run test 2 with an internal link size other than 2"  
     exit 1  
   fi  
   if [ $do5 = yes ] ; then  
     echo "Can't run test 5 with an internal link size other than 2"  
     exit 1  
   fi  
   if [ $do6 = yes ] ; then  
     echo "Can't run test 6 with an internal link size other than 2"  
     exit 1  
   fi  
 fi  
   
 if [ "@UTF8@" = "" ] ; then  
59    if [ $do4 = yes ] ; then    if [ $do4 = yes ] ; then
60      echo "Can't run test 4 because UTF-8 support is not configured"      echo "Can't run test 4 because UTF-8 support is not configured"
61      exit 1      exit 1
# Line 77  if [ "@UTF8@" = "" ] ; then Line 78  if [ "@UTF8@" = "" ] ; then
78    fi    fi
79  fi  fi
80    
81  if [ "@UCP@" = "" ] ; then  if [ $ucp -eq 0 ] ; then
82    if [ $do6 = yes ] ; then    if [ $do6 = yes ] ; then
83      echo "Can't run test 6 because Unicode property support is not configured"      echo "Can't run test 6 because Unicode property support is not configured"
84      exit 1      exit 1
# Line 88  if [ "@UCP@" = "" ] ; then Line 89  if [ "@UCP@" = "" ] ; then
89    fi    fi
90  fi  fi
91    
92    # If no specific tests were requested, select all that are relevant.
93    
94  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 \
95       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \       $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
96       $do9 = no ] ; then       $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 -ne 0 ] ; then do4=yes; fi
101    if [ "@UTF8@" != "" ] ; then do5=yes; fi    if [ $utf8 -ne 0 ] ; then do5=yes; fi
102    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
103    do7=yes    do7=yes
104    if [ "@UTF8@" != "" ] ; then do8=yes; fi    if [ $utf8 -ne 0 ] ; then do8=yes; fi
105    if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do9=yes; fi    if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
106  fi  fi
107    
108  # Show which release  # Show which release
109    
110    echo ""
111    echo PCRE C library tests
112  ./pcretest /dev/null  ./pcretest /dev/null
113    
114  # Primary test, Perl-compatible  # Primary test, Perl-compatible
115    
116  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
117    echo "Test 1: main functionality (Perl compatible)"    echo "Test 1: main functionality (Perl compatible)"
118    ./pcretest $testdata/testinput1 testtry    $valgrind ./pcretest -q $testdata/testinput1 testtry
119    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
120      $cf testtry $testdata/testoutput1      $cf $testdata/testoutput1 testtry
121      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
122    else exit 1    else exit 1
123    fi    fi
124    echo "OK"    echo "OK"
   echo " "  
125  fi  fi
126    
127  # PCRE tests that are not Perl-compatible - API & error tests, mostly  # PCRE tests that are not Perl-compatible - API & error tests, mostly
128    
129  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
130    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo "Test 2: API and error handling (not Perl compatible)"
131      echo "Test 2: API and error handling (not Perl compatible)"    $valgrind ./pcretest -q $testdata/testinput2 testtry
132      ./pcretest -i $testdata/testinput2 testtry    if [ $? = 0 ] ; then
133      if [ $? = 0 ] ; then      $cf $testdata/testoutput2 testtry
134        $cf testtry $testdata/testoutput2      if [ $? != 0 ] ; then exit 1; fi
135        if [ $? != 0 ] ; then exit 1; fi    else exit 1
     else exit 1  
     fi  
     echo "OK"  
     echo " "  
   else  
     echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\)  
     echo " "  
136    fi    fi
137      echo "OK"
138  fi  fi
139    
140  # Locale-specific tests, provided the "fr_FR" locale is available  # Locale-specific tests, provided that either the "fr_FR" or the "french"
141    # locale is available. The former is the Unix-like standard; the latter is
142    # for Windows.
143    
144  if [ $do3 = yes ] ; then  if [ $do3 = yes ] ; then
145    locale -a | grep '^fr_FR$' >/dev/null    locale -a | grep '^fr_FR$' >/dev/null
146    if [ $? -eq 0 ] ; then    if [ $? -eq 0 ] ; then
147      echo "Test 3: locale-specific features (using 'fr_FR' locale)"      locale=fr_FR
148      ./pcretest $testdata/testinput3 testtry      infile=$testdata/testinput3
149        outfile=$testdata/testoutput3
150      else
151        locale -a | grep '^french$' >/dev/null
152        if [ $? -eq 0 ] ; then
153          locale=french
154          sed 's/fr_FR/french/' $testdata/testinput3 >test3input
155          sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
156          infile=test3input
157          outfile=test3output
158        else
159          locale=
160        fi
161      fi
162    
163      if [ "$locale" != "" ] ; then
164        echo "Test 3: locale-specific features (using '$locale' locale)"
165        $valgrind ./pcretest -q $infile testtry
166      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
167        $cf testtry $testdata/testoutput3        $cf $outfile testtry
168        if [ $? != 0 ] ; then        if [ $? != 0 ] ; then
169          echo " "          echo " "
170          echo "Locale test did not run entirely successfully."          echo "Locale test did not run entirely successfully."
# Line 156  if [ $do3 = yes ] ; then Line 173  if [ $do3 = yes ] ; then
173        else        else
174        echo "OK"        echo "OK"
175        fi        fi
       echo " "  
176      else exit 1      else exit 1
177      fi      fi
178    else    else
179      echo "Cannot test locale-specific features - 'fr_FR' locale not found,"      echo "Cannot test locale-specific features - neither the 'fr_FR' nor the"
180      echo "or the \"locale\" command is not available to check for it."      echo "'french' locale exists, or the \"locale\" command is not available"
181        echo "to check for them."
182      echo " "      echo " "
183    fi    fi
184  fi  fi
# Line 170  fi Line 187  fi
187    
188  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
189    echo "Test 4: 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 $testdata/testoutput4 testtry
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 "OK"    echo "OK"
   echo " "  
197  fi  fi
198    
199  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
200    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
201      echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"    $valgrind ./pcretest -q $testdata/testinput5 testtry
202      ./pcretest $testdata/testinput5 testtry    if [ $? = 0 ] ; then
203      if [ $? = 0 ] ; then      $cf $testdata/testoutput5 testtry
204        $cf testtry $testdata/testoutput5      if [ $? != 0 ] ; then exit 1; fi
205        if [ $? != 0 ] ; then exit 1; fi    else exit 1
     else exit 1  
     fi  
     echo "OK"  
     echo " "  
   else  
     echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\)  
     echo " "  
206    fi    fi
207      echo "OK"
208  fi  fi
209    
210  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
211    if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then    echo "Test 6: Unicode property support"
212      echo "Test 6: Unicode property support"    $valgrind ./pcretest -q $testdata/testinput6 testtry
213      ./pcretest $testdata/testinput6 testtry    if [ $? = 0 ] ; then
214      if [ $? = 0 ] ; then      $cf $testdata/testoutput6 testtry
215        $cf testtry $testdata/testoutput6      if [ $? != 0 ] ; then exit 1; fi
216        if [ $? != 0 ] ; then exit 1; fi    else exit 1
     else exit 1  
     fi  
     echo "OK"  
     echo " "  
   else  
     echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)  
     echo " "  
217    fi    fi
218      echo "OK"
219  fi  fi
220    
221  # Tests for DFA matching support  # Tests for DFA matching support
222    
223  if [ $do7 = yes ] ; then  if [ $do7 = yes ] ; then
224    echo "Test 7: DFA matching"    echo "Test 7: DFA matching"
225    ./pcretest -dfa $testdata/testinput7 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput7 testtry
226    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
227      $cf testtry $testdata/testoutput7      $cf $testdata/testoutput7 testtry
228      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
229    else exit 1    else exit 1
230    fi    fi
231    echo "OK"    echo "OK"
   echo " "  
232  fi  fi
233    
234  if [ $do8 = yes ] ; then  if [ $do8 = yes ] ; then
235    echo "Test 8: DFA matching with UTF-8"    echo "Test 8: DFA matching with UTF-8"
236    ./pcretest -dfa $testdata/testinput8 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput8 testtry
237    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
238      $cf testtry $testdata/testoutput8      $cf $testdata/testoutput8 testtry
239      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
240    else exit 1    else exit 1
241    fi    fi
242    echo "OK"    echo "OK"
   echo " "  
243  fi  fi
244    
245  if [ $do9 = yes ] ; then  if [ $do9 = yes ] ; then
246    echo "Test 9: DFA matching with Unicode properties"    echo "Test 9: DFA matching with Unicode properties"
247    ./pcretest -dfa $testdata/testinput9 testtry    $valgrind ./pcretest -q -dfa $testdata/testinput9 testtry
248    if [ $? = 0 ] ; then    if [ $? = 0 ] ; then
249      $cf testtry $testdata/testoutput9      $cf $testdata/testoutput9 testtry
250      if [ $? != 0 ] ; then exit 1; fi      if [ $? != 0 ] ; then exit 1; fi
251    else exit 1    else exit 1
252    fi    fi
253    echo "OK"    echo "OK"
   echo " "  
254  fi  fi
255    
256  # End  # End

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

  ViewVC Help
Powered by ViewVC 1.1.5