#!/bin/sh # run jacks against javac and ajc (with and without usejavac) # @process-test ajc runjacks.sh # run jacks tests against javac and ajc (with and without usejavac) [ -n "$DEBUG" ] && set -vx errMssg() { [ -n "$1" ] && echo "## $0 $1" [ -n "$2" ] && exit "$2" } toJavaPath() { echo "$1" | sed 's|/cygdrive/\([a-zA-Z]\)/|\1:/|' } toDosPath() { toJavaPath "$1" | sed 's|/|\\|g' } emit_ajcbat() { cat< "$i.join" done join -a 1 -a 2 $ajc.join javac.join \ | sed "/$ajc javac/d" \ | sort > compare.javac.$ajc.out rm $ajc.join javac.join ajcCount=`sed -n "/ $ajc/p" compare.javac.$ajc.out | wc -l` javacCount=`sed -n "/ javac/p" compare.javac.$ajc.out | wc -l` echo "## $ajcCount $ajc failures unmatched by javac" echo "## $javacCount javac failures unmatched by $ajc" done wc -l *.out } ############################################# SKIP_USEJAVAC=skippingUseJavac #pattern='*abrupt*' # use this to test script w/o running all if [ ! "$1" = "compare" ] ; then tclDir=/cygdrive/c/home/apps/tcl # XXX crosscut only case `uname` in CYGWIN* ) ;; * ) errMssg "only cygwin supported" 4 ;; esac [ -z "$JDKDIR" -o -x "$JDKDIR/bin/java" ] \ || errMssg "requires valid JDKDIR=$JDKDIR" 5 [ -z "$tclDir" -o -x "$tclDir/bin/tclsh" ] \ || errMssg "requires valid tclDir=$tclDir" 5 cvsroot=":pserver:anoncvs@oss.software.ibm.com:/usr/cvs/jikes" scriptDir=`dirname "$0"` scriptDir=`cd "$scriptDir";pwd` toBaseDir=../../.. jacksDir="${jacksDir:-`cd "$scriptDir/$toBaseDir";pwd`/jacks}" ajlibDir="${ajlibDir:-`cd "$scriptDir/$toBaseDir";pwd`/aj-build-modules/jars}" outDir="${outDir:-${1:-.}}" [ -d "$outDir" ] || exit 3 jacksDirJ=`toJavaPath "$jacksDir"` jhomeJ=`toJavaPath "$JDKDIR"` ajlibDos=`toDosPath "$ajlibDir"` jhomeDos=`toDosPath "$JDKDIR"` [ -f "$ajlibDir/aspectjtools.jar" ] \ || errMssg "bad ajlibDir=$ajlibDir" 4 ## get jacks if necessary if [ -d "$jacksDir" ] ; then [ -f "$jacksDir/jacks.tcl" ] || errMssg "bad jacksDir" 4 echo "## using existing jacks dir at $jacksDir" else cd `dirname "$jacksDir"` || errMssg "bad path to $jacksDir" 5 echo anoncvs | cvs -d "$cvsroot" login cvs -d "$cvsroot" co jacks fi ## setup our stuff cd "$jacksDir" || errMssg "jacks dir failed" 6 # comment unix, uncomment cygwin sc='/ulimit/s|^|#|' sc="$sc;"'/^exec tclsh8*/s|^|#|' sc="$sc;"'/^##* *exec tclsh.*cygpath/s|^##* *e|e|' sed "$sc" jacks > ff \ && mv ff jacks || errMssg "unable to setup jacks for cygwin" 2 export PATH="$tclDir/bin:$JDKDIR/bin:$jacksDir:$PATH" ## javac should work in any case if [ -f javac.out ] ; then echo "using existing javac.out" ls -ald javac.out else ## need to setup JAVA_HOME, JAVAC, JAVA sc='/^set JAVA_HOME /s|.*|set JAVA_HOME '"$JDKDIR|" sc="$sc;"'/^set JAVAC /s|.*|set JAVAC $JAVA_HOME/bin/javac.exe|' sc="$sc;"'/^set JAVA /s|.*|set JAVA $JAVA_HOME/bin/java.exe|' sed "$sc" javac_setup > ff && mv ff javac_setup echo "## starting javac at `date`" jacks javac $pattern > "$outDir/"javac.out || errMssg "javac failed " "$?" echo "## ending javac at `date`" fi if [ -f "$outDir/"ajc.out ] ; then echo "using existing ajc.out" ls -ald "$outDir/"ajc.out else ## setup and run ajc emit_ajcbat > ajc.bat emit_ajcsetup > ajc_setup echo "## starting ajc at `date`" jacks ajc $pattern > "$outDir/"ajc.out || errMssg "ajc failed " "$?" echo "## ending ajc at `date`" fi if [ -f "$outDir/"usejavac.out ] ; then echo "using existing usejavac.out" ls -ald "$outDir/"usejavac.out elif [ -n "$SKIP_USEJAVAC" ] ; then echo "skipping usejavac" else ## setup -usejavac javacFlags="-usejavac" emit_ajcsetup > ajc_setup echo "## starting ajc -usejavac at `date`" jacks ajc $pattern > "$outDir/"usejavac.out || errMssg "usejavac failed " "$?" echo "## ending ajc -usejavac at `date`" fi fi ## not only comparing compareJacksResults