Date: Sat, 31 Jan 2015 22:53:18 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278007 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting Message-ID: <201501312253.t0VMrIoP053646@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Sat Jan 31 22:53:18 2015 New Revision: 278007 URL: https://svnweb.freebsd.org/changeset/base/278007 Log: 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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -42,7 +42,7 @@ fi dtrace=$1 -bname=`/usr/bin/basename $0` +bname=`basename $0` dfilename=/var/tmp/$bname.$$ Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh Sat Jan 31 22:38:43 2015 (r278006) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh Sat Jan 31 22:53:18 2015 (r278007) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501312253.t0VMrIoP053646>