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

Diff of /code/trunk/RunTest

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

revision 897 by ph10, Fri Jan 20 14:24:02 2012 UTC revision 1033 by ph10, Mon Sep 10 11:02:48 2012 UTC
# Line 2  Line 2 
2    
3  # Run the PCRE tests using the pcretest program. The appropriate tests are  # Run the PCRE tests using the pcretest program. The appropriate tests are
4  # selected, depending on which build-time options were used.  # selected, depending on which build-time options were used.
5    #
6  # All tests are now run both with and without -s, to ensure that everything is  # All tests are now run both with and without -s, to ensure that everything is
7  # tested with and without studying. However, there are some tests that produce  # tested with and without studying. However, there are some tests that produce
8  # different output after studying, typically when we are tracing the actual  # different output after studying, typically when we are tracing the actual
# Line 12  Line 12 
12  # any difference to their output. There is also one test which compiles invalid  # any difference to their output. There is also one test which compiles invalid
13  # UTF-8 with the UTF-8 check turned off; for this, studying must also be  # UTF-8 with the UTF-8 check turned off; for this, studying must also be
14  # disabled with /SS.  # disabled with /SS.
15    #
16  # When JIT support is available, all the tests are also run with -s+ to test  # When JIT support is available, all the tests are also run with -s+ to test
17  # (again, almost) everything with studying and the JIT option. There are also  # (again, almost) everything with studying and the JIT option. There are also
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  # Whichever of the 8-bit and 16-bit libraries exist are tested. It is also  # Whichever of the 8-bit and 16-bit libraries exist are tested. It is also
22  # possible to select which to test by the arguments -8 or -16.  # possible to select which to test by the arguments -8 or -16.
23    #
24  # Other arguments for this script can be individual test numbers, or the word  # Other arguments for this script can be individual test numbers, or the word
25  # "valgrind", or "sim" followed by an argument to run cross-compiled  # "valgrind", or "sim" followed by an argument to run cross-compiled
26  # executables under a simulator, for example:  # executables under a simulator, for example:
27  #  #
28  # RunTest 3 sim "qemu-arm -s 8388608"  # RunTest 3 sim "qemu-arm -s 8388608"
29    #
30    #
31    # There are two special cases where only one argument is allowed:
32    #
33    # If the first and only argument is "ebcdic", the script runs the special
34    # EBCDIC test that can be useful for checking certain EBCDIC features, even
35    # when run in an ASCII environment.
36    #
37    # If the script is obeyed as "RunTest list", a list of available tests is
38    # output, but none of them are run.
39    
40    
41    # Define test titles in variables so that they can be output as a list. Some
42    # of them are modified (e.g. with -8 or -16) when used in the actual tests.
43    
44    title1="Test 1: Main functionality (Compatible with Perl >= 5.10)"
45    title2="Test 2: API, errors, internals, and non-Perl stuff"
46    title3="Test 3: Locale-specific features"
47    title4A="Test 4: UTF"
48    title4B=" support (Compatible with Perl >= 5.10)"
49    title5="Test 5: API, internals, and non-Perl stuff for UTF"
50    title6="Test 6: Unicode property support (Compatible with Perl >= 5.10)"
51    title7="Test 7: API, internals, and non-Perl stuff for Unicode property support"
52    title8="Test 8: DFA matching main functionality"
53    title9="Test 9: DFA matching with UTF"
54    title10="Test 10: DFA matching with Unicode properties"
55    title11="Test 11: Internal offsets and code size tests"
56    title12="Test 12: JIT-specific features (JIT available)"
57    title13="Test 13: JIT-specific features (JIT not available)"
58    title14="Test 14: Specials for the basic 8-bit library"
59    title15="Test 15: Specials for the 8-bit library with UTF-8 support"
60    title16="Test 16: Specials for the 8-bit library with Unicode propery support"
61    title17="Test 17: Specials for the basic 16-bit library"
62    title18="Test 18: Specials for the 16-bit library with UTF-16 support"
63    title19="Test 19: Specials for the 16-bit library with Unicode propery support"
64    title20="Test 20: DFA specials for the basic 16-bit library"
65    title21="Test 21: Reloads for the basic 16-bit library"
66    title22="Test 22: Reloads for the 16-bit library with UTF-16 support"
67    
68    if [ $# -eq 1 -a "$1" = "list" ]; then
69      echo $title1
70      echo $title2 "(not UTF)"
71      echo $title3
72      echo $title4A $title4B
73      echo $title5 support
74      echo $title6
75      echo $title7
76      echo $title8
77      echo $title9
78      echo $title10
79      echo $title11
80      echo $title12
81      echo $title13
82      echo $title14
83      echo $title15
84      echo $title16
85      echo $title17
86      echo $title18
87      echo $title19
88      echo $title20
89      echo $title21
90      echo $title22
91      exit 0
92    fi
93    
94    # Set up a suitable "diff" command for comparison. Some systems
95    # have a diff that lacks a -u option. Try to deal with this.
96    
97    cf="diff"
98    diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
99    
100    # Find the test data
101    
102    if [ -n "$srcdir" -a -d "$srcdir" ] ; then
103      testdata="$srcdir/testdata"
104    elif [ -d "./testdata" ] ; then
105      testdata=./testdata
106    elif [ -d "../testdata" ] ; then
107      testdata=../testdata
108    else
109      echo "Cannot find the testdata directory"
110      exit 1
111    fi
112    
113    
114    # ------ Special EBCDIC Test -------
115    
116    if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
117      ./pcretest -C ebcdic >/dev/null
118      ebcdic=$?
119      if [ $ebcdic -ne 1 ] ; then
120        echo "Cannot run EBCDIC tests: EBCDIC support not compiled"
121        exit 1
122      fi
123    
124      for opt in "" "-s" "-dfa" "-s -dfa"; do
125        ./pcretest -q $opt $testdata/testinputEBC >testtry
126        if [ $? = 0 ] ; then
127          $cf $testdata/testoutputEBC testtry
128          if [ $? != 0 ] ; then exit 1; fi
129        else exit 1
130        fi
131        if [ "$opt" = "-s" ] ; then echo "  OK with study"
132        elif [ "$opt" = "-dfa" ] ; then echo "  OK using DFA"
133        elif [ "$opt" = "-s -dfa" ] ; then echo "  OK using DFA with study"
134        else echo "  OK"
135        fi
136      done
137    
138    exit 0
139    fi
140    
141    
142    # ------ Normal Tests ------
143    
144    # Default values
145    
146  valgrind=  valgrind=
147  sim=  sim=
# Line 89  while [ $# -gt 0 ] ; do Line 205  while [ $# -gt 0 ] ; do
205    -16) arg16=yes;;    -16) arg16=yes;;
206     valgrind) valgrind="valgrind -q --smc-check=all";;     valgrind) valgrind="valgrind -q --smc-check=all";;
207     sim) shift; sim=$1;;     sim) shift; sim=$1;;
208      *) echo "Unknown test number $1"; exit 1;;      *) echo "Unknown test number '$1'"; exit 1;;
209    esac    esac
210    shift    shift
211  done  done
212    
213  # Set up a suitable "diff" command for comparison. Some systems  # Find which optional facilities are available.
 # have a diff that lacks a -u option. Try to deal with this.  
   
 if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi  
   
 # Find the test data  
   
 if [ -n "$srcdir" -a -d "$srcdir" ] ; then  
   testdata="$srcdir/testdata"  
 elif [ -d "./testdata" ] ; then  
   testdata=./testdata  
 elif [ -d "../testdata" ] ; then  
   testdata=../testdata  
 else  
   echo "Cannot find the testdata directory"  
   exit 1  
 fi  
   
 # Find which optional facilities are available. In some Windows environments  
 # the output of pcretest -C has CRLF at the end of each line, but the shell  
 # strips only linefeeds from the output of a `backquoted` command. Hence the  
 # alternative patterns.  
214    
215  $sim ./pcretest -C linksize >/dev/null  $sim ./pcretest -C linksize >/dev/null
216  link_size=$?  link_size=$?
# Line 135  $sim ./pcretest -C pcre8 >/dev/null Line 230  $sim ./pcretest -C pcre8 >/dev/null
230  support8=$?  support8=$?
231  $sim ./pcretest -C pcre16 >/dev/null  $sim ./pcretest -C pcre16 >/dev/null
232  support16=$?  support16=$?
233  if [ $(( $support8 + $support16 )) -eq 2 ] ; then  if [ `expr $support8 + $support16` -eq 2 ] ; then
234    test8=    test8=
235    test16=-16    test16=-16
236    if [ "$arg8" = yes -a "$arg16" != yes ] ; then    if [ "$arg8" = yes -a "$arg16" != yes ] ; then
# Line 275  if [ $do1  = no -a $do2  = no -a $do3  = Line 370  if [ $do1  = no -a $do2  = no -a $do3  =
370    do19=yes    do19=yes
371    do20=yes    do20=yes
372    do21=yes    do21=yes
373    do22=yes    do22=yes
374  fi  fi
375    
376  # Show which release and which test data  # Show which release and which test data
# Line 295  for bmode in "$test8" "$test16"; do Line 390  for bmode in "$test8" "$test16"; do
390  # Primary test, compatible with JIT and all versions of Perl >= 5.8  # Primary test, compatible with JIT and all versions of Perl >= 5.8
391    
392  if [ $do1 = yes ] ; then  if [ $do1 = yes ] ; then
393    echo "Test 1: main functionality (Compatible with Perl >= 5.10)"    echo $title1
394    for opt in "" "-s" $jitopt; do    for opt in "" "-s" $jitopt; do
395      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput1 testtry
396      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
# Line 313  fi Line 408  fi
408  # PCRE tests that are not JIT or Perl-compatible: API, errors, internals  # PCRE tests that are not JIT or Perl-compatible: API, errors, internals
409    
410  if [ $do2 = yes ] ; then  if [ $do2 = yes ] ; then
411    echo "Test 2: API, errors, internals, and non-Perl stuff (not UTF-$bits)"    echo $title2 "(not UTF-$bits)"
412    for opt in "" "-s" $jitopt; do    for opt in "" "-s" $jitopt; do
413      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry      $sim $valgrind ./pcretest -q $bmode $opt $testdata/testinput2 testtry
414      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
# Line 367  if [ $do3 = yes ] ; then Line 462  if [ $do3 = yes ] ; then
462    fi    fi
463    
464    if [ "$locale" != "" ] ; then    if [ "$locale" != "" ] ; then
465      echo "Test 3: locale-specific features (using '$locale' locale)"      echo $title3 "(using '$locale' locale)"
466      for opt in "" "-s" $jitopt; do      for opt in "" "-s" $jitopt; do
467        $sim $valgrind ./pcretest -q $bmode $opt $infile testtry        $sim $valgrind ./pcretest -q $bmode $opt $infile testtry
468        if [ $? = 0 ] ; then        if [ $? = 0 ] ; then
# Line 398  fi Line 493  fi
493  # Additional tests for UTF support  # Additional tests for UTF support
494    
495  if [ $do4 = yes ] ; then  if [ $do4 = yes ] ; then
496    echo "Test 4: UTF-$bits support (Compatible with Perl >= 5.10)"    echo ${title4A}-${bits}${title4B}
497    if [ $utf -eq 0 ] ; then    if [ $utf -eq 0 ] ; then
498      echo "  Skipped because UTF-$bits support is not available"      echo "  Skipped because UTF-$bits support is not available"
499    else    else
# Line 418  if [ $do4 = yes ] ; then Line 513  if [ $do4 = yes ] ; then
513  fi  fi
514    
515  if [ $do5 = yes ] ; then  if [ $do5 = yes ] ; then
516    echo "Test 5: API, internals, and non-Perl stuff for UTF-$bits support"    echo ${title5}-${bits} support
517    if [ $utf -eq 0 ] ; then    if [ $utf -eq 0 ] ; then
518      echo "  Skipped because UTF-$bits support is not available"      echo "  Skipped because UTF-$bits support is not available"
519    else    else
# Line 438  if [ $do5 = yes ] ; then Line 533  if [ $do5 = yes ] ; then
533  fi  fi
534    
535  if [ $do6 = yes ] ; then  if [ $do6 = yes ] ; then
536    echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"    echo $title6
537    if [ $utf -eq 0 -o $ucp -eq 0 ] ; then    if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
538      echo "  Skipped because Unicode property support is not available"      echo "  Skipped because Unicode property support is not available"
539    else    else
# Line 460  fi Line 555  fi
555  # Test non-Perl-compatible Unicode property support  # Test non-Perl-compatible Unicode property support
556    
557  if [ $do7 = yes ] ; then  if [ $do7 = yes ] ; then
558    echo "Test 7: API, internals, and non-Perl stuff for Unicode property support"    echo $title7
559    if [ $utf -eq 0 -o $ucp -eq 0 ] ; then    if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
560      echo "  Skipped because Unicode property support is not available"      echo "  Skipped because Unicode property support is not available"
561    else    else
# Line 482  fi Line 577  fi
577  # Tests for DFA matching support  # Tests for DFA matching support
578    
579  if [ $do8 = yes ] ; then  if [ $do8 = yes ] ; then
580    echo "Test 8: DFA matching main functionality"    echo $title8
581    for opt in "" "-s"; do    for opt in "" "-s"; do
582      $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry      $sim $valgrind ./pcretest -q $bmode $opt -dfa $testdata/testinput8 testtry
583      if [ $? = 0 ] ; then      if [ $? = 0 ] ; then
# Line 495  if [ $do8 = yes ] ; then Line 590  if [ $do8 = yes ] ; then
590  fi  fi
591    
592  if [ $do9 = yes ] ; then  if [ $do9 = yes ] ; then
593    echo "Test 9: DFA matching with UTF-$bits"    echo ${title9}-${bits}
594    if [ $utf -eq 0 ] ; then    if [ $utf -eq 0 ] ; then
595      echo "  Skipped because UTF-$bits support is not available"      echo "  Skipped because UTF-$bits support is not available"
596    else    else
# Line 512  if [ $do9 = yes ] ; then Line 607  if [ $do9 = yes ] ; then
607  fi  fi
608    
609  if [ $do10 = yes ] ; then  if [ $do10 = yes ] ; then
610    echo "Test 10: DFA matching with Unicode properties"    echo $title10
611    if [ $utf -eq 0 -o $ucp -eq 0 ] ; then    if [ $utf -eq 0 -o $ucp -eq 0 ] ; then
612      echo "  Skipped because Unicode property support is not available"      echo "  Skipped because Unicode property support is not available"
613    else    else
# Line 536  fi Line 631  fi
631  # this test is not the same in 8-bit and 16-bit modes.  # this test is not the same in 8-bit and 16-bit modes.
632    
633  if [ $do11 = yes ] ; then  if [ $do11 = yes ] ; then
634    echo "Test 11: Internal offsets and code size tests"    echo $title11
635    if [ $link_size -ne 2 ] ; then    if [ $link_size -ne 2 ] ; then
636      echo "  Skipped because link size is not 2"      echo "  Skipped because link size is not 2"
637    elif [ $ucp -eq 0 ] ; then    elif [ $ucp -eq 0 ] ; then
# Line 557  fi Line 652  fi
652  # Test JIT-specific features when JIT is available  # Test JIT-specific features when JIT is available
653    
654  if [ $do12 = yes ] ; then  if [ $do12 = yes ] ; then
655    echo "Test 12: JIT-specific features (JIT available)"    echo $title12
656    if [ $jit -eq 0 ] ; then    if [ $jit -eq 0 ] ; then
657      echo "  Skipped because JIT is not available or not usable"      echo "  Skipped because JIT is not available or not usable"
658    else    else
# Line 574  fi Line 669  fi
669  # Test JIT-specific features when JIT is not available  # Test JIT-specific features when JIT is not available
670    
671  if [ $do13 = yes ] ; then  if [ $do13 = yes ] ; then
672    echo "Test 13: JIT-specific features (JIT not available)"    echo $title13
673    if [ $jit -ne 0 ] ; then    if [ $jit -ne 0 ] ; then
674      echo "  Skipped because JIT is available"      echo "  Skipped because JIT is available"
675    else    else
# Line 591  fi Line 686  fi
686  # Tests for 8-bit-specific features  # Tests for 8-bit-specific features
687    
688  if [ "$do14" = yes ] ; then  if [ "$do14" = yes ] ; then
689    echo "Test 14: specials for the basic 8-bit library"    echo $title14
690    if [ "$bits" = "16" ] ; then    if [ "$bits" = "16" ] ; then
691      echo "  Skipped when running 16-bit tests"      echo "  Skipped when running 16-bit tests"
692    else    else
# Line 614  fi Line 709  fi
709  # Tests for 8-bit-specific features (needs UTF-8 support)  # Tests for 8-bit-specific features (needs UTF-8 support)
710    
711  if [ "$do15" = yes ] ; then  if [ "$do15" = yes ] ; then
712    echo "Test 15: specials for the 8-bit library with UTF-8 support"    echo $title15
713    if [ "$bits" = "16" ] ; then    if [ "$bits" = "16" ] ; then
714      echo "  Skipped when running 16-bit tests"      echo "  Skipped when running 16-bit tests"
715    elif [ $utf -eq 0 ] ; then    elif [ $utf -eq 0 ] ; then
# Line 638  fi Line 733  fi
733  # Tests for 8-bit-specific features (Unicode property support)  # Tests for 8-bit-specific features (Unicode property support)
734    
735  if [ $do16 = yes ] ; then  if [ $do16 = yes ] ; then
736    echo "Test 16: specials for the 8-bit library with Unicode propery support"    echo $title16
737    if [ "$bits" = "16" ] ; then    if [ "$bits" = "16" ] ; then
738      echo "  Skipped when running 16-bit tests"      echo "  Skipped when running 16-bit tests"
739    elif [ $ucp -eq 0 ] ; then    elif [ $ucp -eq 0 ] ; then
# Line 662  fi Line 757  fi
757  # Tests for 16-bit-specific features  # Tests for 16-bit-specific features
758    
759  if [ $do17 = yes ] ; then  if [ $do17 = yes ] ; then
760    echo "Test 17: specials for the basic 16-bit library"    echo $title17
761    if [ "$bits" = "8" ] ; then    if [ "$bits" = "8" ] ; then
762      echo "  Skipped when running 8-bit tests"      echo "  Skipped when running 8-bit tests"
763    else    else
# Line 684  fi Line 779  fi
779  # Tests for 16-bit-specific features (UTF-16 support)  # Tests for 16-bit-specific features (UTF-16 support)
780    
781  if [ $do18 = yes ] ; then  if [ $do18 = yes ] ; then
782    echo "Test 18: specials for the 16-bit library with UTF-16 support"    echo $title18
783    if [ "$bits" = "8" ] ; then    if [ "$bits" = "8" ] ; then
784      echo "  Skipped when running 8-bit tests"      echo "  Skipped when running 8-bit tests"
785    elif [ $utf -eq 0 ] ; then    elif [ $utf -eq 0 ] ; then
# Line 708  fi Line 803  fi
803  # Tests for 16-bit-specific features (Unicode property support)  # Tests for 16-bit-specific features (Unicode property support)
804    
805  if [ $do19 = yes ] ; then  if [ $do19 = yes ] ; then
806    echo "Test 19: specials for the 16-bit library with Unicode propery support"    echo $title19
807    if [ "$bits" = "8" ] ; then    if [ "$bits" = "8" ] ; then
808      echo "  Skipped when running 8-bit tests"      echo "  Skipped when running 8-bit tests"
809    elif [ $ucp -eq 0 ] ; then    elif [ $ucp -eq 0 ] ; then
# Line 732  fi Line 827  fi
827  # Tests for 16-bit-specific features in DFA non-UTF-16 mode  # Tests for 16-bit-specific features in DFA non-UTF-16 mode
828    
829  if [ $do20 = yes ] ; then  if [ $do20 = yes ] ; then
830    echo "Test 20: DFA specials for the basic 16-bit library"    echo $title20
831    if [ "$bits" = "8" ] ; then    if [ "$bits" = "8" ] ; then
832      echo "  Skipped when running 8-bit tests"      echo "  Skipped when running 8-bit tests"
833    else    else
# Line 753  fi Line 848  fi
848  # Tests for reloads with 16-bit library  # Tests for reloads with 16-bit library
849    
850  if [ $do21 = yes ] ; then  if [ $do21 = yes ] ; then
851    echo "Test 21: reloads for the basic 16-bit library"    echo $title21
852    if [ "$bits" = "8" ] ; then    if [ "$bits" = "8" ] ; then
853      echo "  Skipped when running 8-bit tests"      echo "  Skipped when running 8-bit tests"
854    elif [ $link_size -ne 2 ] ; then    elif [ $link_size -ne 2 ] ; then
# Line 775  fi Line 870  fi
870  # Tests for reloads with 16-bit library (UTF-16 support)  # Tests for reloads with 16-bit library (UTF-16 support)
871    
872  if [ $do22 = yes ] ; then  if [ $do22 = yes ] ; then
873    echo "Test 22: reloads for the 16-bit library with UTF-16 support"    echo $title22
874    if [ "$bits" = "8" ] ; then    if [ "$bits" = "8" ] ; then
875      echo "  Skipped when running 8-bit tests"      echo "  Skipped when running 8-bit tests"
876    elif [ $utf -eq 0 ] ; then    elif [ $utf -eq 0 ] ; then

Legend:
Removed from v.897  
changed lines
  Added in v.1033

  ViewVC Help
Powered by ViewVC 1.1.5