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

Diff of /code/trunk/RunTest

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

revision 674 by ph10, Fri Aug 26 18:17:51 2011 UTC revision 689 by ph10, Fri Sep 9 10:34:57 2011 UTC
# Line 18  Line 18 
18  # two tests for JIT-specific features, one to be run when JIT support is  # two tests for JIT-specific features, one to be run when JIT support is
19  # available, and one when it is not.  # available, and one when it is not.
20    
21  valgrind=  # The arguments for this script can be individual test numbers, or the word
22    # "valgrind", or "sim" followed by an argument to run cross-compiled
23  # Set up a suitable "diff" command for comparison. Some systems  # executables under a simulator, for example:
24  # have a diff that lacks a -u option. Try to deal with this.  #
25    # RunTest 3 sim "qemu-arm -s 8388608"
 if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi  
   
 # Find the test data  
   
 testdata=testdata  
 if [ -n "$srcdir" -a -d "$srcdir" ] ; then  
   testdata="$srcdir/testdata"  
 fi  
   
 # Find which optional facilities are available  
   
 case `./pcretest -C | ./pcregrep 'Internal link size'` in  
   *2) link_size=2;;  
   *3) link_size=3;;  
   *4) link_size=4;;  
    *) echo "Failed to find internal link size"; exit 1;;  
 esac  
   
 ./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null  
 utf8=$?  
   
 ./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null  
 ucp=$?  
   
 jitopt=  
 ./pcretest -C | ./pcregrep \  
   'No Just-in-time compiler support|this architecture is unsupported' \  
   >/dev/null  
 jit=$?  
 if [ $jit -ne 0 ] ; then  
   jitopt=-s+  
 else  
   ./pcretest -C | ./pcregrep 'this architecture is unsupported' >/dev/null  
   jitnotcompiled=$?  
 fi  
26    
27    valgrind=
28    sim=
29    
30  # Select which tests to run; for those that are explicitly requested, check  # Select which tests to run; for those that are explicitly requested, check
31  # that the necessary optional facilities are available.  # that the necessary optional facilities are available.
# Line 97  while [ $# -gt 0 ] ; do Line 64  while [ $# -gt 0 ] ; do
64     14) do14=yes;;     14) do14=yes;;
65     15) do15=yes;;     15) do15=yes;;
66     valgrind) valgrind="valgrind -q --smc-check=all";;     valgrind) valgrind="valgrind -q --smc-check=all";;
67       sim) shift; sim=$1;;
68      *) echo "Unknown test number $1"; exit 1;;      *) echo "Unknown test number $1"; exit 1;;
69    esac    esac
70    shift    shift
71  done  done
72    
73    # Set up a suitable "diff" command for comparison. Some systems
74    # have a diff that lacks a -u option. Try to deal with this.
75    
76    if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi
77    
78    # Find the test data
79    
80    testdata=testdata
81    if [ -n "$srcdir" -a -d "$srcdir" ] ; then
82      testdata="$srcdir/testdata"
83    fi
84    
85    # Find which optional facilities are available
86    
87    case `$sim ./pcretest -C | $sim ./pcregrep 'Internal link size'` in
88      *2) link_size=2;;
89      *3) link_size=3;;
90      *4) link_size=4;;
91       *) echo "Failed to find internal link size"; exit 1;;
92    esac
93    
94    $sim ./pcretest -C | $sim ./pcregrep 'No UTF-8 support' >/dev/null
95    utf8=$?
96    
97    $sim ./pcretest -C | $sim ./pcregrep 'No Unicode properties support' >/dev/null
98    ucp=$?
99    
100    jitopt=
101    $sim ./pcretest -C | $sim ./pcregrep 'No just-in-time compiler support' \
102      >/dev/null
103    jit=$?
104    if [ $jit -ne 0 ] ; then
105      jitopt=-s+
106    fi
107    
108  if [ $utf8 -eq 0 ] ; then  if [ $utf8 -eq 0 ] ; then
109    if [ $do4 = yes ] ; then    if [ $do4 = yes ] ; then
110      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"
# Line 194  echo PCRE C library tests Line 197  echo PCRE C library tests
197  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
198    echo "Test 1: main functionality (Compatible with Perl >= 5.8)"    echo "Test 1: main functionality (Compatible with Perl >= 5.8)"
199    for opt in "" "-s" $jitopt; do    for opt in "" "-s" $jitopt; do
200      $valgrind ./pcretest -q $opt $testdata/testinput1 testtry      $sim $valgrind ./pcretest -q $opt $testdata/testinput1 testtry
201      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
202        $cf $testdata/testoutput1 testtry        $cf $testdata/testoutput1 testtry
203        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
# Line 212  fi Line 215  fi
215  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
216    echo "Test 2: API, errors, internals, and non-Perl stuff"    echo "Test 2: API, errors, internals, and non-Perl stuff"
217    for opt in "" "-s" $jitopt; do    for opt in "" "-s" $jitopt; do
218      $valgrind ./pcretest -q $opt $testdata/testinput2 testtry      $sim $valgrind ./pcretest -q $opt $testdata/testinput2 testtry
219      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
220        $cf $testdata/testoutput2 testtry        $cf $testdata/testoutput2 testtry
221        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
# Line 258  if [ $do3 = yes ] ; then Line 261  if [ $do3 = yes ] ; then
261    if [ "$locale" != "" ] ; then    if [ "$locale" != "" ] ; then
262      echo "Test 3: locale-specific features (using '$locale' locale)"      echo "Test 3: locale-specific features (using '$locale' locale)"
263      for opt in "" "-s" $jitopt; do      for opt in "" "-s" $jitopt; do
264        $valgrind ./pcretest -q $opt $infile testtry        $sim $valgrind ./pcretest -q $opt $infile testtry
265        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
266          $cf $outfile testtry          $cf $outfile testtry
267          if [ $? != 0 ] ; then          if [ $? != 0 ] ; then
# Line 292  if [ $do4 = yes ] ; then Line 295  if [ $do4 = yes ] ; then
295      echo "  Skipped because UTF-8 support is not available"      echo "  Skipped because UTF-8 support is not available"
296    else    else
297      for opt in "" "-s" $jitopt; do      for opt in "" "-s" $jitopt; do
298        $valgrind ./pcretest -q $opt $testdata/testinput4 testtry        $sim $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
299        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
300          $cf $testdata/testoutput4 testtry          $cf $testdata/testoutput4 testtry
301          if [ $? != 0 ] ; then exit 1; fi          if [ $? != 0 ] ; then exit 1; fi
# Line 312  if [ $do5 = yes ] ; then Line 315  if [ $do5 = yes ] ; then
315      echo "  Skipped because UTF-8 support is not available"      echo "  Skipped because UTF-8 support is not available"
316    else    else
317      for opt in "" "-s" $jitopt; do      for opt in "" "-s" $jitopt; do
318        $valgrind ./pcretest -q $opt $testdata/testinput5 testtry        $sim $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
319        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
320          $cf $testdata/testoutput5 testtry          $cf $testdata/testoutput5 testtry
321          if [ $? != 0 ] ; then exit 1; fi          if [ $? != 0 ] ; then exit 1; fi
# Line 332  if [ $do6 = yes ] ; then Line 335  if [ $do6 = yes ] ; then
335      echo "  Skipped because Unicode property support is not available"      echo "  Skipped because Unicode property support is not available"
336    else    else
337      for opt in "" "-s" $jitopt; do      for opt in "" "-s" $jitopt; do
338        $valgrind ./pcretest -q $opt $testdata/testinput6 testtry        $sim $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
339        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
340          $cf $testdata/testoutput6 testtry          $cf $testdata/testoutput6 testtry
341          if [ $? != 0 ] ; then exit 1; fi          if [ $? != 0 ] ; then exit 1; fi
# Line 351  fi Line 354  fi
354  if [ $do7 = yes ] ; then  if [ $do7 = yes ] ; then
355    echo "Test 7: DFA matching"    echo "Test 7: DFA matching"
356    for opt in "" "-s"; do    for opt in "" "-s"; do
357      $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry      $sim $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry
358      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
359        $cf $testdata/testoutput7 testtry        $cf $testdata/testoutput7 testtry
360        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
# Line 367  if [ $do8 = yes ] ; then Line 370  if [ $do8 = yes ] ; then
370      echo "  Skipped because UTF-8 support is not available"      echo "  Skipped because UTF-8 support is not available"
371    else    else
372      for opt in "" "-s"; do      for opt in "" "-s"; do
373        $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry        $sim $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
374        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
375          $cf $testdata/testoutput8 testtry          $cf $testdata/testoutput8 testtry
376          if [ $? != 0 ] ; then exit 1; fi          if [ $? != 0 ] ; then exit 1; fi
# Line 384  if [ $do9 = yes ] ; then Line 387  if [ $do9 = yes ] ; then
387      echo "  Skipped because Unicode property support is not available"      echo "  Skipped because Unicode property support is not available"
388    else    else
389      for opt in "" "-s"; do      for opt in "" "-s"; do
390        $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry        $sim $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
391        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
392          $cf $testdata/testoutput9 testtry          $cf $testdata/testoutput9 testtry
393          if [ $? != 0 ] ; then exit 1; fi          if [ $? != 0 ] ; then exit 1; fi
# Line 409  if [ $do10 = yes ] ; then Line 412  if [ $do10 = yes ] ; then
412      echo "  Skipped because Unicode property support is not available"      echo "  Skipped because Unicode property support is not available"
413    else    else
414      for opt in "" "-s"; do      for opt in "" "-s"; do
415        $valgrind ./pcretest -q $opt $testdata/testinput10 testtry        $sim $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
416        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
417          $cf $testdata/testoutput10 testtry          $cf $testdata/testoutput10 testtry
418          if [ $? != 0 ] ; then exit 1; fi          if [ $? != 0 ] ; then exit 1; fi
# Line 425  fi Line 428  fi
428  if [ $do11 = yes ] ; then  if [ $do11 = yes ] ; then
429    echo "Test 11: Features from Perl >= 5.10 without UTF8 support"    echo "Test 11: Features from Perl >= 5.10 without UTF8 support"
430    for opt in "" "-s" $jitopt; do    for opt in "" "-s" $jitopt; do
431      $valgrind ./pcretest -q $opt $testdata/testinput11 testtry      $sim $valgrind ./pcretest -q $opt $testdata/testinput11 testtry
432      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
433        $cf $testdata/testoutput11 testtry        $cf $testdata/testoutput11 testtry
434        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
# Line 446  if [ $do12 = yes ] ; then Line 449  if [ $do12 = yes ] ; then
449      echo "  Skipped because UTF-8 support is not available"      echo "  Skipped because UTF-8 support is not available"
450    else    else
451      for opt in "" "-s" $jitopt; do      for opt in "" "-s" $jitopt; do
452        $valgrind ./pcretest -q $opt $testdata/testinput12 testtry        $sim $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
453        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
454          $cf $testdata/testoutput12 testtry          $cf $testdata/testoutput12 testtry
455          if [ $? != 0 ] ; then exit 1; fi          if [ $? != 0 ] ; then exit 1; fi
# Line 468  if [ $do13 = yes ] ; then Line 471  if [ $do13 = yes ] ; then
471      echo "  Skipped because Unicode property support is not available"      echo "  Skipped because Unicode property support is not available"
472    else    else
473      for opt in "" "-s" $jitopt; do      for opt in "" "-s" $jitopt; do
474        $valgrind ./pcretest -q $opt $testdata/testinput13 testtry        $sim $valgrind ./pcretest -q $opt $testdata/testinput13 testtry
475        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
476          $cf $testdata/testoutput13 testtry          $cf $testdata/testoutput13 testtry
477          if [ $? != 0 ] ; then exit 1; fi          if [ $? != 0 ] ; then exit 1; fi
# Line 485  fi Line 488  fi
488  # Test JIT-specific features when JIT is available  # Test JIT-specific features when JIT is available
489    
490  if [ $do14 = yes ] ; then  if [ $do14 = yes ] ; then
491    echo "Test 14: JIT-specific features (JIT available and usable)"    echo "Test 14: JIT-specific features (JIT available)"
492    if [ $jit -eq 0 ] ; then    if [ $jit -eq 0 ] ; then
493      echo "  Skipped because JIT is not available or not usable"      echo "  Skipped because JIT is not available or not usable"
494    else    else
495      $valgrind ./pcretest -q $testdata/testinput14 testtry      $sim $valgrind ./pcretest -q $testdata/testinput14 testtry
496      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
497        $cf $testdata/testoutput14 testtry        $cf $testdata/testoutput14 testtry
498        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi
# Line 502  fi Line 505  fi
505  # Test JIT-specific features when JIT is not available  # Test JIT-specific features when JIT is not available
506    
507  if [ $do15 = yes ] ; then  if [ $do15 = yes ] ; then
508    echo "Test 15: JIT-specific features (JIT not available or not usable)"    echo "Test 15: JIT-specific features (JIT not available)"
509    if [ $jit -ne 0 ] ; then    if [ $jit -ne 0 ] ; then
510      echo "  Skipped because JIT is available"      echo "  Skipped because JIT is available"
   elif [ $jitnotcompiled -eq 0 ] ; then  
     echo "  Skipped because JIT does not support this architecture"  
511    else    else
512      $valgrind ./pcretest -q $testdata/testinput15 testtry      $sim $valgrind ./pcretest -q $testdata/testinput15 testtry
513      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
514        $cf $testdata/testoutput15 testtry        $cf $testdata/testoutput15 testtry
515        if [ $? != 0 ] ; then exit 1; fi        if [ $? != 0 ] ; then exit 1; fi

Legend:
Removed from v.674  
changed lines
  Added in v.689

  ViewVC Help
Powered by ViewVC 1.1.5