github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

916 lines
26 KiB

  1. #! /bin/sh
  2. ###############################################################################
  3. # Run the PCRE2 tests using the pcre2test program. The appropriate tests are
  4. # selected, depending on which build-time options were used.
  5. #
  6. # When JIT support is available, all appropriate tests are run with and without
  7. # JIT, unless "-nojit" is given on the command line. There are also two tests
  8. # for JIT-specific features, one to be run when JIT support is available
  9. # (unless "-nojit" is specified), and one when it is not.
  10. #
  11. # Whichever of the 8-, 16- and 32-bit libraries exist are tested. It is also
  12. # possible to select which to test by giving "-8", "-16" or "-32" on the
  13. # command line.
  14. #
  15. # As well as "-nojit", "-8", "-16", and "-32", arguments for this script are
  16. # individual test numbers, ranges of tests such as 3-6 or 3- (meaning 3 to the
  17. # end), or a number preceded by ~ to exclude a test. For example, "3-15 ~10"
  18. # runs tests 3 to 15, excluding test 10, and just "~10" runs all the tests
  19. # except test 10. Whatever order the arguments are in, these tests are always
  20. # run in numerical order.
  21. #
  22. # If no specific tests are selected (which is the case when this script is run
  23. # via 'make check') the default is to run all the numbered tests.
  24. #
  25. # There may also be named (as well as numbered) tests for special purposes. At
  26. # present there is just one, called "heap". This test's output contains the
  27. # sizes of heap frames and frame vectors, which depend on the environment. It
  28. # is therefore not run unless explicitly requested.
  29. #
  30. # Inappropriate tests are automatically skipped (with a comment to say so). For
  31. # example, if JIT support is not compiled, test 16 is skipped, whereas if JIT
  32. # support is compiled, test 15 is skipped.
  33. #
  34. # Other arguments can be one of the words "-valgrind", "-valgrind-log", or
  35. # "-sim" followed by an argument to run cross-compiled executables under a
  36. # simulator, for example:
  37. #
  38. # RunTest 3 -sim "qemu-arm -s 8388608"
  39. #
  40. # For backwards compatibility, -nojit, -valgrind, -valgrind-log, and -sim may
  41. # be given without the leading "-" character.
  42. #
  43. # When PCRE2 is compiled by clang with -fsanitize arguments, some tests need
  44. # very much more stack than normal. In environments where the stack can be
  45. # set at runtime, -bigstack sets a gigantic stack.
  46. #
  47. # There are two special cases where only one argument is allowed:
  48. #
  49. # If the first and only argument is "ebcdic", the script runs the special
  50. # EBCDIC test that can be useful for checking certain EBCDIC features, even
  51. # when run in an ASCII environment. PCRE2 must be built with EBCDIC support for
  52. # this test to be run.
  53. #
  54. # If the script is obeyed as "RunTest list", a list of available tests is
  55. # output, but none of them are run.
  56. ###############################################################################
  57. # Define test titles in variables so that they can be output as a list. Some
  58. # of them are modified (e.g. with -8 or -16) when used in the actual tests.
  59. title0="Test 0: Unchecked pcre2test argument tests (to improve coverage)"
  60. title1="Test 1: Main non-UTF, non-UCP functionality (compatible with Perl >= 5.10)"
  61. title2="Test 2: API, errors, internals and non-Perl stuff"
  62. title3="Test 3: Locale-specific features"
  63. title4A="Test 4: UTF"
  64. title4B=" and Unicode property support (compatible with Perl >= 5.10)"
  65. title5A="Test 5: API, internals, and non-Perl stuff for UTF"
  66. title5B=" and UCP support"
  67. title6="Test 6: DFA matching main non-UTF, non-UCP functionality"
  68. title7A="Test 7: DFA matching with UTF"
  69. title7B=" and Unicode property support"
  70. title8="Test 8: Internal offsets and code size tests"
  71. title9="Test 9: Specials for the basic 8-bit library"
  72. title10="Test 10: Specials for the 8-bit library with UTF-8 and UCP support"
  73. title11="Test 11: Specials for the basic 16-bit and 32-bit libraries"
  74. title12="Test 12: Specials for the 16-bit and 32-bit libraries UTF and UCP support"
  75. title13="Test 13: DFA specials for the basic 16-bit and 32-bit libraries"
  76. title14="Test 14: DFA specials for UTF and UCP support"
  77. title15="Test 15: Non-JIT limits and other non-JIT tests"
  78. title16="Test 16: JIT-specific features when JIT is not available"
  79. title17="Test 17: JIT-specific features when JIT is available"
  80. title18="Test 18: Tests of the POSIX interface, excluding UTF/UCP"
  81. title19="Test 19: Tests of the POSIX interface with UTF/UCP"
  82. title20="Test 20: Serialization and code copy tests"
  83. title21="Test 21: \C tests without UTF (supported for DFA matching)"
  84. title22="Test 22: \C tests with UTF (not supported for DFA matching)"
  85. title23="Test 23: \C disabled test"
  86. title24="Test 24: Non-UTF pattern conversion tests"
  87. title25="Test 25: UTF pattern conversion tests"
  88. title26="Test 26: Auto-generated unicode property tests"
  89. maxtest=26
  90. titleheap="Test 'heap': Environment-specific heap tests"
  91. if [ $# -eq 1 -a "$1" = "list" ]; then
  92. echo $title0
  93. echo $title1
  94. echo $title2 "(not UTF or UCP)"
  95. echo $title3
  96. echo $title4A $title4B
  97. echo $title5A $title5B
  98. echo $title6
  99. echo $title7A $title7B
  100. echo $title8
  101. echo $title9
  102. echo $title10
  103. echo $title11
  104. echo $title12
  105. echo $title13
  106. echo $title14
  107. echo $title15
  108. echo $title16
  109. echo $title17
  110. echo $title18
  111. echo $title19
  112. echo $title20
  113. echo $title21
  114. echo $title22
  115. echo $title23
  116. echo $title24
  117. echo $title25
  118. echo $title26
  119. echo ""
  120. echo $titleheap
  121. echo ""
  122. echo "Numbered tests are automatically run if nothing selected."
  123. echo "Named tests must be explicitly selected."
  124. exit 0
  125. fi
  126. # Set up a suitable "diff" command for comparison. Some systems
  127. # have a diff that lacks a -u option. Try to deal with this.
  128. cf="diff"
  129. diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
  130. # Find the test data
  131. if [ -n "$srcdir" -a -d "$srcdir" ] ; then
  132. testdata="$srcdir/testdata"
  133. elif [ -d "./testdata" ] ; then
  134. testdata=./testdata
  135. elif [ -d "../testdata" ] ; then
  136. testdata=../testdata
  137. else
  138. echo "Cannot find the testdata directory"
  139. exit 1
  140. fi
  141. # ------ Function to check results of a test -------
  142. # This function is called with three parameters:
  143. #
  144. # $1 the value of $? after a call to pcre2test
  145. # $2 the suffix of the output file to compare with
  146. # $3 the $opt value (empty, -jit, or -dfa)
  147. #
  148. # Note: must define using name(), not "function name", for Solaris.
  149. checkresult()
  150. {
  151. if [ $1 -ne 0 ] ; then
  152. echo "** pcre2test failed - check testtry"
  153. exit 1
  154. fi
  155. case "$3" in
  156. -jit) with=" with JIT";;
  157. -dfa) with=" with DFA";;
  158. *) with="";;
  159. esac
  160. $cf $testdata/testoutput$2 testtry
  161. if [ $? != 0 ] ; then
  162. echo ""
  163. echo "** Test $2 failed$with"
  164. exit 1
  165. fi
  166. echo " OK$with"
  167. }
  168. # ------ Function to run and check a special pcre2test arguments test -------
  169. checkspecial()
  170. {
  171. $valgrind $vjs ./pcre2test $1 >>testtry
  172. if [ $? -ne 0 ] ; then
  173. echo "** pcre2test $1 failed - check testtry"
  174. exit 1
  175. fi
  176. }
  177. # ------ Special EBCDIC Test -------
  178. if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
  179. $valgrind ./pcre2test -C ebcdic >/dev/null
  180. ebcdic=$?
  181. if [ $ebcdic -ne 1 ] ; then
  182. echo "Cannot run EBCDIC tests: EBCDIC support not compiled"
  183. exit 1
  184. fi
  185. for opt in "" "-dfa"; do
  186. ./pcre2test -q $opt $testdata/testinputEBC >testtry
  187. checkresult $? EBC "$opt"
  188. done
  189. exit 0
  190. fi
  191. # ------ Normal Tests ------
  192. # Default values
  193. arg8=
  194. arg16=
  195. arg32=
  196. nojit=
  197. bigstack=
  198. sim=
  199. skip=
  200. valgrind=
  201. vjs=
  202. # This is in case the caller has set aliases (as I do - PH)
  203. unset cp ls mv rm
  204. # Process options and select which tests to run; for those that are explicitly
  205. # requested, check that the necessary optional facilities are available.
  206. do0=no
  207. do1=no
  208. do2=no
  209. do3=no
  210. do4=no
  211. do5=no
  212. do6=no
  213. do7=no
  214. do8=no
  215. do9=no
  216. do10=no
  217. do11=no
  218. do12=no
  219. do13=no
  220. do14=no
  221. do15=no
  222. do16=no
  223. do17=no
  224. do18=no
  225. do19=no
  226. do20=no
  227. do21=no
  228. do22=no
  229. do23=no
  230. do24=no
  231. do25=no
  232. do26=no
  233. doheap=no
  234. while [ $# -gt 0 ] ; do
  235. case $1 in
  236. 0) do0=yes;;
  237. 1) do1=yes;;
  238. 2) do2=yes;;
  239. 3) do3=yes;;
  240. 4) do4=yes;;
  241. 5) do5=yes;;
  242. 6) do6=yes;;
  243. 7) do7=yes;;
  244. 8) do8=yes;;
  245. 9) do9=yes;;
  246. 10) do10=yes;;
  247. 11) do11=yes;;
  248. 12) do12=yes;;
  249. 13) do13=yes;;
  250. 14) do14=yes;;
  251. 15) do15=yes;;
  252. 16) do16=yes;;
  253. 17) do17=yes;;
  254. 18) do18=yes;;
  255. 19) do19=yes;;
  256. 20) do20=yes;;
  257. 21) do21=yes;;
  258. 22) do22=yes;;
  259. 23) do23=yes;;
  260. 24) do24=yes;;
  261. 25) do25=yes;;
  262. 26) do26=yes;;
  263. heap) doheap=yes;;
  264. -8) arg8=yes;;
  265. -16) arg16=yes;;
  266. -32) arg32=yes;;
  267. bigstack|-bigstack) bigstack=yes;;
  268. nojit|-nojit) nojit=yes;;
  269. sim|-sim) shift; sim=$1;;
  270. valgrind|-valgrind) valgrind="valgrind --tool=memcheck -q --smc-check=all-non-file";;
  271. valgrind-log|-valgrind-log) valgrind="valgrind --tool=memcheck --num-callers=30 --leak-check=no --error-limit=no --smc-check=all-non-file --log-file=report.%p ";;
  272. ~*)
  273. if expr "$1" : '~[0-9][0-9]*$' >/dev/null; then
  274. skip="$skip `expr "$1" : '~\([0-9]*\)*$'`"
  275. else
  276. echo "Unknown option or test selector '$1'"; exit 1
  277. fi
  278. ;;
  279. *-*)
  280. if expr "$1" : '[0-9][0-9]*-[0-9]*$' >/dev/null; then
  281. tf=`expr "$1" : '\([0-9]*\)'`
  282. tt=`expr "$1" : '.*-\([0-9]*\)'`
  283. if [ "$tt" = "" ] ; then tt=$maxtest; fi
  284. if expr \( "$tt" ">" "$maxtest" \) >/dev/null; then
  285. echo "Invalid test range '$1'"; exit 1
  286. fi
  287. while expr "$tf" "<=" "$tt" >/dev/null; do
  288. eval do${tf}=yes
  289. tf=`expr $tf + 1`
  290. done
  291. else
  292. echo "Invalid test range '$1'"; exit 1
  293. fi
  294. ;;
  295. *) echo "Unknown option or test selector '$1'"; exit 1;;
  296. esac
  297. shift
  298. done
  299. # Find which optional facilities are available.
  300. $sim ./pcre2test -C linksize >/dev/null
  301. link_size=$?
  302. if [ $link_size -lt 2 ] ; then
  303. echo "RunTest: Failed to find internal link size"
  304. exit 1
  305. fi
  306. if [ $link_size -gt 4 ] ; then
  307. echo "RunTest: Failed to find internal link size"
  308. exit 1
  309. fi
  310. # If it is possible to set the system stack size and -bigstack was given,
  311. # set up a large stack.
  312. $sim ./pcre2test -S 64 /dev/null /dev/null
  313. support_setstack=$?
  314. if [ $support_setstack -eq 0 -a "$bigstack" != "" ] ; then
  315. setstack="-S 64"
  316. else
  317. setstack=""
  318. fi
  319. # All of 8-bit, 16-bit, and 32-bit character strings may be supported, but only
  320. # one need be.
  321. $sim ./pcre2test -C pcre2-8 >/dev/null
  322. support8=$?
  323. $sim ./pcre2test -C pcre2-16 >/dev/null
  324. support16=$?
  325. $sim ./pcre2test -C pcre2-32 >/dev/null
  326. support32=$?
  327. # \C may be disabled
  328. $sim ./pcre2test -C backslash-C >/dev/null
  329. supportBSC=$?
  330. # Initialize all bitsizes skipped
  331. test8=skip
  332. test16=skip
  333. test32=skip
  334. # If no bitsize arguments, select all that are available
  335. if [ "$arg8$arg16$arg32" = "" ] ; then
  336. if [ $support8 -ne 0 ] ; then
  337. test8=-8
  338. fi
  339. if [ $support16 -ne 0 ] ; then
  340. test16=-16
  341. fi
  342. if [ $support32 -ne 0 ] ; then
  343. test32=-32
  344. fi
  345. # Otherwise, select requested bit sizes
  346. else
  347. if [ "$arg8" = yes ] ; then
  348. if [ $support8 -eq 0 ] ; then
  349. echo "Cannot run 8-bit library tests: 8-bit library not compiled"
  350. exit 1
  351. fi
  352. test8=-8
  353. fi
  354. if [ "$arg16" = yes ] ; then
  355. if [ $support16 -eq 0 ] ; then
  356. echo "Cannot run 16-bit library tests: 16-bit library not compiled"
  357. exit 1
  358. fi
  359. test16=-16
  360. fi
  361. if [ "$arg32" = yes ] ; then
  362. if [ $support32 -eq 0 ] ; then
  363. echo "Cannot run 32-bit library tests: 32-bit library not compiled"
  364. exit 1
  365. fi
  366. test32=-32
  367. fi
  368. fi
  369. # UTF support is implied by Unicode support, and it always applies to all bit
  370. # sizes if both are supported; we can't have UTF-8 support without UTF-16 or
  371. # UTF-32 support.
  372. $sim ./pcre2test -C unicode >/dev/null
  373. utf=$?
  374. # When JIT is used with valgrind, we need to set up valgrind suppressions as
  375. # otherwise there are a lot of false positive valgrind reports when the
  376. # the hardware supports SSE2.
  377. jitopt=
  378. $sim ./pcre2test -C jit >/dev/null
  379. jit=$?
  380. if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then
  381. jitopt=-jit
  382. if [ "$valgrind" != "" ] ; then
  383. vjs="--suppressions=$testdata/valgrind-jit.supp"
  384. fi
  385. fi
  386. # If no specific tests were requested, select all the numbered tests. Those
  387. # that are not relevant will be automatically skipped.
  388. if [ $do0 = no -a $do1 = no -a $do2 = no -a $do3 = no -a \
  389. $do4 = no -a $do5 = no -a $do6 = no -a $do7 = no -a \
  390. $do8 = no -a $do9 = no -a $do10 = no -a $do11 = no -a \
  391. $do12 = no -a $do13 = no -a $do14 = no -a $do15 = no -a \
  392. $do16 = no -a $do17 = no -a $do18 = no -a $do19 = no -a \
  393. $do20 = no -a $do21 = no -a $do22 = no -a $do23 = no -a \
  394. $do24 = no -a $do25 = no -a $do26 = no -a $doheap = no \
  395. ]; then
  396. do0=yes
  397. do1=yes
  398. do2=yes
  399. do3=yes
  400. do4=yes
  401. do5=yes
  402. do6=yes
  403. do7=yes
  404. do8=yes
  405. do9=yes
  406. do10=yes
  407. do11=yes
  408. do12=yes
  409. do13=yes
  410. do14=yes
  411. do15=yes
  412. do16=yes
  413. do17=yes
  414. do18=yes
  415. do19=yes
  416. do20=yes
  417. do21=yes
  418. do22=yes
  419. do23=yes
  420. do24=yes
  421. do25=yes
  422. do26=yes
  423. fi
  424. # Handle any explicit skips at this stage, so that an argument list may consist
  425. # only of explicit skips.
  426. for i in $skip; do eval do$i=no; done
  427. # Show which release and which test data
  428. echo ""
  429. echo PCRE2 C library tests using test data from $testdata
  430. $sim ./pcre2test /dev/null
  431. echo ""
  432. for bmode in "$test8" "$test16" "$test32"; do
  433. case "$bmode" in
  434. skip) continue;;
  435. -16) if [ "$test8$test32" != "skipskip" ] ; then echo ""; fi
  436. bits=16; echo "---- Testing 16-bit library ----"; echo "";;
  437. -32) if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
  438. bits=32; echo "---- Testing 32-bit library ----"; echo "";;
  439. -8) bits=8; echo "---- Testing 8-bit library ----"; echo "";;
  440. esac
  441. # Test 0 is a special test. Its output is not checked, because it will
  442. # be different on different hardware and with different configurations.
  443. # Running this test just exercises the code.
  444. if [ $do0 = yes ] ; then
  445. echo $title0
  446. echo '/abc/jit,memory,framesize' >testSinput
  447. echo ' abc' >>testSinput
  448. echo '' >testtry
  449. checkspecial '-C'
  450. checkspecial '--help'
  451. if [ $support_setstack -eq 0 ] ; then
  452. checkspecial '-S 1 -t 10 testSinput'
  453. fi
  454. echo " OK"
  455. fi
  456. # Primary non-UTF test, compatible with JIT and all versions of Perl >= 5.8
  457. if [ $do1 = yes ] ; then
  458. echo $title1
  459. for opt in "" $jitopt; do
  460. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput1 testtry
  461. checkresult $? 1 "$opt"
  462. done
  463. fi
  464. # PCRE2 tests that are not Perl-compatible: API, errors, internals. We copy
  465. # the testbtables file to the current directory for use by this test.
  466. if [ $do2 = yes ] ; then
  467. echo $title2 "(excluding UTF-$bits)"
  468. cp $testdata/testbtables .
  469. for opt in "" $jitopt; do
  470. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput2 testtry
  471. saverc=$?
  472. if [ $saverc = 0 ] ; then
  473. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $bmode $opt -error -70,-62,-2,-1,0,100,101,191,300 >>testtry
  474. checkresult $? 2 "$opt"
  475. else
  476. checkresult $saverc 2 "$opt"
  477. fi
  478. done
  479. fi
  480. # Locale-specific tests, provided that either the "fr_FR", "fr_CA", "french"
  481. # or "fr" locale is available. The first two are Unix-like standards; the
  482. # last two are for Windows. Unfortunately, different versions of the French
  483. # locale give different outputs for some items. This test passes if the
  484. # output matches any one of the alternative output files.
  485. if [ $do3 = yes ] ; then
  486. locale=
  487. # In some environments locales that are listed by the "locale -a"
  488. # command do not seem to work with setlocale(). Therefore, we do
  489. # a preliminary test to see if pcre2test can set one before going
  490. # on to use it.
  491. for loc in 'fr_FR' 'french' 'fr' 'fr_CA'; do
  492. locale -a | grep "^$loc\$" >/dev/null
  493. if [ $? -eq 0 ] ; then
  494. echo "/a/locale=$loc" | \
  495. $sim $valgrind ./pcre2test -q $bmode | \
  496. grep "Failed to set locale" >/dev/null
  497. if [ $? -ne 0 ] ; then
  498. locale=$loc
  499. if [ "$locale" = "fr_FR" ] ; then
  500. infile=$testdata/testinput3
  501. outfile=$testdata/testoutput3
  502. outfile2=$testdata/testoutput3A
  503. outfile3=$testdata/testoutput3B
  504. else
  505. infile=test3input
  506. outfile=test3output
  507. outfile2=test3outputA
  508. outfile3=test3outputB
  509. sed "s/fr_FR/$loc/" $testdata/testinput3 >test3input
  510. sed "s/fr_FR/$loc/" $testdata/testoutput3 >test3output
  511. sed "s/fr_FR/$loc/" $testdata/testoutput3A >test3outputA
  512. sed "s/fr_FR/$loc/" $testdata/testoutput3B >test3outputB
  513. fi
  514. break
  515. fi
  516. fi
  517. done
  518. if [ "$locale" != "" ] ; then
  519. echo $title3 "(using '$locale' locale)"
  520. for opt in "" $jitopt; do
  521. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $infile testtry
  522. if [ $? = 0 ] ; then
  523. case "$opt" in
  524. -jit) with=" with JIT";;
  525. *) with="";;
  526. esac
  527. if $cf $outfile testtry >teststdout || \
  528. $cf $outfile2 testtry >teststdout || \
  529. $cf $outfile3 testtry >teststdout
  530. then
  531. echo " OK$with"
  532. else
  533. echo "** Locale test did not run successfully$with. The output did not match"
  534. echo " $outfile, $outfile2 or $outfile3."
  535. echo " This may mean that there is a problem with the locale settings rather"
  536. echo " than a bug in PCRE2."
  537. exit 1
  538. fi
  539. else exit 1
  540. fi
  541. done
  542. else
  543. echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr_CA',"
  544. echo "'fr' or 'french' locales can be set, or the \"locale\" command is"
  545. echo "not available to check for them."
  546. echo " "
  547. fi
  548. fi
  549. # Tests for UTF and Unicode property support
  550. if [ $do4 = yes ] ; then
  551. echo ${title4A}-${bits}${title4B}
  552. if [ $utf -eq 0 ] ; then
  553. echo " Skipped because UTF-$bits support is not available"
  554. else
  555. for opt in "" $jitopt; do
  556. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput4 testtry
  557. checkresult $? 4 "$opt"
  558. done
  559. fi
  560. fi
  561. if [ $do5 = yes ] ; then
  562. echo ${title5A}-${bits}$title5B
  563. if [ $utf -eq 0 ] ; then
  564. echo " Skipped because UTF-$bits support is not available"
  565. else
  566. for opt in "" $jitopt; do
  567. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput5 testtry
  568. checkresult $? 5 "$opt"
  569. done
  570. fi
  571. fi
  572. # Tests for DFA matching support
  573. if [ $do6 = yes ] ; then
  574. echo $title6
  575. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput6 testtry
  576. checkresult $? 6 ""
  577. fi
  578. if [ $do7 = yes ] ; then
  579. echo ${title7A}-${bits}$title7B
  580. if [ $utf -eq 0 ] ; then
  581. echo " Skipped because UTF-$bits support is not available"
  582. else
  583. $sim $valgrind ./pcre2test -q $setstack $bmode $opt $testdata/testinput7 testtry
  584. checkresult $? 7 ""
  585. fi
  586. fi
  587. # Test of internal offsets and code sizes. This test is run only when there
  588. # is UTF/UCP support. The actual tests are mostly the same as in some of the
  589. # above, but in this test we inspect some offsets and sizes. This is a
  590. # doublecheck for the maintainer, just in case something changes unexpectedly.
  591. # The output from this test is different in 8-bit, 16-bit, and 32-bit modes
  592. # and for different link sizes, so there are different output files for each
  593. # mode and link size.
  594. if [ $do8 = yes ] ; then
  595. echo $title8
  596. if [ $utf -eq 0 ] ; then
  597. echo " Skipped because UTF-$bits support is not available"
  598. else
  599. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput8 testtry
  600. checkresult $? 8-$bits-$link_size ""
  601. fi
  602. fi
  603. # Tests for 8-bit-specific features
  604. if [ "$do9" = yes ] ; then
  605. echo $title9
  606. if [ "$bits" = "16" -o "$bits" = "32" ] ; then
  607. echo " Skipped when running 16/32-bit tests"
  608. else
  609. for opt in "" $jitopt; do
  610. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput9 testtry
  611. checkresult $? 9 "$opt"
  612. done
  613. fi
  614. fi
  615. # Tests for UTF-8 and UCP 8-bit-specific features
  616. if [ "$do10" = yes ] ; then
  617. echo $title10
  618. if [ "$bits" = "16" -o "$bits" = "32" ] ; then
  619. echo " Skipped when running 16/32-bit tests"
  620. elif [ $utf -eq 0 ] ; then
  621. echo " Skipped because UTF-$bits support is not available"
  622. else
  623. for opt in "" $jitopt; do
  624. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput10 testtry
  625. checkresult $? 10 "$opt"
  626. done
  627. fi
  628. fi
  629. # Tests for 16-bit and 32-bit features. Output is different for the two widths.
  630. if [ $do11 = yes ] ; then
  631. echo $title11
  632. if [ "$bits" = "8" ] ; then
  633. echo " Skipped when running 8-bit tests"
  634. else
  635. for opt in "" $jitopt; do
  636. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput11 testtry
  637. checkresult $? 11-$bits "$opt"
  638. done
  639. fi
  640. fi
  641. # Tests for 16-bit and 32-bit features with UTF-16/32 and UCP support. Output
  642. # is different for the two widths.
  643. if [ $do12 = yes ] ; then
  644. echo $title12
  645. if [ "$bits" = "8" ] ; then
  646. echo " Skipped when running 8-bit tests"
  647. elif [ $utf -eq 0 ] ; then
  648. echo " Skipped because UTF-$bits support is not available"
  649. else
  650. for opt in "" $jitopt; do
  651. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput12 testtry
  652. checkresult $? 12-$bits "$opt"
  653. done
  654. fi
  655. fi
  656. # Tests for 16/32-bit-specific features in DFA non-UTF modes
  657. if [ $do13 = yes ] ; then
  658. echo $title13
  659. if [ "$bits" = "8" ] ; then
  660. echo " Skipped when running 8-bit tests"
  661. else
  662. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput13 testtry
  663. checkresult $? 13 ""
  664. fi
  665. fi
  666. # Tests for DFA UTF and UCP features. Output is different for the different widths.
  667. if [ $do14 = yes ] ; then
  668. echo $title14
  669. if [ $utf -eq 0 ] ; then
  670. echo " Skipped because UTF-$bits support is not available"
  671. else
  672. $sim $valgrind ./pcre2test -q $setstack $bmode $opt $testdata/testinput14 testtry
  673. checkresult $? 14-$bits ""
  674. fi
  675. fi
  676. # Test non-JIT match and recursion limits
  677. if [ $do15 = yes ] ; then
  678. echo $title15
  679. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput15 testtry
  680. checkresult $? 15 ""
  681. fi
  682. # Test JIT-specific features when JIT is not available
  683. if [ $do16 = yes ] ; then
  684. echo $title16
  685. if [ $jit -ne 0 ] ; then
  686. echo " Skipped because JIT is available"
  687. else
  688. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput16 testtry
  689. checkresult $? 16 ""
  690. fi
  691. fi
  692. # Test JIT-specific features when JIT is available
  693. if [ $do17 = yes ] ; then
  694. echo $title17
  695. if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
  696. echo " Skipped because JIT is not available or nojit was specified"
  697. else
  698. $sim $valgrind $vjs ./pcre2test -q $setstack $bmode $testdata/testinput17 testtry
  699. checkresult $? 17 ""
  700. fi
  701. fi
  702. # Tests for the POSIX interface without UTF/UCP (8-bit only)
  703. if [ $do18 = yes ] ; then
  704. echo $title18
  705. if [ "$bits" = "16" -o "$bits" = "32" ] ; then
  706. echo " Skipped when running 16/32-bit tests"
  707. else
  708. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput18 testtry
  709. checkresult $? 18 ""
  710. fi
  711. fi
  712. # Tests for the POSIX interface with UTF/UCP (8-bit only)
  713. if [ $do19 = yes ] ; then
  714. echo $title19
  715. if [ "$bits" = "16" -o "$bits" = "32" ] ; then
  716. echo " Skipped when running 16/32-bit tests"
  717. elif [ $utf -eq 0 ] ; then
  718. echo " Skipped because UTF-$bits support is not available"
  719. else
  720. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput19 testtry
  721. checkresult $? 19 ""
  722. fi
  723. fi
  724. # Serialization tests
  725. if [ $do20 = yes ] ; then
  726. echo $title20
  727. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput20 testtry
  728. checkresult $? 20 ""
  729. fi
  730. # \C tests without UTF - DFA matching is supported
  731. if [ "$do21" = yes ] ; then
  732. echo $title21
  733. if [ $supportBSC -eq 0 ] ; then
  734. echo " Skipped because \C is disabled"
  735. else
  736. for opt in "" $jitopt -dfa; do
  737. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput21 testtry
  738. checkresult $? 21 "$opt"
  739. done
  740. fi
  741. fi
  742. # \C tests with UTF - DFA matching is not supported for \C in UTF mode
  743. if [ "$do22" = yes ] ; then
  744. echo $title22
  745. if [ $supportBSC -eq 0 ] ; then
  746. echo " Skipped because \C is disabled"
  747. elif [ $utf -eq 0 ] ; then
  748. echo " Skipped because UTF-$bits support is not available"
  749. else
  750. for opt in "" $jitopt; do
  751. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput22 testtry
  752. checkresult $? 22-$bits "$opt"
  753. done
  754. fi
  755. fi
  756. # Test when \C is disabled
  757. if [ "$do23" = yes ] ; then
  758. echo $title23
  759. if [ $supportBSC -ne 0 ] ; then
  760. echo " Skipped because \C is not disabled"
  761. else
  762. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput23 testtry
  763. checkresult $? 23 ""
  764. fi
  765. fi
  766. # Non-UTF pattern conversion tests
  767. if [ "$do24" = yes ] ; then
  768. echo $title24
  769. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput24 testtry
  770. checkresult $? 24 ""
  771. fi
  772. # UTF pattern conversion tests
  773. if [ "$do25" = yes ] ; then
  774. echo $title25
  775. if [ $utf -eq 0 ] ; then
  776. echo " Skipped because UTF-$bits support is not available"
  777. else
  778. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput25 testtry
  779. checkresult $? 25 ""
  780. fi
  781. fi
  782. # Auto-generated unicode property tests
  783. if [ $do26 = yes ] ; then
  784. echo $title26
  785. if [ $utf -eq 0 ] ; then
  786. echo " Skipped because UTF-$bits support is not available"
  787. else
  788. for opt in "" $jitopt; do
  789. $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput26 testtry
  790. checkresult $? 26 "$opt"
  791. done
  792. fi
  793. fi
  794. # Manually selected heap tests - output may vary in different environments,
  795. # which is why that are not automatically run.
  796. if [ $doheap = yes ] ; then
  797. echo $titleheap
  798. $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinputheap testtry
  799. checkresult $? heap-$bits ""
  800. fi
  801. # End of loop for 8/16/32-bit tests
  802. done
  803. # Clean up local working files
  804. rm -f testbtables testSinput test3input testsaved1 testsaved2 test3output test3outputA test3outputB teststdout teststderr testtry
  805. # End