From 5eb01d191d98da090682a3f85842e01b357ca7d9 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Wed, 20 Feb 2013 13:23:56 -0800 Subject: [PATCH] 8008352: java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh fails on MKS Use more portable pattern counting constructs in test driver. Reviewed-by: sspitsyn, sla, coleenp --- .../RedefineSubclassWithTwoInterfaces.sh | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh index 6deb7ce6e44..850fac252a1 100644 --- a/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh +++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh @@ -141,32 +141,30 @@ else fi PASS1_MESG="before any redefines" -cnt=`grep "$PASS1_MESG" output.log | grep 'version-0' | wc -l | sed 's/^ *//'` -case "$cnt" in -2) +cnt=`grep "$PASS1_MESG" output.log | grep 'version-0' | wc -l` +# no quotes around $cnt so any whitespace from 'wc -l' is ignored +if [ $cnt = 2 ]; then echo "INFO: found 2 version-0 '$PASS1_MESG' mesgs." - ;; -*) +else echo "FAIL: did NOT find 2 version-0 '$PASS1_MESG' mesgs." + echo "INFO: cnt='$cnt'" echo "INFO: grep '$PASS1_MESG' output:" grep "$PASS1_MESG" output.log result=1 - ;; -esac +fi PASS2_MESG="after redefine" -cnt=`grep "$PASS2_MESG" output.log | grep 'version-1' | wc -l | sed 's/^ *//'` -case "$cnt" in -2) +cnt=`grep "$PASS2_MESG" output.log | grep 'version-1' | wc -l` +# no quotes around $cnt so any whitespace from 'wc -l' is ignored +if [ $cnt = 2 ]; then echo "INFO: found 2 version-1 '$PASS2_MESG' mesgs." - ;; -*) +else echo "FAIL: did NOT find 2 version-1 '$PASS2_MESG' mesgs." + echo "INFO: cnt='$cnt'" echo "INFO: grep '$PASS2_MESG' output:" grep "$PASS2_MESG" output.log result=1 - ;; -esac +fi if [ "$result" = 0 ]; then echo "PASS: test passed both positive and negative output checks."