1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/agent/test/jdi/sasanity.sh Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,76 @@ 1.4 +#!/bin/ksh 1.5 +# 1.6 +# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 +# 1.9 +# This code is free software; you can redistribute it and/or modify it 1.10 +# under the terms of the GNU General Public License version 2 only, as 1.11 +# published by the Free Software Foundation. 1.12 +# 1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.15 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.16 +# version 2 for more details (a copy is included in the LICENSE file that 1.17 +# accompanied this code). 1.18 +# 1.19 +# You should have received a copy of the GNU General Public License version 1.20 +# 2 along with this work; if not, write to the Free Software Foundation, 1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.22 +# 1.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.24 +# or visit www.oracle.com if you need additional information or have any 1.25 +# questions. 1.26 +# 1.27 +# 1.28 + 1.29 +# This script is used to run sanity check on vmStructs. 1.30 +# Each SA class is checked against a given VM. "PASSED" is 1.31 +# printed if vmStructs are consistent. Else, "FAILED" is 1.32 +# printed and an exception stack trace follows. 1.33 + 1.34 +usage() { 1.35 + echo "usage: ./sasanity.sh <jdk>" 1.36 + echo "<jdk> is the 1.5 j2se directory against which you want to run sanity check" 1.37 + exit 1 1.38 +} 1.39 + 1.40 +if [ "$1" == "" ]; then 1.41 + usage 1.42 +fi 1.43 + 1.44 +if [ "$1" == "-help" ]; then 1.45 + usage 1.46 +fi 1.47 + 1.48 +jdk=$1 1.49 +shift 1.50 +OS=`uname` 1.51 + 1.52 +javacp=$jdk/lib/sa-jdi.jar:./workdir 1.53 + 1.54 +mkdir -p workdir 1.55 +if [ SASanityChecker.java -nt ./workdir/SASanityChecker.class ] ; then 1.56 + $jdk/bin/javac -d ./workdir -classpath $javacp SASanityChecker.java 1.57 + if [ $? != 0 ] ; then 1.58 + exit 1 1.59 + fi 1.60 +fi 1.61 + 1.62 +if [ sagtarg.java -nt ./workdir/sagtarg.class ]; then 1.63 + $jdk/bin/javac -g -classpath -d $workdir sagtarg.java 1.64 + if [ $? != 0 ] ; then 1.65 + exit 1 1.66 + fi 1.67 +fi 1.68 + 1.69 +tmp=/tmp/sagsetup 1.70 +rm -f $tmp 1.71 +$jdk/bin/java $* sagtarg > $tmp & 1.72 +pid=$! 1.73 +while [ ! -s $tmp ] ; do 1.74 + # Kludge alert! 1.75 + sleep 2 1.76 +done 1.77 + 1.78 +$jdk/bin/java -showversion ${OPTIONS} -classpath $javacp $* SASanityChecker $pid 1.79 +kill -9 $pid