~ubuntu-branches/ubuntu/trusty/pcre3/trusty

« back to all changes in this revision

Viewing changes to RunGrepTest

  • Committer: Package Import Robot
  • Author(s): Mark Baker
  • Date: 2012-03-23 22:34:54 UTC
  • mfrom: (23.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20120323223454-grhqqolk8a7x1h24
Tags: 1:8.30-4
* Reluctantly using an epoch, as it seems the funny version number with
  extra dots causes problems
* Bumped standard version to 3.9.3. No changes needed
* Converted to use new source format / quilt
* Put back obsolete pcre_info() API that upstream have dropped (Closes:
  #665300, #665356)
* Don't include pcregrep binary in debug package

Thanks to Elimar Riesebieter for the conversion to the new source format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
# supported by pcregrep.
6
6
 
7
7
# Set the C locale, so that sort(1) behaves predictably.
 
8
 
8
9
LC_ALL=C
9
10
export LC_ALL
10
11
 
 
12
# Remove any non-default colouring and aliases that the caller may have set.
 
13
 
 
14
unset PCREGREP_COLOUR PCREGREP_COLOR
 
15
unset cp ls mv rm
 
16
 
 
17
# Set the program to be tested, and valgrind settings when requested.
 
18
 
11
19
pcregrep=`pwd`/pcregrep
12
20
 
13
21
valgrind=
14
22
while [ $# -gt 0 ] ; do
15
23
  case $1 in
16
 
    valgrind) valgrind="valgrind -q --leak-check=no";;
 
24
    valgrind) valgrind="valgrind -q --leak-check=no --smc-check=all";;
17
25
    *) echo "RunGrepTest: Unknown argument $1"; exit 1;;
18
26
  esac
19
27
  shift
28
36
 
29
37
$pcregrep -V
30
38
 
31
 
cf="diff -ub"
32
 
 
33
39
# Set up a suitable "diff" command for comparison. Some systems have a diff
34
40
# that lacks a -u option. Try to deal with this; better do the test for the -b
35
41
# option as well.
36
42
 
 
43
cf="diff -ub"
37
44
if diff -u /dev/null /dev/null; then
38
45
  if diff -ub /dev/null /dev/null; then cf="diff -ub"; else cf="diff -u"; fi
39
46
else
41
48
fi
42
49
 
43
50
# If PCRE has been built in a directory other than the source directory, and
44
 
# this test is being run from "make check" as usual, then $(srcdir) will be
45
 
# set. If not, set it to the current directory. We then arrange to run the
46
 
# pcregrep command in the source directory so that the file names that appear
47
 
# in the output are always the same.
 
51
# this test is being run from "make check" as usual, then $srcdir will be
 
52
# set. If not, set it to the current or parent directory, whichever one
 
53
# contains the test data. We then arrange to run the pcregrep command in the
 
54
# source directory so that the file names that appear in the output are always
 
55
# the same.
48
56
 
49
57
if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then
50
 
  srcdir=.
 
58
  if [ -d "./testdata" ] ; then
 
59
    srcdir=.
 
60
  elif [ -d "../testdata" ] ; then
 
61
    srcdir=..
 
62
  else
 
63
    echo "Cannot find the testdata directory"
 
64
    exit 1
 
65
  fi
51
66
fi
52
67
 
53
68
# Check for the availability of UTF-8 support
54
69
 
55
 
./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null
 
70
./pcretest -C utf >/dev/null
56
71
utf8=$?
57
72
 
58
73
echo "---------------------------- Test 1 ------------------------------" >testtry
305
320
echo "RC=$?" >>testtry
306
321
 
307
322
echo "---------------------------- Test 62 -----------------------------" >>testtry
308
 
(cd $srcdir; $valgrind $pcregrep --match-limit=1000 -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtry 2>&1
 
323
(cd $srcdir; $valgrind $pcregrep --match-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtry 2>&1
309
324
echo "RC=$?" >>testtry
310
325
 
311
326
echo "---------------------------- Test 63 -----------------------------" >>testtry
312
 
(cd $srcdir; $valgrind $pcregrep --recursion-limit=1000 -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtry 2>&1
 
327
(cd $srcdir; $valgrind $pcregrep --recursion-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtry 2>&1
313
328
echo "RC=$?" >>testtry
314
329
 
315
330
echo "---------------------------- Test 64 ------------------------------" >>testtry
340
355
(cd $srcdir; $valgrind $pcregrep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtry
341
356
echo "RC=$?" >>testtry
342
357
 
 
358
echo "---------------------------- Test 71 -----------------------------" >>testtry
 
359
(cd $srcdir; $valgrind $pcregrep -o "^01|^02|^03" ./testdata/grepinput) >>testtry
 
360
echo "RC=$?" >>testtry
 
361
 
 
362
echo "---------------------------- Test 72 -----------------------------" >>testtry
 
363
(cd $srcdir; $valgrind $pcregrep --color=always "^01|^02|^03" ./testdata/grepinput) >>testtry
 
364
echo "RC=$?" >>testtry
 
365
 
 
366
echo "---------------------------- Test 73 -----------------------------" >>testtry
 
367
(cd $srcdir; $valgrind $pcregrep -o --colour=always "^01|^02|^03" ./testdata/grepinput) >>testtry
 
368
echo "RC=$?" >>testtry
 
369
 
 
370
echo "---------------------------- Test 74 -----------------------------" >>testtry
 
371
(cd $srcdir; $valgrind $pcregrep -o "^01|02|^03" ./testdata/grepinput) >>testtry
 
372
echo "RC=$?" >>testtry
 
373
 
 
374
echo "---------------------------- Test 75 -----------------------------" >>testtry
 
375
(cd $srcdir; $valgrind $pcregrep --color=always "^01|02|^03" ./testdata/grepinput) >>testtry
 
376
echo "RC=$?" >>testtry
 
377
 
 
378
echo "---------------------------- Test 76 -----------------------------" >>testtry
 
379
(cd $srcdir; $valgrind $pcregrep -o --colour=always "^01|02|^03" ./testdata/grepinput) >>testtry
 
380
echo "RC=$?" >>testtry
 
381
 
 
382
echo "---------------------------- Test 77 -----------------------------" >>testtry
 
383
(cd $srcdir; $valgrind $pcregrep -o "^01|^02|03" ./testdata/grepinput) >>testtry
 
384
echo "RC=$?" >>testtry
 
385
 
 
386
echo "---------------------------- Test 78 -----------------------------" >>testtry
 
387
(cd $srcdir; $valgrind $pcregrep --color=always "^01|^02|03" ./testdata/grepinput) >>testtry
 
388
echo "RC=$?" >>testtry
 
389
 
 
390
echo "---------------------------- Test 79 -----------------------------" >>testtry
 
391
(cd $srcdir; $valgrind $pcregrep -o --colour=always "^01|^02|03" ./testdata/grepinput) >>testtry
 
392
echo "RC=$?" >>testtry
 
393
 
 
394
echo "---------------------------- Test 80 -----------------------------" >>testtry
 
395
(cd $srcdir; $valgrind $pcregrep -o "\b01|\b02" ./testdata/grepinput) >>testtry
 
396
echo "RC=$?" >>testtry
 
397
 
 
398
echo "---------------------------- Test 81 -----------------------------" >>testtry
 
399
(cd $srcdir; $valgrind $pcregrep --color=always "\\b01|\\b02" ./testdata/grepinput) >>testtry
 
400
echo "RC=$?" >>testtry
 
401
 
 
402
echo "---------------------------- Test 82 -----------------------------" >>testtry
 
403
(cd $srcdir; $valgrind $pcregrep -o --colour=always "\\b01|\\b02" ./testdata/grepinput) >>testtry
 
404
echo "RC=$?" >>testtry
 
405
 
 
406
echo "---------------------------- Test 83 -----------------------------" >>testtry
 
407
(cd $srcdir; $valgrind $pcregrep --buffer-size=100 "^a" ./testdata/grepinput3) >>testtry 2>&1
 
408
echo "RC=$?" >>testtry
 
409
 
343
410
# Now compare the results.
344
411
 
345
412
$cf $srcdir/testdata/grepoutput testtry
388
455
$valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry
389
456
 
390
457
printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry
391
 
pattern=`printf 'xxx\r\njkl'`
392
 
$valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput >>testtry
 
458
$valgrind $pcregrep -n --newline=crlf -F -f $srcdir/testdata/greppatN4 testNinput >>testtry
393
459
 
394
460
printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry
395
461
$valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput >>testtry