Fix a number of DTrace scripting tests:

* Avoid hard-coding program paths.
* Use -x when searching for oneself in ps(1) output.
* Use the correct keyword (egid instead of pgid) in tst.egid.ksh.

MFC after:	1 week
This commit is contained in:
Mark Johnston 2015-01-31 22:53:18 +00:00
parent 9ed9976cd9
commit 0feb85424f
11 changed files with 27 additions and 27 deletions

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file

View File

@ -42,7 +42,7 @@ fi
dtrace=$1
bname=`/usr/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$

View File

@ -43,7 +43,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/usr/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
@ -77,7 +77,7 @@ fi
#Get the groupid of the calling process using ps
groupid=`ps -o pid,pgid | grep "$$ " | awk '{print $2}' 2>/dev/null`
groupid=`ps -x -o pid,egid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -93,5 +93,5 @@ fi
#Cleanup leftovers
/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
userid=`ps -x -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
groupid=`ps -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
groupid=`ps -x -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
@ -75,12 +75,12 @@ fi
#Pass current pid (I mean parent pid for .d script).
$dfilename $$ >/dev/null 2>&1
$dfilename $$ #>/dev/null 2>&1
if [ $? -ne 0 ]; then
print -u2 "Error in executing $dfilename"
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
projectid=`ps -o pid,projid | grep "$$ " | awk '{print $2}' 2>/dev/null`
projectid=`ps -x -o pid,projid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
sessionid=`ps -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null`
sessionid=`ps -x -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get sid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
taskidval=`ps -o pid,taskid | grep "$$ " | awk '{print $2}' 2>/dev/null`
taskidval=`ps -x -o pid,taskid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
userid=`ps -x -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0