Print this page
8858 /usr/bin/grep doesn't support -E option
4580 /usr/bin/grep can't handle multibyte characters
8929 8868 tests are not delivered with system/test/utiltest
8860 Example in grep(1) is incorrect
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Yuri Pankov <yuripv@gmx.com>
   1 #!/bin/ksh
   2 #
   3 # This file and its contents are supplied under the terms of the
   4 # Common Development and Distribution License ("CDDL"), version 1.0.
   5 # You may only use this file in accordance with the terms of version
   6 # 1.0 of the CDDL.
   7 #
   8 # A full copy of the text of the CDDL should have accompanied this
   9 # source.  A copy of the CDDL is also available via the Internet at
  10 # http://www.illumos.org/license/CDDL.
  11 #
  12 
  13 # Copyright 2012, Richard Lowe.
  14 
  15 function grep_test {
  16     name=$1
  17     pattern=$2
  18 
  19     if /usr/xpg4/bin/fgrep -q "${pattern}"; then
  20         print -u2 "pass: $name"
  21     else
  22         print -u2 "FAIL: $name"
  23     fi
  24 }        
  25 
  26 function dis_test {
  27     name=${1}
  28     func=${2}
  29     file=${3}
  30     pattern=${4}
  31 
  32     dis -F${func} ${file} | grep_test "${name}" "${pattern}"
  33 }
  34 
  35 make PROTO="${1}"
  36 
  37 dis_test "addq-->leaq 1" func style1 \
  38     'func+0x10: 48 8d 92 f8 ff ff  leaq   -0x8(%rdx),%rdx'
  39 dis_test "addq-->leaq 2" func style1 \


   1 #!/bin/ksh
   2 #
   3 # This file and its contents are supplied under the terms of the
   4 # Common Development and Distribution License ("CDDL"), version 1.0.
   5 # You may only use this file in accordance with the terms of version
   6 # 1.0 of the CDDL.
   7 #
   8 # A full copy of the text of the CDDL should have accompanied this
   9 # source.  A copy of the CDDL is also available via the Internet at
  10 # http://www.illumos.org/license/CDDL.
  11 #
  12 
  13 # Copyright 2012, Richard Lowe.
  14 
  15 function grep_test {
  16     name=$1
  17     pattern=$2
  18 
  19     if /usr/bin/fgrep -q "${pattern}"; then
  20         print -u2 "pass: $name"
  21     else
  22         print -u2 "FAIL: $name"
  23     fi
  24 }        
  25 
  26 function dis_test {
  27     name=${1}
  28     func=${2}
  29     file=${3}
  30     pattern=${4}
  31 
  32     dis -F${func} ${file} | grep_test "${name}" "${pattern}"
  33 }
  34 
  35 make PROTO="${1}"
  36 
  37 dis_test "addq-->leaq 1" func style1 \
  38     'func+0x10: 48 8d 92 f8 ff ff  leaq   -0x8(%rdx),%rdx'
  39 dis_test "addq-->leaq 2" func style1 \