8008352: java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh fails on MKS
authordcubed
Wed, 20 Feb 2013 13:23:56 -0800
changeset 16017 0742f7c261fe
parent 16016 70e2e77626ec
child 16018 3fe4876de509
8008352: java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh fails on MKS Summary: Use more portable pattern counting constructs in test driver. Reviewed-by: sspitsyn, sla, coleenp
jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh
--- a/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh	Wed Feb 20 16:39:35 2013 +0400
+++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh	Wed Feb 20 13:23:56 2013 -0800
@@ -141,32 +141,30 @@
 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."