test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh

Print this page




 124 #
 125 #     guarantee(false) failed: OLD and/or OBSOLETE method(s) found
 126 #
 127 # If this guarantee happens, the test should fail in the status
 128 # check above, but just in case it doesn't, we check for "guarantee".
 129 #
 130 
 131 FAIL_MESG="guarantee"
 132 grep "$FAIL_MESG" output.log
 133 status=$?
 134 if [ "$status" = 0 ]; then
 135     echo "FAIL: found '$FAIL_MESG' in the test output."
 136     result=1
 137 else
 138     echo "INFO: did NOT find '$FAIL_MESG' in the test output."
 139     # be optimistic here
 140     result=0
 141 fi
 142 
 143 PASS1_MESG="before any redefines"
 144 cnt=`grep "$PASS1_MESG" output.log | grep 'version-0' | wc -l | sed 's/^ *//'`
 145 case "$cnt" in
 146 2)
 147     echo "INFO: found 2 version-0 '$PASS1_MESG' mesgs."
 148     ;;
 149 *)
 150     echo "FAIL: did NOT find 2 version-0 '$PASS1_MESG' mesgs."

 151     echo "INFO: grep '$PASS1_MESG' output:"
 152     grep "$PASS1_MESG" output.log
 153     result=1
 154     ;;
 155 esac
 156 
 157 PASS2_MESG="after redefine"
 158 cnt=`grep "$PASS2_MESG" output.log | grep 'version-1' | wc -l | sed 's/^ *//'`
 159 case "$cnt" in
 160 2)
 161     echo "INFO: found 2 version-1 '$PASS2_MESG' mesgs."
 162     ;;
 163 *)
 164     echo "FAIL: did NOT find 2 version-1 '$PASS2_MESG' mesgs."

 165     echo "INFO: grep '$PASS2_MESG' output:"
 166     grep "$PASS2_MESG" output.log
 167     result=1
 168     ;;
 169 esac
 170 
 171 if [ "$result" = 0 ]; then
 172     echo "PASS: test passed both positive and negative output checks."
 173 fi
 174 
 175 exit $result


 124 #
 125 #     guarantee(false) failed: OLD and/or OBSOLETE method(s) found
 126 #
 127 # If this guarantee happens, the test should fail in the status
 128 # check above, but just in case it doesn't, we check for "guarantee".
 129 #
 130 
 131 FAIL_MESG="guarantee"
 132 grep "$FAIL_MESG" output.log
 133 status=$?
 134 if [ "$status" = 0 ]; then
 135     echo "FAIL: found '$FAIL_MESG' in the test output."
 136     result=1
 137 else
 138     echo "INFO: did NOT find '$FAIL_MESG' in the test output."
 139     # be optimistic here
 140     result=0
 141 fi
 142 
 143 PASS1_MESG="before any redefines"
 144 cnt=`grep "$PASS1_MESG" output.log | grep 'version-0' | wc -l`
 145 # no quotes around $cnt so any whitespace from 'wc -l' is ignored
 146 if [ $cnt = 2 ]; then
 147     echo "INFO: found 2 version-0 '$PASS1_MESG' mesgs."
 148 else

 149     echo "FAIL: did NOT find 2 version-0 '$PASS1_MESG' mesgs."
 150     echo "INFO: cnt='$cnt'"
 151     echo "INFO: grep '$PASS1_MESG' output:"
 152     grep "$PASS1_MESG" output.log
 153     result=1
 154 fi

 155 
 156 PASS2_MESG="after redefine"
 157 cnt=`grep "$PASS2_MESG" output.log | grep 'version-1' | wc -l`
 158 # no quotes around $cnt so any whitespace from 'wc -l' is ignored
 159 if [ $cnt = 2 ]; then
 160     echo "INFO: found 2 version-1 '$PASS2_MESG' mesgs."
 161 else

 162     echo "FAIL: did NOT find 2 version-1 '$PASS2_MESG' mesgs."
 163     echo "INFO: cnt='$cnt'"
 164     echo "INFO: grep '$PASS2_MESG' output:"
 165     grep "$PASS2_MESG" output.log
 166     result=1
 167 fi

 168 
 169 if [ "$result" = 0 ]; then
 170     echo "PASS: test passed both positive and negative output checks."
 171 fi
 172 
 173 exit $result